Skip to content

Commit

Permalink
Merge branch 'release-prep' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovasa committed Sep 27, 2023
2 parents 1a1fea1 + 4a1cd92 commit 84580ae
Show file tree
Hide file tree
Showing 79 changed files with 23,536 additions and 3,663 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ file(GLOB LIB_SOURCES RELATIVE ${PROJECT_SOURCE_DIR} "src/*.h" "src/*.c")
list(REMOVE_ITEM LIB_SOURCES "src/encmain.c" "src/cli.c" "src/cli.h" "src/yuv_io.c" "src/yuv_io.h")

# Add also all the strategies
file(GLOB_RECURSE LIB_SOURCES_STRATEGIES RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/*.c")
file(GLOB_RECURSE LIB_SOURCES_STRATEGIES RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/*.h" "src/strategies/*.c")

# ToDo: do something with encode_coding_tree-avx2, currently not converted to VVC
list(REMOVE_ITEM LIB_SOURCES_STRATEGIES "src/strategies/avx2/encode_coding_tree-avx2.c")
Expand Down Expand Up @@ -340,6 +340,9 @@ if(NOT DEFINED MSVC)
if(NOT "test_external_symbols" IN_LIST XFAIL)
add_test( NAME test_external_symbols COMMAND ${PROJECT_SOURCE_DIR}/tests/test_external_symbols.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
endif()
if(NOT "test_mtt" IN_LIST XFAIL)
add_test( NAME test_mtt COMMAND ${PROJECT_SOURCE_DIR}/tests/test_mtt.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
endif()
if(NOT "test_intra" IN_LIST XFAIL)
add_test( NAME test_intra COMMAND ${PROJECT_SOURCE_DIR}/tests/test_intra.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests)
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/cabac.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ typedef struct
cabac_ctx_t mts_idx_model[4];
cabac_ctx_t split_flag_model[9]; //!< \brief split flag context models
cabac_ctx_t qt_split_flag_model[6]; //!< \brief qt split flag context models
cabac_ctx_t mtt_vertical_model[5];
cabac_ctx_t mtt_binary_model[4];
cabac_ctx_t intra_luma_mpm_flag_model; //!< \brief intra mode context models
cabac_ctx_t intra_subpart_model[2]; //!< \brief intra sub part context models
cabac_ctx_t chroma_pred_model;
Expand Down
100 changes: 80 additions & 20 deletions src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ int uvg_config_init(uvg_config *cfg)
cfg->trskip_max_size = 2; //Default to 4x4
cfg->mts = 0;
cfg->mts_implicit = 0;
cfg->tr_depth_intra = 0;
cfg->ime_algorithm = 0; /* hexbs */
cfg->fme_level = 4;
cfg->source_scan_type = 0; /* progressive */
Expand Down Expand Up @@ -207,6 +206,8 @@ int uvg_config_init(uvg_config *cfg)

cfg->lfnst = false;

cfg->isp = false;

parse_qp_map(cfg, 0);

cfg->jccr = 0;
Expand All @@ -221,10 +222,27 @@ int uvg_config_init(uvg_config *cfg)
cfg->cabac_debug_file_name = NULL;

cfg->dual_tree = 0;

cfg->min_qt_size[0] = 4;
cfg->min_qt_size[1] = 4;
cfg->min_qt_size[2] = 4;

cfg->max_btt_depth[0] = 0;
cfg->max_btt_depth[1] = 0;
cfg->max_btt_depth[2] = 0;

cfg->max_tt_size[0] = 64;
cfg->max_bt_size[0] = 64;
cfg->max_tt_size[1] = 64;
cfg->max_bt_size[1] = 64;
cfg->max_tt_size[2] = 64;
cfg->max_bt_size[2] = 64;

cfg->intra_rough_search_levels = 2;

cfg->ibc = 0;

cfg->dep_quant = 0;
return 1;
}

Expand Down Expand Up @@ -333,7 +351,7 @@ static int parse_tiles_specification(const char* const arg, int32_t * const ntil

return 1;
}
/*

static int parse_uint8(const char *numstr,uint8_t* number,int min, int max)
{
char *tail;
Expand All @@ -349,7 +367,7 @@ static int parse_uint8(const char *numstr,uint8_t* number,int min, int max)
return 1;
}
}
*/

