diff --git a/stb_resample.h b/stb_resample.h index a563210..c6eb1f3 100644 --- a/stb_resample.h +++ b/stb_resample.h @@ -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)); diff --git a/tests/resample_test.cpp b/tests/resample_test.cpp index b446442..bd40333 100644 --- a/tests/resample_test.cpp +++ b/tests/resample_test.cpp @@ -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); + } }