adpcm_swf: Use correct sample offsets when using trellis.
Fixes invalid reads when encoding mono streams when trellis is used.
This commit is contained in:
parent
7011a42b1a
commit
5d4ef004bf
@ -615,10 +615,11 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
|
|
||||||
if (avctx->trellis > 0) {
|
if (avctx->trellis > 0) {
|
||||||
FF_ALLOC_OR_GOTO(avctx, buf, 2 * n, error);
|
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)
|
if (avctx->channels == 2)
|
||||||
adpcm_compress_trellis(avctx, samples + 3, buf + n,
|
adpcm_compress_trellis(avctx, samples + avctx->channels + 1,
|
||||||
&c->status[1], n);
|
buf + n, &c->status[1], n);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
put_bits(&pb, 4, buf[i]);
|
put_bits(&pb, 4, buf[i]);
|
||||||
if (avctx->channels == 2)
|
if (avctx->channels == 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user