static int parse_int8(const char *numstr,int8_t* number,int min, int max)
{
char *tail;
Expand All @@ -365,7 +383,7 @@ static int parse_int8(const char *numstr,int8_t* number,int min, int max)
return 1;
}
}
/*

static int parse_array(const char *array, uint8_t *coeff_key, int size,
int min, int max)
{
Expand All @@ -389,15 +407,15 @@ static int parse_array(const char *array, uint8_t *coeff_key, int size,
free(key);
return 0;
}
else if (i<size){
fprintf(stderr, "parsing failed : too few members.\n");
free(key);
return 0;
}
//else if (i<size){
// fprintf(stderr, "parsing failed : too few members.\n");
// free(key);
// return 0;
//}
free(key);
return 1;
return i;
}
*/


static int parse_qp_scale_array(const char *array, int8_t *out)
{
Expand Down Expand Up @@ -928,8 +946,6 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
cfg->mts = mts_type;
cfg->mts_implicit = (mts_type == UVG_MTS_IMPLICIT);
}
else if OPT("tr-depth-intra")
cfg->tr_depth_intra = atoi(value);
else if OPT("me") {
int8_t ime_algorithm = 0;
if (!parse_enum(value, me_names, &ime_algorithm)) return 0;
Expand Down Expand Up @@ -1454,6 +1470,9 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
else if OPT("lfnst") {
cfg->lfnst = atobool(value);
}
else if OPT("isp") {
cfg->isp = atobool(value);
}
else if OPT("jccr") {
cfg->jccr = (bool)atobool(value);
}
Expand All @@ -1479,6 +1498,49 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
else if OPT("dual-tree") {
cfg->dual_tree = atobool(value);
}
else if OPT("mtt-depth-intra") {
cfg->max_btt_depth[0] = atoi(value);
}
else if OPT("mtt-depth-intra-chroma") {
cfg->max_btt_depth[2] = atoi(value);
}
else if OPT("mtt-depth-inter") {
cfg->max_btt_depth[1] = atoi(value);
}
else if OPT("max-bt-size") {
uint8_t sizes[3];
const int got = parse_array(value, sizes, 3, 0, 128);
if (got == 1) {
cfg->max_bt_size[0] = sizes[0];
cfg->max_bt_size[1] = sizes[0];
cfg->max_bt_size[2] = sizes[0];
}
else if (got == 3) {
cfg->max_bt_size[0] = sizes[0];
cfg->max_bt_size[1] = sizes[1];
cfg->max_bt_size[2] = sizes[2];
} else {
fprintf(stderr, "Incorrect amount of values provided for max-bt-size\n");
return 0;
}
}
else if OPT("max-tt-size") {
uint8_t sizes[3];
const int got = parse_array(value, sizes, 3, 0, 128);
if (got == 1) {
cfg->max_tt_size[0] = sizes[0];
cfg->max_tt_size[1] = sizes[0];
cfg->max_tt_size[2] = sizes[0];
}
else if (got == 3) {
cfg->max_tt_size[0] = sizes[0];
cfg->max_tt_size[1] = sizes[1];
cfg->max_tt_size[2] = sizes[2];
} else {
fprintf(stderr, "Incorrect amount of values provided for max-tt-size\n");
return 0;
}
}
else if OPT("intra-rough-granularity") {
cfg->intra_rough_search_levels = atoi(value);
}
Expand All @@ -1489,7 +1551,11 @@ int uvg_config_parse(uvg_config *cfg, const char *name, const char *value)
return 0;
}
cfg->ibc = (uint8_t)ibc_value;
} else {
}
else if OPT("dep-quant") {
cfg->dep_quant = (bool)atobool(value);
}
else {
return 0;
}
#undef OPT
Expand Down Expand Up @@ -1681,12 +1747,6 @@ int uvg_config_validate(const uvg_config *const cfg)
error = 1;
}

if (cfg->tr_depth_intra < 0 || cfg->tr_depth_intra > 4) {
// range is 0 .. CtbLog2SizeY - Log2MinTrafoSize
fprintf(stderr, "Input error: --tr-depth-intra is out of range [0..4]\n");
error = 1;
}

