diff --git a/src/cu.c b/src/cu.c index 56c8135b..2697c38c 100644 --- a/src/cu.c +++ b/src/cu.c @@ -413,7 +413,7 @@ int uvg_get_possible_splits(const encoder_state_t * const state, splits[NO_SPLIT] = splits[QT_SPLIT] = splits[BT_HOR_SPLIT] = splits[TT_HOR_SPLIT] = splits[BT_VER_SPLIT] = splits[TT_VER_SPLIT] = true; bool can_btt = split_tree.mtt_depth < max_btd; - const enum split_type last_split = (split_tree.split_tree >> (split_tree.current_depth * 3 - 3)) & 7; + const enum split_type last_split = GET_SPLITDATA(&split_tree, 0); const enum split_type parl_split = last_split == TT_HOR_SPLIT ? BT_HOR_SPLIT : BT_VER_SPLIT; // don't allow QT-splitting below a BT split diff --git a/src/cu.h b/src/cu.h index bf89e477..e3668f19 100644 --- a/src/cu.h +++ b/src/cu.h @@ -614,7 +614,7 @@ static INLINE void cbf_copy(uint16_t *cbf, uint16_t src, color_t plane) *cbf |= src & (1 << plane); } -#define GET_SPLITDATA(CU,curDepth) (((CU)->split_tree >> ((curDepth) * 3)) & 7) +#define GET_SPLITDATA(CU,curDepth) ((CU)->split_tree >> ((MAX((curDepth), 0) * 3)) & 7) #define PU_IS_TU(cu) ((cu)->log2_width <= TR_MAX_LOG2_SIZE && (cu)->log2_height <= TR_MAX_LOG2_SIZE) #endif