]> granicus.if.org Git - libvpx/commitdiff
Simplify vp10_xform_quant index parsing
authorJingning Han <jingning@google.com>
Wed, 7 Oct 2015 00:17:44 +0000 (17:17 -0700)
committerJingning Han <jingning@google.com>
Wed, 7 Oct 2015 00:19:23 +0000 (17:19 -0700)
Change-Id: Id7f7a9b2e53fc0074b55d58143f296afad6b844e

vp10/encoder/encodemb.c
vp10/encoder/encodemb.h
vp10/encoder/rdopt.c

index e636efa5c8a7138574439ae47e79e4a289113a22..12f1962e38567435b494cb8c28d0a0c4044ecd34 100644 (file)
@@ -1268,7 +1268,8 @@ void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
 }
 
 void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
-                     BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
+                      int blk_row, int blk_col,
+                      BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
   MACROBLOCKD *const xd = &x->e_mbd;
   const struct macroblock_plane *const p = &x->plane[plane];
   const struct macroblockd_plane *const pd = &xd->plane[plane];
@@ -1281,10 +1282,8 @@ void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
   tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   uint16_t *const eob = &p->eobs[block];
   const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
-  int i, j;
   const int16_t *src_diff;
-  txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
-  src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+  src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
 
 #if CONFIG_VP9_HIGHBITDEPTH
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -1403,7 +1402,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
         int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
         if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
           // full forward transform and quantization
-          vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+          vp10_xform_quant(x, plane, block, j, i, plane_bsize, tx_size);
         } else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
           // fast path forward transform and quantization
           vp10_xform_quant_dc(x, plane, block, plane_bsize, tx_size);
@@ -1414,7 +1413,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
           return;
         }
       } else {
-        vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+        vp10_xform_quant(x, plane, block, j, i, plane_bsize, tx_size);
       }
     }
   }
@@ -1501,7 +1500,7 @@ static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
   txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
   dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
 
-  vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+  vp10_xform_quant(x, plane, block, j, i, plane_bsize, tx_size);
 
   if (p->eobs[block] > 0) {
 #if CONFIG_VP9_HIGHBITDEPTH
index 62a7db4a29450278c3f8378970f837141628cccc..60184a1cdd10f49c8cc52c680b2a6af3aa38a313 100644 (file)
@@ -30,7 +30,8 @@ void vp10_xform_quant_fp(MACROBLOCK *x, int plane, int block,
 void vp10_xform_quant_dc(MACROBLOCK *x, int plane, int block,
                         BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
 void vp10_xform_quant(MACROBLOCK *x, int plane, int block,
-                     BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
+                      int blk_row, int blk_col,
+                      BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
 
 void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
 
index 553510604c4813a6a4d0ad1f98ba07333f647e14..a106d051524c7b63212298d069a5d85424b1a7e7 100644 (file)
@@ -465,6 +465,8 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
   int rate;
   int64_t dist;
   int64_t sse;
+  int i, j;
+  txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
 
   if (args->exit_early)
     return;
@@ -477,7 +479,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
     if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
         SKIP_TXFM_NONE) {
       // full forward transform and quantization
-      vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+      vp10_xform_quant(x, plane, block, j, i, plane_bsize, tx_size);
       dist_block(x, plane, block, tx_size, &dist, &sse);
     } else if (x->skip_txfm[(plane << 2) + (block >> (tx_size << 1))] ==
                SKIP_TXFM_AC_ONLY) {
@@ -508,7 +510,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize,
     }
   } else {
     // full forward transform and quantization
-    vp10_xform_quant(x, plane, block, plane_bsize, tx_size);
+    vp10_xform_quant(x, plane, block, j, i, plane_bsize, tx_size);
     dist_block(x, plane, block, tx_size, &dist, &sse);
   }