diff --git a/src/inter.c b/src/inter.c index 9597931d..45f2b174 100644 --- a/src/inter.c +++ b/src/inter.c @@ -266,8 +266,11 @@ void inter_get_mv_cand(encoder_control *encoder, int32_t x_cu, int32_t y_cu, int // B0, B1 and B2 availability testing if (y_cu != 0) { - b0 = &encoder->in.cur_pic->cu_array[MAX_DEPTH][x_cu + cur_block_in_scu + (y_cu - 1) * (encoder->in.width_in_lcu<coded) b0 = NULL; + + if (x_cu + cur_block_in_scu < encoder->in.width_in_lcu<in.cur_pic->cu_array[MAX_DEPTH][x_cu + cur_block_in_scu + (y_cu - 1) * (encoder->in.width_in_lcu<coded) b0 = NULL; + } b1 = &encoder->in.cur_pic->cu_array[MAX_DEPTH][x_cu + cur_block_in_scu - 1 + (y_cu - 1) * (encoder->in.width_in_lcu<coded) b1 = NULL;