]> granicus.if.org Git - libvpx/commitdiff
Scale the distortion mectric with tx size
authorJingning Han <jingning@google.com>
Sat, 21 Jul 2018 23:04:34 +0000 (16:04 -0700)
committerJingning Han <jingning@google.com>
Sun, 22 Jul 2018 14:33:37 +0000 (07:33 -0700)
Properly scale the distortion metric according to the tranfer
function gain of the transform block size.

Change-Id: I8e3539d8936f5db78c1352f902f72ef19fc09ed8

vp9/encoder/vp9_encoder.c

index b55e89e5bb068787ffc2e4dc57c9f0ae8e0eeb42..818302237b52e3e9e0b63651410f2872751f60aa 100644 (file)
@@ -5720,14 +5720,16 @@ void get_quantize_error(MACROBLOCK *x, int plane, tran_low_t *coeff,
   const scan_order *const scan_order = &vp9_default_scan_orders[tx_size];
   uint16_t eob;
   int pix_num = 1 << num_pels_log2_lookup[txsize_to_bsize[tx_size]];
+  const int shift = tx_size == TX_32X32 ? 0 : 2;
 
   vp9_quantize_fp_32x32(coeff, pix_num, x->skip_block, p->round_fp, p->quant_fp,
                         qcoeff, dqcoeff, pd->dequant, &eob, scan_order->scan,
                         scan_order->iscan);
 
-  *recon_error = vp9_block_error(coeff, dqcoeff, pix_num, sse);
-
+  *recon_error = vp9_block_error(coeff, dqcoeff, pix_num, sse) >> shift;
   *recon_error = VPXMAX(*recon_error, 1);
+
+  *sse = (*sse) >> shift;
   *sse = VPXMAX(*sse, 1);
 }