If |HPB-VPB| ≤ 40 Then
 best_INTER_mode = SMB8×8
 // (sub-macroblock is not divided into sub-partitions)
Else If HPB−VPB > 40 Then
  If VSB1 > 20 OR VSB2 > 20 Then
    best_INTER_mode = SMB4×4
   // (sub-MB is divided into four 4×4 sub-partitions)
  Else
    best_INTER_mode = SMB8×4
   // (sub-MB is divided into two 8x4 sub-partitions)
Else If VPB − HPB > 40 Then
  If HSB1 > 20 OR HSB2 > 20 Then
    best_INTER_mode = SMB4×4
   // (sub-MB is divided into four 4×4 sub-partitions)
  Else
    best_INTER_mode = SMB4×8
   // (sub-MB is divided into two 4×8 blocks)
Algorithm 2: Algorithm used to define the sub-partition size.