because of we divide by /255 not /256, we lose numerical precision, so can't guarantee that box filter results round to same results as naive
This commit is contained in:
parent
adbbe8dabd
commit
1dcca19ae0
@ -155,7 +155,7 @@ static void performance(int argc, char **argv)
|
||||
out_w = w*2; out_h = h/4; count=20; // 2 // note this is structured pessimily, would be much faster to downsample vertically first
|
||||
#elif 0
|
||||
out_w = w/4; out_h = h*2; count=50; // 3
|
||||
#elif 0
|
||||
#elif 1
|
||||
out_w = w*3; out_h = h*3; count=5; srgb=0; // 4
|
||||
#else
|
||||
out_w = w*3; out_h = h*3; count=3; // 5 // this is dominated by linear->sRGB conversion
|
||||
@ -181,7 +181,7 @@ int main(int argc, char** argv)
|
||||
int out_w, out_h, out_stride;
|
||||
|
||||
//resizer(argc, argv);
|
||||
performance(argc, argv);
|
||||
//performance(argc, argv);
|
||||
|
||||
#if 1
|
||||
test_suite(argc, argv);
|
||||
@ -648,10 +648,10 @@ void verify_box(void)
|
||||
+ image88[j*2+0][i*2+1]
|
||||
+ image88[j*2+1][i*2+0]
|
||||
+ image88[j*2+1][i*2+1];
|
||||
STBIR_ASSERT(output44[j][i] == ((n+2)>>2));
|
||||
STBIR_ASSERT(output44[j][i] == ((n+2)>>2) || output44[j][i] == ((n+1)>>2)); // can't guarantee exact rounding due to numerical precision
|
||||
t += n;
|
||||
}
|
||||
STBIR_ASSERT(output11[0][0] == ((t+32)>>6));
|
||||
STBIR_ASSERT(output11[0][0] == ((t+32)>>6) || output11[0][0] == ((t+31)>>6)); // can't guarantee exact rounding due to numerical precision
|
||||
}
|
||||
|
||||
void verify_filter_normalized(stbir_filter filter, int output_size, unsigned int value)
|
||||
@ -675,6 +675,8 @@ void test_filters(void)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
mtsrand(0);
|
||||
|
||||
for (i=0; i < sizeof(image88); ++i)
|
||||
image88[0][i] = mtrand() & 255;
|
||||
verify_box();
|
||||
|
Loading…
Reference in New Issue
Block a user