Add av1_inverse_transform_block_facade

This function will apply av1_inverse_transform_block to
pd->dst.buf directly.

Change-Id: I703762c2d3cee2af626c190fe3b3995e3cce2082
diff --git a/av1/common/idct.c b/av1/common/idct.c
index 8b6b875..10d610f 100644
--- a/av1/common/idct.c
+++ b/av1/common/idct.c
@@ -2822,6 +2822,20 @@
 #endif  // CONFIG_AOM_HIGHBITDEPTH
 }
 
+void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
+                                        int blk_row, int blk_col, int eob) {
+  struct macroblockd_plane *const pd = &xd->plane[plane];
+  tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
+  const PLANE_TYPE plane_type = get_plane_type(plane);
+  const TX_SIZE tx_size = get_tx_size(plane, xd);
+  const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
+  const int dst_stride = pd->dst.stride;
+  uint8_t *dst =
+      &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+  av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
+                              eob);
+}
+
 #if CONFIG_AOM_HIGHBITDEPTH
 void av1_highbd_inv_txfm_add(const tran_low_t *input, uint8_t *dest, int stride,
                              INV_TXFM_PARAM *inv_txfm_param) {
diff --git a/av1/common/idct.h b/av1/common/idct.h
index 1d64c06..2d24efe 100644
--- a/av1/common/idct.h
+++ b/av1/common/idct.h
@@ -69,6 +69,8 @@
 void av1_inverse_transform_block(MACROBLOCKD *xd, const tran_low_t *dqcoeff,
                                  const TX_TYPE tx_type, const TX_SIZE tx_size,
                                  uint8_t *dst, int stride, int eob);
+void av1_inverse_transform_block_facade(MACROBLOCKD *xd, int plane, int block,
+                                        int blk_row, int blk_col, int eob);
 #if CONFIG_AOM_HIGHBITDEPTH
 void av1_highbd_iwht4x4_add(const tran_low_t *input, uint8_t *dest, int stride,
                             int eob, int bd);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index bb61c94..c9a51f3 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1560,6 +1560,8 @@
                                            *(args->t_left + blk_row));
   RD_STATS this_rd_stats;
 
+  assert(tx_size == get_tx_size(plane, xd));
+
   av1_init_rd_stats(&this_rd_stats);
 
   if (args->exit_early) return;
@@ -1577,15 +1579,8 @@
 
   if (!is_inter_block(mbmi)) {
     struct macroblock_plane *const p = &x->plane[plane];
-    struct macroblockd_plane *const pd = &xd->plane[plane];
-    tran_low_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
-    PLANE_TYPE plane_type = get_plane_type(plane);
-    const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
-    const int dst_stride = pd->dst.stride;
-    uint8_t *dst =
-        &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
-    av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
-                                p->eobs[block]);
+    av1_inverse_transform_block_facade(xd, plane, block, blk_row, blk_col,
+                                       p->eobs[block]);
     dist_block(args->cpi, x, plane, plane_bsize, block, blk_row, blk_col,
                tx_size, &this_rd_stats.dist, &this_rd_stats.sse,
                OUTPUT_HAS_DECODED_PIXELS);