stb_image_write: fix jpeg to work on non-C99 compilers

This commit is contained in:
Sean Barrett 2020-02-02 10:02:53 -08:00
parent 4067b6d28b
commit 24fdc35c90

View File

@ -1289,8 +1289,9 @@ static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt
// Quantize/descale/zigzag the coefficients
for(y = 0, j=0; y < 8; ++y) {
for(x = 0; x < 8; ++x,++j) {
float v;
i = y*du_stride+x;
float v = CDU[i]*fdtbl[j];
v = CDU[i]*fdtbl[j];
// DU[stbiw__jpg_ZigZag[j]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f));
// ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway?
DU[stbiw__jpg_ZigZag[j]] = (int)(v < 0 ? v - 0.5f : v + 0.5f);