[cclm] Add bits to RD calculation

This commit is contained in:
Joose Sainio 2021-11-22 08:15:08 +02:00
parent 85ff5f23b1
commit 697d4c0652

View file

@ -825,8 +825,20 @@ double kvz_chroma_mode_bits(const encoder_state_t *state, int8_t chroma_mode, in
if (chroma_mode == luma_mode) { if (chroma_mode == luma_mode) {
mode_bits = CTX_ENTROPY_FBITS(ctx, 0); mode_bits = CTX_ENTROPY_FBITS(ctx, 0);
} else { } else {
if(chroma_mode > 67) {
mode_bits = 2.0 + CTX_ENTROPY_FBITS(ctx, 1); mode_bits = 2.0 + CTX_ENTROPY_FBITS(ctx, 1);
} }
else {
ctx = &(state->cabac.ctx.cclm_model);
mode_bits = CTX_ENTROPY_FBITS(ctx, chroma_mode != 81);
if (chroma_mode != 81) mode_bits += 1;
}
}
// Technically this is encoded first but for this method of counting bits it does not matter
if(state->encoder_control->cfg.cclm) {
ctx = &(state->cabac.ctx.cclm_flag);
mode_bits += CTX_ENTROPY_FBITS(ctx, chroma_mode > 67);
}
return mode_bits; return mode_bits;
} }