Skip to content

Commit

Permalink
Add a cli option to control whether intra cus are tried to combine on…
Browse files Browse the repository at this point in the history
… the lower depth when search for said depth is disabled
  • Loading branch information
Jovasa committed Dec 2, 2021
1 parent 9e40f43 commit f1f0033
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ int kvz_config_init(kvz_config *cfg)
cfg->fastrd_sampling_on = 0;
cfg->fastrd_accuracy_check_on = 0;
cfg->fastrd_learning_outdir_fn = NULL;

cfg->combine_intra_cus = 1;
return 1;
}

Expand Down Expand Up @@ -1421,6 +1423,9 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
else if OPT("stats-file-prefix") {
cfg->stats_file_prefix = strdup(value);
}
else if OPT("combine-intra-cus") {
cfg->combine_intra_cus = atobool(value);
}
else {
return 0;
}
Expand Down
8 changes: 8 additions & 0 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ static const struct option long_options[] = {
{ "fastrd-sampling", no_argument, NULL, 0 },
{ "fastrd-accuracy-check", no_argument, NULL, 0 },
{ "fastrd-outdir", required_argument, NULL, 0 },
{ "combine-intra-cus", no_argument, NULL, 0 },
{ "no-combine-intra-cus", no_argument, NULL, 0 },
{0, 0, 0, 0}
};

Expand Down Expand Up @@ -578,6 +580,12 @@ 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"
" --(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"
" be disabled if cus absolutely must not\n"
" be larger than limited by the search.\n"
" [enabled]"
" --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"
Expand Down
3 changes: 3 additions & 0 deletions src/kvazaar.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ typedef struct kvz_config

char *fastrd_learning_outdir_fn;

/** \brief whether to try combining intra cus at the lower depth when search
* is not performed at said depth*/
uint8_t combine_intra_cus;
} kvz_config;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,8 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
// gets used, at least in the most obvious cases, while avoiding any
// searching.
if (cur_cu->type == CU_NOTSET && depth < MAX_PU_DEPTH
&& x + cu_width <= frame->width && y + cu_width <= frame->height)
&& x + cu_width <= frame->width && y + cu_width <= frame->height
&& state->encoder_control->cfg.combine_intra_cus)
{
cu_info_t *cu_d1 = LCU_GET_CU_AT_PX(&work_tree[depth + 1], x_local, y_local);

Expand Down

0 comments on commit f1f0033

Please sign in to comment.