From a8e676a0dae091559b632b7b34053773f96c69a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 3 Sep 2024 21:36:56 +0200 Subject: [PATCH] vkencoder-private: remove is_ref member from GstVulkanEncoderPicture It's not used. Modified the unit test accordingly. Part-of: --- .../gst-libs/gst/vulkan/gstvkencoder-private.c | 4 +--- .../gst-libs/gst/vulkan/gstvkencoder-private.h | 3 --- .../tests/check/libs/vkvideoencodeh264.c | 15 +++++++++------ .../tests/check/libs/vkvideoencodeh265.c | 11 +++++++---- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.c index fff554eba4..20f740f84c 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.c @@ -377,7 +377,6 @@ gst_vulkan_encoder_new_video_session_parameters (GstVulkanEncoder * self, * @in_buffer: (transfer none): the input #GstBuffer. * @width: the picture width * @height: the picture height - * @is_ref: the picture reference flag * @nb_refs: the picture number of references * * Create a new vulkan encode picture from the input buffer. @@ -387,7 +386,7 @@ gst_vulkan_encoder_new_video_session_parameters (GstVulkanEncoder * self, */ GstVulkanEncoderPicture * gst_vulkan_encoder_picture_new (GstVulkanEncoder * self, GstBuffer * in_buffer, - int width, int height, gsize size, gboolean is_ref, gint nb_refs) + int width, int height, gsize size, gint nb_refs) { GstVulkanEncoderPicture *pic; GstVulkanEncoderPrivate *priv; @@ -423,7 +422,6 @@ gst_vulkan_encoder_picture_new (GstVulkanEncoder * self, GstBuffer * in_buffer, VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR, size_aligned); pic->width = width; pic->height = height; - pic->is_ref = is_ref; pic->nb_refs = nb_refs; pic->packed_headers = g_ptr_array_new_with_free_func ((GDestroyNotify) gst_buffer_unref); diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.h b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.h index a630345c55..3f4e5bc7d9 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkencoder-private.h @@ -40,7 +40,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture; /** * GstVulkanEncoderPicture: - * @is_ref: picture is reference * @nb_refs: number of references * @slotIndex: slot index * @packed_headers: packed headers @@ -59,7 +58,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture; */ struct _GstVulkanEncoderPicture { - gboolean is_ref; gint nb_refs; gint slotIndex; @@ -187,7 +185,6 @@ GstVulkanEncoderPicture* gst_vulkan_encoder_picture_new (GstVulkanEncode gint width, gint height, gsize size, - gboolean is_ref, gint nb_refs); GST_VULKAN_API void gst_vulkan_encoder_picture_free (GstVulkanEncoderPicture * pic); diff --git a/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh264.c b/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh264.c index 77f9cfbc86..3c89dd39d5 100644 --- a/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh264.c +++ b/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh264.c @@ -47,6 +47,8 @@ typedef struct { GstVulkanEncoderPicture *picture; + gboolean is_ref; + VkVideoEncodeH264NaluSliceInfoKHR slice_info; VkVideoEncodeH264PictureInfoKHR enc_pic_info; VkVideoEncodeH264DpbSlotInfoKHR dpb_slot_info; @@ -61,13 +63,14 @@ typedef struct } GstVulkanH264EncodeFrame; static GstVulkanH264EncodeFrame * -_h264_encode_frame_new (GstVulkanEncoderPicture * picture) +_h264_encode_frame_new (GstVulkanEncoderPicture * picture, gboolean is_ref) { GstVulkanH264EncodeFrame *frame; g_return_val_if_fail (picture, NULL); frame = g_new (GstVulkanH264EncodeFrame, 1); frame->picture = picture; + frame->is_ref = is_ref; return frame; } @@ -357,7 +360,7 @@ allocate_frame (GstVulkanEncoder * enc, int width, upload_buffer_to_image(img_pool, in_buffer, &img_buffer); frame = _h264_encode_frame_new (gst_vulkan_encoder_picture_new (enc, - img_buffer, width, height, width * height * 3, is_ref, nb_refs)); + img_buffer, width, height, width * height * 3, nb_refs), is_ref); fail_unless (frame); fail_unless (frame->picture); gst_buffer_unref (in_buffer); @@ -407,15 +410,15 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame, frame->pic_info = (StdVideoEncodeH264PictureInfo) { /* *INDENT-OFF* */ .flags = (StdVideoEncodeH264PictureInfoFlags) { - .IdrPicFlag = (slice_type == STD_VIDEO_H264_SLICE_TYPE_I && picture->is_ref), - .is_reference = picture->is_ref, /* TODO: Check why it creates a deadlock in query result when TRUE */ + .IdrPicFlag = (slice_type == STD_VIDEO_H264_SLICE_TYPE_I && frame->is_ref), + .is_reference = frame->is_ref, /* TODO: Check why it creates a deadlock in query result when TRUE */ .no_output_of_prior_pics_flag = 0, .long_term_reference_flag = 0, .adaptive_ref_pic_marking_mode_flag = 0, }, .seq_parameter_set_id = sps_id, .pic_parameter_set_id = pps_id, - .primary_pic_type = PICTURE_TYPE (slice_type, picture->is_ref), + .primary_pic_type = PICTURE_TYPE (slice_type, frame->is_ref), .frame_num = frame_num, .PicOrderCnt = picture->pic_order_cnt, /* *INDENT-ON* */ @@ -513,7 +516,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame, .flags = { .used_for_long_term_reference = 0, }, - .primary_pic_type = PICTURE_TYPE (slice_type, picture->is_ref), + .primary_pic_type = PICTURE_TYPE (slice_type, frame->is_ref), .FrameNum = frame_num, .PicOrderCnt = picture->pic_order_cnt, .long_term_pic_num = 0, diff --git a/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh265.c b/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh265.c index 22b64e0207..139bb65240 100644 --- a/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh265.c +++ b/subprojects/gst-plugins-bad/tests/check/libs/vkvideoencodeh265.c @@ -49,6 +49,8 @@ typedef struct { GstVulkanEncoderPicture *picture; + gboolean is_ref; + VkVideoEncodeH265PictureInfoKHR enc_pic_info; VkVideoEncodeH265NaluSliceSegmentInfoKHR slice_info; VkVideoEncodeH265DpbSlotInfoKHR dpb_slot_info; @@ -66,13 +68,14 @@ typedef struct static GstVulkanH265EncodeFrame * -_h265_encode_frame_new (GstVulkanEncoderPicture * picture) +_h265_encode_frame_new (GstVulkanEncoderPicture * picture, gboolean is_ref) { GstVulkanH265EncodeFrame *frame; g_return_val_if_fail (picture, NULL); frame = g_new (GstVulkanH265EncodeFrame, 1); frame->picture = picture; + frame->is_ref = is_ref; return frame; } @@ -364,7 +367,7 @@ allocate_frame (GstVulkanEncoder * enc, int width, upload_buffer_to_image(img_pool, in_buffer, &img_buffer); frame = _h265_encode_frame_new (gst_vulkan_encoder_picture_new (enc, - img_buffer, width, height, width * height * 3, is_ref, nb_refs)); + img_buffer, width, height, width * height * 3, nb_refs), is_ref); fail_unless (frame); fail_unless (frame->picture); gst_buffer_unref (in_buffer); @@ -394,7 +397,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame, guint qp_p = 26; guint qp_b = 26; GstVulkanEncoderPicture *picture = frame->picture; - gint picture_type = PICTURE_TYPE(slice_type, picture->is_ref); + gint picture_type = PICTURE_TYPE(slice_type, frame->is_ref); GST_DEBUG ("Encoding frame num: %d", frame_num); @@ -482,7 +485,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame, frame->pic_info = (StdVideoEncodeH265PictureInfo) { /* *INDENT-OFF* */ .flags = (StdVideoEncodeH265PictureInfoFlags) { - .is_reference = picture->is_ref, + .is_reference = frame->is_ref, .IrapPicFlag = (picture_type == STD_VIDEO_H265_PICTURE_TYPE_IDR), .used_for_long_term_reference = 0, .discardable_flag = 0,