re-enable static qp encoding and lambda rc

This commit is contained in:
Joose Sainio 2019-11-19 13:45:58 +02:00
parent 57e5615ece
commit 50d410a316
2 changed files with 27 additions and 6 deletions

View file

@ -616,8 +616,17 @@ static void encoder_state_worker_encode_lcu(void * opaque)
const encoder_control_t * const encoder = state->encoder_control;
videoframe_t* const frame = state->tile->frame;
//kvz_set_lcu_lambda_and_qp(state, lcu->position);
kvz_set_ctu_qp_lambda(state, lcu->position);
switch (encoder->cfg.rc_algorithm) {
case KVZ_NO_RC:
case KVZ_LAMBDA:
kvz_set_lcu_lambda_and_qp(state, lcu->position);
break;
case KVZ_OBA:
kvz_set_ctu_qp_lambda(state, lcu->position);
break;
default:
assert(0);
}
lcu_coeff_t coeff;
state->coeff = &coeff;
@ -1306,9 +1315,19 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict
normalize_lcu_weights(state);
}
state->frame->cur_frame_bits_coded = 0;
// kvz_set_picture_lambda_and_qp(state);
kvz_estimate_pic_lambda(state);
switch (state->encoder_control->cfg.rc_algorithm) {
case KVZ_NO_RC:
case KVZ_LAMBDA:
kvz_set_picture_lambda_and_qp(state);
break;
case KVZ_OBA:
kvz_estimate_pic_lambda(state);
break;
default:
assert(0);
}
encoder_state_init_children(state);
}

View file

@ -938,10 +938,12 @@ void kvz_search_lcu(encoder_state_t * const state, const int x, const int y, con
}
// Start search from depth 0.
search_cu(state, x, y, 0, work_tree);
double cost = search_cu(state, x, y, 0, work_tree);
// Save squared cost for rate control.
// kvz_get_lcu_stats(state, x / LCU_WIDTH, y / LCU_WIDTH)->weight = cost * cost;
if(state->encoder_control->cfg.rc_algorithm == KVZ_LAMBDA) {
kvz_get_lcu_stats(state, x / LCU_WIDTH, y / LCU_WIDTH)->weight = cost * cost;
}
// The best decisions through out the LCU got propagated back to depth 0,
// so copy those back to the frame.