From c4dcabe95ba8c886caf82bae22e0fdc7b68d530a Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Tue, 22 Dec 2020 11:05:53 +0200 Subject: [PATCH] Add config parameter "parallel_merge_level" and array for hmvp --- src/cfg.c | 1 + src/encoder_state-bitstream.c | 2 +- src/kvazaar.h | 3 +++ src/videoframe.c | 5 +++++ src/videoframe.h | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cfg.c b/src/cfg.c index 37cf6b04..195993cf 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -177,6 +177,7 @@ int kvz_config_init(kvz_config *cfg) cfg->stats_file_prefix = NULL; + cfg->log2_parallel_merge_level = 2; cfg->fastrd_sampling_on = 0; cfg->fastrd_accuracy_check_on = 0; cfg->fastrd_learning_outdir_fn = NULL; diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 1d49ee33..c2e5f57e 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -686,7 +686,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream, WRITE_U(stream, 0, 1, "sps_gpm_enabled_flag"); } - WRITE_UE(stream, 0, "log2_parallel_merge_level_minus2"); + 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"); diff --git a/src/kvazaar.h b/src/kvazaar.h index f5d62baa..31e2504d 100644 --- a/src/kvazaar.h +++ b/src/kvazaar.h @@ -467,6 +467,9 @@ typedef struct kvz_config enum kvz_file_format file_format; char *stats_file_prefix; + + uint8_t log2_parallel_merge_level; + char *fast_coeff_table_fn; /*!< \brief Pointer to fast coeff table filename */ /** \brief whether we're sampling TBs and their costs for fast cost diff --git a/src/videoframe.c b/src/videoframe.c index 81022319..8d63c904 100644 --- a/src/videoframe.c +++ b/src/videoframe.c @@ -49,6 +49,9 @@ videoframe_t * kvz_videoframe_alloc(int32_t width, frame->sao_chroma = MALLOC(sao_info_t, frame->width_in_lcu * frame->height_in_lcu); } + frame->hmvp_lut = calloc(1, sizeof(vector2d_t) * frame->height_in_lcu); + + return frame; } @@ -78,6 +81,8 @@ int kvz_videoframe_free(videoframe_t * const frame) FREE_POINTER(frame->sao_luma); FREE_POINTER(frame->sao_chroma); + FREE_POINTER(frame->hmvp_lut); + free(frame); return 1; diff --git a/src/videoframe.h b/src/videoframe.h index d01ea1a8..eb652aa8 100644 --- a/src/videoframe.h +++ b/src/videoframe.h @@ -57,6 +57,7 @@ typedef struct videoframe struct param_set_map* alf_param_set_map; int32_t poc; //!< \brief Picture order count + vector2d_t* hmvp_lut; //!< \brief Look-up table for HMVP, one for each LCU row bool source_lmcs_mapped; //!< \brief Indicate if source_lmcs is available and mapped to LMCS bool lmcs_top_level; //!< \brief Indicate that in this level the LMCS images are allocated