]> granicus.if.org Git - libvpx/commitdiff
Fixing issue with calculation of block_idx
authorJulia Robson <juliamrobson@gmail.com>
Mon, 9 Nov 2015 11:50:36 +0000 (11:50 +0000)
committerDebargha Mukherjee <debargha@google.com>
Thu, 12 Nov 2015 16:21:53 +0000 (08:21 -0800)
For tall rectangular blocks, the block_idx of the lower transform
block was being mis-calculated.

Does not affect results the way this function is being used now.

Change-Id: I470464d19be0bf0f42003d0cc29793bc42db8f52

vp9/encoder/vp9_rdopt.c

index 10a98fde167627fd42505318b764058864b79e57..9b9923fb670388502b0badff9016b2ee0ddde1d8 100644 (file)
@@ -457,8 +457,10 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
     // low enough so that we can skip the mode search.
     const int64_t low_dc_thr = MIN(50, dc_thr >> 2);
     const int64_t low_ac_thr = MIN(80, ac_thr >> 2);
-    int bw = 1 << (b_width_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
-    int bh = 1 << (b_height_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
+    int bw_shift = (b_width_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
+    int bh_shift = (b_height_log2_lookup[bs] - b_width_log2_lookup[unit_size]);
+    int bw = 1 << bw_shift;
+    int bh = 1 << bh_shift;
     int idx, idy;
     int lw = b_width_log2_lookup[unit_size] + 2;
     int lh = b_height_log2_lookup[unit_size] + 2;
@@ -469,7 +471,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
       for (idx = 0; idx < bw; ++idx) {
         uint8_t *src = p->src.buf + (idy * p->src.stride << lh) + (idx << lw);
         uint8_t *dst = pd->dst.buf + (idy * pd->dst.stride << lh) + (idx << lh);
-        int block_idx = (idy << 1) + idx;
+        int block_idx = (idy << bw_shift) + idx;
         int low_err_skip = 0;
 
         var = cpi->fn_ptr[unit_size].vf(src, p->src.stride,