libavcodec/h264.c:81: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `ff_h264_hl_decode_mb`.

libavcodec/h264.c:68:5: Unknown value from: __infer_skip
66.     sl->mb_xy = mb_x + mb_y * h->mb_stride;
67.     memset(sl->non_zero_count_cache, 0, sizeof(sl->non_zero_count_cache));
68.     assert(ref >= 0);
        ^
69.     /* FIXME: It is possible albeit uncommon that slice references
70.      * differ between slices. We take the easy approach and ignore

libavcodec/h264.c:81:5: Call
79.                    pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4);
80.     assert(!FRAME_MBAFF(h));
81.     ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);
        ^
82. }
83. 

libavcodec/h264_mb.c:792:1: Parameter `sl->list_count`
  790. #include "h264_mb_template.c"
  791. 
  792. void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl)
       ^
  793. {
  794.     const int mb_xy   = sl->mb_xy;

libavcodec/h264_mb.c:807:9: Call
  805.         hl_decode_mb_complex(h, sl);
  806.     } else if (h->pixel_shift) {
  807.         hl_decode_mb_simple_16(h, sl);
               ^
  808.     } else
  809.         hl_decode_mb_simple_8(h, sl);

libavcodec/h264_mb_template.c:41:1: Parameter `sl->list_count`
    39. #include "h264_mc_template.c"
    40. 
    41. static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)
        ^
    42. {
    43.     const int mb_x    = sl->mb_x;

libavcodec/h264_mb_template.c:175:17: Call
    173.         } else {
    174.             if (chroma422) {
    175.                 FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,
                         ^
    176.                               h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,
    177.                               h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,

libavcodec/h264_mc_template.c:64:1: Parameter `sl->list_count`
      62. }
      63. 
      64. static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl,
          ^
      65.                               uint8_t *dest_y,
      66.                               uint8_t *dest_cb, uint8_t *dest_cr,

libavcodec/h264_mc_template.c:80:9: Call
      78. 
      79.     if (HAVE_THREADS && (h->avctx->active_thread_type & FF_THREAD_FRAME))
      80.         await_references(h, sl);
                  ^
      81.     prefetch_motion(h, sl, 0, PIXEL_SHIFT, CHROMA_IDC);
      82. 

libavcodec/h264_mb.c:95:1: <LHS trace>
93.  * @param h the H264 context
94.  */
95. static void await_references(const H264Context *h, H264SliceContext *sl)
    ^
