From 1d8d8f562bf382e47071bb38d13b7ded366820af Mon Sep 17 00:00:00 2001 From: sdeng Date: Fri, 12 Apr 2019 06:00:20 -0700 Subject: [PATCH] Add VPX_TUNE_SSIM and VPX_TUNE_PSNR enums Change-Id: I3df5af2c60b774e6d395062077542c52db868236 --- vp8/common/onyx.h | 2 +- vp8/encoder/encodeframe.c | 8 ++++---- vp8/encoder/ethreading.c | 2 +- vp8/vp8_cx_iface.c | 2 +- vp9/encoder/vp9_encodeframe.c | 10 +++++----- vp9/encoder/vp9_encoder.c | 2 +- vp9/encoder/vp9_encoder.h | 2 +- vp9/vp9_cx_iface.c | 4 ++-- vpx/vp8cx.h | 6 +++--- vpxenc.c | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h index 05c72df3f..adc832664 100644 --- a/vp8/common/onyx.h +++ b/vp8/common/onyx.h @@ -217,7 +217,7 @@ typedef struct { vpx_fixed_buf_t two_pass_stats_in; struct vpx_codec_pkt_list *output_pkt_list; - vp8e_tuning tuning; + vpx_tuning tuning; /* Temporal scaling parameters */ unsigned int number_of_layers; diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 2b3d9564c..624d60c95 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -426,7 +426,7 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row, } #endif - if (cpi->oxcf.tuning == VP8_TUNE_SSIM) vp8_activity_masking(cpi, x); + if (cpi->oxcf.tuning == VPX_TUNE_SSIM) vp8_activity_masking(cpi, x); /* Is segmentation enabled */ /* MB level adjustment to quantizer */ @@ -720,7 +720,7 @@ void vp8_encode_frame(VP8_COMP *cpi) { vp8cx_initialize_me_consts(cpi, cm->base_qindex); - if (cpi->oxcf.tuning == VP8_TUNE_SSIM) { + if (cpi->oxcf.tuning == VPX_TUNE_SSIM) { /* Initialize encode frame context. */ init_encode_frame_mb_context(cpi); @@ -1086,7 +1086,7 @@ int vp8cx_encode_intra_macroblock(VP8_COMP *cpi, MACROBLOCK *x, vp8_pick_intra_mode(x, &rate); } - if (cpi->oxcf.tuning == VP8_TUNE_SSIM) { + if (cpi->oxcf.tuning == VPX_TUNE_SSIM) { adjust_act_zbin(cpi, x); vp8_update_zbin_extra(cpi, x); } @@ -1172,7 +1172,7 @@ int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t, x->prediction_error += distortion; x->intra_error += intra_error; - if (cpi->oxcf.tuning == VP8_TUNE_SSIM) { + if (cpi->oxcf.tuning == VPX_TUNE_SSIM) { /* Adjust the zbin based on this MB rate. */ adjust_act_zbin(cpi, x); } diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 55a1528b1..7714d9d76 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -149,7 +149,7 @@ static THREAD_FUNCTION thread_encoding_proc(void *p_data) { /* Copy current mb to a buffer */ vp8_copy_mem16x16(x->src.y_buffer, x->src.y_stride, x->thismb, 16); - if (cpi->oxcf.tuning == VP8_TUNE_SSIM) vp8_activity_masking(cpi, x); + if (cpi->oxcf.tuning == VPX_TUNE_SSIM) vp8_activity_masking(cpi, x); /* Is segmentation enabled */ /* MB level adjustment to quantizer */ diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index d65bf9652..bd291201f 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -38,7 +38,7 @@ struct vp8_extracfg { unsigned int arnr_max_frames; /* alt_ref Noise Reduction Max Frame Count */ unsigned int arnr_strength; /* alt_ref Noise Reduction Strength */ unsigned int arnr_type; /* alt_ref filter type */ - vp8e_tuning tuning; + vpx_tuning tuning; unsigned int cq_level; /* constrained quality level */ unsigned int rc_max_intra_bitrate_pct; unsigned int gf_cbr_boost_pct; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a5d59b69b..f41dfa020 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -269,7 +269,7 @@ static double get_ssim_rdmult_scaling_factor(VP9_COMP *const cpi, int mi_row, const int col = mi_col / num_8x8_w; const int index = row * num_cols + col; - assert(cpi->oxcf.tuning == VP8_TUNE_SSIM); + assert(cpi->oxcf.tuning == VPX_TUNE_SSIM); vpx_clear_system_state(); return cpi->mi_ssim_rdmult_scaling_factors[index]; } @@ -309,7 +309,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, // R/D setup. x->rddiv = cpi->rd.RDDIV; x->rdmult = cpi->rd.RDMULT; - if (oxcf->tuning == VP8_TUNE_SSIM) { + if (oxcf->tuning == VPX_TUNE_SSIM) { const double ssim_factor = get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); x->rdmult = (int)(ssim_factor * x->rdmult); @@ -1961,7 +1961,7 @@ static void set_segment_rdmult(VP9_COMP *const cpi, MACROBLOCK *const x, } } - if (oxcf->tuning == VP8_TUNE_SSIM) { + if (oxcf->tuning == VPX_TUNE_SSIM) { const double ssim_factor = get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); x->rdmult = (int)(ssim_factor * x->rdmult); @@ -2207,7 +2207,7 @@ static void encode_b(VP9_COMP *cpi, const TileInfo *const tile, ThreadData *td, cpi->oxcf.aq_mode == NO_AQ) { const VP9EncoderConfig *const oxcf = &cpi->oxcf; x->rdmult = x->cb_rdmult; - if (oxcf->tuning == VP8_TUNE_SSIM) { + if (oxcf->tuning == VPX_TUNE_SSIM) { const double ssim_factor = get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); x->rdmult = (int)(ssim_factor * x->rdmult); @@ -3823,7 +3823,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, uint8_t ref_frames_used[4] = { 0, 0, 0, 0 }; int partition_mul = x->cb_rdmult; - if (oxcf->tuning == VP8_TUNE_SSIM) { + if (oxcf->tuning == VPX_TUNE_SSIM) { const double ssim_factor = get_ssim_rdmult_scaling_factor(cpi, mi_row, mi_col); partition_mul = (int)(ssim_factor * partition_mul); diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index f7e3237dc..353b026b0 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -5022,7 +5022,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, size_t *size, } } - if (oxcf->tuning == VP8_TUNE_SSIM) set_mb_ssim_rdmult_scaling(cpi); + if (oxcf->tuning == VPX_TUNE_SSIM) set_mb_ssim_rdmult_scaling(cpi); set_mb_wiener_variance(cpi); diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 5eec17d59..73592fdfe 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -262,7 +262,7 @@ typedef struct VP9EncoderConfig { vpx_fixed_buf_t firstpass_mb_stats_in; #endif - vp8e_tuning tuning; + vpx_tuning tuning; vp9e_tune_content content; #if CONFIG_VP9_HIGHBITDEPTH int use_highbitdepth; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 565882856..191101113 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -35,7 +35,7 @@ struct vp9_extracfg { unsigned int arnr_strength; unsigned int min_gf_interval; unsigned int max_gf_interval; - vp8e_tuning tuning; + vpx_tuning tuning; unsigned int cq_level; // constrained quality level unsigned int rc_max_intra_bitrate_pct; unsigned int rc_max_inter_bitrate_pct; @@ -69,7 +69,7 @@ static struct vp9_extracfg default_extra_cfg = { 5, // arnr_strength 0, // min_gf_interval; 0 -> default decision 0, // max_gf_interval; 0 -> default decision - VP8_TUNE_PSNR, // tuning + VPX_TUNE_PSNR, // tuning 10, // cq_level 0, // rc_max_intra_bitrate_pct 0, // rc_max_inter_bitrate_pct diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h index 0aef1ff32..ff85a096c 100644 --- a/vpx/vp8cx.h +++ b/vpx/vp8cx.h @@ -782,12 +782,12 @@ typedef enum { VP9E_CONTENT_INVALID } vp9e_tune_content; -/*!\brief VP8 model tuning parameters +/*!\brief VPX model tuning parameters * * Changes the encoder to tune for certain types of input material. * */ -typedef enum { VP8_TUNE_PSNR, VP8_TUNE_SSIM } vp8e_tuning; +typedef enum { VPX_TUNE_PSNR, VPX_TUNE_SSIM } vpx_tuning; /*!\brief vp9 svc layer parameters * @@ -911,7 +911,7 @@ VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int) #define VPX_CTRL_VP8E_SET_ARNR_STRENGTH VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ARNR_TYPE, unsigned int) #define VPX_CTRL_VP8E_SET_ARNR_TYPE -VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */ +VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vpx_tuning */ #define VPX_CTRL_VP8E_SET_TUNING VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int) #define VPX_CTRL_VP8E_SET_CQ_LEVEL diff --git a/vpxenc.c b/vpxenc.c index fc640f644..c6cb03c4f 100644 --- a/vpxenc.c +++ b/vpxenc.c @@ -320,8 +320,8 @@ static const arg_def_t arnr_strength = ARG_DEF(NULL, "arnr-strength", 1, "AltRef filter strength (0..6)"); static const arg_def_t arnr_type = ARG_DEF(NULL, "arnr-type", 1, "AltRef filter type (1..3)"); -static const struct arg_enum_list tuning_enum[] = { { "psnr", VP8_TUNE_PSNR }, - { "ssim", VP8_TUNE_SSIM }, +static const struct arg_enum_list tuning_enum[] = { { "psnr", VPX_TUNE_PSNR }, + { "ssim", VPX_TUNE_SSIM }, { NULL, 0 } }; static const arg_def_t tune_ssim = ARG_DEF_ENUM(NULL, "tune", 1, "Material to favor", tuning_enum); -- 2.40.0