Use vp10_[fwd/inv]_txfm2d_add_#x# for bd 10

Change-Id: Ie35bdbd7aafae693e3106d7ccbbdd8e65ee8800c
diff --git a/vp10/common/idct.c b/vp10/common/idct.c
index 0e211ad..fbae4aa 100644
--- a/vp10/common/idct.c
+++ b/vp10/common/idct.c
@@ -15,6 +15,7 @@
 #include "vp10/common/blockd.h"
 #include "vp10/common/enums.h"
 #include "vp10/common/idct.h"
+#include "vp10/common/vp10_inv_txfm2d_cfg.h"
 #include "vpx_dsp/inv_txfm.h"
 #include "vpx_ports/mem.h"
 
@@ -1288,7 +1289,11 @@
 
   switch (tx_type) {
     case DCT_DCT:
-      vp10_highbd_idct4x4_add(input, dest, stride, eob, bd);
+      if (bd == 10)
+        vp10_inv_txfm2d_add_4x4(input, CONVERT_TO_SHORTPTR(dest), stride,
+                                &inv_txfm_2d_cfg_dct_dct_4, bd);
+      else
+        vp10_highbd_idct4x4_add(input, dest, stride, eob, bd);
       break;
     case ADST_DCT:
     case DCT_ADST:
@@ -1327,7 +1332,11 @@
                                   TX_TYPE tx_type) {
   switch (tx_type) {
     case DCT_DCT:
-      vp10_highbd_idct8x8_add(input, dest, stride, eob, bd);
+      if (bd == 10)
+        vp10_inv_txfm2d_add_8x8(input, CONVERT_TO_SHORTPTR(dest), stride,
+                                &inv_txfm_2d_cfg_dct_dct_8, bd);
+      else
+        vp10_highbd_idct8x8_add(input, dest, stride, eob, bd);
       break;
     case ADST_DCT:
     case DCT_ADST:
@@ -1366,7 +1375,11 @@
                                     TX_TYPE tx_type) {
   switch (tx_type) {
     case DCT_DCT:
-      vp10_highbd_idct16x16_add(input, dest, stride, eob, bd);
+      if (bd == 10)
+        vp10_inv_txfm2d_add_16x16(input, CONVERT_TO_SHORTPTR(dest), stride,
+                                  &inv_txfm_2d_cfg_dct_dct_16, bd);
+      else
+        vp10_highbd_idct16x16_add(input, dest, stride, eob, bd);
       break;
     case ADST_DCT:
     case DCT_ADST:
diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c
index c42b7f1..00f2e03 100644
--- a/vp10/encoder/encodemb.c
+++ b/vp10/encoder/encodemb.c
@@ -377,6 +377,7 @@
   src_diff = &p->src_diff[4 * (blk_row * diff_stride + blk_col)];
 
 #if CONFIG_VP9_HIGHBITDEPTH
+  fwd_txfm_param.bd = xd->bd;
   if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     highbd_fwd_txfm(src_diff, coeff, diff_stride, &fwd_txfm_param);
     if (xform_quant_idx != VP10_XFORM_QUANT_SKIP_QUANT) {
diff --git a/vp10/encoder/hybrid_fwd_txfm.c b/vp10/encoder/hybrid_fwd_txfm.c
index e9dd70b..8a19a40 100644
--- a/vp10/encoder/hybrid_fwd_txfm.c
+++ b/vp10/encoder/hybrid_fwd_txfm.c
@@ -13,6 +13,7 @@
 #include "./vpx_dsp_rtcd.h"
 
 #include "vp10/common/idct.h"
+#include "vp10/common/vp10_fwd_txfm2d_cfg.h"
 #include "vp10/encoder/hybrid_fwd_txfm.h"
 
 static INLINE void fdct32x32(int rd_transform, const int16_t *src,
@@ -193,7 +194,8 @@
 
 #if CONFIG_VP9_HIGHBITDEPTH
 void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
-                              int diff_stride, TX_TYPE tx_type, int lossless) {
+                              int diff_stride, TX_TYPE tx_type, int lossless,
+                              const int bd) {
   if (lossless) {
     assert(tx_type == DCT_DCT);
     vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
@@ -202,7 +204,12 @@
 
   switch (tx_type) {
     case DCT_DCT:
-      vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
+      if (bd == 10) {
+        vp10_fwd_txfm2d_4x4(src_diff, coeff, diff_stride,
+                            &fwd_txfm_2d_cfg_dct_dct_4, bd);
+      } else {
+        vp10_highbd_fht4x4(src_diff, coeff, diff_stride, tx_type);
+      }
       break;
     case ADST_DCT:
     case DCT_ADST:
@@ -237,10 +244,15 @@
 
 static void highbd_fwd_txfm_8x8(const int16_t *src_diff, tran_low_t *coeff,
                                 int diff_stride, TX_TYPE tx_type,
-                                FWD_TXFM_OPT fwd_txfm_opt) {
+                                FWD_TXFM_OPT fwd_txfm_opt, const int bd) {
   (void)fwd_txfm_opt;
   switch (tx_type) {
     case DCT_DCT:
+      if (bd == 10) {
+        vp10_fwd_txfm2d_8x8(src_diff, coeff, diff_stride,
+                            &fwd_txfm_2d_cfg_dct_dct_8, bd);
+        break;
+      }
     case ADST_DCT:
     case DCT_ADST:
     case ADST_ADST:
@@ -278,10 +290,15 @@
 
 static void highbd_fwd_txfm_16x16(const int16_t *src_diff, tran_low_t *coeff,
                                   int diff_stride, TX_TYPE tx_type,
-                                  FWD_TXFM_OPT fwd_txfm_opt) {
+                                  FWD_TXFM_OPT fwd_txfm_opt, const int bd) {
   (void)fwd_txfm_opt;
   switch (tx_type) {
     case DCT_DCT:
+      if (bd == 10) {
+        vp10_fwd_txfm2d_16x16(src_diff, coeff, diff_stride,
+                              &fwd_txfm_2d_cfg_dct_dct_16, bd);
+        break;
+      }
     case ADST_DCT:
     case DCT_ADST:
     case ADST_ADST:
@@ -319,7 +336,9 @@
 
 static void highbd_fwd_txfm_32x32(int rd_transform, const int16_t *src_diff,
                                   tran_low_t *coeff, int diff_stride,
-                                  TX_TYPE tx_type, FWD_TXFM_OPT fwd_txfm_opt) {
+                                  TX_TYPE tx_type, FWD_TXFM_OPT fwd_txfm_opt,
+                                  const int bd) {
+  (void)bd;
   switch (tx_type) {
     case DCT_DCT:
       if (fwd_txfm_opt == FWD_TXFM_OPT_NORMAL)
@@ -390,20 +409,23 @@
   const TX_SIZE tx_size = fwd_txfm_param->tx_size;
   const int rd_transform = fwd_txfm_param->rd_transform;
   const int lossless = fwd_txfm_param->lossless;
+  const int bd = fwd_txfm_param->bd;
   switch (tx_size) {
     case TX_32X32:
       highbd_fwd_txfm_32x32(rd_transform, src_diff, coeff, diff_stride, tx_type,
-                            fwd_txfm_opt);
+                            fwd_txfm_opt, bd);
       break;
     case TX_16X16:
       highbd_fwd_txfm_16x16(src_diff, coeff, diff_stride, tx_type,
-                            fwd_txfm_opt);
+                            fwd_txfm_opt, bd);
       break;
     case TX_8X8:
-      highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
+      highbd_fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type,
+                          fwd_txfm_opt, bd);
       break;
     case TX_4X4:
-      vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless);
+      vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
+                               lossless, bd);
       break;
     default:
       assert(0);
diff --git a/vp10/encoder/hybrid_fwd_txfm.h b/vp10/encoder/hybrid_fwd_txfm.h
index 62b8d5a..d5c5a9d 100644
--- a/vp10/encoder/hybrid_fwd_txfm.h
+++ b/vp10/encoder/hybrid_fwd_txfm.h
@@ -21,6 +21,9 @@
   FWD_TXFM_OPT fwd_txfm_opt;
   int rd_transform;
   int lossless;
+#if CONFIG_VP9_HIGHBITDEPTH
+  int bd;
+#endif  // CONFIG_VP9_HIGHBITDEPTH
 } FWD_TXFM_PARAM;
 
 #ifdef __cplusplus
@@ -36,7 +39,8 @@
 void highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff,
                      int diff_stride, FWD_TXFM_PARAM *fwd_txfm_param);
 void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
-                              int diff_stride, TX_TYPE tx_type, int lossless);
+                              int diff_stride, TX_TYPE tx_type, int lossless,
+                              const int bd);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 
 static INLINE int get_tx1d_size(TX_SIZE tx_size) {
diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c
index d736751..ba113d7 100644
--- a/vp10/encoder/rdopt.c
+++ b/vp10/encoder/rdopt.c
@@ -1970,7 +1970,7 @@
             const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
                                                            *(templ + idy));
 #endif  // CONFIG_VAR_TX
-            vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
+            vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1, xd->bd);
             vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
 #if CONFIG_VAR_TX
             ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
@@ -1997,7 +1997,7 @@
             const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
                                                            *(templ + idy));
 #endif  // CONFIG_VAR_TX
-            vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
+            vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0, xd->bd);
             vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
 #if CONFIG_VAR_TX
             ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
@@ -4305,7 +4305,7 @@
 #if CONFIG_VP9_HIGHBITDEPTH
       if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
         vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
-                                 xd->lossless[mi->mbmi.segment_id]);
+                                 xd->lossless[mi->mbmi.segment_id], xd->bd);
       } else {
         vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
                           xd->lossless[mi->mbmi.segment_id]);