shithub: libvpx

Download patch

ref: f1f4f883057a00cf6b07604ac492cb52fc95fc6b
parent: 851554a0554b53938fd0721380059354f99f827b
parent: ee1fbb91afa485e362885c9f8385f24a753046d6
author: Jingning Han <jingning@google.com>
date: Thu Dec 20 02:07:23 EST 2018

Merge "Add control interface to PSNR_AQ mode"

--- 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;