mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
encoder: add infrastructure for per-slice handling of packed headers.
The packed slice header and packed raw data need to be paired with the submission of VAEncSliceHeaderParameterBuffer. So handle them on a per-slice basis insted of a per-picture basis. [removed useless initializer] Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
5e5d62cac7
commit
786b68ac21
2 changed files with 38 additions and 0 deletions
|
@ -156,6 +156,11 @@ GST_VAAPI_CODEC_DEFINE_TYPE (GstVaapiEncSlice, gst_vaapi_enc_slice);
|
||||||
void
|
void
|
||||||
gst_vaapi_enc_slice_destroy (GstVaapiEncSlice * slice)
|
gst_vaapi_enc_slice_destroy (GstVaapiEncSlice * slice)
|
||||||
{
|
{
|
||||||
|
if (slice->packed_headers) {
|
||||||
|
g_ptr_array_unref (slice->packed_headers);
|
||||||
|
slice->packed_headers = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
vaapi_destroy_buffer (GET_VA_DISPLAY (slice), &slice->param_id);
|
vaapi_destroy_buffer (GET_VA_DISPLAY (slice), &slice->param_id);
|
||||||
slice->param = NULL;
|
slice->param = NULL;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +178,12 @@ gst_vaapi_enc_slice_create (GstVaapiEncSlice * slice,
|
||||||
args->param_size, args->param, &slice->param_id, &slice->param);
|
args->param_size, args->param, &slice->param_id, &slice->param);
|
||||||
if (!success)
|
if (!success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
slice->packed_headers = g_ptr_array_new_with_free_func ((GDestroyNotify)
|
||||||
|
gst_vaapi_mini_object_unref);
|
||||||
|
if (!slice->packed_headers)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,6 +392,16 @@ gst_vaapi_enc_picture_add_slice (GstVaapiEncPicture * picture,
|
||||||
g_ptr_array_add (picture->slices, gst_vaapi_codec_object_ref (slice));
|
g_ptr_array_add (picture->slices, gst_vaapi_codec_object_ref (slice));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_vaapi_enc_slice_add_packed_header (GstVaapiEncSlice * slice,
|
||||||
|
GstVaapiEncPackedHeader * header)
|
||||||
|
{
|
||||||
|
g_return_if_fail (slice != NULL);
|
||||||
|
g_return_if_fail (header != NULL);
|
||||||
|
|
||||||
|
g_ptr_array_add (slice->packed_headers, gst_vaapi_codec_object_ref (header));
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
do_encode (VADisplay dpy, VAContextID ctx, VABufferID * buf_id, void **buf_ptr)
|
do_encode (VADisplay dpy, VAContextID ctx, VABufferID * buf_id, void **buf_ptr)
|
||||||
{
|
{
|
||||||
|
@ -449,6 +470,17 @@ gst_vaapi_enc_picture_encode (GstVaapiEncPicture * picture)
|
||||||
/* Submit Slice parameters */
|
/* Submit Slice parameters */
|
||||||
for (i = 0; i < picture->slices->len; i++) {
|
for (i = 0; i < picture->slices->len; i++) {
|
||||||
GstVaapiEncSlice *const slice = g_ptr_array_index (picture->slices, i);
|
GstVaapiEncSlice *const slice = g_ptr_array_index (picture->slices, i);
|
||||||
|
guint j;
|
||||||
|
|
||||||
|
/* Submit packed_slice_header and packed_raw_data */
|
||||||
|
for (j = 0; j < slice->packed_headers->len; j++) {
|
||||||
|
GstVaapiEncPackedHeader *const header =
|
||||||
|
g_ptr_array_index (slice->packed_headers, j);
|
||||||
|
if (!do_encode (va_display, va_context,
|
||||||
|
&header->param_id, &header->param) ||
|
||||||
|
!do_encode (va_display, va_context, &header->data_id, &header->data))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (!do_encode (va_display, va_context, &slice->param_id, &slice->param))
|
if (!do_encode (va_display, va_context, &slice->param_id, &slice->param))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@ struct _GstVaapiEncSlice
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
VABufferID param_id;
|
VABufferID param_id;
|
||||||
gpointer param;
|
gpointer param;
|
||||||
|
GPtrArray *packed_headers;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
@ -230,6 +231,11 @@ void
|
||||||
gst_vaapi_enc_picture_add_slice (GstVaapiEncPicture * picture,
|
gst_vaapi_enc_picture_add_slice (GstVaapiEncPicture * picture,
|
||||||
GstVaapiEncSlice * slice);
|
GstVaapiEncSlice * slice);
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
void
|
||||||
|
gst_vaapi_enc_slice_add_packed_header (GstVaapiEncSlice *slice,
|
||||||
|
GstVaapiEncPackedHeader * header);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_enc_picture_encode (GstVaapiEncPicture * picture);
|
gst_vaapi_enc_picture_encode (GstVaapiEncPicture * picture);
|
||||||
|
|
Loading…
Reference in a new issue