Reduce risk of overflowing in mono downsampling
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 22 Jul 2016 18:44:24 +0000 (14:44 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Fri, 22 Jul 2016 19:30:19 +0000 (15:30 -0400)
Not observed yet (except when caused by a different bug), but "just in case"

celt/celt_decoder.c

index b978bb3..0228d9e 100644 (file)
@@ -333,7 +333,7 @@ void celt_synthesis(const CELTMode *mode, celt_norm *X, celt_sig * out_syn[],
       denormalise_bands(mode, X+N, freq2, oldBandE+nbEBands, start, effEnd, M,
             downsample, silence);
       for (i=0;i<N;i++)
-         freq[i] = HALF32(ADD32(freq[i],freq2[i]));
+         freq[i] = ADD32(HALF32(freq[i]), HALF32(freq2[i]));
       for (b=0;b<B;b++)
          clt_mdct_backward(&mode->mdct, &freq[b], out_syn[0]+NB*b, mode->window, overlap, shift, B, arch);
    } else {