mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
vp9enc: expose aq-mode property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/874>
This commit is contained in:
parent
e76218c1cb
commit
846ee58cac
2 changed files with 38 additions and 0 deletions
|
@ -72,6 +72,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vp9enc_debug);
|
|||
#define DEFAULT_TILE_COLUMNS 6
|
||||
#define DEFAULT_TILE_ROWS 0
|
||||
#define DEFAULT_ROW_MT 0
|
||||
#define DEFAULT_AQ_MODE 0
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -79,6 +80,7 @@ enum
|
|||
PROP_TILE_COLUMNS,
|
||||
PROP_TILE_ROWS,
|
||||
PROP_ROW_MT,
|
||||
PROP_AQ_MODE,
|
||||
};
|
||||
|
||||
/* FIXME: Y42B do not work yet it seems */
|
||||
|
@ -177,6 +179,19 @@ gst_vp9_enc_class_init (GstVP9EncClass * klass)
|
|||
DEFAULT_ROW_MT,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||
|
||||
/**
|
||||
* GstVP9Enc:aq-mode:
|
||||
*
|
||||
* Adaptive Quantization Mode
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
g_object_class_install_property (gobject_class, PROP_AQ_MODE,
|
||||
g_param_spec_int ("aq-mode", "Adaptive Quantization Mode",
|
||||
"0: off (default), 1: variance 2: complexity, 3: cyclic refresh, 4: equator360",
|
||||
0, 4, DEFAULT_AQ_MODE,
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_vp9_enc_src_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
|
@ -225,6 +240,7 @@ gst_vp9_enc_init (GstVP9Enc * gst_vp9_enc)
|
|||
gst_vp9_enc->tile_columns = DEFAULT_TILE_COLUMNS;
|
||||
gst_vp9_enc->tile_rows = DEFAULT_TILE_ROWS;
|
||||
gst_vp9_enc->row_mt = DEFAULT_ROW_MT;
|
||||
gst_vp9_enc->aq_mode = DEFAULT_AQ_MODE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -276,6 +292,18 @@ gst_vp9_enc_set_property (GObject * object, guint prop_id,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case PROP_AQ_MODE:
|
||||
gst_vp9_enc->aq_mode = g_value_get_int (value);
|
||||
if (gst_vpx_enc->inited) {
|
||||
status = vpx_codec_control (&gst_vpx_enc->encoder, VP9E_SET_AQ_MODE,
|
||||
gst_vp9_enc->aq_mode);
|
||||
if (status != VPX_CODEC_OK) {
|
||||
GST_WARNING_OBJECT (gst_vpx_enc,
|
||||
"Failed to set VP9E_SET_AQ_MODE: %s",
|
||||
gst_vpx_error_name (status));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -303,6 +331,9 @@ gst_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
case PROP_ROW_MT:
|
||||
g_value_set_boolean (value, gst_vp9_enc->row_mt);
|
||||
break;
|
||||
case PROP_AQ_MODE:
|
||||
g_value_set_int (value, gst_vp9_enc->aq_mode);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -423,6 +454,12 @@ gst_vp9_enc_configure_encoder (GstVPXEnc * encoder, GstVideoCodecState * state)
|
|||
GST_DEBUG_OBJECT (encoder,
|
||||
"Failed to set VP9E_SET_ROW_MT: %s", gst_vpx_error_name (status));
|
||||
}
|
||||
status =
|
||||
vpx_codec_control (&encoder->encoder, VP9E_SET_AQ_MODE, vp9enc->aq_mode);
|
||||
if (status != VPX_CODEC_OK) {
|
||||
GST_WARNING_OBJECT (encoder,
|
||||
"Failed to set VP9E_SET_AQ_MODE: %s", gst_vpx_error_name (status));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ struct _GstVP9Enc
|
|||
#ifdef VPX_CTRL_VP9E_SET_ROW_MT
|
||||
gboolean row_mt;
|
||||
#endif
|
||||
guint aq_mode;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue