shithub: libvpx

Download patch

ref: 1d8d8f562bf382e47071bb38d13b7ded366820af
parent: 8cbea4a04902f749bae528b11485712d06411c44
author: sdeng <sdeng@google.com>
date: Fri Apr 12 02:00:20 EDT 2019

Add VPX_TUNE_SSIM and VPX_TUNE_PSNR enums

Change-Id: I3df5af2c60b774e6d395062077542c52db868236

--- a/vp8/common/onyx.h
+++ b/vp8/common/onyx.h
@@ -217,7 +217,7 @@
   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;
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -426,7 +426,7 @@
     }
 #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 @@
 
   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 @@
     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 @@
   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);
   }
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -149,7 +149,7 @@
           /* 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 */
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -38,7 +38,7 @@
   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;
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -269,7 +269,7 @@
   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 @@
   // 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 @@
     }
   }
 
-  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 @@
       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 @@
   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);
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -5022,7 +5022,7 @@
     }
   }
 
-  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);
 
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -262,7 +262,7 @@
   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;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -35,7 +35,7 @@
   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 @@
   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
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -782,12 +782,12 @@
   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 @@
 #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
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -320,8 +320,8 @@
     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);