summaryrefslogtreecommitdiff
path: root/libavcodec/g722enc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-03-02 17:03:06 +0200
committerMartin Storsjö <martin@martin.st>2012-03-02 18:58:19 +0200
commitb087ce2bee81db8cc5caffb8f0a4f6c7c92a30fe (patch)
tree33d6290462f3f1f41bf18ed00403a7a176ba6697 /libavcodec/g722enc.c
parent56bf24ad7821974bc92a2d02a120165ee61efb90 (diff)
g722: Fix the QMF scaling
This fixes clipping if the encoder input used the full 16 bit input range (samples with a magnitude below 16383 worked fine). The filtered subband samples should be 15 bit maximum, while the code earlier produced them scaled to 16 bit. This makes the decoder output have double the magnitude compared to before. The spec reference samples doesn't test the QMF at all, which was why this part slipped past initially. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/g722enc.c')
-rw-r--r--libavcodec/g722enc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index a5ae0a5153..ba8ceeff86 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -136,8 +136,8 @@ static inline void filter_samples(G722Context *c, const int16_t *samples,
c->prev_samples[c->prev_samples_pos++] = samples[0];
c->prev_samples[c->prev_samples_pos++] = samples[1];
ff_g722_apply_qmf(c->prev_samples + c->prev_samples_pos - 24, &xout1, &xout2);
- *xlow = xout1 + xout2 >> 13;
- *xhigh = xout1 - xout2 >> 13;
+ *xlow = xout1 + xout2 >> 14;
+ *xhigh = xout1 - xout2 >> 14;
if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) {
memmove(c->prev_samples,
c->prev_samples + c->prev_samples_pos - 22,