[tiles] Clear HMVP size properly before each leaf encoder

This commit is contained in:
Marko Viitanen 2021-11-26 13:48:31 +02:00
parent 23170ff5a7
commit b648bb1cd1
3 changed files with 7 additions and 3 deletions

View file

@ -119,7 +119,7 @@ static int encoder_state_config_tile_init(encoder_state_t * const state,
state->tile->frame = kvz_videoframe_alloc(width, height, state->encoder_control->chroma_format, encoder->cfg.alf_type);
state->tile->frame->hmvp_lut = malloc(sizeof(cu_info_t) * height_in_lcu * MAX_NUM_HMVP_CANDS);
state->tile->frame->hmvp_size = malloc(sizeof(uint8_t) * height_in_lcu);
state->tile->frame->hmvp_size = calloc(1, sizeof(uint8_t) * height_in_lcu);
state->tile->frame->rec = NULL;

View file

@ -850,9 +850,13 @@ static void encoder_state_encode_leaf(encoder_state_t * const state)
// Select whether to encode the frame/tile in current thread or to define
// wavefront jobs for other threads to handle.
bool wavefront = state->type == ENCODER_STATE_TYPE_WAVEFRONT_ROW;
// Clear hmvp lut size before each leaf
if (!wavefront) memset(state->tile->frame->hmvp_size, 0, sizeof(uint8_t) * state->tile->frame->height_in_lcu);
else state->tile->frame->hmvp_size[state->wfrow->lcu_offset_y] = 0;
bool use_parallel_encoding = (wavefront && state->parent->children[1].encoder_control);
if (!use_parallel_encoding) {
memset(state->tile->frame->hmvp_size, 0, sizeof(uint8_t) * state->tile->frame->height_in_lcu);
// Encode every LCU in order and perform SAO reconstruction after every
// frame is encoded. Deblocking and SAO search is done during LCU encoding.

View file

@ -1714,7 +1714,7 @@ uint8_t kvz_inter_get_merge_cand(const encoder_state_t * const state,
const uint32_t ctu_row = (y >> LOG2_LCU_WIDTH);
const uint32_t ctu_row_mul_five = ctu_row * MAX_NUM_HMVP_CANDS;
int32_t num_cand = state->tile->frame->hmvp_size[ctu_row];
// ToDo: VVC: verify B-frames
for (int i = 0; i < num_cand; i++) {
const cu_info_t* hmvp_cand = &state->tile->frame->hmvp_lut[ctu_row_mul_five + i];
// ToDo: Add IBC condition