]> granicus.if.org Git - libvpx/commitdiff
Fix RD multiplier bug impacting AQ1.
authorpaulwilkins <paulwilkins@google.com>
Tue, 26 Feb 2019 12:34:07 +0000 (12:34 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Thu, 28 Feb 2019 13:03:42 +0000 (13:03 +0000)
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

vp9/encoder/vp9_encodeframe.c

index b2ad686dc975cf59c4069af520c7f43c81a46c23..bdbee80134151b75ad95373dea4f6001eb0898c5 100644 (file)
@@ -1894,15 +1894,12 @@ static void set_mode_info_seg_skip(MACROBLOCK *x, TX_MODE tx_mode,
 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;
 
   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 @@ static void set_segment_rdmult(VP9_COMP *const cpi, MACROBLOCK *const x,
     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,