diff --git a/src/search.c b/src/search.c index a681a228..9f5e1406 100644 --- a/src/search.c +++ b/src/search.c @@ -1145,8 +1145,8 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, if (depth < MAX_DEPTH) { // Add cost of cu_split_flag. kvz_write_split_flag(state, &state->search_cabac, - x > 0 ? LCU_GET_CU_AT_PX(lcu, x -1, y ): NULL, - y > 0 ? LCU_GET_CU_AT_PX(lcu, x, y - 1) : NULL, + x > 0 ? LCU_GET_CU_AT_PX(lcu,SUB_SCU(x) -1, SUB_SCU(y)): NULL, + y > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x), SUB_SCU(y) - 1) : NULL, 1, depth, cu_width, x, y, &split_bits); } @@ -1187,8 +1187,8 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, cost = 0; double bits = 0; kvz_write_split_flag(state, &state->search_cabac, - x > 0 ? LCU_GET_CU_AT_PX(lcu, x - 1, y) : NULL, - y > 0 ? LCU_GET_CU_AT_PX(lcu, x, y - 1) : NULL, + x > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x) - 1, SUB_SCU(y)) : NULL, + y > 0 ? LCU_GET_CU_AT_PX(lcu, SUB_SCU(x), SUB_SCU(y) - 1) : NULL, 0, depth, cu_width, x, y, & split_bits); cur_cu->intra = cu_d1->intra; diff --git a/src/search_inter.c b/src/search_inter.c index c2203b72..1ec6ecbf 100644 --- a/src/search_inter.c +++ b/src/search_inter.c @@ -2066,7 +2066,7 @@ static void search_pu_inter(encoder_state_t * const state, assert(amvp[2].size <= MAX_UNIT_STATS_MAP_SIZE); kvz_sort_keys_by_cost(&amvp[2]); - if (state->encoder_control->cfg.rdo >= 2 && cur_pu->part_size == SIZE_2Nx2N) { + if (amvp[2].size > 0 && state->encoder_control->cfg.rdo >= 2 && cur_pu->part_size == SIZE_2Nx2N) { kvz_cu_cost_inter_rd2(state, x, y, depth, &amvp[2].unit[amvp[2].keys[0]], lcu, &amvp[2].cost[amvp[2].keys[0]], &amvp[2].bits[amvp[2].keys[0]]); } }