better early skip?

This commit is contained in:
Joose Sainio 2022-02-02 09:51:25 +02:00
parent c7174b25cf
commit 3ac17ffd95

View file

@ -1706,14 +1706,6 @@ static void search_pu_inter(encoder_state_t * const state,
double bits = merge_flag_cost + merge_idx + CTX_ENTROPY_FBITS(&(state->search_cabac.ctx.cu_merge_idx_ext_model), merge_idx != 0);
if(state->encoder_control->cfg.rdo >= 2 && cur_pu->part_size == SIZE_2Nx2N) {
kvz_cu_cost_inter_rd2(state, x, y, depth, &merge->unit[merge->size], lcu, &merge->cost[merge->size], &bits);
if(state->encoder_control->cfg.early_skip && merge->unit[merge->size].skipped) {
*cur_pu = merge->unit[merge->size];
merge->unit[0] = *cur_pu;
merge->size = 1;
merge->cost[0] = merge->cost[merge->size];
merge->bits[0] = bits;
return;
}
}
else {
merge->cost[merge->size] = kvz_satd_any_size(width, height,
@ -1737,9 +1729,16 @@ static void search_pu_inter(encoder_state_t * const state,
// Early Skip Mode Decision
bool has_chroma = state->encoder_control->chroma_format != KVZ_CSP_400;
if (cfg->early_skip && cur_pu->part_size == SIZE_2Nx2N && cfg->rdo < 2) {
if (cfg->early_skip && cur_pu->part_size == SIZE_2Nx2N) {
for (int merge_key = 0; merge_key < num_rdo_cands; ++merge_key) {
if(cfg->rdo >= 2 && merge->unit[merge->keys[merge_key]].skipped) {
merge->size = 1;
merge->bits[0] = merge->bits[merge->keys[merge_key]];
merge->cost[0] = merge->cost[merge->keys[merge_key]];
merge->unit[0] = merge->unit[merge->keys[merge_key]];
merge->keys[0] = 0;
}
else if(cfg->rdo < 2) {
// Reconstruct blocks with merge candidate.
// Check luma CBF. Then, check chroma CBFs if luma CBF is not set
// and chroma exists.
@ -1776,6 +1775,7 @@ static void search_pu_inter(encoder_state_t * const state,
}
}
}
}
// AMVP search starts here