[FFmpeg-devel] [PATCH] hwaccel: mpeg2: decode first field, if requested.

Gwenole Beauchesne gb.devel at gmail.com
Fri Mar 16 16:33:16 CET 2012


Hi,

If user opted to present fields as they come, then the first field
picture needs to be submitted to the HW for decoding. In particular,
this fixes MPEG-2 decoding of interlaced streams.

I believe we can get rid of the SLICE_FLAG_ALLOW_FIELD check because
we always have to submit the first field to the HW decoder.

This fixes sony-ct1.bits and hhi_burst_long.bits from conformance streams.
Tested on Intel Gen (Sandy Bridge, Ivy Bridge), Intel PVR (Cedar Trail).
I will test on NVIDIA at home.

Could someone please test with DXVA or any other hwaccel enabled platform?

Thanks,
Gwenole.
---
 libavcodec/mpeg12.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index fde4e02..18ef6da 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1627,6 +1627,12 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
             return -1;
         }
 
+        if (s->avctx->hwaccel &&
+            (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
+            if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
+                av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode first field\n");
+        }
+
         for (i = 0; i < 4; i++) {
             s->current_picture.f.data[i] = s->current_picture_ptr->f.data[i];
             if (s->picture_structure == PICT_BOTTOM_FIELD) {
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list