Same deal with height.

pull/32/head
Jorge Rodriguez 2014-07-29 23:02:56 -07:00
parent ebe0473d8b
commit 043fa28c11
2 changed files with 16 additions and 2 deletions

View File

@ -1147,7 +1147,7 @@ static void stbr__buffer_loop_downsample(stbr__info* stbr_info)
{
int y;
float scale_ratio = (float)stbr_info->output_h / stbr_info->input_h;
float in_pixels_radius = stbr__filter_info_table[stbr_info->filter].support;
float in_pixels_radius = stbr__filter_info_table[stbr_info->filter].support / scale_ratio;
int max_y = stbr_info->input_h + stbr__get_filter_texel_margin(stbr_info->filter, stbr_info->input_h, stbr_info->output_h);
STBR_DEBUG_ASSERT(!stbr__use_height_upsampling(stbr_info));

View File

@ -137,12 +137,26 @@ void test_suite()
resize_image("barbara.png", (float)i / 100, 1, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
for (int i = 110; i < 1000; i += 10)
for (int i = 110; i < 500; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-width-%d.jpg", i);
resize_image("barbara.png", (float)i / 100, 1, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
for (int i = 10; i < 100; i++)
{
char outname[200];
sprintf(outname, "test-output/barbara-height-%d.jpg", i);
resize_image("barbara.png", 1, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
for (int i = 110; i < 500; i += 10)
{
char outname[200];
sprintf(outname, "test-output/barbara-height-%d.jpg", i);
resize_image("barbara.png", 1, (float)i / 100, STBR_FILTER_CATMULLROM, STBR_EDGE_CLAMP, outname);
}
}