]> granicus.if.org Git - libvpx/commitdiff
vp9: Compute source sad for every superblock when partition copy is on.
authorJerome Jiang <jianj@google.com>
Thu, 5 Jan 2017 00:19:42 +0000 (16:19 -0800)
committerJerome Jiang <jianj@google.com>
Fri, 6 Jan 2017 17:59:02 +0000 (17:59 +0000)
The source sad could be used to copy the partition without going into
choose_partitioning function to speed up vp9 encoding. Computing source
sad takes little time. Speed test on Android and Linux shows little
encoding time gain (less than 1.4%).

Turned off for now since partition copy is turned off.

Change-Id: I61c9d5b8f22329760cb29a4ee30a7f9c232ce8d3

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_ratectrl.c

index 476cb2d6933c9dfaaa5b799e45f0e1eeaad03607..dee7ca75e49bf71b901e2aa4b590c9cbd6492d51 100644 (file)
@@ -3133,7 +3133,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->oxcf.rc_mode == VPX_VBR || cpi->sf.copy_partition_flag) &&
       cm->show_frame)
     vp9_avg_source_sad(cpi);
 
index 34ee11548eebe92166f985305b524b5414f5885d..b2abe1780dc76dd079f1751ff9ba6106bf9cd04b 100644 (file)
@@ -2251,10 +2251,12 @@ 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 ((sbi_row > 0 && sbi_col > 0) &&
-                (sbi_row < sb_rows - 1 && sbi_col < sb_cols - 1) &&
-                ((sbi_row % 2 == 0 && sbi_col % 2 == 0) ||
-                 (sbi_row % 2 != 0 && sbi_col % 2 != 0))) {
+            // If the partition copy is on, compute for every superblock.
+            if (cpi->sf.copy_partition_flag ||
+                ((sbi_row > 0 && sbi_col > 0) &&
+                 (sbi_row < sb_rows - 1 && sbi_col < sb_cols - 1) &&
+                 ((sbi_row % 2 == 0 && sbi_col % 2 == 0) ||
+                  (sbi_row % 2 != 0 && sbi_col % 2 != 0)))) {
               num_samples++;
               avg_sad += cpi->fn_ptr[bsize].sdf(src_y, src_ystride, last_src_y,
                                                 last_src_ystride);