mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
vkencoder-private: remove pic_num and pic_order_cnt from GstVulkanEncoderPicture
Since they aren't semantically part of the codec-independent encoding operation. And modify unit tests accordingly. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8007>
This commit is contained in:
parent
a8e676a0da
commit
87db136cc7
4 changed files with 27 additions and 32 deletions
|
@ -1355,8 +1355,8 @@ gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
|||
|
||||
gst_vulkan_operation_get_query (priv->exec, (gpointer *) & encode_res, &err);
|
||||
if (encode_res->status == VK_QUERY_RESULT_STATUS_COMPLETE_KHR) {
|
||||
GST_INFO_OBJECT (self, "The frame %d has been encoded with size %lu",
|
||||
pic->pic_num, encode_res->data_size + params_size);
|
||||
GST_INFO_OBJECT (self, "The frame %p has been encoded with size %lu",
|
||||
pic, encode_res->data_size + params_size);
|
||||
gst_buffer_resize (pic->out_buffer, encode_res->offset,
|
||||
encode_res->data_size + params_size);
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture;
|
|||
* @nb_refs: number of references
|
||||
* @slotIndex: slot index
|
||||
* @packed_headers: packed headers
|
||||
* @pic_num: picture number
|
||||
* @pic_order_cnt: order count
|
||||
* @width: picture width
|
||||
* @height: picture height
|
||||
* @fps_n: fps numerator
|
||||
|
@ -64,9 +62,6 @@ struct _GstVulkanEncoderPicture
|
|||
/* picture parameters */
|
||||
GPtrArray *packed_headers;
|
||||
|
||||
gint pic_num;
|
||||
gint pic_order_cnt;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ typedef struct
|
|||
GstVulkanEncoderPicture *picture;
|
||||
|
||||
gboolean is_ref;
|
||||
gint pic_num;
|
||||
gint pic_order_cnt;
|
||||
|
||||
VkVideoEncodeH264NaluSliceInfoKHR slice_info;
|
||||
VkVideoEncodeH264PictureInfoKHR enc_pic_info;
|
||||
|
@ -420,7 +422,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame,
|
|||
.pic_parameter_set_id = pps_id,
|
||||
.primary_pic_type = PICTURE_TYPE (slice_type, frame->is_ref),
|
||||
.frame_num = frame_num,
|
||||
.PicOrderCnt = picture->pic_order_cnt,
|
||||
.PicOrderCnt = frame->pic_order_cnt,
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
||||
|
@ -518,7 +520,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame,
|
|||
},
|
||||
.primary_pic_type = PICTURE_TYPE (slice_type, frame->is_ref),
|
||||
.FrameNum = frame_num,
|
||||
.PicOrderCnt = picture->pic_order_cnt,
|
||||
.PicOrderCnt = frame->pic_order_cnt,
|
||||
.long_term_pic_num = 0,
|
||||
.long_term_frame_idx = 0,
|
||||
.temporal_id = 0,
|
||||
|
@ -848,8 +850,8 @@ GST_START_TEST (test_encoder_h264_i_p)
|
|||
/* Encode following pictures as P-Frames */
|
||||
for (i = 1; i < N_BUFFERS; i++) {
|
||||
frame = allocate_frame (enc, width, height, TRUE, list0_num);
|
||||
frame->picture->pic_num = frame_num;
|
||||
frame->picture->pic_order_cnt = frame_num;
|
||||
frame->pic_num = frame_num;
|
||||
frame->pic_order_cnt = frame_num;
|
||||
|
||||
encode_frame (enc, frame, STD_VIDEO_H264_SLICE_TYPE_P,
|
||||
frame_num, list0, list0_num, NULL, 0, sps_id, pps_id);
|
||||
|
@ -914,8 +916,8 @@ GST_START_TEST (test_encoder_h264_i_p_b)
|
|||
|
||||
/* Encode 4th picture as a P-Frame */
|
||||
frame = allocate_frame (enc, width, height, TRUE, list0_num);
|
||||
frame->picture->pic_num = 3;
|
||||
frame->picture->pic_order_cnt = frame->picture->pic_num * 2;
|
||||
frame->pic_num = 3;
|
||||
frame->pic_order_cnt = frame->pic_num * 2;
|
||||
encode_frame (enc, frame, STD_VIDEO_H264_SLICE_TYPE_P,
|
||||
frame_num, list0, list0_num, list1, list1_num, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H264_NAL_SLICE);
|
||||
|
@ -925,8 +927,8 @@ GST_START_TEST (test_encoder_h264_i_p_b)
|
|||
|
||||
/* Encode second picture as a B-Frame */
|
||||
frame = allocate_frame (enc, width, height, FALSE, list0_num + list1_num);
|
||||
frame->picture->pic_num = 1;
|
||||
frame->picture->pic_order_cnt = frame->picture->pic_num * 2;
|
||||
frame->pic_num = 1;
|
||||
frame->pic_order_cnt = frame->pic_num * 2;
|
||||
encode_frame (enc, frame, STD_VIDEO_H264_SLICE_TYPE_B,
|
||||
frame_num, list0, list0_num, list1, list1_num, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H264_NAL_SLICE);
|
||||
|
@ -935,8 +937,8 @@ GST_START_TEST (test_encoder_h264_i_p_b)
|
|||
|
||||
/* Encode third picture as a B-Frame */
|
||||
frame = allocate_frame (enc, width, height, FALSE, list0_num + list1_num);
|
||||
frame->picture->pic_num = 2;
|
||||
frame->picture->pic_order_cnt = frame->picture->pic_num * 2;
|
||||
frame->pic_num = 2;
|
||||
frame->pic_order_cnt = frame->pic_num * 2;
|
||||
|
||||
encode_frame (enc, frame, STD_VIDEO_H264_SLICE_TYPE_B,
|
||||
frame_num, list0, list0_num, list1, list1_num, sps_id, pps_id);
|
||||
|
|
|
@ -50,6 +50,8 @@ typedef struct
|
|||
GstVulkanEncoderPicture *picture;
|
||||
|
||||
gboolean is_ref;
|
||||
gint pic_num;
|
||||
gint pic_order_cnt;
|
||||
|
||||
VkVideoEncodeH265PictureInfoKHR enc_pic_info;
|
||||
VkVideoEncodeH265NaluSliceSegmentInfoKHR slice_info;
|
||||
|
@ -454,14 +456,10 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
|
|||
/* *INDENT-ON* */
|
||||
};
|
||||
|
||||
if (list0_num) {
|
||||
delta_poc_s0_minus1 =
|
||||
picture->pic_order_cnt - list0[0]->picture->pic_order_cnt - 1;
|
||||
}
|
||||
if (list1_num) {
|
||||
delta_poc_s1_minus1 =
|
||||
list1[0]->picture->pic_order_cnt - picture->pic_order_cnt - 1;
|
||||
}
|
||||
if (list0_num)
|
||||
delta_poc_s0_minus1 = frame->pic_order_cnt - list0[0]->pic_order_cnt - 1;
|
||||
if (list1_num)
|
||||
delta_poc_s1_minus1 = list1[0]->pic_order_cnt - frame->pic_order_cnt - 1;
|
||||
|
||||
frame->short_term_ref_pic_set = (StdVideoH265ShortTermRefPicSet) {
|
||||
/* *INDENT-OFF* */
|
||||
|
@ -499,7 +497,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
|
|||
.sps_video_parameter_set_id = vps_id,
|
||||
.pps_seq_parameter_set_id = sps_id,
|
||||
.pps_pic_parameter_set_id = pps_id,
|
||||
.PicOrderCntVal = picture->pic_order_cnt,
|
||||
.PicOrderCntVal = frame->pic_order_cnt,
|
||||
.pShortTermRefPicSet = &frame->short_term_ref_pic_set,
|
||||
.pLongTermRefPics = NULL,
|
||||
/* *INDENT-ON* */
|
||||
|
@ -590,7 +588,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
|
|||
.unused_for_reference = 0,
|
||||
},
|
||||
.pic_type = picture_type,
|
||||
.PicOrderCntVal = picture->pic_order_cnt,
|
||||
.PicOrderCntVal = frame->pic_order_cnt,
|
||||
.TemporalId = 0,
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
@ -1025,7 +1023,7 @@ GST_START_TEST (test_encoder_h265_i_p)
|
|||
/* Encode following pictures as a P-Frames */
|
||||
for (i = 1; i < N_BUFFERS; i++) {
|
||||
frame = allocate_frame (enc, width, height, TRUE, list0_num);
|
||||
frame->picture->pic_num = frame_num;
|
||||
frame->pic_num = frame_num;
|
||||
encode_frame (enc, frame, STD_VIDEO_H265_SLICE_TYPE_P,
|
||||
frame_num, list0, list0_num, NULL, 0, vps_id, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H265_NAL_SLICE_TRAIL_R);
|
||||
|
@ -1078,7 +1076,7 @@ GST_START_TEST (test_encoder_h265_i_p_b)
|
|||
|
||||
/* Encode first picture as an IDR-Frame */
|
||||
frame = allocate_frame (enc, width, height, TRUE, 0);
|
||||
frame->picture->pic_num = frame_num;
|
||||
frame->pic_num = frame_num;
|
||||
encode_frame (enc, frame, STD_VIDEO_H265_SLICE_TYPE_I,
|
||||
frame_num, NULL, 0, NULL, 0, vps_id, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H265_NAL_SLICE_IDR_W_RADL);
|
||||
|
@ -1087,7 +1085,7 @@ GST_START_TEST (test_encoder_h265_i_p_b)
|
|||
|
||||
/* Encode 4th picture as a P-Frame */
|
||||
frame = allocate_frame (enc, width, height, TRUE, list0_num);
|
||||
frame->picture->pic_num = frame_num + 2;
|
||||
frame->pic_num = frame_num + 2;
|
||||
encode_frame (enc, frame, STD_VIDEO_H265_SLICE_TYPE_P,
|
||||
frame_num, list0, list0_num, NULL, 0, vps_id, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H265_NAL_SLICE_TRAIL_R);
|
||||
|
@ -1096,7 +1094,7 @@ GST_START_TEST (test_encoder_h265_i_p_b)
|
|||
|
||||
/* Encode 2nd picture as a B-Frame */
|
||||
frame = allocate_frame (enc, width, height, FALSE, list0_num + list1_num);
|
||||
frame->picture->pic_num = frame_num - 1;
|
||||
frame->pic_num = frame_num - 1;
|
||||
encode_frame (enc, frame, STD_VIDEO_H265_SLICE_TYPE_B,
|
||||
frame_num, list0, list0_num, list1, list1_num, vps_id, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H265_NAL_SLICE_TRAIL_N);
|
||||
|
@ -1105,7 +1103,7 @@ GST_START_TEST (test_encoder_h265_i_p_b)
|
|||
|
||||
/* Encode 3rd picture as a B-Frame */
|
||||
frame = allocate_frame (enc, width, height, FALSE, list0_num + list1_num);
|
||||
frame->picture->pic_num = frame_num - 1;
|
||||
frame->pic_num = frame_num - 1;
|
||||
encode_frame (enc, frame, STD_VIDEO_H265_SLICE_TYPE_B,
|
||||
frame_num, list0, list0_num, list1, list1_num, vps_id, sps_id, pps_id);
|
||||
check_encoded_frame (frame, GST_H265_NAL_SLICE_TRAIL_N);
|
||||
|
|
Loading…
Reference in a new issue