X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fg723_1dec.c;h=f601d31d0027df88948dc6feae55b98ffd03fece;hb=6268034b5d03580f86e9ff5a1879ebd56f35db40;hp=d8bc3f97acfddcda0fdc06bae0969d29572ffc23;hpb=e427ba5c68a522b26a45bf7c61016d9349fab43d;p=ffmpeg diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c index d8bc3f97acf..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); @@ -1010,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]); } }