mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
vaapipostproc: factor out operations to be applied into flags.
Even if we only support deinterlacing for now, use flags to specify which filters are to be applied to each frame we receive in transform(). This is preparatory work for integrating new filters.
This commit is contained in:
parent
ae5e5be80b
commit
d71008210d
2 changed files with 37 additions and 6 deletions
|
@ -249,7 +249,7 @@ gst_vaapipostproc_stop(GstBaseTransform *trans)
|
|||
static gboolean
|
||||
is_interlaced_buffer(GstVaapiPostproc *postproc, GstBuffer *buf)
|
||||
{
|
||||
if (!postproc->deinterlace)
|
||||
if (!(postproc->flags & GST_VAAPI_POSTPROC_FLAG_DEINTERLACE))
|
||||
return FALSE;
|
||||
|
||||
switch (GST_VIDEO_INFO_INTERLACE_MODE(&postproc->sinkpad_info)) {
|
||||
|
@ -441,6 +441,7 @@ gst_vaapipostproc_update_sink_caps(GstVaapiPostproc *postproc, GstCaps *caps,
|
|||
gboolean *caps_changed_ptr)
|
||||
{
|
||||
GstVideoInfo vi;
|
||||
gboolean deinterlace;
|
||||
|
||||
if (!gst_video_info_from_caps(&vi, caps))
|
||||
return FALSE;
|
||||
|
@ -448,10 +449,12 @@ gst_vaapipostproc_update_sink_caps(GstVaapiPostproc *postproc, GstCaps *caps,
|
|||
if (video_info_changed(&vi, &postproc->sinkpad_info))
|
||||
postproc->sinkpad_info = vi, *caps_changed_ptr = TRUE;
|
||||
|
||||
postproc->deinterlace = is_deinterlace_enabled(postproc, &vi);
|
||||
deinterlace = is_deinterlace_enabled(postproc, &vi);
|
||||
if (deinterlace)
|
||||
postproc->flags |= GST_VAAPI_POSTPROC_FLAG_DEINTERLACE;
|
||||
postproc->field_duration = gst_util_uint64_scale(
|
||||
GST_SECOND, GST_VIDEO_INFO_FPS_D(&vi),
|
||||
(1 + postproc->deinterlace) * GST_VIDEO_INFO_FPS_N(&vi));
|
||||
(1 + deinterlace) * GST_VIDEO_INFO_FPS_N(&vi));
|
||||
|
||||
postproc->is_raw_yuv = GST_VIDEO_INFO_IS_YUV(&vi);
|
||||
#if !GST_CHECK_VERSION(1,0,0)
|
||||
|
@ -684,7 +687,7 @@ gst_vaapipostproc_transform(GstBaseTransform *trans, GstBuffer *inbuf,
|
|||
if (!buf)
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
if (postproc->deinterlace)
|
||||
if (postproc->flags == GST_VAAPI_POSTPROC_FLAG_DEINTERLACE)
|
||||
ret = gst_vaapipostproc_process(trans, buf, outbuf);
|
||||
else
|
||||
ret = gst_vaapipostproc_passthrough(trans, buf, outbuf);
|
||||
|
@ -993,7 +996,6 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
|
|||
static void
|
||||
gst_vaapipostproc_init(GstVaapiPostproc *postproc)
|
||||
{
|
||||
postproc->deinterlace = FALSE;
|
||||
postproc->deinterlace_mode = DEFAULT_DEINTERLACE_MODE;
|
||||
postproc->deinterlace_method = DEFAULT_DEINTERLACE_METHOD;
|
||||
postproc->field_duration = GST_CLOCK_TIME_NONE;
|
||||
|
|
|
@ -70,12 +70,42 @@ typedef enum {
|
|||
GST_VAAPI_DEINTERLACE_MODE_DISABLED,
|
||||
} GstVaapiDeinterlaceMode;
|
||||
|
||||
/**
|
||||
* GstVaapiPostprocFlags:
|
||||
* @GST_VAAPI_POSTPROC_FLAG_FORMAT: Pixel format conversion.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_DENOISE: Noise reduction.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_SHARPEN: Sharpening.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_HUE: Change color hue.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_SATURATION: Change saturation.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_BRIGHTNESS: Change brightness.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_CONTRAST: Change contrast.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_DEINTERLACE: Deinterlacing.
|
||||
* @GST_VAAPI_POSTPROC_FLAG_SIZE: Video scaling.
|
||||
*
|
||||
* The set of operations that are to be performed for each frame.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VAAPI_POSTPROC_FLAG_FORMAT = 1 << GST_VAAPI_FILTER_OP_FORMAT,
|
||||
GST_VAAPI_POSTPROC_FLAG_DENOISE = 1 << GST_VAAPI_FILTER_OP_DENOISE,
|
||||
GST_VAAPI_POSTPROC_FLAG_SHARPEN = 1 << GST_VAAPI_FILTER_OP_SHARPEN,
|
||||
GST_VAAPI_POSTPROC_FLAG_HUE = 1 << GST_VAAPI_FILTER_OP_HUE,
|
||||
GST_VAAPI_POSTPROC_FLAG_SATURATION = 1 << GST_VAAPI_FILTER_OP_SATURATION,
|
||||
GST_VAAPI_POSTPROC_FLAG_BRIGHTNESS = 1 << GST_VAAPI_FILTER_OP_BRIGHTNESS,
|
||||
GST_VAAPI_POSTPROC_FLAG_CONTRAST = 1 << GST_VAAPI_FILTER_OP_CONTRAST,
|
||||
GST_VAAPI_POSTPROC_FLAG_DEINTERLACE = 1 << GST_VAAPI_FILTER_OP_DEINTERLACING,
|
||||
|
||||
/* Additional custom flags */
|
||||
GST_VAAPI_POSTPROC_FLAG_CUSTOM = 1 << 20,
|
||||
GST_VAAPI_POSTPROC_FLAG_SIZE = GST_VAAPI_POSTPROC_FLAG_CUSTOM,
|
||||
} GstVaapiPostprocFlags;
|
||||
|
||||
struct _GstVaapiPostproc {
|
||||
/*< private >*/
|
||||
GstBaseTransform parent_instance;
|
||||
|
||||
GstVaapiDisplay *display;
|
||||
GstVaapiUploader *uploader;
|
||||
guint flags;
|
||||
gboolean is_raw_yuv;
|
||||
|
||||
GstCaps *allowed_caps;
|
||||
|
@ -89,7 +119,6 @@ struct _GstVaapiPostproc {
|
|||
GstVideoInfo srcpad_info;
|
||||
|
||||
/* Deinterlacing */
|
||||
gboolean deinterlace;
|
||||
GstVaapiDeinterlaceMode deinterlace_mode;
|
||||
GstVaapiDeinterlaceMethod deinterlace_method;
|
||||
GstClockTime field_duration;
|
||||
|
|
Loading…
Reference in a new issue