diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-09 00:19:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-11 00:43:29 +0100 |
commit | 0c2d6a219f2831fd46557bbfb5a2c4c7da6f90b1 (patch) | |
tree | 987cc81a8aeca28248d5ca26361f8f88a48cb0c8 | |
parent | 8a4b18c639b536d08926c96810a4d9628f422c9d (diff) | |
download | ffmpeg-0c2d6a219f2831fd46557bbfb5a2c4c7da6f90b1.tar.gz |
avcodec/ffv1enc: Fix size of first slice
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cff1c0edaa797eca96663d9b83e4b8c1b609ff19)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ffv1enc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c index 383956bcc9..d13cea1226 100644 --- a/libavcodec/ffv1enc.c +++ b/libavcodec/ffv1enc.c @@ -1223,7 +1223,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, FFV1Context *f = avctx->priv_data; RangeCoder *const c = &f->slice_context[0]->c; AVFrame *const p = f->picture.f; - int used_count = 0; uint8_t keystate = 128; uint8_t *buf_p; int i, ret; @@ -1312,11 +1311,17 @@ FF_ENABLE_DEPRECATION_WARNINGS } } - for (i = 1; i < f->slice_count; i++) { + for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; - uint8_t *start = pkt->data + (pkt->size - used_count) * (int64_t)i / f->slice_count; + uint8_t *start = pkt->data + pkt->size * (int64_t)i / f->slice_count; int len = pkt->size / f->slice_count; - ff_init_range_encoder(&fs->c, start, len); + if (i) { + ff_init_range_encoder(&fs->c, start, len); + } else { + av_assert0(fs->c.bytestream_end >= fs->c.bytestream_start + len); + av_assert0(fs->c.bytestream < fs->c.bytestream_start + len); + fs->c.bytestream_end = fs->c.bytestream_start + len; + } } avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void *)); |