96. {
97.     const int mb_xy   = sl->mb_xy;

libavcodec/h264_mb.c:95:1: Parameter `sl->list_count`
        93.  * @param h the H264 context
        94.  */
        95. static void await_references(const H264Context *h, H264SliceContext *sl)
            ^
        96. {
        97.     const int mb_xy   = sl->mb_xy;

libavcodec/h264_mb.c:165:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_h264_hl_decode_mb` 
        163.     }
        164. 
        165.     for (list = sl->list_count - 1; list >= 0; list--)
                      ^
        166.         for (ref = 0; ref < 48 && nrefs[list]; ref++) {
        167.             int row = refs[list][ref];

static void await_references(const H264Context *h, H264SliceContext *sl)
{
    const int mb_xy   = sl->mb_xy;
    const int mb_type = h->cur_pic.mb_type[mb_xy];
    int refs[2][48];
    int nrefs[2] = { 0 };
    int ref, list;
    memset(refs, -1, sizeof(refs));
    if (IS_16X16(mb_type)) {
        get_lowest_part_y(h, sl, refs, 0, 16, 0,
                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
    } else if (IS_16X8(mb_type)) {
        get_lowest_part_y(h, sl, refs, 0, 8, 0,
                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, sl, refs, 8, 8, 8,
                          IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
    } else if (IS_8X16(mb_type)) {
        get_lowest_part_y(h, sl, refs, 0, 16, 0,
                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, sl, refs, 4, 16, 0,
                          IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
    } else {
        int i;
        assert(IS_8X8(mb_type));
        for (i = 0; i < 4; i++) {
            const int sub_mb_type = sl->sub_mb_type[i];
            const int n           = 4 * i;
            int y_offset          = (i & 2) << 2;
            if (IS_SUB_8X8(sub_mb_type)) {
                get_lowest_part_y(h, sl, refs, n, 8, y_offset,
                                  IS_DIR(sub_mb_type, 0, 0),
                                  IS_DIR(sub_mb_type, 0, 1),
                                  nrefs);
            } else if (IS_SUB_8X4(sub_mb_type)) {
                get_lowest_part_y(h, sl, refs, n, 4, y_offset,
                                  IS_DIR(sub_mb_type, 0, 0),
                                  IS_DIR(sub_mb_type, 0, 1),
                                  nrefs);
                get_lowest_part_y(h, sl, refs, n + 2, 4, y_offset + 4,
                                  IS_DIR(sub_mb_type, 0, 0),
                                  IS_DIR(sub_mb_type, 0, 1),
                                  nrefs);
            } else if (IS_SUB_4X8(sub_mb_type)) {
                get_lowest_part_y(h, sl, refs, n, 8, y_offset,
                                  IS_DIR(sub_mb_type, 0, 0),
                                  IS_DIR(sub_mb_type, 0, 1),
                                  nrefs);
                get_lowest_part_y(h, sl, refs, n + 1, 8, y_offset,
                                  IS_DIR(sub_mb_type, 0, 0),
                                  IS_DIR(sub_mb_type, 0, 1),
                                  nrefs);
            } else {
                int j;
                assert(IS_SUB_4X4(sub_mb_type));
                for (j = 0; j < 4; j++) {
                    int sub_y_offset = y_offset + 2 * (j & 2);
                    get_lowest_part_y(h, sl, refs, n + j, 4, sub_y_offset,
                                      IS_DIR(sub_mb_type, 0, 0),
                                      IS_DIR(sub_mb_type, 0, 1),
                                      nrefs);
                }
            }
        }
    }
    for (list = sl->list_count - 1; list >= 0; list--)
        for (ref = 0; ref < 48 && nrefs[list]; ref++) {
            int row = refs[list][ref];
            if (row >= 0) {
                H264Ref *ref_pic  = &sl->ref_list[list][ref];
                int ref_field         = ref_pic->reference - 1;
                int ref_field_picture = ref_pic->parent->field_picture;
                int pic_height        = 16 * h->mb_height >> ref_field_picture;
                row <<= MB_MBAFF(sl);
                nrefs[list]--;
                if (!FIELD_PICTURE(h) && ref_field_picture) {
                    ff_thread_await_progress(&ref_pic->parent->tf,
                                             FFMIN((row >> 1) - !(row & 1),
                                                   pic_height - 1),
                                             1);
                    ff_thread_await_progress(&ref_pic->parent->tf,
                                             FFMIN((row >> 1), pic_height - 1),
                                             0);
                } else if (FIELD_PICTURE(h) && !ref_field_picture) {
                    ff_thread_await_progress(&ref_pic->parent->tf,
                                             FFMIN(row * 2 + ref_field,
                                                   pic_height - 1),
                                             0);
                } else if (FIELD_PICTURE(h)) {
                    ff_thread_await_progress(&ref_pic->parent->tf,
                                             FFMIN(row, pic_height - 1),
                                             ref_field);
                } else {
                    ff_thread_await_progress(&ref_pic->parent->tf,
                                             FFMIN(row, pic_height - 1),
                                             0);
                }
            }
        }
}
['static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type,\n                              int (*mv)[2][4][2],\n                              int mb_x, int mb_y, int mb_intra, int mb_skipped)\n{\n    H264Context *h = opaque;\n    H264SliceContext *sl = &h->slice_ctx[0];\n    sl->mb_x = mb_x;\n    sl->mb_y = mb_y;\n    sl->mb_xy = mb_x + mb_y * h->mb_stride;\n    memset(sl->non_zero_count_cache, 0, sizeof(sl->non_zero_count_cache));\n    assert(ref >= 0);\n    if (ref >= sl->ref_count[0])\n        ref = 0;\n    fill_rectangle(&h->cur_pic.ref_index[0][4 * sl->mb_xy],\n                   2, 2, 2, ref, 1);\n    fill_rectangle(&sl->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);\n    fill_rectangle(sl->mv_cache[0][scan8[0]], 4, 4, 8,\n                   pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4);\n    assert(!FRAME_MBAFF(h));\n    ff_h264_hl_decode_mb(h, &h->slice_ctx[0]);\n}', 'void ff_h264_hl_decode_mb(const H264Context *h, H264SliceContext *sl)\n{\n    const int mb_xy   = sl->mb_xy;\n    const int mb_type = h->cur_pic.mb_type[mb_xy];\n    int is_complex    = CONFIG_SMALL || sl->is_complex ||\n                        IS_INTRA_PCM(mb_type) || sl->qscale == 0;\n    if (CHROMA444(h)) {\n        if (is_complex || h->pixel_shift)\n            hl_decode_mb_444_complex(h, sl);\n        else\n            hl_decode_mb_444_simple_8(h, sl);\n    } else if (is_complex) {\n        hl_decode_mb_complex(h, sl);\n    } else if (h->pixel_shift) {\n        hl_decode_mb_simple_16(h, sl);\n    } else\n        hl_decode_mb_simple_8(h, sl);\n}', 'static av_noinline void FUNC(hl_decode_mb)(const H264Context *h, H264SliceContext *sl)\n{\n    const int mb_x    = sl->mb_x;\n    const int mb_y    = sl->mb_y;\n    const int mb_xy   = sl->mb_xy;\n    const int mb_type = h->cur_pic.mb_type[mb_xy];\n    uint8_t *dest_y, *dest_cb, *dest_cr;\n    int linesize, uvlinesize  ;\n    int i, j;\n    const int *block_offset = &h->block_offset[0];\n    const int transform_bypass = !SIMPLE && (sl->qscale == 0 && h->sps.transform_bypass);\n    void (*idct_add)(uint8_t *dst, int16_t *block, int stride);\n    const int block_h   = 16 >> h->chroma_y_shift;\n    const int chroma422 = CHROMA422(h);\n    dest_y  = h->cur_pic.f->data[0] + ((mb_x << PIXEL_SHIFT)     + mb_y * sl->linesize)  * 16;\n    dest_cb = h->cur_pic.f->data[1] +  (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;\n    dest_cr = h->cur_pic.f->data[2] +  (mb_x << PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;\n    h->vdsp.prefetch(dest_y  + (sl->mb_x & 3) * 4 * sl->linesize   + (64 << PIXEL_SHIFT), sl->linesize,       4);\n    h->vdsp.prefetch(dest_cb + (sl->mb_x & 7)     * sl->uvlinesize + (64 << PIXEL_SHIFT), dest_cr - dest_cb, 2);\n    h->list_counts[mb_xy] = sl->list_count;\n    if (!SIMPLE && MB_FIELD(sl)) {\n        linesize     = sl->mb_linesize = sl->linesize * 2;\n        uvlinesize   = sl->mb_uvlinesize = sl->uvlinesize * 2;\n        block_offset = &h->block_offset[48];\n        if (mb_y & 1) {\n            dest_y  -= sl->linesize * 15;\n            dest_cb -= sl->uvlinesize * (block_h - 1);\n            dest_cr -= sl->uvlinesize * (block_h - 1);\n        }\n        if (FRAME_MBAFF(h)) {\n            int list;\n            for (list = 0; list < sl->list_count; list++) {\n                if (!USES_LIST(mb_type, list))\n                    continue;\n                if (IS_16X16(mb_type)) {\n                    int8_t *ref = &sl->ref_cache[list][scan8[0]];\n                    fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (sl->mb_y & 1), 1);\n                } else {\n                    for (i = 0; i < 16; i += 4) {\n                        int ref = sl->ref_cache[list][scan8[i]];\n                        if (ref >= 0)\n                            fill_rectangle(&sl->ref_cache[list][scan8[i]], 2, 2,\n                                           8, (16 + ref) ^ (sl->mb_y & 1), 1);\n                    }\n                }\n            }\n        }\n    } else {\n        linesize   = sl->mb_linesize   = sl->linesize;\n        uvlinesize = sl->mb_uvlinesize = sl->uvlinesize;\n    }\n    if (!SIMPLE && IS_INTRA_PCM(mb_type)) {\n        if (PIXEL_SHIFT) {\n            const int bit_depth = h->sps.bit_depth_luma;\n            int j;\n            GetBitContext gb;\n            init_get_bits(&gb, sl->intra_pcm_ptr,\n                          ff_h264_mb_sizes[h->sps.chroma_format_idc] * bit_depth);\n            for (i = 0; i < 16; i++) {\n                uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);\n                for (j = 0; j < 16; j++)\n                    tmp_y[j] = get_bits(&gb, bit_depth);\n            }\n            if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {\n                if (!h->sps.chroma_format_idc) {\n                    for (i = 0; i < block_h; i++) {\n                        uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);\n                        for (j = 0; j < 8; j++)\n                            tmp_cb[j] = 1 << (bit_depth - 1);\n                    }\n                    for (i = 0; i < block_h; i++) {\n                        uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);\n                        for (j = 0; j < 8; j++)\n                            tmp_cr[j] = 1 << (bit_depth - 1);\n                    }\n                } else {\n                    for (i = 0; i < block_h; i++) {\n                        uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);\n                        for (j = 0; j < 8; j++)\n                            tmp_cb[j] = get_bits(&gb, bit_depth);\n                    }\n                    for (i = 0; i < block_h; i++) {\n                        uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);\n                        for (j = 0; j < 8; j++)\n                            tmp_cr[j] = get_bits(&gb, bit_depth);\n                    }\n                }\n            }\n        } else {\n            for (i = 0; i < 16; i++)\n                memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);\n            if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {\n                if (!h->sps.chroma_format_idc) {\n                    for (i = 0; i < block_h; i++) {\n                        memset(dest_cb + i * uvlinesize, 128, 8);\n                        memset(dest_cr + i * uvlinesize, 128, 8);\n                    }\n                } else {\n                    const uint8_t *src_cb = sl->intra_pcm_ptr + 256;\n                    const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;\n                    for (i = 0; i < block_h; i++) {\n                        memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);\n                        memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);\n                    }\n                }\n            }\n        }\n    } else {\n        if (IS_INTRA(mb_type)) {\n            if (sl->deblocking_filter)\n                xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,\n                               uvlinesize, 1, 0, SIMPLE, PIXEL_SHIFT);\n            if (SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) {\n                h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);\n                h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);\n            }\n            hl_decode_mb_predict_luma(h, sl, mb_type, SIMPLE,\n                                      transform_bypass, PIXEL_SHIFT,\n                                      block_offset, linesize, dest_y, 0);\n            if (sl->deblocking_filter)\n                xchg_mb_border(h, sl, dest_y, dest_cb, dest_cr, linesize,\n                               uvlinesize, 0, 0, SIMPLE, PIXEL_SHIFT);\n        } else {\n            if (chroma422) {\n                FUNC(hl_motion_422)(h, sl, dest_y, dest_cb, dest_cr,\n                              h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\n                              h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\n                              h->h264dsp.weight_h264_pixels_tab,\n                              h->h264dsp.biweight_h264_pixels_tab);\n            } else {\n                FUNC(hl_motion_420)(h, sl, dest_y, dest_cb, dest_cr,\n                              h->qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\n                              h->qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\n                              h->h264dsp.weight_h264_pixels_tab,\n                              h->h264dsp.biweight_h264_pixels_tab);\n            }\n        }\n        hl_decode_mb_idct_luma(h, sl, mb_type, SIMPLE, transform_bypass,\n                               PIXEL_SHIFT, block_offset, linesize, dest_y, 0);\n        if ((SIMPLE || !CONFIG_GRAY || !(h->flags & AV_CODEC_FLAG_GRAY)) &&\n            (sl->cbp & 0x30)) {\n            uint8_t *dest[2] = { dest_cb, dest_cr };\n            if (transform_bypass) {\n                if (IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&\n                    (sl->chroma_pred_mode == VERT_PRED8x8 ||\n                     sl->chroma_pred_mode == HOR_PRED8x8)) {\n                    h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],\n                                                            block_offset + 16,\n                                                            sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\n                                                            uvlinesize);\n                    h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],\n                                                            block_offset + 32,\n                                                            sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\n                                                            uvlinesize);\n                } else {\n                    idct_add = h->h264dsp.h264_add_pixels4_clear;\n                    for (j = 1; j < 3; j++) {\n                        for (i = j * 16; i < j * 16 + 4; i++)\n                            if (sl->non_zero_count_cache[scan8[i]] ||\n                                dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))\n                                idct_add(dest[j - 1] + block_offset[i],\n                                         sl->mb + (i * 16 << PIXEL_SHIFT),\n                                         uvlinesize);\n                        if (chroma422) {\n                            for (i = j * 16 + 4; i < j * 16 + 8; i++)\n                                if (sl->non_zero_count_cache[scan8[i + 4]] ||\n                                    dctcoef_get(sl->mb, PIXEL_SHIFT, i * 16))\n                                    idct_add(dest[j - 1] + block_offset[i + 4],\n                                             sl->mb + (i * 16 << PIXEL_SHIFT),\n                                             uvlinesize);\n                        }\n                    }\n                }\n            } else {\n                int qp[2];\n                if (chroma422) {\n                    qp[0] = sl->chroma_qp[0] + 3;\n                    qp[1] = sl->chroma_qp[1] + 3;\n                } else {\n                    qp[0] = sl->chroma_qp[0];\n                    qp[1] = sl->chroma_qp[1];\n                }\n                if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 0]])\n                    h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 << PIXEL_SHIFT),\n                                                           h->dequant4_coeff[IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);\n                if (sl->non_zero_count_cache[scan8[CHROMA_DC_BLOCK_INDEX + 1]])\n                    h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 << PIXEL_SHIFT),\n                                                           h->dequant4_coeff[IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);\n                h->h264dsp.h264_idct_add8(dest, block_offset,\n                                          sl->mb, uvlinesize,\n                                          sl->non_zero_count_cache);\n            }\n        }\n    }\n}', 'static void MCFUNC(hl_motion)(const H264Context *h, H264SliceContext *sl,\n                              uint8_t *dest_y,\n                              uint8_t *dest_cb, uint8_t *dest_cr,\n                              qpel_mc_func(*qpix_put)[16],\n                              const h264_chroma_mc_func(*chroma_put),\n                              qpel_mc_func(*qpix_avg)[16],\n                              const h264_chroma_mc_func(*chroma_avg),\n                              const h264_weight_func *weight_op,\n                              const h264_biweight_func *weight_avg)\n{\n    const int mb_xy   = sl->mb_xy;\n    const int mb_type = h->cur_pic.mb_type[mb_xy];\n    assert(IS_INTER(mb_type));\n    if (HAVE_THREADS && (h->avctx->active_thread_type & FF_THREAD_FRAME))\n        await_references(h, sl);\n    prefetch_motion(h, sl, 0, PIXEL_SHIFT, CHROMA_IDC);\n    if (IS_16X16(mb_type)) {\n        mc_part(h, sl, 0, 1, 16, 0, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],\n                weight_op, weight_avg,\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));\n    } else if (IS_16X8(mb_type)) {\n        mc_part(h, sl, 0, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],\n                weight_op, weight_avg,\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));\n        mc_part(h, sl, 8, 0, 8, 8 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr, 0, 4,\n                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],\n                weight_op, weight_avg,\n                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));\n    } else if (IS_8X16(mb_type)) {\n        mc_part(h, sl, 0, 0, 16, 8 * sl->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,\n                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                &weight_op[1], &weight_avg[1],\n                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));\n        mc_part(h, sl, 4, 0, 16, 8 * sl->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,\n                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                &weight_op[1], &weight_avg[1],\n                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));\n    } else {\n        int i;\n        assert(IS_8X8(mb_type));\n        for (i = 0; i < 4; i++) {\n            const int sub_mb_type = sl->sub_mb_type[i];\n            const int n  = 4 * i;\n            int x_offset = (i & 1) << 2;\n            int y_offset = (i & 2) << 1;\n            if (IS_SUB_8X8(sub_mb_type)) {\n                mc_part(h, sl, n, 1, 8, 0, dest_y, dest_cb, dest_cr,\n                        x_offset, y_offset,\n                        qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],\n                        &weight_op[1], &weight_avg[1],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n            } else if (IS_SUB_8X4(sub_mb_type)) {\n                mc_part(h, sl, n, 0, 4, 4 << PIXEL_SHIFT, dest_y, dest_cb, dest_cr,\n                        x_offset, y_offset,\n                        qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],\n                        &weight_op[1], &weight_avg[1],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n                mc_part(h, sl, n + 2, 0, 4, 4 << PIXEL_SHIFT,\n                        dest_y, dest_cb, dest_cr, x_offset, y_offset + 2,\n                        qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],\n                        &weight_op[1], &weight_avg[1],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n            } else if (IS_SUB_4X8(sub_mb_type)) {\n                mc_part(h, sl, n, 0, 8, 4 * sl->mb_linesize,\n                        dest_y, dest_cb, dest_cr, x_offset, y_offset,\n                        qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                        &weight_op[2], &weight_avg[2],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n                mc_part(h, sl, n + 1, 0, 8, 4 * sl->mb_linesize,\n                        dest_y, dest_cb, dest_cr, x_offset + 2, y_offset,\n                        qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                        &weight_op[2], &weight_avg[2],\n                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n            } else {\n                int j;\n                assert(IS_SUB_4X4(sub_mb_type));\n                for (j = 0; j < 4; j++) {\n                    int sub_x_offset = x_offset + 2 * (j & 1);\n                    int sub_y_offset = y_offset + (j & 2);\n                    mc_part(h, sl, n + j, 1, 4, 0,\n                            dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,\n                            qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],\n                            &weight_op[2], &weight_avg[2],\n                            IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));\n                }\n            }\n        }\n    }\n    prefetch_motion(h, sl, 1, PIXEL_SHIFT, CHROMA_IDC);\n}', 'static void await_references(const H264Context *h, H264SliceContext *sl)\n{\n    const int mb_xy   = sl->mb_xy;\n    const int mb_type = h->cur_pic.mb_type[mb_xy];\n    int refs[2][48];\n    int nrefs[2] = { 0 };\n    int ref, list;\n    memset(refs, -1, sizeof(refs));\n    if (IS_16X16(mb_type)) {\n        get_lowest_part_y(h, sl, refs, 0, 16, 0,\n                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n    } else if (IS_16X8(mb_type)) {\n        get_lowest_part_y(h, sl, refs, 0, 8, 0,\n                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, sl, refs, 8, 8, 8,\n                          IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);\n    } else if (IS_8X16(mb_type)) {\n        get_lowest_part_y(h, sl, refs, 0, 16, 0,\n                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, sl, refs, 4, 16, 0,\n                          IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);\n    } else {\n        int i;\n        assert(IS_8X8(mb_type));\n        for (i = 0; i < 4; i++) {\n            const int sub_mb_type = sl->sub_mb_type[i];\n            const int n           = 4 * i;\n            int y_offset          = (i & 2) << 2;\n            if (IS_SUB_8X8(sub_mb_type)) {\n                get_lowest_part_y(h, sl, refs, n, 8, y_offset,\n                                  IS_DIR(sub_mb_type, 0, 0),\n                                  IS_DIR(sub_mb_type, 0, 1),\n                                  nrefs);\n            } else if (IS_SUB_8X4(sub_mb_type)) {\n                get_lowest_part_y(h, sl, refs, n, 4, y_offset,\n                                  IS_DIR(sub_mb_type, 0, 0),\n                                  IS_DIR(sub_mb_type, 0, 1),\n                                  nrefs);\n                get_lowest_part_y(h, sl, refs, n + 2, 4, y_offset + 4,\n                                  IS_DIR(sub_mb_type, 0, 0),\n                                  IS_DIR(sub_mb_type, 0, 1),\n                                  nrefs);\n            } else if (IS_SUB_4X8(sub_mb_type)) {\n                get_lowest_part_y(h, sl, refs, n, 8, y_offset,\n                                  IS_DIR(sub_mb_type, 0, 0),\n                                  IS_DIR(sub_mb_type, 0, 1),\n                                  nrefs);\n                get_lowest_part_y(h, sl, refs, n + 1, 8, y_offset,\n                                  IS_DIR(sub_mb_type, 0, 0),\n                                  IS_DIR(sub_mb_type, 0, 1),\n                                  nrefs);\n            } else {\n                int j;\n                assert(IS_SUB_4X4(sub_mb_type));\n                for (j = 0; j < 4; j++) {\n                    int sub_y_offset = y_offset + 2 * (j & 2);\n                    get_lowest_part_y(h, sl, refs, n + j, 4, sub_y_offset,\n                                      IS_DIR(sub_mb_type, 0, 0),\n                                      IS_DIR(sub_mb_type, 0, 1),\n                                      nrefs);\n                }\n            }\n        }\n    }\n    for (list = sl->list_count - 1; list >= 0; list--)\n        for (ref = 0; ref < 48 && nrefs[list]; ref++) {\n            int row = refs[list][ref];\n            if (row >= 0) {\n                H264Ref *ref_pic  = &sl->ref_list[list][ref];\n                int ref_field         = ref_pic->reference - 1;\n                int ref_field_picture = ref_pic->parent->field_picture;\n                int pic_height        = 16 * h->mb_height >> ref_field_picture;\n                row <<= MB_MBAFF(sl);\n                nrefs[list]--;\n                if (!FIELD_PICTURE(h) && ref_field_picture) {\n                    ff_thread_await_progress(&ref_pic->parent->tf,\n                                             FFMIN((row >> 1) - !(row & 1),\n                                                   pic_height - 1),\n                                             1);\n                    ff_thread_await_progress(&ref_pic->parent->tf,\n                                             FFMIN((row >> 1), pic_height - 1),\n                                             0);\n                } else if (FIELD_PICTURE(h) && !ref_field_picture) {\n                    ff_thread_await_progress(&ref_pic->parent->tf,\n                                             FFMIN(row * 2 + ref_field,\n                                                   pic_height - 1),\n                                             0);\n                } else if (FIELD_PICTURE(h)) {\n                    ff_thread_await_progress(&ref_pic->parent->tf,\n                                             FFMIN(row, pic_height - 1),\n                                             ref_field);\n                } else {\n                    ff_thread_await_progress(&ref_pic->parent->tf,\n                                             FFMIN(row, pic_height - 1),\n                                             0);\n                }\n            }\n        }\n}']