From 135fe47602ecc0deef4f5943bd5266c7a23d18aa Mon Sep 17 00:00:00 2001 From: paulwilkins Date: Tue, 26 Feb 2019 12:34:07 +0000 Subject: [PATCH] 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 --- vp9/encoder/vp9_encodeframe.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index b2ad686dc..bdbee8013 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -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, -- 2.40.0