X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fg723_1dec.c;h=f601d31d0027df88948dc6feae55b98ffd03fece;hb=d4440c7e91b0ef5f6776d98c51dbb6cd66ea0194;hp=676c4bbac34b4ad85777fd9ac0916245675ce0b7;hpb=493240a522fca34882601fbeeda4e17aa40a0303;p=ffmpeg diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c index 676c4bbac34..f601d31d002 100644 --- a/libavcodec/g723_1dec.c +++ b/libavcodec/g723_1dec.c @@ -677,7 +677,9 @@ static int estimate_sid_gain(G723_1_ChannelContext *p) if (p->sid_gain < 0) t = INT32_MIN; else t = INT32_MAX; } else - t = p->sid_gain << shift; + t = p->sid_gain * (1 << shift); + } else if(shift < -31) { + t = (p->sid_gain < 0) ? -1 : 0; }else t = p->sid_gain >> -shift; x = av_clipl_int32(t * (int64_t)cng_filt[0] >> 16); @@ -883,7 +885,8 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data, G723_1_ChannelContext *p = &s->ch[ch]; int16_t *audio = p->audio; - if (unpack_bitstream(p, buf, buf_size) < 0) { + if (unpack_bitstream(p, buf + ch * (buf_size / avctx->channels), + buf_size / avctx->channels) < 0) { bad_frame = 1; if (p->past_frame_type == ACTIVE_FRAME) p->cur_frame_type = ACTIVE_FRAME; @@ -1009,7 +1012,7 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data, formant_postfilter(p, lpc, p->audio, out); } 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); + out[i] = av_clip_int16(2 * p->audio[LPC_ORDER + i]); } }