summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_vc1.c
diff options
context:
space:
mode:
authorJerome Borsboom <jerome.borsboom@carpalis.nl>2018-05-09 07:50:23 +0200
committerMark Thompson <sw@jkqxz.net>2018-06-17 16:35:30 +0100
commit3d028b7b72a071df7ec2b5a2ccdbf767eec60505 (patch)
treec7c518a2c516dfe797850e629029576362a5851b /libavcodec/vaapi_vc1.c
parentbd47cca6a79616ae1ebf2baf1e8b071dd1707b0d (diff)
avcodec/vaapi_vc1: slice_vertical_position starts from zero for the second field
Contrary to VC-1 spec, VAAPI expects the row address of the first macroblock row in the first slice to start from zero for the second field in a field interlaced picture. Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
Diffstat (limited to 'libavcodec/vaapi_vc1.c')
-rw-r--r--libavcodec/vaapi_vc1.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index bdb5e24cc5..921ca6391b 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -467,6 +467,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
const MpegEncContext *s = &v->s;
VAAPIDecodePicture *pic = s->current_picture_ptr->hwaccel_picture_private;
VASliceParameterBufferVC1 slice_param;
+ int mb_height;
int err;
/* Current bit buffer is beyond any marker for VC-1, so skip it */
@@ -475,12 +476,17 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
size -= 4;
}
+ if (v->fcm == ILACE_FIELD)
+ mb_height = avctx->coded_height + 31 >> 5;
+ else
+ mb_height = avctx->coded_height + 15 >> 4;
+
slice_param = (VASliceParameterBufferVC1) {
.slice_data_size = size,
.slice_data_offset = 0,
.slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
.macroblock_offset = get_bits_count(&s->gb),
- .slice_vertical_position = s->mb_y,
+ .slice_vertical_position = s->mb_y % mb_height,
};
err = ff_vaapi_decode_make_slice_buffer(avctx, pic,