[cfg] Parameterize intra rough search granularity

This commit is contained in:
Joose Sainio 2022-09-28 08:49:38 +03:00
parent ed6a0528fe
commit e636db489f
4 changed files with 21 additions and 2 deletions

View file

@ -221,6 +221,7 @@ int uvg_config_init(uvg_config *cfg)
cfg->cabac_debug_file_name = NULL;
cfg->dual_tree = 0;
cfg->intra_rough_search_levels = 2;
return 1;
}
@ -1475,6 +1476,9 @@ 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("intra-rough-granularity") {
cfg->intra_rough_search_levels = atoi(value);
}
else {
return 0;
}
@ -1838,6 +1842,11 @@ int uvg_config_validate(const uvg_config *const cfg)
error = 1;
}
if(cfg->intra_rough_search_levels > 4) {
fprintf(stderr, "intra-rough-granularity must be between [0..4].\n");
error = 1;
}
return !error;
}

View file

@ -191,6 +191,7 @@ 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 },
{ "intra-rough-granularity",required_argument, NULL, 0 },
{0, 0, 0, 0}
};
@ -615,6 +616,13 @@ void print_help(void)
" --ml-pu-depth-intra : Predict the pu-depth-intra using machine\n"
" learning trees, overrides the\n"
" --pu-depth-intra parameter. [disabled]\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"
" in a single level, 1 checks every second\n"
" mode is checked on first level and then\n"
" second level checks the modes surrounding\n"
" the three best modes. [2]\n"
" --(no-)combine-intra-cus: Whether the encoder tries to code a cu\n"
" on lower depth even when search is not\n"
" performed on said depth. Should only\n"

View file

@ -1075,7 +1075,7 @@ static uint8_t search_intra_rough(
FILL(search_proxy, 0);
search_proxy.pred_cu = *pred_cu;
int offset = 8;
int offset = 1 << state->encoder_control->cfg.intra_rough_search_levels;
search_proxy.pred_cu.intra.mode = 0;
uvg_intra_predict(state, refs, &loc, COLOR_Y, preds[0], &search_proxy, NULL, UVG_LUMA_T);
search_proxy.pred_cu.intra.mode = 1;
@ -1123,7 +1123,7 @@ static uint8_t search_intra_rough(
best_six_modes[3].cost = MAX_DOUBLE;
best_six_modes[4].cost = MAX_DOUBLE;
best_six_modes[5].cost = MAX_DOUBLE;
for (int mode = 4; mode <= 66; mode += PARALLEL_BLKS * offset) {
for (int mode = 2 + offset / 2; mode <= 66; mode += PARALLEL_BLKS * offset) {
double costs_out[PARALLEL_BLKS] = { 0 };
for (int i = 0; i < PARALLEL_BLKS; ++i) {

View file

@ -541,6 +541,8 @@ typedef struct uvg_config
char* cabac_debug_file_name;
uint8_t dual_tree;
uint8_t intra_rough_search_levels;
} uvg_config;
/**