[inter] Fix max-merge usage

This commit is contained in:
Marko Viitanen 2021-10-25 11:25:23 +03:00
parent 6e120ef5b4
commit 08766c0bb3
3 changed files with 17 additions and 17 deletions

View file

@ -156,7 +156,7 @@ int kvz_config_init(kvz_config *cfg)
cfg->scaling_list = KVZ_SCALING_LIST_OFF;
cfg->max_merge = 5;
cfg->max_merge = 6;
cfg->early_skip = true;
cfg->intra_smoothing_disabled = false;
@ -575,7 +575,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "28",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -603,7 +603,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "28",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -631,7 +631,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "28",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -659,7 +659,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -687,7 +687,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -715,7 +715,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -743,7 +743,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -771,7 +771,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -799,7 +799,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "1",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{
@ -827,7 +827,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
"intra-rdo-et", "0",
"early-skip", "0",
"fast-residual-cost", "0",
"max-merge", "5",
"max-merge", "6",
NULL
},
{ NULL }
@ -1393,8 +1393,8 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
}
else if (OPT("max-merge")) {
int max_merge = atoi(value);
if (max_merge < 1 || max_merge > 5) {
fprintf(stderr, "max-merge needs to be between 1 and 5\n");
if (max_merge < 1 || max_merge > 6) {
fprintf(stderr, "max-merge needs to be between 1 and 6\n");
return 0;
}
cfg->max_merge = (uint8_t)max_merge;

View file

@ -589,7 +589,7 @@ static void encode_inter_prediction_unit(encoder_state_t * const state,
int16_t num_cand = 0;
cabac->cur_ctx = &(cabac->ctx.cu_merge_flag_ext_model);
CABAC_BIN(cabac, cur_cu->merged, "MergeFlag");
num_cand = MRG_MAX_NUM_CANDS;
num_cand = state->encoder_control->cfg.max_merge;
if (cur_cu->merged) { //merge
if (num_cand > 1) {
int32_t ui;
@ -1263,7 +1263,7 @@ void kvz_encode_coding_tree(encoder_state_t * const state,
if (cur_cu->skipped) {
kvz_hmvp_add_mv(state, x, y, cu_width, cu_width, cur_cu);
int16_t num_cand = MRG_MAX_NUM_CANDS;
int16_t num_cand = state->encoder_control->cfg.max_merge;
if (num_cand > 1) {
for (int ui = 0; ui < num_cand - 1; ui++) {
int32_t symbol = (ui != cur_cu->merge_idx);

View file

@ -674,14 +674,14 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
WRITE_U(stream, 0, 1, "sps_mmvd_enabled_flag");
WRITE_UE(stream, 6 - MRG_MAX_NUM_CANDS, "six_minus_max_num_merge_cand");
WRITE_UE(stream, 6 - state->encoder_control->cfg.max_merge, "six_minus_max_num_merge_cand");
WRITE_U(stream, 0, 1, "sps_sbt_enabled_flag");
WRITE_U(stream, 0, 1, "sps_affine_enabled_flag");
WRITE_U(stream, 0, 1, "sps_bcw_enabled_flag");
WRITE_U(stream, 0, 1, "sps_ciip_enabled_flag");
if (MRG_MAX_NUM_CANDS >= 2)
if (state->encoder_control->cfg.max_merge >= 2)
{
WRITE_U(stream, 0, 1, "sps_gpm_enabled_flag");
}