From b0da9b399d8e9129f47c81366902e66823063878 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Fri, 17 Dec 2010 09:43:39 -0500 Subject: Add psnr/ssim tuning option Add a new encoder control, VP8E_SET_TUNING, to allow the application to inform the encoder that the material will benefit from certain tuning. Expose this control as the --tune option to vpxenc. The args helper is expanded to support enumerated arguments by name or value. Two tunings are provided by this patch, PSNR (default) and SSIM. Activity masking is made dependent on setting --tune=ssim, as the current implementation hurts speed (10%) and PSNR (2.7% avg, 10% peak) too much for it to be a default yet. Change-Id: I110d969381c4805347ff5a0ffaf1a14ca1965257 --- vpxenc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'vpxenc.c') diff --git a/vpxenc.c b/vpxenc.c index 4baeefcdf..5e4fe3f0f 100755 --- a/vpxenc.c +++ b/vpxenc.c @@ -993,18 +993,27 @@ static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1, "AltRef Strength"); static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1, "AltRef Type"); +static const struct arg_enum_list tuning_enum[] = { + {"psnr", VP8_TUNE_PSNR}, + {"ssim", VP8_TUNE_SSIM}, + {NULL, 0} +}; +static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1, + "Material to favor", tuning_enum); static const arg_def_t *vp8_args[] = { &cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh, - &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type, NULL + &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type, + &tune_ssim, NULL }; static const int vp8_arg_ctrl_map[] = { VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF, VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD, VP8E_SET_TOKEN_PARTITIONS, - VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH , VP8E_SET_ARNR_TYPE, 0 + VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH , VP8E_SET_ARNR_TYPE, + VP8E_SET_TUNING, 0 }; #endif @@ -1317,7 +1326,7 @@ int main(int argc, const char **argv_) if (arg_ctrl_cnt < ARG_CTRL_CNT_MAX) { arg_ctrls[arg_ctrl_cnt][0] = ctrl_args_map[i]; - arg_ctrls[arg_ctrl_cnt][1] = arg_parse_int(&arg); + arg_ctrls[arg_ctrl_cnt][1] = arg_parse_enum_or_int(&arg); arg_ctrl_cnt++; } } -- cgit v1.2.3