[FFmpeg-cvslog] adpcm_swf: Use correct sample offsets when using trellis.
Justin Ruggles
git at videolan.org
Thu Aug 23 14:41:49 CEST 2012
ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Aug 20 12:18:58 2012 -0400| [5d4ef004bfe85a006501d21373cce86c9bf32401] | committer: Justin Ruggles
adpcm_swf: Use correct sample offsets when using trellis.
Fixes invalid reads when encoding mono streams when trellis is used.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d4ef004bfe85a006501d21373cce86c9bf32401
---
libavcodec/adpcmenc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 038dbf1..843b32f 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -615,10 +615,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)
More information about the ffmpeg-cvslog
mailing list