X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=idct_float.c;h=ede97cda9951a598f714e4d5b453dfe15b1115af;hb=0e688f0b5db93745648802bdf1c96d0d526eb9ff;hp=c8bde1b236ac80c3bc5f5380fc5adcbd9569bc77;hpb=d0afece00533a174faf2ce93633ca9731be89fc0;p=fjl 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); } } }