diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-24 12:16:22 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-24 12:16:22 -0400 |
commit | f71142496931d264ceeedfaac399eba07b7c5def (patch) | |
tree | 6a1d7d39f2d5b846b3974aff4026268b55fe82ec /libavcodec/mpeg12.c | |
parent | cd256c3b89c14651b9ff75d9235f2c146fa48aba (diff) | |
download | ffmpeg-f71142496931d264ceeedfaac399eba07b7c5def.tar.gz |
mpeg12.c: fix slice threading for mpeg2 field picture mode.
Fixes "make THREADS=2 fate-mpeg2-field-enc".
Diffstat (limited to 'libavcodec/mpeg12.c')
-rw-r--r-- | libavcodec/mpeg12.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index c60826b91b..c47b6e2877 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1882,7 +1882,9 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){ start_code= -1; buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code); - mb_y= start_code - SLICE_MIN_START_CODE; + mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic; + if (s->picture_structure == PICT_BOTTOM_FIELD) + mb_y++; if(mb_y < 0 || mb_y >= s->end_mb_y) return -1; } @@ -2299,6 +2301,16 @@ static int decode_chunks(AVCodecContext *avctx, break; case PICTURE_START_CODE: + if (avctx->thread_count > 1 && s->slice_count) { + int i; + + avctx->execute(avctx, slice_decode_thread, + s2->thread_context, NULL, + s->slice_count, sizeof(void*)); + for (i = 0; i < s->slice_count; i++) + s2->error_count += s2->thread_context[i]->error_count; + s->slice_count = 0; + } if(last_code == 0 || last_code == SLICE_MIN_START_CODE){ if(mpeg_decode_postinit(avctx) < 0){ av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n"); |