From 89db34d4e07999913b82ac4a922ebebc1bdf4e31 Mon Sep 17 00:00:00 2001 From: siivonek Date: Wed, 21 Sep 2022 16:04:52 +0300 Subject: [PATCH] [isp] Use TR_MAX_WIDTH in ISP checks instead of parameter. --- src/encode_coding_tree.c | 2 +- src/intra.c | 4 ++-- src/intra.h | 2 +- src/search_intra.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/encode_coding_tree.c b/src/encode_coding_tree.c index 79756712..d0dab272 100644 --- a/src/encode_coding_tree.c +++ b/src/encode_coding_tree.c @@ -1103,7 +1103,7 @@ void uvg_encode_intra_luma_coding_unit(const encoder_state_t * const state, bool enable_isp = state->encoder_control->cfg.isp; // Need at least 16 samples in sub blocks to use isp. If both dimensions are 4, not enough samples. Blocks of size 2 do not exist yet (not for luma at least) - bool allow_isp = enable_isp ? uvg_can_use_isp(width, height, 64 /*MAX_TR_SIZE*/) : false; + bool allow_isp = enable_isp ? uvg_can_use_isp(width, height) : false; uint8_t isp_mode = allow_isp ? cur_cu->intra.isp_mode : 0; if (allow_isp && !multi_ref_idx /*&& !bdpcm && !color_transform*/) { diff --git a/src/intra.c b/src/intra.c index e6ccb77a..7eb07911 100644 --- a/src/intra.c +++ b/src/intra.c @@ -1851,7 +1851,7 @@ void uvg_intra_recon_cu( * \param height Block height. * \param max_tr_size Maximum supported transform block size (64). */ -bool uvg_can_use_isp(const int width, const int height, const int max_tr_size) +bool uvg_can_use_isp(const int width, const int height) { assert(!(width > LCU_WIDTH || height > LCU_WIDTH) && "Block size larger than max LCU size."); assert(!(width < TR_MIN_WIDTH || height < TR_MIN_WIDTH) && "Block size smaller than min TR_WIDTH."); @@ -1861,7 +1861,7 @@ bool uvg_can_use_isp(const int width, const int height, const int max_tr_size) // Each split block must have at least 16 samples. bool not_enough_samples = (log2_width + log2_height <= 4); - bool cu_size_larger_than_max_tr_size = width > max_tr_size || height > max_tr_size; + bool cu_size_larger_than_max_tr_size = width > TR_MAX_WIDTH || height > TR_MAX_WIDTH; if (not_enough_samples || cu_size_larger_than_max_tr_size) { return false; } diff --git a/src/intra.h b/src/intra.h index ac076327..c4bdc87e 100644 --- a/src/intra.h +++ b/src/intra.h @@ -174,5 +174,5 @@ int uvg_get_mip_flag_context(int x, int y, int width, int height, const lcu_t* l int uvg_get_isp_split_dim(const int width, const int height, const int split_type, const bool is_transform_block); int uvg_get_isp_split_num(const int width, const int height, const int split_type, const bool is_transform_block); void uvg_get_isp_split_loc(cu_loc_t *loc, const int x, const int y, const int block_w, const int block_h, int split_idx, const int split_type, const bool is_transform_block); -bool uvg_can_use_isp(const int width, const int height, const int max_tr_size); +bool uvg_can_use_isp(const int width, const int height); bool uvg_can_use_isp_with_lfnst(const int width, const int height, const int isp_mode, const enum uvg_tree_type tree_type); diff --git a/src/search_intra.c b/src/search_intra.c index 50baded9..224482dc 100644 --- a/src/search_intra.c +++ b/src/search_intra.c @@ -1392,7 +1392,7 @@ static int8_t search_intra_rdo( double best_isp_cost = MAX_DOUBLE; double best_bits = MAX_DOUBLE; int8_t best_isp_mode = -1; - int max_isp_modes = can_do_isp_search && uvg_can_use_isp(width, height, TR_MAX_WIDTH) && state->encoder_control->cfg.isp ? NUM_ISP_MODES : 1; + int max_isp_modes = can_do_isp_search && uvg_can_use_isp(width, height) && state->encoder_control->cfg.isp ? NUM_ISP_MODES : 1; for (int isp_mode = 0; isp_mode < max_isp_modes; ++isp_mode) { search_data[mode].pred_cu.intra.isp_mode = isp_mode;