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){ |
1883 | 1883 | |
1884 | 1884 | start_code= -1; |
1885 | 1885 | 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++; |
1887 | 1889 | if(mb_y < 0 || mb_y >= s->end_mb_y) |
1888 | 1890 | return -1; |
1889 | 1891 | } |
… |
… |
static int decode_chunks(AVCodecContext *avctx, |
2486 | 2488 | break; |
2487 | 2489 | |
2488 | 2490 | 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 | } |
2489 | 2501 | if(last_code == 0 || last_code == SLICE_MIN_START_CODE){ |
2490 | 2502 | if(mpeg_decode_postinit(avctx) < 0){ |
2491 | 2503 | av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n"); |