aboutsummaryrefslogtreecommitdiff
path: root/celt/quant_bands.c
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-04-12 11:07:21 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-04-12 11:09:09 -0400
commit367c39486618fe6a6f9ffe85e834d59cae241253 (patch)
treec0135bdb19163c0be8d56ddf75897c38f639afe5 /celt/quant_bands.c
parent7aecadda2f72cbf1f55209293dc63e01bb743035 (diff)
downloadlibopus-367c39486618fe6a6f9ffe85e834d59cae241253.tar.gz
Fixes several overflows in the CELT fixed-point
These were all mostly benign and would at worst result in (rare) suboptimal encoder decisions rather than signal corruption.
Diffstat (limited to 'celt/quant_bands.c')
-rw-r--r--celt/quant_bands.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/celt/quant_bands.c b/celt/quant_bands.c
index 04a819ef..e55c645e 100644
--- a/celt/quant_bands.c
+++ b/celt/quant_bands.c
@@ -146,11 +146,11 @@ static opus_val32 loss_distortion(const opus_val16 *eBands, opus_val16 *oldEBand
c=0; do {
for (i=start;i<end;i++)
{
- opus_val16 d = SHR16(SUB16(eBands[i+c*len], oldEBands[i+c*len]),2);
+ opus_val16 d = SUB16(SHR16(eBands[i+c*len], 3), SHR16(oldEBands[i+c*len], 3));
dist = MAC16_16(dist, d,d);
}
} while (++c<C);
- return MIN32(200,SHR32(dist,2*DB_SHIFT-4));
+ return MIN32(200,SHR32(dist,2*DB_SHIFT-6));
}
static int quant_coarse_energy_impl(const CELTMode *m, int start, int end,