Fix an issue in vp9_first_pass for non-mulitple of 16 resolutions
authorDeepa K G <deepa.kg@ittiam.com>
Thu, 29 Sep 2016 03:38:34 +0000 (20:38 -0700)
committerYunqing Wang <yunqingwang@google.com>
Thu, 29 Sep 2016 23:19:23 +0000 (16:19 -0700)
This patch sets the 16x16 src_diff to zero and ensures correct calculation
of this_error for block sizes smaller than 16x16.

Change-Id: I7b7c02d267433c9f22c8ac9b8d5df2f499175172

vp9/encoder/vp9_firstpass.c

index 1c716a1..272dde5 100644 (file)
@@ -843,6 +843,10 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
       xd->mi[0]->mode = DC_PRED;
       xd->mi[0]->tx_size =
           use_dc_pred ? (bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4;
+
+      // Set the 16x16 src_diff block to zero, which ensures correct this_error
+      // calculation for block sizes smaller than 16x16.
+      vp9_zero_array(x->plane[0].src_diff, 256);
       vp9_encode_intra_block_plane(x, bsize, 0, 0);
       this_error = vpx_get_mb_ss(x->plane[0].src_diff);
       this_intra_error = this_error;