Commit b26d9eab authored by Alex Converse's avatar Alex Converse Committed by Gerrit Code Review

Merge "Add a codec control option to tune for screen content."

parents 0fa4777b 572de929
......@@ -232,6 +232,7 @@ typedef struct VP9EncoderConfig {
#endif
vp8e_tuning tuning;
vp9e_tune_content content;
} VP9EncoderConfig;
static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) {
......
......@@ -40,6 +40,7 @@ struct vp9_extracfg {
AQ_MODE aq_mode;
unsigned int frame_periodic_boost;
BIT_DEPTH bit_depth;
vp9e_tune_content content;
};
struct extraconfig_map {
......@@ -219,6 +220,8 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
RANGE_CHECK_HI(extra_cfg, arnr_strength, 6);
RANGE_CHECK(extra_cfg, arnr_type, 1, 3);
RANGE_CHECK(extra_cfg, cq_level, 0, 63);
RANGE_CHECK(extra_cfg, content,
VP9E_CONTENT_DEFAULT, VP9E_CONTENT_INVALID - 1);
// TODO(yaowu): remove this when ssim tuning is implemented for vp9
if (extra_cfg->tuning == VP8_TUNE_SSIM)
......@@ -397,6 +400,7 @@ static vpx_codec_err_t set_encoder_config(
oxcf->arnr_type = extra_cfg->arnr_type;
oxcf->tuning = extra_cfg->tuning;
oxcf->content = extra_cfg->content;
oxcf->tile_columns = extra_cfg->tile_columns;
oxcf->tile_rows = extra_cfg->tile_rows;
......@@ -1213,6 +1217,13 @@ static vpx_codec_err_t ctrl_set_svc_parameters(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_OK;
}
static vpx_codec_err_t ctrl_set_tune_content(vpx_codec_alg_priv_t *ctx,
va_list args) {
struct vp9_extracfg extra_cfg = ctx->extra_cfg;
ctx->extra_cfg.content = CAST(VP9E_SET_TUNE_CONTENT, args);
return update_extra_cfg(ctx, &extra_cfg);
}
static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{VP8_COPY_REFERENCE, ctrl_copy_reference},
{VP8E_UPD_ENTROPY, ctrl_update_entropy},
......@@ -1245,6 +1256,7 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{VP9E_SET_SVC, ctrl_set_svc},
{VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters},
{VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id},
{VP9E_SET_TUNE_CONTENT, ctrl_set_tune_content},
// Getters
{VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer},
......
......@@ -205,7 +205,8 @@ enum vp8e_enc_control_id {
* layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
* temporal layer.
*/
VP9E_SET_SVC_LAYER_ID
VP9E_SET_SVC_LAYER_ID,
VP9E_SET_TUNE_CONTENT
};
/*!\brief vpx 1-D scaling mode
......@@ -277,6 +278,12 @@ typedef enum {
VP8_EIGHT_TOKENPARTITION = 3
} vp8e_token_partitions;
/*!brief VP9 encoder content type */
typedef enum {
VP9E_CONTENT_DEFAULT,
VP9E_CONTENT_SCREEN,
VP9E_CONTENT_INVALID
} vp9e_tune_content;
/*!\brief VP8 model tuning parameters
*
......@@ -370,6 +377,7 @@ VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
/*! @} - end defgroup vp8_encoder */
#ifdef __cplusplus
} // extern "C"
......
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