From 544b59b7de490d4a24c18fc78ccd199c022000fe Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Mon, 8 Jul 2024 10:17:52 +0300 Subject: [PATCH] [api] Add new parameter "ref_wraparound" for motion vector wrapping --- src/cfg.c | 5 +++++ src/cli.c | 2 ++ src/encoder_state-bitstream.c | 2 +- src/uvg266.h | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cfg.c b/src/cfg.c index 5dfe3a83..5885e241 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -243,6 +243,9 @@ int uvg_config_init(uvg_config *cfg) cfg->ibc = 0; cfg->dep_quant = 0; + + cfg->ref_wraparound = 0; + return 1; } @@ -1624,6 +1627,8 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value) } else if OPT("dep-quant") { cfg->dep_quant = (bool)atobool(value); + } else if OPT ("ref-wraparound") { + cfg->ref_wraparound = (bool)atobool(value); } else { return 0; diff --git a/src/cli.c b/src/cli.c index 6e66f77e..00237503 100644 --- a/src/cli.c +++ b/src/cli.c @@ -201,6 +201,8 @@ static const struct option long_options[] = { { "ibc", required_argument, NULL, 0 }, { "dep-quant", no_argument, NULL, 0 }, { "no-dep-quant", no_argument, NULL, 0 }, + { "ref-wraparound", no_argument, NULL, 0 }, + { "no-ref-wraparound", no_argument, NULL, 0 }, {0, 0, 0, 0} }; diff --git a/src/encoder_state-bitstream.c b/src/encoder_state-bitstream.c index 2083e36f..59488197 100644 --- a/src/encoder_state-bitstream.c +++ b/src/encoder_state-bitstream.c @@ -612,7 +612,7 @@ static void encoder_state_write_bitstream_seq_parameter_set(bitstream_t* stream, WRITE_UE(stream, 0, "num_ref_pic_lists_in_sps[0]"); WRITE_UE(stream, 0, "num_ref_pic_lists_in_sps[0]"); - WRITE_U(stream, 0, 1, "sps_ref_wraparound_enabled_flag"); + WRITE_U(stream, encoder->cfg.ref_wraparound, 1, "sps_ref_wraparound_enabled_flag"); diff --git a/src/uvg266.h b/src/uvg266.h index c71a835a..b252bc73 100644 --- a/src/uvg266.h +++ b/src/uvg266.h @@ -553,6 +553,9 @@ typedef struct uvg_config uint8_t ibc; /* \brief Intra Block Copy parameter */ uint8_t dep_quant; + + uint8_t ref_wraparound; /* \brief MV reference wraparound */ + } uvg_config; /**