Change rectangular vartx recursion depth to 2
0.15% improvement on lowres set
Change-Id: If16a8e07797c64508f9e2d9b26ae874ac53c57a4
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 5076357..b072600 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1765,11 +1765,13 @@
const int bw = tx_size_wide_unit[max_tx_size];
const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
const int height = block_size_high[bsize] >> tx_size_wide_log2[0];
+ int init_depth =
+ (height != width) ? RECT_VARTX_DEPTH_INIT : SQR_VARTX_DEPTH_INIT;
int idx, idy;
for (idy = 0; idy < height; idy += bh)
for (idx = 0; idx < width; idx += bw)
- write_tx_size_vartx(cm, xd, mbmi, max_tx_size, height != width, idy,
- idx, w);
+ write_tx_size_vartx(cm, xd, mbmi, max_tx_size, init_depth, idy, idx,
+ w);
#if CONFIG_RECT_TX_EXT
if (is_quarter_tx_allowed(xd, mbmi, is_inter_block(mbmi)) &&
quarter_txsize_lookup[bsize] != max_tx_size &&
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 1c665d0..35c0d52 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -6072,6 +6072,8 @@
const int bh = tx_size_high_unit[max_tx_size];
const int bw = tx_size_wide_unit[max_tx_size];
int idx, idy;
+ int init_depth =
+ (mi_height != mi_width) ? RECT_VARTX_DEPTH_INIT : SQR_VARTX_DEPTH_INIT;
xd->above_txfm_context =
cm->above_txfm_context + (mi_col << TX_UNIT_WIDE_LOG2);
@@ -6080,8 +6082,7 @@
for (idy = 0; idy < mi_height; idy += bh)
for (idx = 0; idx < mi_width; idx += bw)
- update_txfm_count(x, xd, td_counts, max_tx_size, mi_width != mi_height,
- idy, idx);
+ update_txfm_count(x, xd, td_counts, max_tx_size, init_depth, idy, idx);
}
static void set_txfm_context(MACROBLOCKD *xd, TX_SIZE tx_size, int blk_row,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index e02933b..63d34dc 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4991,6 +4991,8 @@
const int bw = tx_size_wide_unit[max_tx_size];
int idx, idy;
int block = 0;
+ int init_depth =
+ (mi_height != mi_width) ? RECT_VARTX_DEPTH_INIT : SQR_VARTX_DEPTH_INIT;
int step = tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE];
@@ -5006,10 +5008,9 @@
for (idy = 0; idy < mi_height; idy += bh) {
for (idx = 0; idx < mi_width; idx += bw) {
- select_tx_block(cpi, x, idy, idx, 0, block, max_tx_size,
- mi_height != mi_width, plane_bsize, ctxa, ctxl,
- tx_above, tx_left, &pn_rd_stats, ref_best_rd - this_rd,
- &is_cost_valid);
+ select_tx_block(cpi, x, idy, idx, 0, block, max_tx_size, init_depth,
+ plane_bsize, ctxa, ctxl, tx_above, tx_left,
+ &pn_rd_stats, ref_best_rd - this_rd, &is_cost_valid);
if (pn_rd_stats.rate == INT_MAX) {
av1_invalid_rd_stats(rd_stats);
return;