+ fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
+ fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
+ } else {
+ int n = 0;
+ for (i8 = 0; i8 < 4; i8++) {
+ const int x8 = i8 & 1;
+ const int y8 = i8 >> 1;
+
+ if (is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
+ continue;
+ h->sub_mb_type[i8] = sub_mb_type;
+
+ fill_rectangle(&h->mv_cache[0][scan8[i8 * 4]], 2, 2, 8, mv[0], 4);
+ fill_rectangle(&h->mv_cache[1][scan8[i8 * 4]], 2, 2, 8, mv[1], 4);
+ fill_rectangle(&h->ref_cache[0][scan8[i8 * 4]], 2, 2, 8,
+ (uint8_t)ref[0], 1);
+ fill_rectangle(&h->ref_cache[1][scan8[i8 * 4]], 2, 2, 8,
+ (uint8_t)ref[1], 1);
+
+ assert(b8_stride == 2);
+ /* col_zero_flag */
+ if (!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref &&
+ (l1ref0[i8] == 0 ||
+ (l1ref0[i8] < 0 &&
+ l1ref1[i8] == 0 &&
+ h->x264_build > 33U))) {
+ const int16_t (*l1mv)[2] = l1ref0[i8] == 0 ? l1mv0 : l1mv1;
+ if (IS_SUB_8X8(sub_mb_type)) {
+ const int16_t *mv_col = l1mv[x8 * 3 + y8 * 3 * b4_stride];
+ if (FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1) {
+ if (ref[0] == 0)
+ fill_rectangle(&h->mv_cache[0][scan8[i8 * 4]], 2, 2,
+ 8, 0, 4);
+ if (ref[1] == 0)
+ fill_rectangle(&h->mv_cache[1][scan8[i8 * 4]], 2, 2,
+ 8, 0, 4);
+ n += 4;
+ }
+ } else {
+ int m = 0;
+ for (i4 = 0; i4 < 4; i4++) {
+ const int16_t *mv_col = l1mv[x8 * 2 + (i4 & 1) +
+ (y8 * 2 + (i4 >> 1)) * b4_stride];
+ if (FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1) {
+ if (ref[0] == 0)
+ AV_ZERO32(h->mv_cache[0][scan8[i8 * 4 + i4]]);
+ if (ref[1] == 0)
+ AV_ZERO32(h->mv_cache[1][scan8[i8 * 4 + i4]]);
+ m++;
+ }
+ }
+ if (!(m & 3))
+ h->sub_mb_type[i8] += MB_TYPE_16x16 - MB_TYPE_8x8;
+ n += m;
+ }
+ }
+ }
+ if (!is_b8x8 && !(n & 15))
+ *mb_type = (*mb_type & ~(MB_TYPE_8x8 | MB_TYPE_16x8 | MB_TYPE_8x16 |
+ MB_TYPE_P1L0 | MB_TYPE_P1L1)) |
+ MB_TYPE_16x16 | MB_TYPE_DIRECT2;
+ }
+}