typedef struct _GstVaapiSliceH264 GstVaapiSliceH264;
typedef struct _GstVaapiSliceH264Class GstVaapiSliceH264Class;
+// Used for field_poc[]
+#define TOP_FIELD 0
+#define BOTTOM_FIELD 1
+
/* ------------------------------------------------------------------------- */
/* --- H.264 Pictures --- */
/* ------------------------------------------------------------------------- */
struct _GstVaapiPictureH264 {
GstVaapiPicture base;
- VAPictureH264 info;
GstH264PPS *pps;
- gint32 poc;
+ gint32 field_poc[2];
gint32 frame_num; // Original frame_num from slice_header()
gint32 frame_num_wrap; // Temporary for ref pic marking: FrameNumWrap
gint32 long_term_frame_idx; // Temporary for ref pic marking: LongTermFrameIdx
static void
gst_vaapi_picture_h264_init(GstVaapiPictureH264 *picture)
{
- VAPictureH264 *va_pic;
-
- va_pic = &picture->info;
- va_pic->flags = 0;
- va_pic->TopFieldOrderCnt = 0;
- va_pic->BottomFieldOrderCnt = 0;
-
- picture->poc = 0;
+ picture->field_poc[0] = G_MAXINT32;
+ picture->field_poc[1] = G_MAXINT32;
picture->output_needed = FALSE;
}
GST_VAAPI_TYPE_DECODER_H264, \
GstVaapiDecoderH264Private))
-// Used for field_poc[]
-#define TOP_FIELD 0
-#define BOTTOM_FIELD 1
-
struct _GstVaapiDecoderH264Private {
GstAdapter *adapter;
GstH264NalParser *parser;
lowest_poc_index = i++;
for (; i < priv->dpb_count; i++) {
GstVaapiPictureH264 * const picture = priv->dpb[i];
- if (picture->output_needed && picture->poc < priv->dpb[lowest_poc_index]->poc)
+ if (picture->output_needed && picture->base.poc < priv->dpb[lowest_poc_index]->base.poc)
lowest_poc_index = i;
}
while (priv->dpb_count == priv->dpb_size) {
for (i = 0; i < priv->dpb_count; i++) {
if (priv->dpb[i]->output_needed &&
- priv->dpb[i]->poc < picture->poc)
+ priv->dpb[i]->base.poc < picture->base.poc)
break;
}
if (i == priv->dpb_count)
)
{
GstVaapiDecoderH264Private * const priv = decoder->priv;
- VAPictureH264 * const pic = &picture->info;
GstH264PPS * const pps = slice_hdr->pps;
GstH264SPS * const sps = pps->sequence;
}
if (picture->base.structure != GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
- pic->TopFieldOrderCnt = priv->field_poc[TOP_FIELD];
+ picture->field_poc[TOP_FIELD] = priv->field_poc[TOP_FIELD];
if (picture->base.structure != GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
- pic->BottomFieldOrderCnt = priv->field_poc[BOTTOM_FIELD];
- picture->poc = MIN(pic->TopFieldOrderCnt, pic->BottomFieldOrderCnt);
+ picture->field_poc[BOTTOM_FIELD] = priv->field_poc[BOTTOM_FIELD];
+ picture->base.poc = MIN(picture->field_poc[0], picture->field_poc[1]);
}
static int
const GstVaapiPictureH264 * const picA = *(GstVaapiPictureH264 **)a;
const GstVaapiPictureH264 * const picB = *(GstVaapiPictureH264 **)b;
- return picB->poc - picA->poc;
+ return picB->base.poc - picA->base.poc;
}
static int
const GstVaapiPictureH264 * const picA = *(GstVaapiPictureH264 **)a;
const GstVaapiPictureH264 * const picB = *(GstVaapiPictureH264 **)b;
- return picA->poc - picB->poc;
+ return picA->base.poc - picB->base.poc;
}
static int
// 1. Short-term references
ref_list = priv->RefPicList0;
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc < picture->poc)
+ if (priv->short_ref[i]->base.poc < picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_dec);
ref_list = &priv->RefPicList0[priv->RefPicList0_count];
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc >= picture->poc)
+ if (priv->short_ref[i]->base.poc >= picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_inc);
// 1. Short-term references
ref_list = priv->RefPicList1;
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc > picture->poc)
+ if (priv->short_ref[i]->base.poc > picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_inc);
ref_list = &priv->RefPicList1[priv->RefPicList1_count];
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc <= picture->poc)
+ if (priv->short_ref[i]->base.poc <= picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_dec);
if (priv->short_ref_count > 0) {
ref_list = short_ref0;
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc <= picture->poc)
+ if (priv->short_ref[i]->base.poc <= picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_dec);
ref_list = &short_ref0[short_ref0_count];
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc > picture->poc)
+ if (priv->short_ref[i]->base.poc > picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_inc);
if (priv->short_ref_count > 0) {
ref_list = short_ref1;
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc > picture->poc)
+ if (priv->short_ref[i]->base.poc > picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_inc);
ref_list = &short_ref1[short_ref1_count];
for (n = 0, i = 0; i < priv->short_ref_count; i++) {
- if (priv->short_ref[i]->poc <= picture->poc)
+ if (priv->short_ref[i]->base.poc <= picture->base.poc)
ref_list[n++] = priv->short_ref[i];
}
SORT_REF_LIST(ref_list, n, poc_dec);
)
{
GstVaapiDecoderH264Private * const priv = decoder->priv;
- VAPictureH264 * const pic = &picture->info;
clear_references(decoder, priv->short_ref, &priv->short_ref_count);
clear_references(decoder, priv->long_ref, &priv->long_ref_count );
/* Update TopFieldOrderCnt and BottomFieldOrderCnt (8.2.1) */
if (picture->base.structure != GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD)
- pic->TopFieldOrderCnt -= picture->poc;
+ picture->field_poc[TOP_FIELD] -= picture->base.poc;
if (picture->base.structure != GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD)
- pic->BottomFieldOrderCnt -= picture->poc;
- picture->poc = 0;
+ picture->field_poc[BOTTOM_FIELD] -= picture->base.poc;
+ picture->base.poc = 0;
}
/* 8.2.5.4.6. Assign a long-term frame index to the current picture */
switch (picture->base.structure) {
case GST_VAAPI_PICTURE_STRUCTURE_FRAME:
- pic->TopFieldOrderCnt = picture->info.TopFieldOrderCnt;
- pic->BottomFieldOrderCnt = picture->info.BottomFieldOrderCnt;
+ pic->TopFieldOrderCnt = picture->field_poc[TOP_FIELD];
+ pic->BottomFieldOrderCnt = picture->field_poc[BOTTOM_FIELD];
break;
case GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
pic->flags |= VA_PICTURE_H264_TOP_FIELD;
- pic->TopFieldOrderCnt = picture->info.BottomFieldOrderCnt;
+ pic->TopFieldOrderCnt = picture->field_poc[TOP_FIELD];
pic->BottomFieldOrderCnt = 0;
break;
case GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
pic->flags |= VA_PICTURE_H264_BOTTOM_FIELD;
- pic->BottomFieldOrderCnt = picture->info.BottomFieldOrderCnt;
+ pic->BottomFieldOrderCnt = picture->field_poc[BOTTOM_FIELD];
pic->TopFieldOrderCnt = 0;
break;
}