diff --git a/src/encoderstate.c b/src/encoderstate.c index 383f5fa2..089618c9 100644 --- a/src/encoderstate.c +++ b/src/encoderstate.c @@ -761,8 +761,8 @@ static void encoder_state_worker_encode_lcu_search(void * opaque) const uint32_t ibc_block_height = MIN(LCU_WIDTH, (state->tile->frame->height-lcu->position_px.y)); int items = 0; // Hash the current LCU to the IBC hashmap - for (int32_t xx = 0; xx < (int32_t)(ibc_block_width)-7; xx+=UVG_HASHMAP_BLOCKSIZE) { - for (int32_t yy = 0; yy < (int32_t)(ibc_block_height)-7; yy+=UVG_HASHMAP_BLOCKSIZE) { + for (int32_t xx = 0; xx < (int32_t)(ibc_block_width)-7; xx+=UVG_HASHMAP_BLOCKSIZE>>1) { + for (int32_t yy = 0; yy < (int32_t)(ibc_block_height)-7; yy+=UVG_HASHMAP_BLOCKSIZE>>1) { int cur_x = lcu->position_px.x + xx; int cur_y = lcu->position_px.y + yy; @@ -782,12 +782,6 @@ static void encoder_state_worker_encode_lcu_search(void * opaque) if (xx % UVG_HASHMAP_BLOCKSIZE == 0 && yy % UVG_HASHMAP_BLOCKSIZE == 0) { state->tile->frame->ibc_hashmap_pos_to_hash[(cur_y / UVG_HASHMAP_BLOCKSIZE)*state->tile->frame->ibc_hashmap_pos_to_hash_stride + cur_x / UVG_HASHMAP_BLOCKSIZE] = crc; } - /* - if (state->encoder_control->chroma_format != UVG_CSP_400) { - crc ^= uvg_crc32c_4x4(&frame->rec->u[(cur_y>>1) * (frame->rec->stride>>1) + (cur_x>>1)],frame->rec->stride>>1); - crc ^= uvg_crc32c_4x4(&frame->rec->v[(cur_y>>1) * (frame->rec->stride>>1) + (cur_x>>1)],frame->rec->stride>>1); - } - */ uvg_hashmap_insert(frame->ibc_hashmap_row[ctu_row], crc, ((cur_x&0xffff)<<16) | (cur_y&0xffff)); items++; } diff --git a/src/search_ibc.c b/src/search_ibc.c index ba5fffba..44f9ac50 100644 --- a/src/search_ibc.c +++ b/src/search_ibc.c @@ -489,7 +489,7 @@ static double calc_ibc_mvd_cost(const encoder_state_t *state, temp_bitcost += mvd_cost; } *bitcost = temp_bitcost; - return temp_bitcost * state->lambda_sqrt; + return temp_bitcost * state->lambda; } @@ -1008,7 +1008,7 @@ static void search_pu_ibc(encoder_state_t * const state, info->width, (best_mv.x >> INTERNAL_MV_PREC), (best_mv.y >> INTERNAL_MV_PREC)); - best_cost += best_bits * info->state->lambda_sqrt; + best_cost += best_bits * info->state->lambda; } @@ -1069,7 +1069,7 @@ static void search_pu_ibc(encoder_state_t * const state, if(amvp[0].size > 0) { const uint8_t best_key = amvp[0].keys[0]; amvp[0].bits[best_key] += total_bits; - amvp[0].cost[best_key] += (total_bits)* state->lambda_sqrt; + amvp[0].cost[best_key] += (total_bits)* state->lambda; } } } @@ -1240,7 +1240,7 @@ static int uvg_search_hash_cu_ibc(encoder_state_t* const state, if (!found_block) return; - *inter_cost = 2; + *inter_cost = ibc_cost; *inter_bitcost = ibc_bitcost; uint32_t merge_idx; @@ -1268,7 +1268,7 @@ static int uvg_search_hash_cu_ibc(encoder_state_t* const state, const int ibc_flag = CTX_ENTROPY_FBITS(&state->search_cabac.ctx.ibc_flag[0], 1); - ibc_cost += ibc_flag * state->lambda_sqrt; + ibc_cost += ibc_flag * state->lambda; ibc_bitcost += ibc_flag; uvg_inter_recon_cu(