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)) {
gboolean *caps_changed_ptr)
{
GstVideoInfo vi;
+ gboolean deinterlace;
if (!gst_video_info_from_caps(&vi, caps))
return FALSE;
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)
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);
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;
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;
GstVideoInfo srcpad_info;
/* Deinterlacing */
- gboolean deinterlace;
GstVaapiDeinterlaceMode deinterlace_mode;
GstVaapiDeinterlaceMethod deinterlace_method;
GstClockTime field_duration;