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.
This commit is contained in:
Arttu Ylä-Outinen 2018-01-10 14:21:48 +02:00
parent 4e13608b01
commit 649113a821

View file

@ -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;