mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
vkencoder-private: remove width, height and fps from GstVulkanEncoderPicture
In GStreamer that buffer information is decoupled, holding other structures to describe the stream: GstCaps. So, to keep the GStreamer design this patch removes these information from GstVulkanEncoderPicture and pass to gst_vulkan_encoder_encode() a pointer to GstVideoInfo. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8007>
This commit is contained in:
parent
eef9717478
commit
c1e364ecdc
4 changed files with 16 additions and 29 deletions
|
@ -375,8 +375,7 @@ gst_vulkan_encoder_new_video_session_parameters (GstVulkanEncoder * self,
|
|||
* gst_vulkan_encoder_picture_new:
|
||||
* @self: the #GstVulkanEncoder with the pool's configuration.
|
||||
* @in_buffer: (transfer none): the input #GstBuffer.
|
||||
* @width: the picture width
|
||||
* @height: the picture height
|
||||
* @size: size of the output buffer
|
||||
*
|
||||
* Create a new vulkan encode picture from the input buffer.
|
||||
*
|
||||
|
@ -385,7 +384,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)
|
||||
gsize size)
|
||||
{
|
||||
GstVulkanEncoderPicture *pic;
|
||||
GstVulkanEncoderPrivate *priv;
|
||||
|
@ -419,8 +418,6 @@ gst_vulkan_encoder_picture_new (GstVulkanEncoder * self, GstBuffer * in_buffer,
|
|||
pic->out_buffer =
|
||||
gst_vulkan_video_codec_buffer_new (self->queue->device, &priv->profile,
|
||||
VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR, size_aligned);
|
||||
pic->width = width;
|
||||
pic->height = height;
|
||||
pic->slotIndex = -1;
|
||||
pic->offset = 0;
|
||||
|
||||
|
@ -1057,6 +1054,7 @@ bail:
|
|||
/**
|
||||
* gst_vulkan_encoder_encode:
|
||||
* @self: a #GstVulkanEncoder
|
||||
* @info: the #GstVideoInfo of the @pic to process
|
||||
* @pic: a #GstVulkanEncoderPicture
|
||||
* @nb_refs: number of @ref_pics
|
||||
* @ref_pics: an array of #GstVulkanEncoderPicture
|
||||
|
@ -1067,7 +1065,7 @@ bail:
|
|||
*
|
||||
*/
|
||||
gboolean
|
||||
gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
||||
gst_vulkan_encoder_encode (GstVulkanEncoder * self, GstVideoInfo * info,
|
||||
GstVulkanEncoderPicture * pic, guint nb_refs,
|
||||
GstVulkanEncoderPicture ** ref_pics)
|
||||
{
|
||||
|
@ -1090,7 +1088,7 @@ gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
|||
GArray *barriers;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_ENCODER (self), FALSE);
|
||||
g_return_val_if_fail (pic != NULL, FALSE);
|
||||
g_return_val_if_fail (info != NULL && pic != NULL, FALSE);
|
||||
|
||||
priv = gst_vulkan_encoder_get_instance_private (self);
|
||||
|
||||
|
@ -1123,8 +1121,8 @@ gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
|||
.pNext = pic->codec_rc_layer_info,
|
||||
.averageBitrate = priv->prop.average_bitrate,
|
||||
.maxBitrate = priv->caps.encoder.caps.maxBitrate,
|
||||
.frameRateNumerator = pic->fps_n,
|
||||
.frameRateDenominator = pic->fps_d,
|
||||
.frameRateNumerator = GST_VIDEO_INFO_FPS_N (info),
|
||||
.frameRateDenominator = GST_VIDEO_INFO_FPS_D (info),
|
||||
};
|
||||
priv->rate_control_info = (VkVideoEncodeRateControlInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR,
|
||||
|
@ -1166,8 +1164,8 @@ gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
|||
.pNext = NULL,
|
||||
.codedOffset = { 0, 0 },
|
||||
.codedExtent = {
|
||||
.width = pic->width,
|
||||
.height = pic->height
|
||||
.width = GST_VIDEO_INFO_WIDTH (info),
|
||||
.height = GST_VIDEO_INFO_HEIGHT (info),
|
||||
},
|
||||
.baseArrayLayer = 0,
|
||||
.imageViewBinding = pic->dpb_view->view,
|
||||
|
@ -1269,8 +1267,8 @@ gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
|||
.pNext = NULL,
|
||||
.codedOffset = { 0, 0 },
|
||||
.codedExtent = {
|
||||
.width = pic->width,
|
||||
.height = pic->height
|
||||
.width = GST_VIDEO_INFO_WIDTH (info),
|
||||
.height = GST_VIDEO_INFO_HEIGHT (info),
|
||||
},
|
||||
.baseArrayLayer = 0,
|
||||
.imageViewBinding = pic->img_view->view,
|
||||
|
|
|
@ -42,10 +42,6 @@ typedef struct _GstVulkanEncoderPicture GstVulkanEncoderPicture;
|
|||
* GstVulkanEncoderPicture:
|
||||
* @slotIndex: slot index
|
||||
* @offset: headers offset
|
||||
* @width: picture width
|
||||
* @height: picture height
|
||||
* @fps_n: fps numerator
|
||||
* @fps_d: fps denominator
|
||||
* @in_buffer: input buffer
|
||||
* @out_buffer: output buffer
|
||||
*
|
||||
|
@ -59,12 +55,6 @@ struct _GstVulkanEncoderPicture
|
|||
|
||||
guint64 offset;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
gint fps_n;
|
||||
gint fps_d;
|
||||
|
||||
GstBuffer *in_buffer;
|
||||
GstBuffer *dpb_buffer;
|
||||
GstBuffer *out_buffer;
|
||||
|
@ -164,6 +154,7 @@ gboolean gst_vulkan_encoder_create_dpb_pool (GstVulkanEncode
|
|||
GstCaps * caps);
|
||||
GST_VULKAN_API
|
||||
gboolean gst_vulkan_encoder_encode (GstVulkanEncoder * self,
|
||||
GstVideoInfo * info,
|
||||
GstVulkanEncoderPicture * pic,
|
||||
guint nb_refs,
|
||||
GstVulkanEncoderPicture ** ref_pics);
|
||||
|
@ -175,8 +166,6 @@ GstCaps * gst_vulkan_encoder_profile_caps (GstVulkanEncode
|
|||
GST_VULKAN_API
|
||||
GstVulkanEncoderPicture* gst_vulkan_encoder_picture_new (GstVulkanEncoder * self,
|
||||
GstBuffer * in_buffer,
|
||||
gint width,
|
||||
gint height,
|
||||
gsize size);
|
||||
GST_VULKAN_API
|
||||
void gst_vulkan_encoder_picture_free (GstVulkanEncoderPicture * pic);
|
||||
|
|
|
@ -362,7 +362,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);
|
||||
img_buffer, width * height * 3), is_ref);
|
||||
fail_unless (frame);
|
||||
fail_unless (frame->picture);
|
||||
gst_buffer_unref (in_buffer);
|
||||
|
@ -552,7 +552,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH264EncodeFrame * frame,
|
|||
frame->ref_list_info.RefPicList1[i] = list1[i]->picture->slotIndex;
|
||||
}
|
||||
|
||||
fail_unless (gst_vulkan_encoder_encode (enc, picture, ref_pics_num,
|
||||
fail_unless (gst_vulkan_encoder_encode (enc, &in_info, picture, ref_pics_num,
|
||||
ref_pics));
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,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);
|
||||
img_buffer, width * height * 3), is_ref);
|
||||
fail_unless (frame);
|
||||
fail_unless (frame->picture);
|
||||
gst_buffer_unref (in_buffer);
|
||||
|
@ -618,7 +618,7 @@ encode_frame (GstVulkanEncoder * enc, GstVulkanH265EncodeFrame * frame,
|
|||
frame->ref_list_info.RefPicList1[i] = list1[i]->picture->slotIndex;
|
||||
}
|
||||
|
||||
fail_unless (gst_vulkan_encoder_encode (enc, picture, ref_pics_num,
|
||||
fail_unless (gst_vulkan_encoder_encode (enc, &in_info, picture, ref_pics_num,
|
||||
ref_pics));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue