d3d11h264dec: Fix for MbaffFrameFlag and FrameNumList
authorSeungha Yang <seungha@centricular.com>
Sun, 8 Nov 2020 10:08:25 +0000 (19:08 +0900)
committerSeungha Yang <seungha@centricular.com>
Sun, 8 Nov 2020 18:07:06 +0000 (03:07 +0900)
As per spec 7.4.3 Slice header semantics, the flag value is derived as
MbaffFrameFlag = (mb_adaptive_frame_field_flag && !field_pic_flag)
and DXVA uses the value.
Regarding FrameNumList, in case of long-term ref, FrameNumList[i]
value should be long_term_frame_idx not long_term_pic_num.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1780>

sys/d3d11/gstd3d11h264dec.c

index 5946e93..4cd0a87 100644 (file)
@@ -578,7 +578,7 @@ gst_d3d11_h264_dec_start_picture (GstH264Decoder * decoder,
     self->field_order_cnt_list[i][0] = other->top_field_order_cnt;
     self->field_order_cnt_list[i][1] = other->bottom_field_order_cnt;
     self->frame_num_list[i] = self->ref_frame_list[i].AssociatedFlag
-        ? other->long_term_pic_num : other->frame_num;
+        ? other->long_term_frame_idx : other->frame_num;
     self->used_for_reference_flags |= ref << (2 * i);
     self->non_existing_frame_flags |= (other->nonexisting) << i;
   }
@@ -904,7 +904,7 @@ gst_d3d11_h264_dec_picture_params_from_sps (GstD3D11H264Dec * self,
   params->wFrameWidthInMbsMinus1 = sps->pic_width_in_mbs_minus1;
   params->wFrameHeightInMbsMinus1 = sps->pic_height_in_map_units_minus1;
   params->residual_colour_transform_flag = sps->separate_colour_plane_flag;
-  params->MbaffFrameFlag = sps->mb_adaptive_frame_field_flag && field_pic;
+  params->MbaffFrameFlag = (sps->mb_adaptive_frame_field_flag && !field_pic);
   params->field_pic_flag = field_pic;
   params->MinLumaBipredSize8x8Flag = sps->level_idc >= 31;