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

This commit is contained in:
Alex Converse 2014-08-06 10:30:40 -07:00 committed by Gerrit Code Review
commit b26d9eab21
3 changed files with 22 additions and 1 deletions

View File

@ -232,6 +232,7 @@ typedef struct VP9EncoderConfig {
#endif #endif
vp8e_tuning tuning; vp8e_tuning tuning;
vp9e_tune_content content;
} VP9EncoderConfig; } VP9EncoderConfig;
static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) { static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) {

View File

@ -40,6 +40,7 @@ struct vp9_extracfg {
AQ_MODE aq_mode; AQ_MODE aq_mode;
unsigned int frame_periodic_boost; unsigned int frame_periodic_boost;
BIT_DEPTH bit_depth; BIT_DEPTH bit_depth;
vp9e_tune_content content;
}; };
struct extraconfig_map { 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_HI(extra_cfg, arnr_strength, 6);
RANGE_CHECK(extra_cfg, arnr_type, 1, 3); RANGE_CHECK(extra_cfg, arnr_type, 1, 3);
RANGE_CHECK(extra_cfg, cq_level, 0, 63); 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 // TODO(yaowu): remove this when ssim tuning is implemented for vp9
if (extra_cfg->tuning == VP8_TUNE_SSIM) 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->arnr_type = extra_cfg->arnr_type;
oxcf->tuning = extra_cfg->tuning; oxcf->tuning = extra_cfg->tuning;
oxcf->content = extra_cfg->content;
oxcf->tile_columns = extra_cfg->tile_columns; oxcf->tile_columns = extra_cfg->tile_columns;
oxcf->tile_rows = extra_cfg->tile_rows; 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; 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[] = { static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{VP8_COPY_REFERENCE, ctrl_copy_reference}, {VP8_COPY_REFERENCE, ctrl_copy_reference},
{VP8E_UPD_ENTROPY, ctrl_update_entropy}, {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, ctrl_set_svc},
{VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters}, {VP9E_SET_SVC_PARAMETERS, ctrl_set_svc_parameters},
{VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id}, {VP9E_SET_SVC_LAYER_ID, ctrl_set_svc_layer_id},
{VP9E_SET_TUNE_CONTENT, ctrl_set_tune_content},
// Getters // Getters
{VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer}, {VP8E_GET_LAST_QUANTIZER, ctrl_get_quantizer},

View File

@ -205,7 +205,8 @@ enum vp8e_enc_control_id {
* layer and 0..#vpx_codec_enc_cfg::ts_number_layers for * layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
* temporal layer. * temporal layer.
*/ */
VP9E_SET_SVC_LAYER_ID VP9E_SET_SVC_LAYER_ID,
VP9E_SET_TUNE_CONTENT
}; };
/*!\brief vpx 1-D scaling mode /*!\brief vpx 1-D scaling mode
@ -277,6 +278,12 @@ typedef enum {
VP8_EIGHT_TOKENPARTITION = 3 VP8_EIGHT_TOKENPARTITION = 3
} vp8e_token_partitions; } 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 /*!\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_FRAME_PERIODIC_BOOST, unsigned int)
VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
/*! @} - end defgroup vp8_encoder */ /*! @} - end defgroup vp8_encoder */
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"