Add option 'zero-coeff-rdo'

This commit is contained in:
Ari Lemmetti 2020-02-04 21:06:21 +02:00
parent 886ff36d12
commit 9a0236bb4e
7 changed files with 22 additions and 4 deletions

View file

@ -173,6 +173,8 @@ Compression tools:
chroma mode search.
--(no-)mv-rdo : Rate-distortion optimized motion vector costs
[disabled]
--(no-)zero-coeff-rdo : If a CU is set inter, check if forcing zero
residual improves the RD cost. [enabled]
--(no-)full-intra-search : Try all intra modes during rough search.
[disabled]
--(no-)transform-skip : Try transform skip [disabled]

View file

@ -23,7 +23,7 @@ AC_CONFIG_SRCDIR([src/encmain.c])
#
# Here is a somewhat sane guide to lib versioning: http://apr.apache.org/versioning.html
ver_major=4
ver_minor=2
ver_minor=3
ver_release=0
# Prevents configure from adding a lot of defines to the CFLAGS

View file

@ -1,4 +1,4 @@
.TH KVAZAAR "1" "January 2020" "kvazaar v1.3.0" "User Commands"
.TH KVAZAAR "1" "February 2020" "kvazaar v1.3.0" "User Commands"
.SH NAME
kvazaar \- open source HEVC encoder
.SH SYNOPSIS
@ -217,6 +217,10 @@ Intra mode search complexity [0]
Rate\-distortion optimized motion vector costs
[disabled]
.TP
\fB\-\-(no\-)zero\-coeff\-rdo
If a CU is set inter, check if forcing zero
residual improves the RD cost. [enabled]
.TP
\fB\-\-(no\-)full\-intra\-search
Try all intra modes during rough search.
[disabled]

View file

@ -147,6 +147,8 @@ int kvz_config_init(kvz_config *cfg)
cfg->partial_coding.startCTU_y = 0;
cfg->partial_coding.fullWidth = 0;
cfg->partial_coding.fullHeight = 0;
cfg->zero_coeff_rdo = true;
return 1;
}
@ -1284,6 +1286,9 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
cfg->partial_coding.fullWidth = fullWidth;
cfg->partial_coding.fullHeight = fullHeight;
}
else if OPT("zero-coeff-rdo") {
cfg->zero_coeff_rdo = (bool)atobool(value);
}
else {
return 0;
}

View file

@ -139,6 +139,8 @@ static const struct option long_options[] = {
{ "no-early-skip", no_argument, NULL, 0 },
{ "ml-pu-depth-intra", no_argument, NULL, 0 },
{ "partial-coding", required_argument, NULL, 0 },
{ "zero-coeff-rdo", no_argument, NULL, 0 },
{ "no-zero-coeff-rdo", no_argument, NULL, 0 },
{0, 0, 0, 0}
};
@ -459,6 +461,8 @@ void print_help(void)
" chroma mode search.\n"
" --(no-)mv-rdo : Rate-distortion optimized motion vector costs\n"
" [disabled]\n"
" --(no-)zero-coeff-rdo : If a CU is set inter, check if forcing zero\n"
" residual is improves the RD cost. [enabled]\n"
" --(no-)full-intra-search : Try all intra modes during rough search.\n"
" [disabled]\n"
" --(no-)transform-skip : Try transform skip [disabled]\n"

View file

@ -401,6 +401,9 @@ typedef struct kvz_config
uint16_t fullHeight;
} partial_coding;
/** \brief Always consider CU without any quantized residual */
uint8_t zero_coeff_rdo;
} kvz_config;
/**

View file

@ -625,7 +625,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
const bool has_chroma = state->encoder_control->chroma_format != KVZ_CSP_400;
kvz_inter_recon_cu(state, lcu, x, y, cu_width, true, has_chroma);
if (!ctrl->cfg.lossless && !ctrl->cfg.rdoq_enable) {
if (ctrl->cfg.zero_coeff_rdo && !ctrl->cfg.lossless && !ctrl->cfg.rdoq_enable) {
//Calculate cost for zero coeffs
inter_zero_coeff_cost = cu_zero_coeff_cost(state, work_tree, x, y, depth) + inter_bitcost * state->lambda;
@ -668,7 +668,7 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth,
cost += mode_bits * state->lambda;
if (inter_zero_coeff_cost <= cost) {
if (ctrl->cfg.zero_coeff_rdo && inter_zero_coeff_cost <= cost) {
cost = inter_zero_coeff_cost;
// Restore saved pixels from lower level of the working tree.