mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Merge branch 'intra_qp_offset_auto' into 'master'
Add auto option to intra-qp-offset See merge request TIE/ultravideo/kvazaar!7
This commit is contained in:
commit
cb0c7b23b5
|
@ -119,7 +119,10 @@ Video structure:
|
||||||
- 16: B-frame pyramid of length 16
|
- 16: B-frame pyramid of length 16
|
||||||
- lp-<string>: Low-delay P/B-frame GOP
|
- lp-<string>: Low-delay P/B-frame GOP
|
||||||
(e.g. lp-g8d4t2, see README)
|
(e.g. lp-g8d4t2, see README)
|
||||||
--intra-qp-offset <int>: QP offset for intra frames [-51..51] [0]
|
--intra-qp-offset <int>: QP offset for intra frames [-51..51] [auto]
|
||||||
|
- N: Set QP offset to N.
|
||||||
|
- auto: Select offset automatically based
|
||||||
|
on GOP length.
|
||||||
--(no-)open-gop : Use open GOP configuration. [enabled]
|
--(no-)open-gop : Use open GOP configuration. [enabled]
|
||||||
--cqmfile <filename> : Read custom quantization matrices from a file.
|
--cqmfile <filename> : Read custom quantization matrices from a file.
|
||||||
--scaling-list <string>: Set scaling list mode. [off]
|
--scaling-list <string>: Set scaling list mode. [off]
|
||||||
|
@ -335,7 +338,6 @@ where the names have been abbreviated to fit the layout in GitHub.
|
||||||
| pu-depth-inter | 2-3 | 2-3 | 1-3 | 1-3 | 1-3 | 0-3 | 0-3 | 0-3 | 0-3 | 0-3 |
|
| pu-depth-inter | 2-3 | 2-3 | 1-3 | 1-3 | 1-3 | 0-3 | 0-3 | 0-3 | 0-3 | 0-3 |
|
||||||
| me | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | tz | tz |
|
| me | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | tz | tz |
|
||||||
| gop | g4d4t1| g4d4t1| g4d4t1| g4d4t1| g4d4t1| 8 | 8 | 8 | 16 | 16 |
|
| gop | g4d4t1| g4d4t1| g4d4t1| g4d4t1| g4d4t1| 8 | 8 | 8 | 16 | 16 |
|
||||||
| intra-qp-offset | 0 | 0 | 0 | 0 | 0 | -2 | -2 | -2 | -3 | -3 |
|
|
||||||
| ref | 1 | 1 | 1 | 1 | 2 | 4 | 4 | 4 | 4 | 4 |
|
| ref | 1 | 1 | 1 | 1 | 2 | 4 | 4 | 4 | 4 | 4 |
|
||||||
| bipred | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
|
| bipred | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
|
||||||
| deblock | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
|
| deblock | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
|
||||||
|
|
|
@ -22,7 +22,7 @@ AC_CONFIG_SRCDIR([src/encmain.c])
|
||||||
# - Increment when making new releases and major or minor was not changed since last release.
|
# - Increment when making new releases and major or minor was not changed since last release.
|
||||||
#
|
#
|
||||||
# Here is a somewhat sane guide to lib versioning: http://apr.apache.org/versioning.html
|
# Here is a somewhat sane guide to lib versioning: http://apr.apache.org/versioning.html
|
||||||
ver_major=5
|
ver_major=6
|
||||||
ver_minor=1
|
ver_minor=1
|
||||||
ver_release=0
|
ver_release=0
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,10 @@ GOP structure [lp\-g4d3t1]
|
||||||
\- lp\-<string>: Low\-delay P/B\-frame GOP
|
\- lp\-<string>: Low\-delay P/B\-frame GOP
|
||||||
(e.g. lp\-g8d4t2, see README)
|
(e.g. lp\-g8d4t2, see README)
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-intra\-qp\-offset <int>: QP offset for intra frames [\-51..51] [0]
|
\fB\-\-intra\-qp\-offset <int>: QP offset for intra frames [\-51..51] [auto]
|
||||||
|
\- N: Set QP offset to N.
|
||||||
|
\- auto: Select offset automatically based
|
||||||
|
on GOP length.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-(no\-)open\-gop
|
\fB\-\-(no\-)open\-gop
|
||||||
Use open GOP configuration. [enabled]
|
Use open GOP configuration. [enabled]
|
||||||
|
|
19
src/cfg.c
19
src/cfg.c
|
@ -42,6 +42,7 @@ int kvz_config_init(kvz_config *cfg)
|
||||||
cfg->framerate_denom = 1;
|
cfg->framerate_denom = 1;
|
||||||
cfg->qp = 22;
|
cfg->qp = 22;
|
||||||
cfg->intra_qp_offset = 0;
|
cfg->intra_qp_offset = 0;
|
||||||
|
cfg->intra_qp_offset_auto = true;
|
||||||
cfg->intra_period = 64;
|
cfg->intra_period = 64;
|
||||||
cfg->vps_period = 0;
|
cfg->vps_period = 0;
|
||||||
cfg->deblock_enable = 1;
|
cfg->deblock_enable = 1;
|
||||||
|
@ -441,7 +442,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
static const char * const scaling_list_names[] = { "off", "custom", "default", NULL };
|
static const char * const scaling_list_names[] = { "off", "custom", "default", NULL };
|
||||||
|
|
||||||
static const char * const rc_algorithm_names[] = { "no-rc", "lambda", "oba", NULL };
|
static const char * const rc_algorithm_names[] = { "no-rc", "lambda", "oba", NULL };
|
||||||
static const char * const preset_values[11][26*2] = {
|
static const char * const preset_values[11][25*2] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"ultrafast",
|
"ultrafast",
|
||||||
|
@ -450,7 +451,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "2-3",
|
"pu-depth-inter", "2-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "lp-g4d4t1",
|
"gop", "lp-g4d4t1",
|
||||||
"intra-qp-offset", "0",
|
|
||||||
"ref", "1",
|
"ref", "1",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -479,7 +479,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "2-3",
|
"pu-depth-inter", "2-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "lp-g4d4t1",
|
"gop", "lp-g4d4t1",
|
||||||
"intra-qp-offset", "0",
|
|
||||||
"ref", "1",
|
"ref", "1",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -508,7 +507,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "1-3",
|
"pu-depth-inter", "1-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "lp-g4d4t1",
|
"gop", "lp-g4d4t1",
|
||||||
"intra-qp-offset", "0",
|
|
||||||
"ref", "1",
|
"ref", "1",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -537,7 +535,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "1-3",
|
"pu-depth-inter", "1-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "lp-g4d4t1",
|
"gop", "lp-g4d4t1",
|
||||||
"intra-qp-offset", "0",
|
|
||||||
"ref", "1",
|
"ref", "1",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -566,7 +563,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "1-3",
|
"pu-depth-inter", "1-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "lp-g4d4t1",
|
"gop", "lp-g4d4t1",
|
||||||
"intra-qp-offset", "0",
|
|
||||||
"ref", "2",
|
"ref", "2",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -595,7 +591,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "0-3",
|
"pu-depth-inter", "0-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "8",
|
"gop", "8",
|
||||||
"intra-qp-offset", "-2",
|
|
||||||
"ref", "4",
|
"ref", "4",
|
||||||
"bipred", "0",
|
"bipred", "0",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -624,7 +619,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "0-3",
|
"pu-depth-inter", "0-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "8",
|
"gop", "8",
|
||||||
"intra-qp-offset", "-2",
|
|
||||||
"ref", "4",
|
"ref", "4",
|
||||||
"bipred", "1",
|
"bipred", "1",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -653,7 +647,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "0-3",
|
"pu-depth-inter", "0-3",
|
||||||
"me", "hexbs",
|
"me", "hexbs",
|
||||||
"gop", "8",
|
"gop", "8",
|
||||||
"intra-qp-offset", "-2",
|
|
||||||
"ref", "4",
|
"ref", "4",
|
||||||
"bipred", "1",
|
"bipred", "1",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -682,7 +675,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "0-3",
|
"pu-depth-inter", "0-3",
|
||||||
"me", "tz",
|
"me", "tz",
|
||||||
"gop", "16",
|
"gop", "16",
|
||||||
"intra-qp-offset", "-3",
|
|
||||||
"ref", "4",
|
"ref", "4",
|
||||||
"bipred", "1",
|
"bipred", "1",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -711,7 +703,6 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
"pu-depth-inter", "0-3",
|
"pu-depth-inter", "0-3",
|
||||||
"me", "tz",
|
"me", "tz",
|
||||||
"gop", "16",
|
"gop", "16",
|
||||||
"intra-qp-offset", "-3",
|
|
||||||
"ref", "4",
|
"ref", "4",
|
||||||
"bipred", "1",
|
"bipred", "1",
|
||||||
"deblock", "0:0",
|
"deblock", "0:0",
|
||||||
|
@ -1024,6 +1015,12 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
}
|
}
|
||||||
else if OPT("intra-qp-offset") {
|
else if OPT("intra-qp-offset") {
|
||||||
cfg->intra_qp_offset = atoi(value);
|
cfg->intra_qp_offset = atoi(value);
|
||||||
|
if( cfg->intra_qp_offset == 0 && !strcmp( value, "auto" ) )
|
||||||
|
{
|
||||||
|
cfg->intra_qp_offset_auto = true;
|
||||||
|
} else {
|
||||||
|
cfg->intra_qp_offset_auto = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if OPT("open-gop") {
|
else if OPT("open-gop") {
|
||||||
cfg->open_gop = (bool)atobool(value);
|
cfg->open_gop = (bool)atobool(value);
|
||||||
|
|
|
@ -412,7 +412,10 @@ void print_help(void)
|
||||||
" - 16: B-frame pyramid of length 16\n"
|
" - 16: B-frame pyramid of length 16\n"
|
||||||
" - lp-<string>: Low-delay P/B-frame GOP\n"
|
" - lp-<string>: Low-delay P/B-frame GOP\n"
|
||||||
" (e.g. lp-g8d4t2, see README)\n"
|
" (e.g. lp-g8d4t2, see README)\n"
|
||||||
" --intra-qp-offset <int>: QP offset for intra frames [-51..51] [0]\n"
|
" --intra-qp-offset <int>: QP offset for intra frames [-51..51] [auto]\n"
|
||||||
|
" - N: Set QP offset to N.\n"
|
||||||
|
" - auto: Select offset automatically based\n"
|
||||||
|
" on GOP length.\n"
|
||||||
" --(no-)open-gop : Use open GOP configuration. [enabled]\n"
|
" --(no-)open-gop : Use open GOP configuration. [enabled]\n"
|
||||||
" --cqmfile <filename> : Read custom quantization matrices from a file.\n"
|
" --cqmfile <filename> : Read custom quantization matrices from a file.\n"
|
||||||
" --scaling-list <string>: Set scaling list mode. [off]\n"
|
" --scaling-list <string>: Set scaling list mode. [off]\n"
|
||||||
|
|
|
@ -243,6 +243,10 @@ encoder_control_t* kvz_encoder_control_init(const kvz_config *const cfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( encoder->cfg.intra_qp_offset_auto ) {
|
||||||
|
encoder->cfg.intra_qp_offset = encoder->cfg.gop_len > 1 ? -kvz_math_ceil_log2( encoder->cfg.gop_len ) + 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Disable GOP and QP offset for all-intra coding
|
// Disable GOP and QP offset for all-intra coding
|
||||||
if (encoder->cfg.intra_period == 1) {
|
if (encoder->cfg.intra_period == 1) {
|
||||||
encoder->cfg.gop_len = 0;
|
encoder->cfg.gop_len = 0;
|
||||||
|
|
|
@ -387,6 +387,8 @@ typedef struct kvz_config
|
||||||
|
|
||||||
/** \brief Offset to add to QP for intra frames */
|
/** \brief Offset to add to QP for intra frames */
|
||||||
int8_t intra_qp_offset;
|
int8_t intra_qp_offset;
|
||||||
|
/** \brief Select intra QP Offset based on GOP length */
|
||||||
|
uint8_t intra_qp_offset_auto;
|
||||||
|
|
||||||
/** \brief Minimum QP that uses CABAC for residual cost instead of a fast estimate. */
|
/** \brief Minimum QP that uses CABAC for residual cost instead of a fast estimate. */
|
||||||
int8_t fast_residual_cost_limit;
|
int8_t fast_residual_cost_limit;
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
race:kvz_eight_tap_filter_hor_8x1_avx2
|
race:kvz_eight_tap_filter_hor_8x1_avx2
|
||||||
|
race:kvz_filter_hpel_blocks_hor_ver_luma_avx2
|
||||||
|
race:kvz_eight_tap_filter_hor_avx2
|
Loading…
Reference in a new issue