ref: ba760bc52593ba6dae8b3886b3f68226e50c951a
parent: 3c15659c39ca266286a53e04fcbf09735e311d0d
author: Jean-Marc Valin <[email protected]>
date: Tue Sep 14 12:06:22 EDT 2010
Fixes rare overflow in intra_decision()
--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -74,11 +74,11 @@
{
for (i=start;i<end;i++)
{
- celt_word16 d = SUB16(eBands[i+c*len], oldEBands[i+c*len]);
+ celt_word16 d = SHR16(SUB16(eBands[i+c*len], oldEBands[i+c*len]),1);
dist = MAC16_16(dist, d,d);
}
}
- return SHR32(dist,2*DB_SHIFT) > 2*C*(end-start);
+ return SHR32(dist,2*DB_SHIFT-2) > 2*C*(end-start);
}
#ifndef STATIC_MODES