Allow txk_sel to turn off optimize_b in rd loop

This is for speeding up the testing process

Change-Id: I90866fa239794f14e4801675d471dbf50b779d18
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index a2b3c6d..599ba36 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -2533,10 +2533,15 @@
 
     RD_STATS this_rd_stats;
     av1_invalid_rd_stats(&this_rd_stats);
+#if DISABLE_TRELLISQ_SEARCH
+    av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
+                    coeff_ctx, AV1_XFORM_QUANT_B);
+#else
     av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
                     coeff_ctx, AV1_XFORM_QUANT_FP);
     av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size,
                    a, l, 1);
+#endif
     av1_dist_block(cpi, x, plane, plane_bsize, block, blk_row, blk_col, tx_size,
                    &this_rd_stats.dist, &this_rd_stats.sse,
                    OUTPUT_HAS_PREDICTED_PIXELS);
@@ -2563,12 +2568,17 @@
   x->plane[plane].txb_entropy_ctx[block] = best_eob;
 
   if (!is_inter_block(mbmi)) {
-    // intra mode needs decoded result such that the next transform block
-    // can use it for prediction.
+// intra mode needs decoded result such that the next transform block
+// can use it for prediction.
+#if DISABLE_TRELLISQ_SEARCH
+    av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
+                    coeff_ctx, AV1_XFORM_QUANT_B);
+#else
     av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
                     coeff_ctx, AV1_XFORM_QUANT_FP);
     av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size,
                    a, l, 1);
+#endif
 
     av1_inverse_transform_block_facade(xd, plane, block, blk_row, blk_col,
                                        x->plane[plane].eobs[block],
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 1ec0cca..27806ab 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -122,13 +122,6 @@
 #define FILTER_FAST_SEARCH 1
 #endif  // CONFIG_EXT_INTRA
 
-// Setting this to 1 will disable trellis optimization within the
-// transform search. Trellis optimization will still be applied
-// in the final encode.
-#ifndef DISABLE_TRELLISQ_SEARCH
-#define DISABLE_TRELLISQ_SEARCH 0
-#endif
-
 static const double ADST_FLIP_SVM[8] = {
   /* vertical */
   -6.6623, -2.8062, -3.2531, 3.1671,
diff --git a/av1/encoder/rdopt.h b/av1/encoder/rdopt.h
index 932ca65..47e02ac 100644
--- a/av1/encoder/rdopt.h
+++ b/av1/encoder/rdopt.h
@@ -21,6 +21,13 @@
 extern "C" {
 #endif
 
+// Setting this to 1 will disable trellis optimization within the
+// transform search. Trellis optimization will still be applied
+// in the final encode.
+#ifndef DISABLE_TRELLISQ_SEARCH
+#define DISABLE_TRELLISQ_SEARCH 0
+#endif
+
 struct TileInfo;
 struct AV1_COMP;
 struct macroblock;