mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Change: vaq requires parameter. Parameter defines vaq strength ex. 15 == 1.5
This commit is contained in:
parent
bf1b2c1e22
commit
be2f420d61
|
@ -138,7 +138,7 @@ int kvz_config_init(kvz_config *cfg)
|
||||||
|
|
||||||
cfg->me_max_steps = (uint32_t)-1;
|
cfg->me_max_steps = (uint32_t)-1;
|
||||||
|
|
||||||
cfg->vaq = false;
|
cfg->vaq = 0;
|
||||||
|
|
||||||
cfg->scaling_list = KVZ_SCALING_LIST_OFF;
|
cfg->scaling_list = KVZ_SCALING_LIST_OFF;
|
||||||
|
|
||||||
|
@ -1250,7 +1250,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
else if (OPT("fast-residual-cost"))
|
else if (OPT("fast-residual-cost"))
|
||||||
cfg->fast_residual_cost_limit = atoi(value);
|
cfg->fast_residual_cost_limit = atoi(value);
|
||||||
else if (OPT("vaq")) {
|
else if (OPT("vaq")) {
|
||||||
cfg->vaq = (bool)atobool(value);
|
cfg->vaq = (int)atoi(value);
|
||||||
}
|
}
|
||||||
else if (OPT("max-merge")) {
|
else if (OPT("max-merge")) {
|
||||||
int max_merge = atoi(value);
|
int max_merge = atoi(value);
|
||||||
|
@ -1396,6 +1396,11 @@ int kvz_config_validate(const kvz_config *const cfg)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
if (cfg->vaq < 0) {
|
||||||
|
fprintf(stderr, "vaq strength must be positive\n");
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (cfg->width <= 0) {
|
if (cfg->width <= 0) {
|
||||||
fprintf(stderr, "Input error: width must be positive\n");
|
fprintf(stderr, "Input error: width must be positive\n");
|
||||||
error = 1;
|
error = 1;
|
||||||
|
|
|
@ -133,7 +133,7 @@ static const struct option long_options[] = {
|
||||||
{ "set-qp-in-cu", no_argument, NULL, 0 },
|
{ "set-qp-in-cu", no_argument, NULL, 0 },
|
||||||
{ "open-gop", no_argument, NULL, 0 },
|
{ "open-gop", no_argument, NULL, 0 },
|
||||||
{ "no-open-gop", no_argument, NULL, 0 },
|
{ "no-open-gop", no_argument, NULL, 0 },
|
||||||
{ "vaq", no_argument, NULL, 0 },
|
{ "vaq", required_argument, NULL, 0 },
|
||||||
{ "no-vaq", no_argument, NULL, 0 },
|
{ "no-vaq", no_argument, NULL, 0 },
|
||||||
{ "scaling-list", required_argument, NULL, 0 },
|
{ "scaling-list", required_argument, NULL, 0 },
|
||||||
{ "max-merge", required_argument, NULL, 0 },
|
{ "max-merge", required_argument, NULL, 0 },
|
||||||
|
|
|
@ -1215,11 +1215,6 @@ static double pixel_var(kvz_pixel * const arr, const uint32_t len) {
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vaq strength
|
|
||||||
#ifndef VAQ_STRENGTH
|
|
||||||
# define VAQ_STRENGTH 1.5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_picture* frame) {
|
static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_picture* frame) {
|
||||||
assert(state->type == ENCODER_STATE_TYPE_MAIN);
|
assert(state->type == ENCODER_STATE_TYPE_MAIN);
|
||||||
|
|
||||||
|
@ -1235,7 +1230,7 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict
|
||||||
|
|
||||||
// Variance adaptive quantization
|
// Variance adaptive quantization
|
||||||
if (cfg->vaq) {
|
if (cfg->vaq) {
|
||||||
double d = VAQ_STRENGTH; // Empirically decided constant. Affects delta-QP strength
|
double d = cfg->vaq * 0.1; // Empirically decided constant. Affects delta-QP strength
|
||||||
|
|
||||||
// Calculate frame pixel variance
|
// Calculate frame pixel variance
|
||||||
uint32_t len = state->tile->frame->width * state->tile->frame->height;
|
uint32_t len = state->tile->frame->width * state->tile->frame->height;
|
||||||
|
|
Loading…
Reference in a new issue