summaryrefslogtreecommitdiff
path: root/libavcodec/g723_1.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-08-02 19:34:53 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-08-03 07:07:07 +0200
commitd3e0766fc00734adbb589eb4c865feb8d26785ab (patch)
tree42782204e089894a30c9addfdfe6c7068baacf50 /libavcodec/g723_1.c
parent94bfdfd6f05a3ccbf048a3ea70694247c2929053 (diff)
g723_1: scale output as supposed for the case with postfilter disabled
Diffstat (limited to 'libavcodec/g723_1.c')
-rw-r--r--libavcodec/g723_1.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c
index 0b59f81ff6..18a5fe316a 100644
--- a/libavcodec/g723_1.c
+++ b/libavcodec/g723_1.c
@@ -1012,6 +1012,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
int16_t lpc[SUBFRAMES * LPC_ORDER];
int16_t acb_vector[SUBFRAME_LEN];
int16_t *vector_ptr;
+ int16_t *out;
int bad_frame = 0, i, j, ret;
if (buf_size < frame_size[dec_mode]) {
@@ -1037,6 +1038,8 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
return ret;
}
+ out = (int16_t *)p->frame.data[0];
+
if (p->cur_frame_type == ACTIVE_FRAME) {
if (!bad_frame)
p->erased_frames = 0;
@@ -1120,7 +1123,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
memcpy(p->prev_excitation, p->excitation + FRAME_LEN,
PITCH_MAX * sizeof(*p->excitation));
} else {
- memset(p->frame.data[0], 0, FRAME_LEN * 2);
+ memset(out, 0, FRAME_LEN * 2);
av_log(avctx, AV_LOG_WARNING,
"G.723.1: Comfort noise generation not supported yet\n");
@@ -1138,10 +1141,13 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data,
0, 1, 1 << 12);
memcpy(p->synth_mem, p->audio + FRAME_LEN, LPC_ORDER * sizeof(*p->audio));
- if (p->postfilter)
+ if (p->postfilter) {
formant_postfilter(p, lpc, p->audio);
-
- memcpy(p->frame.data[0], p->audio + LPC_ORDER, FRAME_LEN * 2);
+ memcpy(p->frame.data[0], p->audio + LPC_ORDER, FRAME_LEN * 2);
+ } else { // if output is not postfiltered it should be scaled by 2
+ for (i = 0; i < FRAME_LEN; i++)
+ out[i] = av_clip_int16(p->audio[LPC_ORDER + i] << 1);
+ }
*got_frame_ptr = 1;
*(AVFrame *)data = p->frame;