if (cfg->fme_level != 0 && cfg->fme_level > 4) {
fprintf(stderr, "Input error: invalid --subme parameter (must be in range 0-4)\n");
error = 1;
Expand Down
39 changes: 33 additions & 6 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static const struct option long_options[] = {
{ "tr-skip-max-size", required_argument, NULL, 0 },
{ "mts", required_argument, NULL, 0 },
{ "no-mts", no_argument, NULL, 0 },
{ "tr-depth-intra", required_argument, NULL, 0 },
{ "me", required_argument, NULL, 0 },
{ "subme", required_argument, NULL, 0 },
{ "source-scan-type", required_argument, NULL, 0 },
Expand Down Expand Up @@ -178,6 +177,8 @@ static const struct option long_options[] = {
{ "no-mip", no_argument, NULL, 0 },
{ "lfnst", no_argument, NULL, 0 },
{ "no-lfnst", no_argument, NULL, 0 },
{ "isp", no_argument, NULL, 0 },
{ "no-isp", no_argument, NULL, 0 },
{ "jccr", no_argument, NULL, 0 },
{ "no-jccr", no_argument, NULL, 0 },
{ "amvr", no_argument, NULL, 0 },
Expand All @@ -191,8 +192,15 @@ static const struct option long_options[] = {
{ "dual-tree", no_argument, NULL, 0 },
{ "no-dual-tree", no_argument, NULL, 0 },
{ "cabac-debug-file", required_argument, NULL, 0 },
{ "mtt-depth-intra", required_argument, NULL, 0 },
{ "mtt-depth-inter", required_argument, NULL, 0 },
{ "mtt-depth-intra-chroma", required_argument, NULL, 0 },
{ "max-bt-size", required_argument, NULL, 0 },
{ "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}
};

Expand Down Expand Up @@ -571,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"
Expand Down Expand Up @@ -602,21 +611,37 @@ void print_help(void)
" - 2: + 1/2-pixel diagonal\n"
" - 3: + 1/4-pixel horizontal and vertical\n"
" - 4: + 1/4-pixel diagonal\n"
" --pu-depth-inter <int>-<int> : Inter prediction units sizes [0-3]\n"
" - 0, 1, 2, 3: from 64x64 to 8x8\n"
" --pu-depth-inter <int>-<int> : Maximum and minimum split depths where\n"
" inter search is performed 0..8. [0-3]\n"
" - Accepts a list of values separated by ','\n"
" for setting separate depths per GOP layer\n"
" (values can be omitted to use the first\n"
" value for the respective layer).\n"
" --pu-depth-intra <int>-<int> : Intra prediction units sizes [1-4]\n"
" - 0, 1, 2, 3, 4: from 64x64 to 4x4\n"
" --pu-depth-intra <int>-<int> : Maximum and minimum split depths where\n"
" intra search is performed 0..8. [1-4]\n"
" - Accepts a list of values separated by ','\n"
" for setting separate depths per GOP layer\n"
" (values can be omitted to use the first\n"
" value for the respective layer).\n"
" --ml-pu-depth-intra : Predict the pu-depth-intra using machine\n"
" learning trees, overrides the\n"
" --pu-depth-intra parameter. [disabled]\n"
" --mtt-depth-intra : Depth of mtt for intra slices 0..3.[0]\n"
" --mtt-depth-intra-chroma : Depth of mtt for chroma dual tree in\n"
" intra slices 0..3.[0]\n"
" --mtt-depth-inter : Depth of mtt for inter slices 0..3.[0]\n"
" All MTTs are currently experimental and\n"
" require disabling some avx2 optimizations.\n"
" --max-bt-size : maximum size for a CU resulting from\n"
" a bt split. A singular value shared for all\n"
" or a list of three values for the different\n"
" slices types (intra, inter, intra-chroma)\n"
" can be provided. [64, 64, 32]\n"
" --max-tt-size : maximum size for a CU resulting from\n"
" a tt split. A singular value shared for all\n"
" or a list of three values for the different\n"
" slices types (intra, inter, intra-chroma)\n"
" can be provided. [64, 64, 32]\n"
" --intra-rough-granularity : How many levels are used for the\n"
" logarithmic intra rough search. 0..4\n"
" With 0 all of the modes are checked \n"
Expand All @@ -634,7 +659,6 @@ void print_help(void)
" This is mostly for debugging and is not\n"
" guaranteed to produce sensible bitstream or\n"
" work at all. [disabled]\n"
" --tr-depth-intra <int> : Transform split depth for intra blocks [0]\n"
" --(no-)bipred : Bi-prediction [disabled]\n"
" --cu-split-termination <string> : CU split search termination [zero]\n"
" - off: Don't terminate early.\n"
Expand Down Expand Up @@ -671,6 +695,9 @@ void print_help(void)
" --(no-)mip : Enable matrix weighted intra prediction.\n"
" --(no-)lfnst : Enable low frequency non-separable transform.\n"
" [disabled]\n"
" --(no-)isp : Enable intra sub partitions. [disabled]\n"
" Experimental, requires disabling some avx2\n"
" optimizations.\n"
" --mts <string> : Multiple Transform Selection [off].\n"
" (Currently only implemented for intra\n"
" and has effect only when rd >= 2)\n"
Expand Down
Loading

0 comments on commit 84580ae

Please sign in to comment.