[DepQuant] WPP: API

This commit is contained in:
Joose Sainio 2023-01-11 10:12:59 +02:00 committed by Marko Viitanen
parent f8994a7fae
commit bfa699fac6
4 changed files with 14 additions and 4 deletions

View file

@ -242,6 +242,7 @@ int uvg_config_init(uvg_config *cfg)
cfg->ibc = 0;
cfg->dep_quant = 0;
return 1;
}
@ -1551,6 +1552,9 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
}
cfg->ibc = (uint8_t)ibc_value;
}
else if OPT("dep-quant") {
cfg->dep_quant = (bool)atobool(value);
}
else {
return 0;
}

View file

@ -199,6 +199,8 @@ static const struct option long_options[] = {
{"max_tt_size", required_argument, NULL, 0 },
{ "intra-rough-granularity",required_argument, NULL, 0 },
{ "ibc", required_argument, NULL, 0 },
{ "dep-quant", no_argument, NULL, 0 },
{ "no-dep-quant", no_argument, NULL, 0 },
{0, 0, 0, 0}
};
@ -577,6 +579,7 @@ void print_help(void)
" - full: Full ALF\n"
" --(no-)rdoq : Rate-distortion optimized quantization [enabled]\n"
" --(no-)rdoq-skip : Skip RDOQ for 4x4 blocks. [disabled]\n"
" --(no-)dep-quant : Use dependent quantization. [disabled]\n"
" --(no-)signhide : Sign hiding [disabled]\n"
" --rd <integer> : Intra mode search complexity [0]\n"
" - 0: Skip intra if inter is good enough.\n"

View file

@ -689,7 +689,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream,
WRITE_U(stream, 0, 1, "scaling_list_enabled_flag");
WRITE_U(stream, 0, 1, "pic_dep_quant_enabled_flag");
WRITE_U(stream, encoder->cfg.dep_quant, 1, "pic_dep_quant_enabled_flag");
WRITE_U(stream, encoder->cfg.signhide_enable, 1, "pic_sign_data_hiding_enabled_flag");
@ -1358,11 +1358,14 @@ void uvg_encoder_state_write_bitstream_slice_header(
}
// ToDo: depquant
if (encoder->cfg.dep_quant) {
WRITE_U(stream, 1, 1, "sh_dep_quant_used_flag");
}
if (state->encoder_control->cfg.signhide_enable) {
if (state->encoder_control->cfg.signhide_enable && !encoder->cfg.dep_quant) {
WRITE_U(stream, 1, 1, "sh_sign_data_hiding_used_flag");
}
if (state->encoder_control->cfg.trskip_enable && !state->encoder_control->cfg.signhide_enable /* && !cfg.dep_quant*/)
if (state->encoder_control->cfg.trskip_enable && !state->encoder_control->cfg.signhide_enable && !encoder->cfg.dep_quant)
{
// TODO: find out what this is actually about and parametrize it
WRITE_U(stream, 0, 1, "sh_ts_residual_coding_disabled_flag");

View file

@ -302,7 +302,7 @@ void uvg_encode_coeff_nxn_generic(encoder_state_t * const state,
uint32_t num_signs = num_non_zero;
if (state->encoder_control->cfg.signhide_enable && (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4)) {
if (state->encoder_control->cfg.signhide_enable && !state->encoder_control->cfg.dep_quant && (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4)) {
num_signs--;
coeff_signs >>= 1;
}