shithub: libvpx

Download patch

ref: 135fe47602ecc0deef4f5943bd5266c7a23d18aa
parent: dfcf95162b6a1be91c771fb39f22a0116c802f41
author: paulwilkins <[email protected]>
date: Tue Feb 26 07:34:07 EST 2019

Fix RD multiplier bug impacting AQ1.

Change to the default RD multiplier computation in set_segment_rdmult()

The default here is wrong as for modes like AQ 1 setting the rdmult based on the
segment ID for bsize will tend to result in the RD loop favoring partition sizes where
the resulting segment assignment has the lowest Q, as these partition sizes will be
then evaluated with a lower value of rdmult. For a valid rd comparison between
partition sizes within a single SB64 we need to use the same value of rdmult.

This change fixes an observed issue with AQ 1 where almost all the blocks were being
assigned to segment 0.

Change-Id: Ibf87e8ca60bca45b8fee866ac6fd53feae11dab4

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -1894,7 +1894,6 @@
 static void set_segment_rdmult(VP9_COMP *const cpi, MACROBLOCK *const x,
                                int mi_row, int mi_col, BLOCK_SIZE bsize,
                                AQ_MODE aq_mode) {
-  int segment_qindex;
   VP9_COMMON *const cm = &cpi->common;
   const uint8_t *const map =
       cm->seg.update_map ? cpi->segmentation_map : cm->last_frame_seg_map;
@@ -1901,8 +1900,6 @@
 
   vp9_init_plane_quantizers(cpi, x);
   vpx_clear_system_state();
-  segment_qindex =
-      vp9_get_qindex(&cm->seg, x->e_mbd.mi[0]->segment_id, cm->base_qindex);
 
   if (aq_mode == NO_AQ || aq_mode == PSNR_AQ) {
     if (cpi->sf.enable_tpl_model) x->rdmult = x->cb_rdmult;
@@ -1917,7 +1914,7 @@
     return;
   }
 
-  x->rdmult = vp9_compute_rd_mult(cpi, segment_qindex + cm->y_dc_delta_q);
+  x->rdmult = vp9_compute_rd_mult(cpi, cm->base_qindex + cm->y_dc_delta_q);
 }
 
 static void rd_pick_sb_modes(VP9_COMP *cpi, TileDataEnc *tile_data,