From 649113a8218bd9564b90edeac3c2a8d0ebabf354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Wed, 10 Jan 2018 14:21:48 +0200 Subject: [PATCH] Fix inter search being used for 4x4 blocks When 4x4 intra blocks are enabled and inter search is limited to 16x16 and larger blocks, it is possible that inter search is accidentally done for 4x4 blocks. Fixed by checking that block size is at least 8x8 before doing inter search. --- src/search.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/search.c b/src/search.c index a0d51523..149be298 100644 --- a/src/search.c +++ b/src/search.c @@ -419,14 +419,17 @@ static double search_cu(encoder_state_t * const state, int x, int y, int depth, y + cu_width <= frame->height) { int cu_width_inter_min = LCU_WIDTH >> ctrl->cfg.pu_depth_inter.max; - bool can_use_inter = state->frame->slicetype != KVZ_SLICE_I && ( - WITHIN(depth, ctrl->cfg.pu_depth_inter.min, ctrl->cfg.pu_depth_inter.max) || - // When the split was forced because the CTU is partially outside the - // frame, we permit inter coding even if pu_depth_inter would - // otherwise forbid it. - (x & ~(cu_width_inter_min - 1)) + cu_width_inter_min > frame->width || - (y & ~(cu_width_inter_min - 1)) + cu_width_inter_min > frame->height - ); + bool can_use_inter = + state->frame->slicetype != KVZ_SLICE_I && + depth <= MAX_DEPTH && + ( + WITHIN(depth, ctrl->cfg.pu_depth_inter.min, ctrl->cfg.pu_depth_inter.max) || + // When the split was forced because the CTU is partially outside the + // frame, we permit inter coding even if pu_depth_inter would + // otherwise forbid it. + (x & ~(cu_width_inter_min - 1)) + cu_width_inter_min > frame->width || + (y & ~(cu_width_inter_min - 1)) + cu_width_inter_min > frame->height + ); if (can_use_inter) { double mode_cost;