mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
va: filter, deinterlace, vpp: Add gst_va_buffer_get_surface_flags().
Add a helper function to get, from GstVideoInfo and GstBuffers flags, the VA interlace surface flags. This is used currently by vainterlace element, but it will be used in vapostproc too if it can process interlaced frames. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
This commit is contained in:
parent
547570cd79
commit
1642c3fc96
4 changed files with 46 additions and 26 deletions
|
@ -396,32 +396,7 @@ gst_va_deinterlace_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
g_assert (self->curr_field == FIRST_FIELD
|
||||
|| self->curr_field == SECOND_FIELD);
|
||||
|
||||
surface_flags = 0;
|
||||
if (GST_VIDEO_INFO_INTERLACE_MODE (info) == GST_VIDEO_INTERLACE_MODE_MIXED
|
||||
|| (GST_VIDEO_INFO_INTERLACE_MODE (info) ==
|
||||
GST_VIDEO_INTERLACE_MODE_INTERLEAVED
|
||||
&& GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_UNKNOWN)) {
|
||||
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_VIDEO_BUFFER_FLAG_INTERLACED)) {
|
||||
if (GST_BUFFER_FLAG_IS_SET (inbuf, GST_VIDEO_BUFFER_FLAG_TFF)) {
|
||||
surface_flags = VA_TOP_FIELD_FIRST;
|
||||
} else {
|
||||
surface_flags = VA_BOTTOM_FIELD_FIRST;
|
||||
}
|
||||
} else {
|
||||
/* complete frame? do it twice */
|
||||
surface_flags = VA_FRAME_PICTURE;
|
||||
}
|
||||
} else if (GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST) {
|
||||
surface_flags = VA_BOTTOM_FIELD_FIRST;
|
||||
} else if (GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST) {
|
||||
surface_flags = VA_TOP_FIELD_FIRST;
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
surface_flags = gst_va_buffer_get_surface_flags (inbuf, info);
|
||||
if (surface_flags != VA_FRAME_PICTURE)
|
||||
_set_field (self, &surface_flags);
|
||||
|
||||
|
|
|
@ -1695,3 +1695,43 @@ fail_end_pic:
|
|||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_va_buffer_get_surface_flags:
|
||||
* @buffer: the #GstBuffer to check.
|
||||
* @info: the #GstVideoInfo with info.
|
||||
*
|
||||
* Gets the surface flags, related with interlace given @buffer and
|
||||
* @info.
|
||||
*
|
||||
* Returns: VA surface flags.
|
||||
*/
|
||||
guint32
|
||||
gst_va_buffer_get_surface_flags (GstBuffer * buffer, GstVideoInfo * info)
|
||||
{
|
||||
guint32 surface_flags = 0;
|
||||
|
||||
if (GST_VIDEO_INFO_INTERLACE_MODE (info) == GST_VIDEO_INTERLACE_MODE_MIXED
|
||||
|| (GST_VIDEO_INFO_INTERLACE_MODE (info) ==
|
||||
GST_VIDEO_INTERLACE_MODE_INTERLEAVED
|
||||
&& GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_UNKNOWN)) {
|
||||
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_INTERLACED)) {
|
||||
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_VIDEO_BUFFER_FLAG_TFF)) {
|
||||
surface_flags = VA_TOP_FIELD_FIRST;
|
||||
} else {
|
||||
surface_flags = VA_BOTTOM_FIELD_FIRST;
|
||||
}
|
||||
} else {
|
||||
surface_flags = VA_FRAME_PICTURE;
|
||||
}
|
||||
} else if (GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST) {
|
||||
surface_flags = VA_BOTTOM_FIELD_FIRST;
|
||||
} else if (GST_VIDEO_INFO_FIELD_ORDER (info) ==
|
||||
GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST) {
|
||||
surface_flags = VA_TOP_FIELD_FIRST;
|
||||
}
|
||||
|
||||
return surface_flags;
|
||||
}
|
||||
|
|
|
@ -110,4 +110,7 @@ gboolean gst_va_filter_process (GstVaFilter * self,
|
|||
GstVaSample * src,
|
||||
GstVaSample * dest);
|
||||
|
||||
guint32 gst_va_buffer_get_surface_flags (GstBuffer * buffer,
|
||||
GstVideoInfo * info);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -651,10 +651,12 @@ gst_va_vpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|||
/* *INDENT-OFF* */
|
||||
src = (GstVaSample) {
|
||||
.buffer = buf,
|
||||
.flags = gst_va_buffer_get_surface_flags (buf, &btrans->in_info),
|
||||
};
|
||||
|
||||
dst = (GstVaSample) {
|
||||
.buffer = outbuf,
|
||||
.flags = gst_va_buffer_get_surface_flags (outbuf, &btrans->out_info),
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
|
|
Loading…
Reference in a new issue