mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 11:24:05 +00:00
Permit negative QP deltas in ROI
Delta QPs should not be arbitrarily restricted to positive values.
This commit is contained in:
parent
edfbd6f122
commit
79cb3a2fd3
|
@ -1021,7 +1021,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
|||
}
|
||||
|
||||
const unsigned size = width * height;
|
||||
uint8_t *dqp_array = calloc((size_t)size, sizeof(cfg->roi.dqps[0]));
|
||||
int8_t *dqp_array = calloc((size_t)size, sizeof(cfg->roi.dqps[0]));
|
||||
if (!dqp_array) {
|
||||
fprintf(stderr, "Failed to allocate memory for ROI table.\n");
|
||||
fclose(f);
|
||||
|
@ -1040,7 +1040,7 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
|||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
dqp_array[i] = (uint8_t)number;
|
||||
dqp_array[i] = CLIP(-51, 51, number);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
|
|
@ -335,7 +335,7 @@ typedef struct kvz_config
|
|||
struct {
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
uint8_t *dqps;
|
||||
int8_t *dqps;
|
||||
} roi; /*!< \since 3.14.0 \brief Map of delta QPs for region of interest coding. */
|
||||
|
||||
unsigned slices; /*!< \since 3.15.0 \brief How to map slices to frame. */
|
||||
|
|
|
@ -291,7 +291,7 @@ void kvz_set_lcu_lambda_and_qp(encoder_state_t * const state,
|
|||
};
|
||||
int roi_index = roi.x + roi.y * ctrl->cfg.roi.width;
|
||||
int dqp = ctrl->cfg.roi.dqps[roi_index];
|
||||
state->qp = state->frame->QP + dqp;
|
||||
state->qp = CLIP(0, 51, state->frame->QP + dqp);
|
||||
state->lambda = qp_to_lamba(state, state->qp);
|
||||
state->lambda_sqrt = sqrt(state->frame->lambda);
|
||||
|
||||
|
|
Loading…
Reference in a new issue