@ -1064,7 +1064,11 @@ static void stbir__calculate_coefficients_upsample(stbir_filter filter, float sc
total_filter + = coefficient_group [ i ] ;
}
STBIR_ASSERT ( stbir__filter_info_table [ filter ] . kernel ( ( float ) ( in_last_pixel + 1 ) + 0.5f - in_center_of_out , 1 / scale ) = = 0 ) ;
// NOTE(fg): Not actually true in general, nor is there any reason to expect it should be.
// It would be true in exact math but is at best approximately true in floating-point math,
// and it would not make sense to try and put actual bounds on this here because it depends
// on the image aspect ratio which can get pretty extreme.
//STBIR_ASSERT(stbir__filter_info_table[filter].kernel((float)(in_last_pixel + 1) + 0.5f - in_center_of_out, 1/scale) == 0);
STBIR_ASSERT ( total_filter > 0.9 ) ;
STBIR_ASSERT ( total_filter < 1.1f ) ; // Make sure it's not way off.
@ -1103,7 +1107,11 @@ static void stbir__calculate_coefficients_downsample(stbir_filter filter, float
coefficient_group [ i ] = stbir__filter_info_table [ filter ] . kernel ( x , scale_ratio ) * scale_ratio ;
}
STBIR_ASSERT ( stbir__filter_info_table [ filter ] . kernel ( ( float ) ( out_last_pixel + 1 ) + 0.5f - out_center_of_in , scale_ratio ) = = 0 ) ;
// NOTE(fg): Not actually true in general, nor is there any reason to expect it should be.
// It would be true in exact math but is at best approximately true in floating-point math,
// and it would not make sense to try and put actual bounds on this here because it depends
// on the image aspect ratio which can get pretty extreme.
//STBIR_ASSERT(stbir__filter_info_table[filter].kernel((float)(out_last_pixel + 1) + 0.5f - out_center_of_in, scale_ratio) == 0);
for ( i = out_last_pixel - out_first_pixel ; i > = 0 ; i - - )
{
@ -1552,7 +1560,6 @@ static void stbir__resample_horizontal_downsample(stbir__info* stbir_info, float
{
int out_pixel_index = k * 1 ;
float coefficient = horizontal_coefficients [ coefficient_group + k - n0 ] ;
STBIR_ASSERT ( coefficient ! = 0 ) ;
output_buffer [ out_pixel_index + 0 ] + = decode_buffer [ in_pixel_index + 0 ] * coefficient ;
}
}
@ -1573,7 +1580,6 @@ static void stbir__resample_horizontal_downsample(stbir__info* stbir_info, float
{
int out_pixel_index = k * 2 ;
float coefficient = horizontal_coefficients [ coefficient_group + k - n0 ] ;
STBIR_ASSERT ( coefficient ! = 0 ) ;
output_buffer [ out_pixel_index + 0 ] + = decode_buffer [ in_pixel_index + 0 ] * coefficient ;
output_buffer [ out_pixel_index + 1 ] + = decode_buffer [ in_pixel_index + 1 ] * coefficient ;
}
@ -1595,7 +1601,6 @@ static void stbir__resample_horizontal_downsample(stbir__info* stbir_info, float
{
int out_pixel_index = k * 3 ;
float coefficient = horizontal_coefficients [ coefficient_group + k - n0 ] ;
STBIR_ASSERT ( coefficient ! = 0 ) ;
output_buffer [ out_pixel_index + 0 ] + = decode_buffer [ in_pixel_index + 0 ] * coefficient ;
output_buffer [ out_pixel_index + 1 ] + = decode_buffer [ in_pixel_index + 1 ] * coefficient ;
output_buffer [ out_pixel_index + 2 ] + = decode_buffer [ in_pixel_index + 2 ] * coefficient ;
@ -1618,7 +1623,6 @@ static void stbir__resample_horizontal_downsample(stbir__info* stbir_info, float
{
int out_pixel_index = k * 4 ;
float coefficient = horizontal_coefficients [ coefficient_group + k - n0 ] ;
STBIR_ASSERT ( coefficient ! = 0 ) ;
output_buffer [ out_pixel_index + 0 ] + = decode_buffer [ in_pixel_index + 0 ] * coefficient ;
output_buffer [ out_pixel_index + 1 ] + = decode_buffer [ in_pixel_index + 1 ] * coefficient ;
output_buffer [ out_pixel_index + 2 ] + = decode_buffer [ in_pixel_index + 2 ] * coefficient ;
@ -1643,7 +1647,6 @@ static void stbir__resample_horizontal_downsample(stbir__info* stbir_info, float
int c ;
int out_pixel_index = k * channels ;
float coefficient = horizontal_coefficients [ coefficient_group + k - n0 ] ;
STBIR_ASSERT ( coefficient ! = 0 ) ;
for ( c = 0 ; c < channels ; c + + )
output_buffer [ out_pixel_index + c ] + = decode_buffer [ in_pixel_index + c ] * coefficient ;
}