]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/adpcmenc.c
afq: update remaining samples variable.
[ffmpeg] / libavcodec / adpcmenc.c
index 3af81cbc21499dd737d9dc72f384e1e9cd221502..a3194abb3c0a08afb579d664dc43bf3938cd4417 100644 (file)
@@ -616,10 +616,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
         if (avctx->trellis > 0) {
             FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
-            adpcm_compress_trellis(avctx, samples + 2, buf, &c->status[0], n);
+            adpcm_compress_trellis(avctx, samples + avctx->channels, buf,
+                                   &c->status[0], n);
             if (avctx->channels == 2)
-                adpcm_compress_trellis(avctx, samples + 3, buf + n,
-                                       &c->status[1], n);
+                adpcm_compress_trellis(avctx, samples + avctx->channels + 1,
+                                       buf + n, &c->status[1], n);
             for (i = 0; i < n; i++) {
                 put_bits(&pb, 4, buf[i]);
                 if (avctx->channels == 2)