X-Git-Url: https://git.sesse.net/?p=fjl;a=blobdiff_plain;f=idct_float.c;h=ede97cda9951a598f714e4d5b453dfe15b1115af;hp=c8bde1b236ac80c3bc5f5380fc5adcbd9569bc77;hb=0e688f0b5db93745648802bdf1c96d0d526eb9ff;hpb=56779091c47e5c61376d7f942cc58b831673e1d7 diff --git a/idct_float.c b/idct_float.c index c8bde1b..ede97cd 100644 --- a/idct_float.c +++ b/idct_float.c @@ -157,12 +157,12 @@ void idct_float(const int16_t* input, const void* userdata, uint8_t* output) temp2); for (unsigned x = 0; x < DCTSIZE; ++x) { const double val = temp2[x]; - if (val < 0.0) { + if (val < -128.0) { output[y * DCTSIZE + x] = 0; - } else if (val >= 255.0) { + } else if (val >= 127.0) { output[y * DCTSIZE + x] = 255; } else { - output[y * DCTSIZE + x] = (uint8_t)(val + 0.5); + output[y * DCTSIZE + x] = (uint8_t)(val + 128.5); } } }