vkencoder-private: remove is_ref member from GstVulkanEncoderPicture

It's not used. Modified the unit test accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8007>
This commit is contained in:
Víctor Manuel Jáquez Leal 2024-09-03 21:36:56 +02:00 committed by GStreamer Marge Bot
parent 4a221aad8a
commit a8e676a0da
4 changed files with 17 additions and 16 deletions

View file

@ -377,7 +377,6 @@ gst_vulkan_encoder_new_video_session_parameters (GstVulkanEncoder * self,
* @in_buffer: (transfer none): the input #GstBuffer. * @in_buffer: (transfer none): the input #GstBuffer.
* @width: the picture width * @width: the picture width
* @height: the picture height * @height: the picture height
* @is_ref: the picture reference flag
* @nb_refs: the picture number of references * @nb_refs: the picture number of references
* *
* Create a new vulkan encode picture from the input buffer. * Create a new vulkan encode picture from the input buffer.
@ -387,7 +386,7 @@ gst_vulkan_encoder_new_video_session_parameters (GstVulkanEncoder * self,
*/ */
GstVulkanEncoderPicture * GstVulkanEncoderPicture *
gst_vulkan_encoder_picture_new (GstVulkanEncoder * self, GstBuffer * in_buffer, 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; GstVulkanEncoderPicture *pic;
GstVulkanEncoderPrivate *priv; 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); VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR, size_aligned);
pic->width = width; pic->width = width;
pic->height = height; pic->height = height;
pic->is_ref = is_ref;
pic->nb_refs = nb_refs; pic->nb_refs = nb_refs;
pic->packed_headers = pic->packed_headers =
g_ptr_array_new_with_free_func ((GDestroyNotify) gst_buffer_unref); g_ptr_array_new_with_free_func ((GDestroyNotify) gst_buffer_unref);

View file

@ -40,7 +40,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture;
/** /**
* GstVulkanEncoderPicture: * GstVulkanEncoderPicture:
* @is_ref: picture is reference
* @nb_refs: number of references * @nb_refs: number of references
* @slotIndex: slot index * @slotIndex: slot index
* @packed_headers: packed headers * @packed_headers: packed headers
@ -59,7 +58,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture;
*/ */
struct _GstVulkanEncoderPicture struct _GstVulkanEncoderPicture
{ {
gboolean is_ref;
gint nb_refs; gint nb_refs;
gint slotIndex; gint slotIndex;
@ -187,7 +185,6 @@ GstVulkanEncoderPicture* gst_vulkan_encoder_picture_new (GstVulkanEncode
gint width, gint width,
gint height, gint height,
gsize size, gsize size,
gboolean is_ref,
gint nb_refs); gint nb_refs);
GST_VULKAN_API GST_VULKAN_API
void gst_vulkan_encoder_picture_free (GstVulkanEncoderPicture * pic); void gst_vulkan_encoder_picture_free (GstVulkanEncoderPicture * pic);

View file

@ -47,6 +47,8 @@ typedef struct
{ {
GstVulkanEncoderPicture *picture; GstVulkanEncoderPicture *picture;
gboolean is_ref;
VkVideoEncodeH264NaluSliceInfoKHR slice_info; VkVideoEncodeH264NaluSliceInfoKHR slice_info;
VkVideoEncodeH264PictureInfoKHR enc_pic_info; VkVideoEncodeH264PictureInfoKHR enc_pic_info;
VkVideoEncodeH264DpbSlotInfoKHR dpb_slot_info; VkVideoEncodeH264DpbSlotInfoKHR dpb_slot_info;
@ -61,13 +63,14 @@ typedef struct
} GstVulkanH264EncodeFrame; } GstVulkanH264EncodeFrame;
static GstVulkanH264EncodeFrame * static GstVulkanH264EncodeFrame *
_h264_encode_frame_new (GstVulkanEncoderPicture * picture) _h264_encode_frame_new (GstVulkanEncoderPicture * picture, gboolean is_ref)
{ {
GstVulkanH264EncodeFrame *frame; GstVulkanH264EncodeFrame *frame;
g_return_val_if_fail (picture, NULL); g_return_val_if_fail (picture, NULL);
frame = g_new (GstVulkanH264EncodeFrame, 1); frame = g_new (GstVulkanH264EncodeFrame, 1);
frame->picture = picture; frame->picture = picture;
frame->is_ref = is_ref;
return frame; return frame;
} }
@ -357,7 +360,7 @@ allocate_frame (GstVulkanEncoder * enc, int width,
upload_buffer_to_image(img_pool, in_buffer, &img_buffer); upload_buffer_to_image(img_pool, in_buffer, &img_buffer);
frame = _h264_encode_frame_new (gst_vulkan_encoder_picture_new (enc, 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);
fail_unless (frame->picture); fail_unless (frame->picture);
gst_buffer_unref (in_buffer); gst_buffer_unref (in_buffer);
@ -407,15 +410,15 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame,
frame->pic_info = (StdVideoEncodeH264PictureInfo) { frame->pic_info = (StdVideoEncodeH264PictureInfo) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
.flags = (StdVideoEncodeH264PictureInfoFlags) { .flags = (StdVideoEncodeH264PictureInfoFlags) {
.IdrPicFlag = (slice_type == STD_VIDEO_H264_SLICE_TYPE_I && picture->is_ref), .IdrPicFlag = (slice_type == STD_VIDEO_H264_SLICE_TYPE_I && frame->is_ref),
.is_reference = picture->is_ref, /* TODO: Check why it creates a deadlock in query result when TRUE */ .is_reference = frame->is_ref, /* TODO: Check why it creates a deadlock in query result when TRUE */
.no_output_of_prior_pics_flag = 0, .no_output_of_prior_pics_flag = 0,
.long_term_reference_flag = 0, .long_term_reference_flag = 0,
.adaptive_ref_pic_marking_mode_flag = 0, .adaptive_ref_pic_marking_mode_flag = 0,
}, },
.seq_parameter_set_id = sps_id, .seq_parameter_set_id = sps_id,
.pic_parameter_set_id = pps_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, .frame_num = frame_num,
.PicOrderCnt = picture->pic_order_cnt, .PicOrderCnt = picture->pic_order_cnt,
/* *INDENT-ON* */ /* *INDENT-ON* */
@ -513,7 +516,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame,
.flags = { .flags = {
.used_for_long_term_reference = 0, .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, .FrameNum = frame_num,
.PicOrderCnt = picture->pic_order_cnt, .PicOrderCnt = picture->pic_order_cnt,
.long_term_pic_num = 0, .long_term_pic_num = 0,

View file

@ -49,6 +49,8 @@ typedef struct
{ {
GstVulkanEncoderPicture *picture; GstVulkanEncoderPicture *picture;
gboolean is_ref;
VkVideoEncodeH265PictureInfoKHR enc_pic_info; VkVideoEncodeH265PictureInfoKHR enc_pic_info;
VkVideoEncodeH265NaluSliceSegmentInfoKHR slice_info; VkVideoEncodeH265NaluSliceSegmentInfoKHR slice_info;
VkVideoEncodeH265DpbSlotInfoKHR dpb_slot_info; VkVideoEncodeH265DpbSlotInfoKHR dpb_slot_info;
@ -66,13 +68,14 @@ typedef struct
static GstVulkanH265EncodeFrame * static GstVulkanH265EncodeFrame *
_h265_encode_frame_new (GstVulkanEncoderPicture * picture) _h265_encode_frame_new (GstVulkanEncoderPicture * picture, gboolean is_ref)
{ {
GstVulkanH265EncodeFrame *frame; GstVulkanH265EncodeFrame *frame;
g_return_val_if_fail (picture, NULL); g_return_val_if_fail (picture, NULL);
frame = g_new (GstVulkanH265EncodeFrame, 1); frame = g_new (GstVulkanH265EncodeFrame, 1);
frame->picture = picture; frame->picture = picture;
frame->is_ref = is_ref;
return frame; return frame;
} }
@ -364,7 +367,7 @@ allocate_frame (GstVulkanEncoder * enc, int width,
upload_buffer_to_image(img_pool, in_buffer, &img_buffer); upload_buffer_to_image(img_pool, in_buffer, &img_buffer);
frame = _h265_encode_frame_new (gst_vulkan_encoder_picture_new (enc, 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);
fail_unless (frame->picture); fail_unless (frame->picture);
gst_buffer_unref (in_buffer); gst_buffer_unref (in_buffer);
@ -394,7 +397,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
guint qp_p = 26; guint qp_p = 26;
guint qp_b = 26; guint qp_b = 26;
GstVulkanEncoderPicture *picture = frame->picture; 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); GST_DEBUG ("Encoding frame num: %d", frame_num);
@ -482,7 +485,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
frame->pic_info = (StdVideoEncodeH265PictureInfo) { frame->pic_info = (StdVideoEncodeH265PictureInfo) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
.flags = (StdVideoEncodeH265PictureInfoFlags) { .flags = (StdVideoEncodeH265PictureInfoFlags) {
.is_reference = picture->is_ref, .is_reference = frame->is_ref,
.IrapPicFlag = (picture_type == STD_VIDEO_H265_PICTURE_TYPE_IDR), .IrapPicFlag = (picture_type == STD_VIDEO_H265_PICTURE_TYPE_IDR),
.used_for_long_term_reference = 0, .used_for_long_term_reference = 0,
.discardable_flag = 0, .discardable_flag = 0,