Merge "Convert rc_max_intra_bitrate_pct to control"

This commit is contained in:
John Koleszar
2011-07-29 11:57:48 -07:00
committed by Code Review
4 changed files with 26 additions and 24 deletions

View File

@@ -39,6 +39,7 @@ struct vp8_extracfg
unsigned int arnr_type; /* alt_ref filter type */ unsigned int arnr_type; /* alt_ref filter type */
vp8e_tuning tuning; vp8e_tuning tuning;
unsigned int cq_level; /* constrained quality level */ unsigned int cq_level; /* constrained quality level */
unsigned int rc_max_intra_bitrate_pct;
}; };
@@ -71,6 +72,7 @@ static const struct extraconfig_map extracfg_map[] =
3, /* arnr_type*/ 3, /* arnr_type*/
0, /* tuning*/ 0, /* tuning*/
10, /* cq_level */ 10, /* cq_level */
0, /* rc_max_intra_bitrate_pct */
} }
} }
}; };
@@ -305,7 +307,7 @@ static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
} }
oxcf->target_bandwidth = cfg.rc_target_bitrate; oxcf->target_bandwidth = cfg.rc_target_bitrate;
oxcf->rc_max_intra_bitrate_pct = cfg.rc_max_intra_bitrate_pct; oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct;
oxcf->best_allowed_q = cfg.rc_min_quantizer; oxcf->best_allowed_q = cfg.rc_min_quantizer;
oxcf->worst_allowed_q = cfg.rc_max_quantizer; oxcf->worst_allowed_q = cfg.rc_max_quantizer;
@@ -462,6 +464,7 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
MAP(VP8E_SET_ARNR_TYPE , xcfg.arnr_type); MAP(VP8E_SET_ARNR_TYPE , xcfg.arnr_type);
MAP(VP8E_SET_TUNING, xcfg.tuning); MAP(VP8E_SET_TUNING, xcfg.tuning);
MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level); MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level);
MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
} }
@@ -1085,6 +1088,7 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] =
{VP8E_SET_ARNR_TYPE , set_param}, {VP8E_SET_ARNR_TYPE , set_param},
{VP8E_SET_TUNING, set_param}, {VP8E_SET_TUNING, set_param},
{VP8E_SET_CQ_LEVEL, set_param}, {VP8E_SET_CQ_LEVEL, set_param},
{VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param},
{ -1, NULL}, { -1, NULL},
}; };
@@ -1117,7 +1121,6 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
{0}, /* rc_twopass_stats_in */ {0}, /* rc_twopass_stats_in */
#endif #endif
256, /* rc_target_bandwidth */ 256, /* rc_target_bandwidth */
0, /* rc_max_intra_bitrate_pct */
4, /* rc_min_quantizer */ 4, /* rc_min_quantizer */
63, /* rc_max_quantizer */ 63, /* rc_max_quantizer */
100, /* rc_undershoot_pct */ 100, /* rc_undershoot_pct */

View File

@@ -164,6 +164,20 @@ enum vp8e_enc_control_id
* \note Valid range: 0..63 * \note Valid range: 0..63
*/ */
VP8E_SET_CQ_LEVEL, VP8E_SET_CQ_LEVEL,
/*!\brief Max data rate for Intra frames
*
* This value controls additional clamping on the maximum size of a
* keyframe. It is expressed as a percentage of the average
* per-frame bitrate, with the special (and default) value 0 meaning
* unlimited, or no additional clamping beyond the codec's built-in
* algorithm.
*
* For example, to allocate no more than 4.5 frames worth of bitrate
* to a keyframe, set this to 450.
*
*/
VP8E_SET_MAX_INTRA_BITRATE_PCT,
}; };
/*!\brief vpx 1-D scaling mode /*!\brief vpx 1-D scaling mode
@@ -295,6 +309,9 @@ VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL , unsigned int)
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *) VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *) VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
/*! @} - end defgroup vp8_encoder */ /*! @} - end defgroup vp8_encoder */
#include "vpx_codec_impl_bottom.h" #include "vpx_codec_impl_bottom.h"
#endif #endif

View File

