Add VPX_TUNE_SSIM and VPX_TUNE_PSNR enums
authorsdeng <sdeng@google.com>
Fri, 12 Apr 2019 13:00:20 +0000 (06:00 -0700)
committersdeng <sdeng@google.com>
Tue, 23 Apr 2019 18:09:32 +0000 (11:09 -0700)
Change-Id: I3df5af2c60b774e6d395062077542c52db868236

vp8/common/onyx.h
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/vp8_cx_iface.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/vp9_cx_iface.c
vpx/vp8cx.h
vpxenc.c

index 05c72df..adc8326 100644 (file)
@@ -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;
index 2b3d956..624d60c 100644 (file)
@@ -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);
   }
index 55a1528..7714d9d 100644 (file)
@@ -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 */
index d65bf96..bd29120 100644 (file)
@@ -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;
index a5d59b6..f41dfa0 100644 (file)
@@ -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);
index f7e3237..353b026 100644 (file)
@@ -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);
 
index 5eec17d..73592fd 100644 (file)
@@ -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;
index 5658828..1911011 100644 (file)
@@ -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
index 0aef1ff..ff85a09 100644 (file)
@@ -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
index fc640f6..c6cb03c 100644 (file)
--- 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);