aboutsummaryrefslogtreecommitdiff
path: root/celt/vq.c
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2013-12-14 11:07:13 -0500
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-12-14 11:07:13 -0500
commite0f26246b08122cef31c1ac85f7ed228e2daca61 (patch)
treecb8ea9a36698ee1ea24ac150ce08dc67530288d5 /celt/vq.c
parent4a168eb343af95be4b3a00ef2c5cf40da1d6b7e0 (diff)
downloadlibopus-e0f26246b08122cef31c1ac85f7ed228e2daca61.tar.gz
fixed-point: adds rounding to some shifts to eliminate bias
This reduces the peak decoding error by removing small (inaudible) spikes in the error at the frame boundaries. These were due to the frequency-domain bias ending up as a small pulse in the middle of the IMDCT overlap. None of this was ever audible, but fixing it is still cleaner.
Diffstat (limited to 'celt/vq.c')
-rw-r--r--celt/vq.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/celt/vq.c b/celt/vq.c
index 9fac0845..189bf23b 100644
--- a/celt/vq.c
+++ b/celt/vq.c
@@ -49,8 +49,8 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
celt_norm x1, x2;
x1 = Xptr[0];
x2 = Xptr[stride];
- Xptr[stride] = EXTRACT16(SHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
- *Xptr++ = EXTRACT16(SHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
+ Xptr[stride] = EXTRACT16(PSHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
+ *Xptr++ = EXTRACT16(PSHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
}
Xptr = &X[len-2*stride-1];
for (i=len-2*stride-1;i>=0;i--)
@@ -58,8 +58,8 @@ static void exp_rotation1(celt_norm *X, int len, int stride, opus_val16 c, opus_
celt_norm x1, x2;
x1 = Xptr[0];
x2 = Xptr[stride];
- Xptr[stride] = EXTRACT16(SHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
- *Xptr-- = EXTRACT16(SHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
+ Xptr[stride] = EXTRACT16(PSHR32(MULT16_16(c,x2) + MULT16_16(s,x1), 15));
+ *Xptr-- = EXTRACT16(PSHR32(MULT16_16(c,x1) - MULT16_16(s,x2), 15));
}
}