@@ -433,21 +433,6 @@ extern "C" {
unsigned int rc_target_bitrate; unsigned int rc_target_bitrate;
/*!\brief Max data rate for Intra frames
*
* This value controls additional clamping on the maximum size of a
* keyframe. It is expressed as a percentage of the average
* per-frame bitrate, with the special (and default) value 0 meaning
* unlimited, or no additional clamping beyond the codec's built-in
* algorithm.
*
* For example, to allocate no more than 4.5 frames worth of bitrate
* to a keyframe, set this to 450.
*
*/
unsigned int rc_max_intra_bitrate_pct;
/* /*
* quantizer settings * quantizer settings
*/ */

View File

@@ -1016,14 +1016,11 @@ static const arg_def_t buf_initial_sz = ARG_DEF(NULL, "buf-initial-sz", 1,
"Client initial buffer size (ms)"); "Client initial buffer size (ms)");
static const arg_def_t buf_optimal_sz = ARG_DEF(NULL, "buf-optimal-sz", 1, static const arg_def_t buf_optimal_sz = ARG_DEF(NULL, "buf-optimal-sz", 1,
"Client optimal buffer size (ms)"); "Client optimal buffer size (ms)");
static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1,
"Max I-frame bitrate (pct)");
static const arg_def_t *rc_args[] = static const arg_def_t *rc_args[] =
{ {
&dropframe_thresh, &resize_allowed, &resize_up_thresh, &resize_down_thresh, &dropframe_thresh, &resize_allowed, &resize_up_thresh, &resize_down_thresh,
&end_usage, &target_bitrate, &min_quantizer, &max_quantizer, &end_usage, &target_bitrate, &min_quantizer, &max_quantizer,
&undershoot_pct, &overshoot_pct, &buf_sz, &buf_initial_sz, &buf_optimal_sz, &undershoot_pct, &overshoot_pct, &buf_sz, &buf_initial_sz, &buf_optimal_sz,
&max_intra_rate_pct,
NULL NULL
}; };
@@ -1087,12 +1084,14 @@ static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1,
"Material to favor", tuning_enum); "Material to favor", tuning_enum);
static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1, static const arg_def_t cq_level = ARG_DEF(NULL, "cq-level", 1,
"Constrained Quality Level"); "Constrained Quality Level");
static const arg_def_t max_intra_rate_pct = ARG_DEF(NULL, "max-intra-rate", 1,
"Max I-frame bitrate (pct)");
static const arg_def_t *vp8_args[] = static const arg_def_t *vp8_args[] =
{ {
&cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh, &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
&token_parts, &arnr_maxframes, &arnr_strength, &arnr_type, &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type,
&tune_ssim, &cq_level, NULL &tune_ssim, &cq_level, &max_intra_rate_pct, NULL
}; };
static const int vp8_arg_ctrl_map[] = static const int vp8_arg_ctrl_map[] =
{ {
@@ -1100,7 +1099,7 @@ static const int vp8_arg_ctrl_map[] =
VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD, VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
VP8E_SET_TOKEN_PARTITIONS, VP8E_SET_TOKEN_PARTITIONS,
VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH , VP8E_SET_ARNR_TYPE, VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH , VP8E_SET_ARNR_TYPE,
VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, 0 VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT, 0
}; };
#endif #endif
@@ -1639,8 +1638,6 @@ int main(int argc, const char **argv_)
cfg.rc_end_usage = arg_parse_enum_or_int(&arg); cfg.rc_end_usage = arg_parse_enum_or_int(&arg);
else if (arg_match(&arg, &target_bitrate, argi)) else if (arg_match(&arg, &target_bitrate, argi))
cfg.rc_target_bitrate = arg_parse_uint(&arg); cfg.rc_target_bitrate = arg_parse_uint(&arg);
else if (arg_match(&arg, &max_intra_rate_pct, argi))
cfg.rc_max_intra_bitrate_pct = arg_parse_uint(&arg);
else if (arg_match(&arg, &min_quantizer, argi)) else if (arg_match(&arg, &min_quantizer, argi))
cfg.rc_min_quantizer = arg_parse_uint(&arg); cfg.rc_min_quantizer = arg_parse_uint(&arg);
else if (arg_match(&arg, &max_quantizer, argi)) else if (arg_match(&arg, &max_quantizer, argi))