[FFmpeg-devel] [PATCH] vaapi: mpeg2: fix slice_vertical_position calculation.

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


Hi,

VASliceParameterBufferMPEG2.slice_vertical_position shall express
the slice vertical position from the original bitstream. The HW
decoder will correctly decode to the right line computed from the
appropriate top_field_first and is_first_field flags.

I will push this patch later on, as this requires a patch in the Intel
Gen driver too. This aligns with DXVA specification (sigh) and other
binary-only VA drivers that are less likely to be fixed, or less easily.

Just wanted to post it meanwhile for interested parties to test. :)

Regards,
Gwenole.
---
 libavcodec/vaapi_mpeg2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 762c53c..8a67e4b 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -132,7 +132,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
         return -1;
     slice_param->macroblock_offset              = macroblock_offset;
     slice_param->slice_horizontal_position      = s->mb_x;
-    slice_param->slice_vertical_position        = s->mb_y;
+    slice_param->slice_vertical_position        = s->mb_y >> (s->picture_structure != PICT_FRAME);
     slice_param->quantiser_scale_code           = quantiser_scale_code;
     slice_param->intra_slice_flag               = intra_slice_flag;
     return 0;
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list