mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Update std_image and stb_image_resize to af1a5bc.
This brings a lot of bugfixes, most of them are irrelevant for us. At least as long as the game is run with standard assets...
This commit is contained in:
parent
5eba52008b
commit
67f22cce17
2 changed files with 582 additions and 240 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
/* stb_image_resize - v0.96 - public domain image resizing
|
||||
/* stb_image_resize - v0.97 - public domain image resizing
|
||||
by Jorge L Rodriguez (@VinoBS) - 2014
|
||||
http://github.com/nothings/stb
|
||||
|
||||
|
@ -159,6 +159,7 @@
|
|||
Nathan Reed: warning fixes
|
||||
|
||||
REVISIONS
|
||||
0.97 (2020-02-02) fixed warning
|
||||
0.96 (2019-03-04) fixed warnings
|
||||
0.95 (2017-07-23) fixed warnings
|
||||
0.94 (2017-03-18) fixed warnings
|
||||
|
@ -1063,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.
|
||||
|
@ -1102,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--)
|
||||
{
|
||||
|
@ -1238,7 +1247,7 @@ static float* stbir__get_decode_buffer(stbir__info* stbir_info)
|
|||
return &stbir_info->decode_buffer[stbir_info->horizontal_filter_pixel_margin * stbir_info->channels];
|
||||
}
|
||||
|
||||
#define STBIR__DECODE(type, colorspace) ((type) * (STBIR_MAX_COLORSPACES) + (colorspace))
|
||||
#define STBIR__DECODE(type, colorspace) ((int)(type) * (STBIR_MAX_COLORSPACES) + (int)(colorspace))
|
||||
|
||||
static void stbir__decode_scanline(stbir__info* stbir_info, int n)
|
||||
{
|
||||
|
@ -1551,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;
|
||||
}
|
||||
}
|
||||
|
@ -1572,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;
|
||||
}
|
||||
|
@ -1594,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;
|
||||
|
@ -1617,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;
|
||||
|
@ -1642,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue