@@ -1942,22 +1942,22 @@ std::vector<std::byte> ImageConversion::resizeImageData(std::span<const std::byt
19421942 stbir_set_filter_callbacks (&resize, KAISER_FILTER, KAISER_SUPPORT, KAISER_FILTER, KAISER_SUPPORT);
19431943 break ;
19441944 }
1945- case ResizeFilter::LANCZOS3 : {
1945+ case ResizeFilter::NICE : {
19461946 static constexpr auto SINC = [](const float x) -> float {
19471947 if (x == 0 .f ) return 1 .f ;
19481948 const float a = x * math::pi_f32;
19491949 return sinf (a) / a;
19501950 };
1951- // Normally you would max(1, inv_scale), but stb is weird and immediately un-scales the result when downsampling.
1952- // See stb_image_resize2.h L2977
1953- static constexpr auto LANCZOS3_SUPPORT = [](float inv_scale, void *) -> float {
1954- return inv_scale * 3 .f ;
1955- };
1956- static constexpr auto LANCZOS3_FILTER = [](float x, float inv_scale, void *) -> float {
1951+ static constexpr auto NICE_FILTER = [](float x, float invScale, void *) -> float {
19571952 if (x >= 3 .f || x <= -3 .f ) return 0 .f ;
19581953 return SINC (x) * SINC (x / 3 .f );
19591954 };
1960- stbir_set_filter_callbacks (&resize, LANCZOS3_FILTER, LANCZOS3_SUPPORT, LANCZOS3_FILTER, LANCZOS3_SUPPORT);
1955+ // Normally you would max(1, invScale), but stb is weird and immediately un-scales the result when downsampling.
1956+ // See stb_image_resize2.h L2977
1957+ static constexpr auto NICE_SUPPORT = [](float invScale, void *) -> float {
1958+ return invScale * 3 .f ;
1959+ };
1960+ stbir_set_filter_callbacks (&resize, NICE_FILTER, NICE_SUPPORT, NICE_FILTER, NICE_SUPPORT);
19611961 break ;
19621962 }
19631963 }
0 commit comments