Commit fb8c5363 authored by Sreerenj Balachandran's avatar Sreerenj Balachandran
Browse files

msdk: Add more scaling filter algorithms

https://bugzilla.gnome.org/show_bug.cgi?id=793705
parent 51b6345d
......@@ -76,6 +76,7 @@ enum
PROP_CONTRAST,
PROP_DETAIL,
PROP_MIRRORING,
PROP_SCALING_MODE,
PROP_N,
};
......@@ -91,6 +92,7 @@ enum
#define PROP_CONTRAST_DEFAULT 1
#define PROP_DETAIL_DEFAULT 0
#define PROP_MIRRORING_DEFAULT MFX_MIRRORING_DISABLED
#define PROP_SCALING_MODE_DEFAULT MFX_SCALING_MODE_DEFAULT
#define gst_msdkvpp_parent_class parent_class
G_DEFINE_TYPE (GstMsdkVPP, gst_msdkvpp, GST_TYPE_BASE_TRANSFORM);
......@@ -685,6 +687,17 @@ ensure_filters (GstMsdkVPP * thiz)
thiz->max_filter_algorithms[n_filters] = MFX_EXTBUFF_VPP_MIRRORING;
n_filters++;
}
/* Scaling Mode */
if (thiz->flags & GST_MSDK_FLAG_SCALING_MODE) {
mfxExtVPPScaling *mfx_scaling = &thiz->mfx_scaling;
mfx_scaling->Header.BufferId = MFX_EXTBUFF_VPP_SCALING;
mfx_scaling->Header.BufferSz = sizeof (mfxExtVPPScaling);
mfx_scaling->ScalingMode = thiz->scaling_mode;
gst_msdkvpp_add_extra_param (thiz, (mfxExtBuffer *) mfx_scaling);
thiz->max_filter_algorithms[n_filters] = MFX_EXTBUFF_VPP_SCALING;
n_filters++;
}
}
static void
......@@ -987,6 +1000,10 @@ gst_msdkvpp_set_property (GObject * object, guint prop_id,
thiz->mirroring = g_value_get_enum (value);
thiz->flags |= GST_MSDK_FLAG_MIRRORING;
break;
case PROP_SCALING_MODE:
thiz->scaling_mode = g_value_get_enum (value);
thiz->flags |= GST_MSDK_FLAG_SCALING_MODE;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1036,6 +1053,9 @@ gst_msdkvpp_get_property (GObject * object, guint prop_id,
case PROP_MIRRORING:
g_value_set_enum (value, thiz->mirroring);
break;
case PROP_SCALING_MODE:
g_value_set_enum (value, thiz->scaling_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1170,6 +1190,11 @@ gst_msdkvpp_class_init (GstMsdkVPPClass * klass)
"The Mirroring type", gst_msdkvpp_mirroring_get_type (),
PROP_MIRRORING_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_SCALING_MODE] =
g_param_spec_enum ("scaling-mode", "Scaling Mode",
"The Scaling mode to use", gst_msdkvpp_scaling_mode_get_type (),
PROP_SCALING_MODE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, PROP_N, obj_properties);
}
......@@ -1189,6 +1214,7 @@ gst_msdkvpp_init (GstMsdkVPP * thiz)
thiz->contrast = PROP_CONTRAST_DEFAULT;
thiz->detail = PROP_DETAIL_DEFAULT;
thiz->mirroring = PROP_MIRRORING_DEFAULT;
thiz->scaling_mode = PROP_SCALING_MODE_DEFAULT;
gst_video_info_init (&thiz->sinkpad_info);
gst_video_info_init (&thiz->srcpad_info);
}
......@@ -58,15 +58,16 @@ typedef struct _GstMsdkVPP GstMsdkVPP;
typedef struct _GstMsdkVPPClass GstMsdkVPPClass;
typedef enum {
GST_MSDK_FLAG_DENOISE = 1 << 0,
GST_MSDK_FLAG_ROTATION = 1 << 1,
GST_MSDK_FLAG_DEINTERLACE = 1 << 2,
GST_MSDK_FLAG_HUE = 1 << 3,
GST_MSDK_FLAG_SATURATION = 1 << 4,
GST_MSDK_FLAG_BRIGHTNESS = 1 << 5,
GST_MSDK_FLAG_CONTRAST = 1 << 6,
GST_MSDK_FLAG_DETAIL = 1 << 7,
GST_MSDK_FLAG_MIRRORING = 1 << 8,
GST_MSDK_FLAG_DENOISE = 1 << 0,
GST_MSDK_FLAG_ROTATION = 1 << 1,
GST_MSDK_FLAG_DEINTERLACE = 1 << 2,
GST_MSDK_FLAG_HUE = 1 << 3,
GST_MSDK_FLAG_SATURATION = 1 << 4,
GST_MSDK_FLAG_BRIGHTNESS = 1 << 5,
GST_MSDK_FLAG_CONTRAST = 1 << 6,
GST_MSDK_FLAG_DETAIL = 1 << 7,
GST_MSDK_FLAG_MIRRORING = 1 << 8,
GST_MSDK_FLAG_SCALING_MODE = 1 << 9,
} GstMsdkVppFlags;
struct _GstMsdkVPP
......@@ -111,6 +112,7 @@ struct _GstMsdkVPP
gfloat contrast;
guint detail;
guint mirroring;
guint scaling_mode;
GstClockTime field_duration;
......@@ -123,6 +125,7 @@ struct _GstMsdkVPP
mfxExtVPPProcAmp mfx_procamp;
mfxExtVPPDetail mfx_detail;
mfxExtVPPMirroring mfx_mirroring;
mfxExtVPPScaling mfx_scaling;
/* Extended buffers */
mfxExtBuffer *extra_params[MAX_EXTRA_PARAMS];
......
......@@ -260,3 +260,21 @@ gst_msdkvpp_mirroring_get_type (void)
}
return type;
}
GType
gst_msdkvpp_scaling_mode_get_type (void)
{
static GType type = 0;
static const GEnumValue values[] = {
{MFX_SCALING_MODE_DEFAULT, "Default Scaling", "disable"},
{MFX_SCALING_MODE_LOWPOWER, "Lowpower Scaling", "lowpower"},
{MFX_SCALING_MODE_QUALITY, "High Quality Scaling", "quality"},
{0, NULL, NULL}
};
if (!type) {
type = g_enum_register_static ("GstMsdkVPPScalingMode", values);
}
return type;
}
......@@ -81,5 +81,8 @@ gst_msdkvpp_deinterlace_method_get_type (void);
GType
gst_msdkvpp_mirroring_get_type (void);
GType
gst_msdkvpp_scaling_mode_get_type (void);
G_END_DECLS
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment