vp9: Add speed feature flag for computing average source sad.
authorMarco <marpan@google.com>
Fri, 13 Jan 2017 19:21:33 +0000 (11:21 -0800)
committerMarco <marpan@google.com>
Fri, 13 Jan 2017 19:52:12 +0000 (11:52 -0800)
If enabled will compute source_sad for every superblock on every frame,
prior to encoding. Off by default, only on for speed=8 when
copy_partition is set.

Change-Id: Iab7903180a23dad369135e8234b7f896f20e1231

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_ratectrl.c
vp9/encoder/vp9_speed_features.c
vp9/encoder/vp9_speed_features.h

index 3fa7dbb..7b85e4a 100644 (file)
@@ -3165,7 +3165,7 @@ static void encode_without_recode_loop(VP9_COMP *cpi, size_t *size,
   if (cpi->oxcf.pass == 0 && cpi->oxcf.mode == REALTIME &&
       cpi->oxcf.speed >= 5 && cpi->resize_state == 0 &&
       (cpi->oxcf.content == VP9E_CONTENT_SCREEN ||
-       cpi->oxcf.rc_mode == VPX_VBR || cpi->sf.copy_partition_flag) &&
+       cpi->oxcf.rc_mode == VPX_VBR || cpi->sf.use_source_sad) &&
       cm->show_frame)
     vp9_avg_source_sad(cpi);
 
index 3a5abfa..7834393 100644 (file)
@@ -2254,8 +2254,8 @@ void vp9_avg_source_sad(VP9_COMP *cpi) {
         for (sbi_row = 0; sbi_row < sb_rows; ++sbi_row) {
           for (sbi_col = 0; sbi_col < sb_cols; ++sbi_col) {
             // Checker-board pattern, ignore boundary.
-            // If the partition copy is on, compute for every superblock.
-            if (cpi->sf.copy_partition_flag ||
+            // If the use_source_sad is on, compute for every superblock.
+            if (cpi->sf.use_source_sad ||
                 ((sbi_row > 0 && sbi_col > 0) &&
                  (sbi_row < sb_rows - 1 && sbi_col < sb_cols - 1) &&
                  ((sbi_row % 2 == 0 && sbi_col % 2 == 0) ||
index 088c4d0..4207a88 100644 (file)
@@ -312,6 +312,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, int speed,
   sf->exhaustive_searches_thresh = INT_MAX;
   sf->allow_acl = 0;
   sf->copy_partition_flag = 0;
+  sf->use_source_sad = 0;
 
   if (speed >= 1) {
     sf->allow_txfm_domain_distortion = 1;
@@ -502,6 +503,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, int speed,
         !cpi->external_resize)
       sf->copy_partition_flag = 1;
     if (sf->copy_partition_flag) {
+      sf->use_source_sad = 1;
       if (cpi->prev_partition == NULL) {
         cpi->prev_partition = (BLOCK_SIZE *)vpx_calloc(
             cm->mi_stride * cm->mi_rows, sizeof(BLOCK_SIZE));
index 944fe63..df93b14 100644 (file)
@@ -478,6 +478,10 @@ typedef struct SPEED_FEATURES {
 
   // Global flag to enable partition copy from the previous frame.
   int copy_partition_flag;
+
+  // Compute the source sad for every superblock of the frame,
+  // prior to encoding the frame, to be used to bypass some encoder decisions.
+  int use_source_sad;
 } SPEED_FEATURES;
 
 struct VP9_COMP;