mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
vaapipostproc: add support for "mixed" interlace mode.
Add support for "mixed" interlace-mode, whereby the video frame buffer shall be deinterlaced only if its flags mention that's actually an interlaced frame buffer.
This commit is contained in:
parent
f6f24bfc55
commit
f0d50cfbc2
3 changed files with 30 additions and 4 deletions
|
@ -397,6 +397,9 @@ gst_caps_set_interlaced(GstCaps *caps, GstVideoInfo *vip)
|
||||||
case GST_VIDEO_INTERLACE_MODE_INTERLEAVED:
|
case GST_VIDEO_INTERLACE_MODE_INTERLEAVED:
|
||||||
mode_str = "interleaved";
|
mode_str = "interleaved";
|
||||||
break;
|
break;
|
||||||
|
case GST_VIDEO_INTERLACE_MODE_MIXED:
|
||||||
|
mode_str = "mixed";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
GST_ERROR("unsupported `interlace-mode' %d", mode);
|
GST_ERROR("unsupported `interlace-mode' %d", mode);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -64,7 +64,7 @@ gst_vaapi_apply_composition(GstVaapiSurface *surface, GstBuffer *buffer);
|
||||||
/* Helpers to handle interlaced contents */
|
/* Helpers to handle interlaced contents */
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
# define GST_CAPS_INTERLACED_MODES \
|
# define GST_CAPS_INTERLACED_MODES \
|
||||||
"interlace-mode = (string){ progressive, interleaved }"
|
"interlace-mode = (string){ progressive, interleaved, mixed }"
|
||||||
# define GST_CAPS_INTERLACED_FALSE \
|
# define GST_CAPS_INTERLACED_FALSE \
|
||||||
"interlace-mode = (string)progressive"
|
"interlace-mode = (string)progressive"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -200,6 +200,28 @@ gst_vaapipostproc_stop(GstBaseTransform *trans)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
is_interlaced_buffer(GstVaapiPostproc *postproc, GstBuffer *buf)
|
||||||
|
{
|
||||||
|
if (!postproc->deinterlace)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
switch (GST_VIDEO_INFO_INTERLACE_MODE(&postproc->sinkpad_info)) {
|
||||||
|
case GST_VIDEO_INTERLACE_MODE_MIXED:
|
||||||
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
|
if (!GST_BUFFER_FLAG_IS_SET(buf, GST_VIDEO_BUFFER_FLAG_INTERLACED))
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
if (GST_BUFFER_FLAG_IS_SET(buf, GST_VIDEO_BUFFER_PROGRESSIVE))
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
create_output_buffer(GstVaapiPostproc *postproc)
|
create_output_buffer(GstVaapiPostproc *postproc)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +264,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
GstBuffer *fieldbuf;
|
GstBuffer *fieldbuf;
|
||||||
guint fieldbuf_flags, outbuf_flags, flags;
|
guint fieldbuf_flags, outbuf_flags, flags;
|
||||||
gboolean tff;
|
gboolean tff, deint;
|
||||||
|
|
||||||
meta = gst_buffer_get_vaapi_video_meta(inbuf);
|
meta = gst_buffer_get_vaapi_video_meta(inbuf);
|
||||||
if (!meta)
|
if (!meta)
|
||||||
|
@ -250,6 +272,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP(inbuf);
|
timestamp = GST_BUFFER_TIMESTAMP(inbuf);
|
||||||
tff = GST_BUFFER_FLAG_IS_SET(inbuf, GST_VIDEO_BUFFER_FLAG_TFF);
|
tff = GST_BUFFER_FLAG_IS_SET(inbuf, GST_VIDEO_BUFFER_FLAG_TFF);
|
||||||
|
deint = is_interlaced_buffer(postproc, inbuf);
|
||||||
|
|
||||||
flags = gst_vaapi_video_meta_get_render_flags(meta) &
|
flags = gst_vaapi_video_meta_get_render_flags(meta) &
|
||||||
~(GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD|
|
~(GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD|
|
||||||
|
@ -263,7 +286,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
|
||||||
|
|
||||||
meta = gst_buffer_get_vaapi_video_meta(fieldbuf);
|
meta = gst_buffer_get_vaapi_video_meta(fieldbuf);
|
||||||
fieldbuf_flags = flags;
|
fieldbuf_flags = flags;
|
||||||
fieldbuf_flags |= postproc->deinterlace ? (
|
fieldbuf_flags |= deint ? (
|
||||||
tff ?
|
tff ?
|
||||||
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD :
|
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD :
|
||||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD) :
|
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD) :
|
||||||
|
@ -281,7 +304,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
|
||||||
|
|
||||||
meta = gst_buffer_get_vaapi_video_meta(outbuf);
|
meta = gst_buffer_get_vaapi_video_meta(outbuf);
|
||||||
outbuf_flags = flags;
|
outbuf_flags = flags;
|
||||||
outbuf_flags |= postproc->deinterlace ? (
|
outbuf_flags |= deint ? (
|
||||||
tff ?
|
tff ?
|
||||||
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD :
|
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD :
|
||||||
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD) :
|
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD) :
|
||||||
|
|
Loading…
Reference in a new issue