Ticket #10281: 0052-ffmpeg-fix-slice-threading-for-mpeg2-field-picture-m.patch

File 0052-ffmpeg-fix-slice-threading-for-mpeg2-field-picture-m.patch, 2.0 KB (added by Lawrence Rust <lvr@…>, 8 years ago)
  • mythtv/external/FFmpeg/libavcodec/mpeg12.c

    From 441bb2265d583ac59cdd718c9d20580168bf3eec Mon Sep 17 00:00:00 2001
    From: Lawrence Rust <lvr@softsystem.co.uk>
    Date: Mon, 23 Jan 2012 17:18:18 +0100
    Subject: [PATCH 52/52] ffmpeg: fix slice threading for mpeg2 field picture mode
    
    Fixes playback of VC1 encoded DVDs like Pink Floyd's Pulse
    
    Cherry-picked from ffmpeg commit f7114249693
    by Ronald S. Bultje <rsbultje@gmail.com>
    
    Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
    ---
     mythtv/external/FFmpeg/libavcodec/mpeg12.c |   14 +++++++++++++-
     1 files changed, 13 insertions(+), 1 deletions(-)
    
    diff --git a/mythtv/external/FFmpeg/libavcodec/mpeg12.c b/mythtv/external/FFmpeg/libavcodec/mpeg12.c
    index dc37c4f..06d1d20 100644
    a b static int slice_decode_thread(AVCodecContext *c, void *arg){ 
    18831883
    18841884        start_code= -1;
    18851885        buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code);
    1886         mb_y= start_code - SLICE_MIN_START_CODE;
     1886        mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
     1887        if (s->picture_structure == PICT_BOTTOM_FIELD)
     1888            mb_y++;
    18871889        if(mb_y < 0 || mb_y >= s->end_mb_y)
    18881890            return -1;
    18891891    }
    static int decode_chunks(AVCodecContext *avctx, 
    24862488            break;
    24872489
    24882490        case PICTURE_START_CODE:
     2491            if (avctx->thread_count > 1 && s->slice_count) {
     2492                int i;
     2493
     2494                avctx->execute(avctx, slice_decode_thread,
     2495                               s2->thread_context, NULL,
     2496                               s->slice_count, sizeof(void*));
     2497                for (i = 0; i < s->slice_count; i++)
     2498                    s2->error_count += s2->thread_context[i]->error_count;
     2499                s->slice_count = 0;
     2500            }
    24892501            if(last_code == 0 || last_code == SLICE_MIN_START_CODE){
    24902502            if(mpeg_decode_postinit(avctx) < 0){
    24912503                av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n");