va: mpeg2dec: set first field either frame or has a first field

Add a helper function _is_frame_start() which check if picture has a
frame structure or if it has not an interlaced first field yet. This
function is used with filling is_first_field parameter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-01-05 14:16:45 +01:00
parent a926511df4
commit aff338bb24

View file

@ -415,6 +415,14 @@ gst_va_mpeg2_dec_add_quant_matrix (GstMpeg2Decoder * decoder,
VAIQMatrixBufferType, &iq_matrix, sizeof (iq_matrix));
}
static inline uint32_t
_is_frame_start (GstMpeg2Picture * picture)
{
return (!picture->first_field
|| (picture->structure == GST_MPEG_VIDEO_PICTURE_STRUCTURE_FRAME))
? 1 : 0;
}
static gboolean
gst_va_mpeg2_dec_start_picture (GstMpeg2Decoder * decoder,
GstMpeg2Picture * picture, GstMpeg2Slice * slice,
@ -436,7 +444,7 @@ gst_va_mpeg2_dec_start_picture (GstMpeg2Decoder * decoder,
.picture_coding_type = slice->pic_hdr->pic_type,
.f_code = _pack_f_code (slice->pic_ext->f_code),
.picture_coding_extension.bits = {
.is_first_field = (picture->first_field) ? 0 : 1,
.is_first_field = _is_frame_start (picture),
.intra_dc_precision = slice->pic_ext->intra_dc_precision,
.picture_structure = slice->pic_ext->picture_structure,
.top_field_first = slice->pic_ext->top_field_first,