Make DCT as default txfm_type for screen content
This change is applicable for speed >=4.
STATS_CHANGED
Change-Id: I22b33a8cf75474a2ff2569563762d094d7da46d2
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 72c0196..23fee04 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -771,11 +771,13 @@
static INLINE TX_TYPE get_default_tx_type(PLANE_TYPE plane_type,
const MACROBLOCKD *xd,
- TX_SIZE tx_size) {
+ TX_SIZE tx_size,
+ int is_screen_content_type) {
const MB_MODE_INFO *const mbmi = xd->mi[0];
if (is_inter_block(mbmi) || plane_type != PLANE_TYPE_Y ||
- xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
+ xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32 ||
+ is_screen_content_type)
return DCT_DCT;
return intra_mode_to_tx_type(mbmi, plane_type);
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 659e372..0dc7543 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3957,6 +3957,7 @@
cm->seq_params.force_screen_content_tools;
}
}
+ cpi->is_screen_content_type = (cm->allow_screen_content_tools != 0);
}
static void set_size_dependent_vars(AV1_COMP *cpi, int *q, int *bottom_index,
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index a8e6a82..b2a6ad2 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -854,6 +854,8 @@
#if CONFIG_MULTITHREAD
pthread_mutex_t *row_mt_mutex_;
#endif
+ // Set if screen content is set or relevant tools are enabled
+ int is_screen_content_type;
} AV1_COMP;
// Must not be called more than once.
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 85c4cdd..f91a360 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3083,7 +3083,8 @@
TX_TYPE txk_end = TX_TYPES - 1;
if ((!is_inter && x->use_default_intra_tx_type) ||
(is_inter && x->use_default_inter_tx_type)) {
- txk_start = txk_end = get_default_tx_type(0, xd, tx_size);
+ txk_start = txk_end =
+ get_default_tx_type(0, xd, tx_size, cpi->is_screen_content_type);
} else if (x->rd_model == LOW_TXFM_RD || x->cb_partition_scan) {
if (plane == 0) txk_end = DCT_DCT;
}