mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
msdkvpp: add interpolation method
For description of interpolation modes, see: <https://intel.github.io/libvpl/latest/API_ref/VPL_enums.html#interpolationmode>. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7278>
This commit is contained in:
parent
317c70651f
commit
f77189a7bf
4 changed files with 75 additions and 2 deletions
|
@ -101,6 +101,9 @@ enum
|
|||
PROP_MIRRORING,
|
||||
#endif
|
||||
PROP_SCALING_MODE,
|
||||
#if (MFX_VERSION >= 1033)
|
||||
PROP_INTERPOLATION_METHOD,
|
||||
#endif
|
||||
PROP_FORCE_ASPECT_RATIO,
|
||||
PROP_FRC_ALGORITHM,
|
||||
PROP_VIDEO_DIRECTION,
|
||||
|
@ -127,6 +130,10 @@ enum
|
|||
#define PROP_CONTRAST_DEFAULT 1
|
||||
#define PROP_DETAIL_DEFAULT 0
|
||||
#define PROP_SCALING_MODE_DEFAULT MFX_SCALING_MODE_DEFAULT
|
||||
#if (MFX_VERSION >= 1033)
|
||||
#define PROP_INTERPOLATION_METHOD_DEFAULT \
|
||||
MFX_INTERPOLATION_DEFAULT
|
||||
#endif
|
||||
#define PROP_FORCE_ASPECT_RATIO_DEFAULT TRUE
|
||||
#define PROP_FRC_ALGORITHM_DEFAULT _MFX_FRC_ALGORITHM_NONE
|
||||
#define PROP_VIDEO_DIRECTION_DEFAULT GST_VIDEO_ORIENTATION_IDENTITY
|
||||
|
@ -1107,8 +1114,9 @@ ensure_filters (GstMsdkVPP * thiz)
|
|||
gst_msdkvpp_add_extra_param (thiz, (mfxExtBuffer *) mfx_mirroring);
|
||||
}
|
||||
|
||||
/* Scaling Mode */
|
||||
if (thiz->flags & GST_MSDK_FLAG_SCALING_MODE) {
|
||||
/* Scaling Mode & Interpolation Method */
|
||||
if (thiz->flags & (GST_MSDK_FLAG_SCALING_MODE |
|
||||
GST_MSDK_FLAG_INTERPOLATION_METHOD)) {
|
||||
gboolean scaling_mode_is_compute = FALSE;
|
||||
#if (MFX_VERSION >= 2007)
|
||||
if (thiz->scaling_mode == MFX_SCALING_MODE_INTEL_GEN_COMPUTE)
|
||||
|
@ -1120,6 +1128,14 @@ ensure_filters (GstMsdkVPP * thiz)
|
|||
mfx_scaling->Header.BufferId = MFX_EXTBUFF_VPP_SCALING;
|
||||
mfx_scaling->Header.BufferSz = sizeof (mfxExtVPPScaling);
|
||||
mfx_scaling->ScalingMode = thiz->scaling_mode;
|
||||
if (MFX_RUNTIME_VERSION_ATLEAST (thiz->version, 1, 33)) {
|
||||
#if (MFX_VERSION >= 1033)
|
||||
mfx_scaling->InterpolationMethod = thiz->interpolation_method;
|
||||
#endif
|
||||
} else if (thiz->flags & GST_MSDK_FLAG_INTERPOLATION_METHOD) {
|
||||
GST_WARNING_OBJECT (thiz,
|
||||
"Interpolation method not supported, ignore it...");
|
||||
}
|
||||
gst_msdkvpp_add_extra_param (thiz, (mfxExtBuffer *) mfx_scaling);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (thiz,
|
||||
|
@ -1666,6 +1682,12 @@ gst_msdkvpp_set_property (GObject * object, guint prop_id,
|
|||
thiz->scaling_mode = g_value_get_enum (value);
|
||||
thiz->flags |= GST_MSDK_FLAG_SCALING_MODE;
|
||||
break;
|
||||
#if (MFX_VERSION >= 1033)
|
||||
case PROP_INTERPOLATION_METHOD:
|
||||
thiz->interpolation_method = g_value_get_enum (value);
|
||||
thiz->flags |= GST_MSDK_FLAG_INTERPOLATION_METHOD;
|
||||
break;
|
||||
#endif
|
||||
case PROP_FORCE_ASPECT_RATIO:
|
||||
thiz->keep_aspect = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -1746,6 +1768,11 @@ gst_msdkvpp_get_property (GObject * object, guint prop_id,
|
|||
case PROP_SCALING_MODE:
|
||||
g_value_set_enum (value, thiz->scaling_mode);
|
||||
break;
|
||||
#if (MFX_VERSION >= 1033)
|
||||
case PROP_INTERPOLATION_METHOD:
|
||||
g_value_set_enum (value, thiz->interpolation_method);
|
||||
break;
|
||||
#endif
|
||||
case PROP_FORCE_ASPECT_RATIO:
|
||||
g_value_set_boolean (value, thiz->keep_aspect);
|
||||
break;
|
||||
|
@ -1895,6 +1922,16 @@ _msdkvpp_install_properties (GObjectClass * gobject_class)
|
|||
"The Scaling mode to use", gst_msdkvpp_scaling_mode_get_type (),
|
||||
PROP_SCALING_MODE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
#if (MFX_VERSION >= 1033)
|
||||
obj_properties[PROP_INTERPOLATION_METHOD] =
|
||||
g_param_spec_enum ("interpolation-method", "Interpolation Method",
|
||||
"The Interpolation method used for scaling, note that not all interpolation-methods "
|
||||
"may be compatible with all scaling-modes",
|
||||
gst_msdkvpp_interpolation_method_get_type (),
|
||||
PROP_INTERPOLATION_METHOD_DEFAULT, G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
#endif
|
||||
|
||||
obj_properties[PROP_FORCE_ASPECT_RATIO] =
|
||||
g_param_spec_boolean ("force-aspect-ratio", "Force Aspect Ratio",
|
||||
"When enabled, scaling will respect original aspect ratio",
|
||||
|
@ -2029,6 +2066,9 @@ gst_msdkvpp_init (GTypeInstance * instance, gpointer g_class)
|
|||
thiz->contrast = PROP_CONTRAST_DEFAULT;
|
||||
thiz->detail = PROP_DETAIL_DEFAULT;
|
||||
thiz->scaling_mode = PROP_SCALING_MODE_DEFAULT;
|
||||
#if (MFX_VERSION >= 1033)
|
||||
thiz->interpolation_method = PROP_INTERPOLATION_METHOD_DEFAULT;
|
||||
#endif
|
||||
thiz->keep_aspect = PROP_FORCE_ASPECT_RATIO_DEFAULT;
|
||||
thiz->frc_algm = PROP_FRC_ALGORITHM_DEFAULT;
|
||||
thiz->video_direction = PROP_VIDEO_DIRECTION_DEFAULT;
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef enum {
|
|||
GST_MSDK_FLAG_FRC = 1 << 10,
|
||||
GST_MSDK_FLAG_VIDEO_DIRECTION = 1 << 11,
|
||||
GST_MSDK_FLAG_TONE_MAPPING = 1 << 12,
|
||||
GST_MSDK_FLAG_INTERPOLATION_METHOD = 1 << 13
|
||||
} GstMsdkVppFlags;
|
||||
|
||||
struct _GstMsdkVPP
|
||||
|
@ -109,6 +110,9 @@ struct _GstMsdkVPP
|
|||
guint detail;
|
||||
guint mirroring;
|
||||
guint scaling_mode;
|
||||
#if (MFX_VERSION >= 1033)
|
||||
guint interpolation_method;
|
||||
#endif
|
||||
gboolean keep_aspect;
|
||||
guint frc_algm;
|
||||
guint video_direction;
|
||||
|
|
|
@ -384,6 +384,30 @@ gst_msdkvpp_scaling_mode_get_type (void)
|
|||
return type;
|
||||
}
|
||||
|
||||
#if (MFX_VERSION >= 1033)
|
||||
GType
|
||||
gst_msdkvpp_interpolation_method_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
static const GEnumValue values[] = {
|
||||
{MFX_INTERPOLATION_DEFAULT, "Default interpolation", "default"},
|
||||
{MFX_INTERPOLATION_NEAREST_NEIGHBOR, "Nearest neighbor interpolation",
|
||||
"nearest-neighbor"},
|
||||
{MFX_INTERPOLATION_BILINEAR, "Bilinear interpolation", "bilinear"},
|
||||
{MFX_INTERPOLATION_ADVANCED,
|
||||
"Advanced interpolation method is defined by each implementation and "
|
||||
"usually gives best quality", "advanced"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (!type) {
|
||||
type = g_enum_register_static ("GstMsdkVPPInterpolationMethod", values);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
#endif
|
||||
|
||||
GType
|
||||
gst_msdkvpp_frc_algorithm_get_type (void)
|
||||
{
|
||||
|
|
|
@ -100,6 +100,11 @@ gst_msdkvpp_mirroring_get_type (void);
|
|||
GType
|
||||
gst_msdkvpp_scaling_mode_get_type (void);
|
||||
|
||||
#if (MFX_VERSION >= 1033)
|
||||
GType
|
||||
gst_msdkvpp_interpolation_method_get_type (void);
|
||||
#endif
|
||||
|
||||
#define _MFX_FRC_ALGORITHM_NONE 0
|
||||
GType
|
||||
gst_msdkvpp_frc_algorithm_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue