From 9396940900c2ac4608c18a0b26134f98f638402f Mon Sep 17 00:00:00 2001 From: siivonek Date: Tue, 31 Aug 2021 06:16:41 +0200 Subject: [PATCH] Implement writing MRL bits to cabac. --- src/encode_coding_tree.c | 4 ++-- src/encoder_state-bitstream.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/encode_coding_tree.c b/src/encode_coding_tree.c index b22eeeed..19f5f8b9 100644 --- a/src/encode_coding_tree.c +++ b/src/encode_coding_tree.c @@ -859,7 +859,7 @@ static void encode_intra_coding_unit(encoder_state_t * const state, int multi_ref_idx = cur_cu->intra.multi_ref_idx; bool enable_mrl = state->encoder_control->cfg.mrl; - if (cur_cu->type == 1/*intra*/ && (y % LCU_WIDTH) != 0 && !cur_cu->bdpcmMode && enable_mrl) { + if (cur_cu->type == CU_INTRA && (y % LCU_WIDTH) != 0 && !cur_cu->bdpcmMode && enable_mrl) { if (MAX_REF_LINE_IDX > 1) { cabac->cur_ctx = &(cabac->ctx.multi_ref_line[0]); CABAC_BIN(cabac, multi_ref_idx != 0, "multi_ref_line"); @@ -930,7 +930,7 @@ static void encode_intra_coding_unit(encoder_state_t * const state, } // Is the mode in the MPM array or not flag[j] = (mpm_preds[j] == -1) ? 0 : 1; - if (true||!(cur_pu->intra.multi_ref_idx || (isp_mode))) { + if (!(cur_pu->intra.multi_ref_idx || (isp_mode))) { CABAC_BIN(cabac, flag[j], "prev_intra_luma_pred_flag"); } } diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index cdb69b5b..aabdec65 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -661,7 +661,13 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream, WRITE_UE(stream, encoder->cfg.log2_parallel_merge_level-2, "log2_parallel_merge_level_minus2"); WRITE_U(stream, 0, 1, "sps_isp_enabled_flag"); - WRITE_U(stream, 0, 1, "sps_mrl_enabled_flag"); + + if (state->encoder_control->cfg.mrl) { + WRITE_U(stream, 1, 1, "sps_mrl_enabled_flag"); + } else { + WRITE_U(stream, 0, 1, "sps_mrl_enabled_flag"); + } + WRITE_U(stream, 0, 1, "sps_mip_enabled_flag"); // if(!no_cclm_constraint_flag) if(encoder->chroma_format != KVZ_CSP_400) {