mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Moved cu split termination from a pre-processor to a input parameter.
This commit is contained in:
parent
2576aeee0b
commit
0d361d5bc7
|
@ -81,6 +81,8 @@ int kvz_config_init(kvz_config *cfg)
|
|||
cfg->target_bitrate = 0;
|
||||
cfg->hash = KVZ_HASH_CHECKSUM;
|
||||
|
||||
cfg->cu_split_termination = KVZ_CU_SPLIT_TERMINATION_ZERO;
|
||||
|
||||
cfg->tiles_width_count = 1;
|
||||
cfg->tiles_height_count = 1;
|
||||
cfg->tiles_width_split = NULL;
|
||||
|
@ -286,6 +288,8 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
|||
static const char * const mv_constraint_names[] = { "none", "frame", "tile", "frametile", "frametilemargin", NULL };
|
||||
static const char * const hash_names[] = { "none", "checksum", "md5", NULL };
|
||||
|
||||
static const char * const cu_split_termination_names[] = { "zero", "off", NULL };
|
||||
|
||||
static const char * const preset_values[11][28] = {
|
||||
{
|
||||
"ultrafast",
|
||||
|
@ -807,6 +811,8 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
else if OPT("cu-split-termination")
|
||||
parse_enum(value, cu_split_termination_names, cfg->cu_split_termination);
|
||||
else
|
||||
return 0;
|
||||
#undef OPT
|
||||
|
|
|
@ -105,6 +105,7 @@ static const struct option long_options[] = {
|
|||
{ "loop-input", no_argument, NULL, 0 },
|
||||
{ "mv-constraint", required_argument, NULL, 0 },
|
||||
{ "hash", required_argument, NULL, 0 },
|
||||
{"cu-split-termination",required_argument, NULL, 0 },
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -374,6 +375,10 @@ void print_help(void)
|
|||
" \"none\": no constraint\n"
|
||||
" \"checksum\": constrain within the tile\n"
|
||||
" \"md5\": constrain even more\n"
|
||||
" --cu-split-termination : Specify the cu split termination behaviour\n"
|
||||
" \"zero\": Terminate when splitting gives little\n"
|
||||
" improvement.\n"
|
||||
" \"off\": Don't terminate splitting early\n"
|
||||
"\n"
|
||||
" Video Usability Information:\n"
|
||||
" --sar <width:height> : Specify Sample Aspect Ratio\n"
|
||||
|
|
|
@ -125,6 +125,15 @@ enum kvz_hash
|
|||
KVZ_HASH_MD5 = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief cu split termination mode
|
||||
*/
|
||||
enum kvz_cu_split_termination
|
||||
{
|
||||
KVZ_CU_SPLIT_TERMINATION_ZERO = 0,
|
||||
KVZ_CU_SPLIT_TERMINATION_OFF = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief GoP picture configuration.
|
||||
*/
|
||||
|
@ -231,6 +240,9 @@ typedef struct kvz_config
|
|||
|
||||
enum kvz_mv_constraint mv_constraint; /*!< \since 3.3.0 \brief Constrain movement vectors. */
|
||||
enum kvz_hash hash; /*!< \since 3.5.0 \brief What hash algorithm to use. */
|
||||
|
||||
enum kvz_cu_split_termination cu_split_termination; /*!< \brief Mode of cu split termination. */
|
||||
|
||||
} kvz_config;
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,10 +48,7 @@
|
|||
# define INTRA_TRESHOLD 20
|
||||
#endif
|
||||
|
||||
// Disable early cu-split pruning.
|
||||
#ifndef FULL_CU_SPLIT_SEARCH
|
||||
# define FULL_CU_SPLIT_SEARCH false
|
||||
#endif
|
||||
|
||||
// Modify weight of luma SSD.
|
||||
#ifndef LUMA_MULT
|
||||
# define LUMA_MULT 0.8
|
||||
|
@ -697,7 +694,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
|
|||
// If skip mode was selected for the block, skip further search.
|
||||
// Skip mode means there's no coefficients in the block, so splitting
|
||||
// might not give any better results but takes more time to do.
|
||||
if (cur_cu->type == CU_NOTSET || cbf || FULL_CU_SPLIT_SEARCH) {
|
||||
if (cur_cu->type == CU_NOTSET || cbf || state->encoder_control->cfg->cu_split_termination == KVZ_CU_SPLIT_TERMINATION_OFF) {
|
||||
split_cost += search_cu(state, x, y, depth + 1, work_tree);
|
||||
split_cost += search_cu(state, x + half_cu, y, depth + 1, work_tree);
|
||||
split_cost += search_cu(state, x, y + half_cu, depth + 1, work_tree);
|
||||
|
|
Loading…
Reference in a new issue