diff --git a/src/rate_control.c b/src/rate_control.c index cbf79b64..bf1d1e3d 100644 --- a/src/rate_control.c +++ b/src/rate_control.c @@ -333,13 +333,13 @@ void kvz_set_lcu_lambda_and_qp(encoder_state_t * const state, pos.y + state->tile->lcu_offset_y }; int id = lcu.x + lcu.y * state->tile->frame->width_in_lcu; - int aq_offset = (int)state->frame->aq_offsets[id]; // TODO: Number stored in aq_offsets may need rounding + int aq_offset = round(state->frame->aq_offsets[id]); state->qp += aq_offset; // Maximum delta QP is clipped between [-26, 25] according to ITU T-REC-H.265 specification chapter 7.4.9.10 Transform unit semantics // Since this value will be later combined with qp_pred, clip to half of that instead to be safe state->qp = CLIP(state->frame->QP - 13, state->frame->QP + 12, state->qp); state->qp = CLIP_TO_QP(state->qp); - state->lambda = qp_to_lamba(state, state->qp); + state->lambda = qp_to_lambda(state, state->qp); state->lambda_sqrt = sqrt(state->lambda); } }