[LMCS] keep the original reference data intact and keep lcu.rec in LMCS domain

This commit is contained in:
Marko Viitanen 2021-05-20 16:40:49 +03:00
parent 9b986c5359
commit 88bec75306
2 changed files with 3 additions and 3 deletions

View file

@ -1626,7 +1626,7 @@ static void encoder_state_init_new_frame(encoder_state_t * const state, kvz_pict
kvz_pixel* luma_lmcs = state->tile->frame->source_lmcs->y;
for (int y = 0; y < state->tile->frame->source->height; y++) {
for (int x = 0; x < state->tile->frame->source->width; x++) {
luma[x] = state->tile->frame->lmcs_aps->m_fwdLUT[luma[x]];
//luma[x] = state->tile->frame->lmcs_aps->m_fwdLUT[luma[x]];
}
luma += state->tile->frame->source->stride;
luma_lmcs += state->tile->frame->source->stride;

View file

@ -951,8 +951,6 @@ static void init_lcu_t(const encoder_state_t * const state, const int x, const i
kvz_pixels_blit(&frame->source->y[x + y * frame->source->stride], lcu->ref.y,
x_max, y_max, frame->source->stride, LCU_WIDTH);
if (state->encoder_control->cfg.lmcs_enable)
for (int i = 0; i < LCU_WIDTH * LCU_WIDTH; i++) lcu->ref.y[i] = state->tile->frame->lmcs_aps->m_fwdLUT[lcu->ref.y[i]];
if (state->encoder_control->chroma_format != KVZ_CSP_400) {
kvz_pixels_blit(&frame->source->u[x_c + y_c * frame->source->stride / 2], lcu->ref.u,
x_max_c, y_max_c, frame->source->stride / 2, LCU_WIDTH / 2);
@ -1031,6 +1029,8 @@ void kvz_search_lcu(encoder_state_t * const state, const int x, const int y, con
if (state->encoder_control->cfg.lmcs_enable)
for (int i = 0; i < LCU_WIDTH * LCU_WIDTH; i++) work_tree[0].rec.y[i] = state->tile->frame->lmcs_aps->m_invLUT[work_tree[0].rec.y[i]];
copy_lcu_to_cu_data(state, x, y, &work_tree[0]);
if (state->encoder_control->cfg.lmcs_enable)
for (int i = 0; i < LCU_WIDTH * LCU_WIDTH; i++) work_tree[0].rec.y[i] = state->tile->frame->lmcs_aps->m_fwdLUT[work_tree[0].rec.y[i]];
// Copy coeffs to encoder state.
copy_coeffs(work_tree[0].coeff.y, state->coeff->y, LCU_WIDTH);