shithub: libvpx

Download patch

ref: ee1fbb91afa485e362885c9f8385f24a753046d6
parent: 535e4039cd9d91e7e92a37f09853eda927bff05e
author: Jingning Han <jingning@google.com>
date: Wed Dec 19 07:20:57 EST 2018

Add control interface to PSNR_AQ mode

Change-Id: I760c69189fb8d8d85b5daffc86064c66913c0220

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -181,7 +181,7 @@
 }
 
 static void set_segment_index(VP9_COMP *cpi, MACROBLOCK *const x, int mi_row,
-                              int mi_col, BLOCK_SIZE bsize) {
+                              int mi_col, BLOCK_SIZE bsize, int segment_index) {
   VP9_COMMON *const cm = &cpi->common;
   const struct segmentation *const seg = &cm->seg;
   MACROBLOCKD *const xd = &x->e_mbd;
@@ -229,6 +229,7 @@
       else
         mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col);
       break;
+    case PSNR_AQ: mi->segment_id = segment_index; break;
     default:
       // NO_AQ or PSNR_AQ
       break;
@@ -1291,7 +1292,7 @@
   }
 
   set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64);
-  set_segment_index(cpi, x, mi_row, mi_col, BLOCK_64X64);
+  set_segment_index(cpi, x, mi_row, mi_col, BLOCK_64X64, 0);
   segment_id = xd->mi[0]->segment_id;
 
   if (cpi->oxcf.speed >= 8 || (cpi->use_svc && cpi->svc.non_reference_frame))
@@ -1919,7 +1920,6 @@
   x->use_lp32x32fdct = 1;
 
   set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
-  set_segment_index(cpi, x, mi_row, mi_col, bsize);
   mi = xd->mi[0];
   mi->sb_type = bsize;
 
@@ -1969,6 +1969,8 @@
     x->block_qcoeff_opt = cpi->sf.allow_quant_coeff_opt;
   }
 
+  set_segment_index(cpi, x, mi_row, mi_col, bsize, 0);
+
   if (aq_mode == VARIANCE_AQ) {
     x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id);
   } else if (aq_mode == EQUATOR360_AQ) {
@@ -4420,7 +4422,7 @@
 
   set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize);
 
-  set_segment_index(cpi, x, mi_row, mi_col, bsize);
+  set_segment_index(cpi, x, mi_row, mi_col, bsize, 0);
 
   mi = xd->mi[0];
   mi->sb_type = bsize;