]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/g723_1dec.c
libavcodec/jpeg2000dec.c: fix error in cod marker
[ffmpeg] / libavcodec / g723_1dec.c
index 676c4bbac34b4ad85777fd9ac0916245675ce0b7..f601d31d0027df88948dc6feae55b98ffd03fece 100644 (file)
@@ -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]);
         }
     }