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

libavcodec/svq3.c:1063:17: Call
1061. 
1062.             if (mb_type != 0) {
1063.                 ff_h264_hl_decode_mb (h);
                      ^
1064.             }
1065. 

libavcodec/h264.c:1925:1: Parameter `h->list_count`
  1923. #include "h264_mb_template.c"
  1924. 
  1925. void ff_h264_hl_decode_mb(H264Context *h)
        ^
  1926. {
  1927.     MpegEncContext *const s = &h->s;

libavcodec/svq3.c:1063:17: Call
1061. 
1062.             if (mb_type != 0) {
1063.                 ff_h264_hl_decode_mb (h);
                      ^
1064.             }
1065. 

libavcodec/h264.c:1925:1: Parameter `h->list_count`
  1923. #include "h264_mb_template.c"
  1924. 
  1925. void ff_h264_hl_decode_mb(H264Context *h)
        ^
  1926. {
  1927.     MpegEncContext *const s = &h->s;

libavcodec/h264.c:1934:13: Call
  1932.     if (CHROMA444) {
  1933.         if (is_complex || h->pixel_shift)
  1934.             hl_decode_mb_444_complex(h);
                    ^
  1935.         else
  1936.             hl_decode_mb_444_simple_8(h);

libavcodec/h264_mb_template.c:278:1: Parameter `h->list_count`
    276. #include "h264_mc_template.c"
    277. 
    278. static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h)
         ^
    279. {
    280.     MpegEncContext *const s = &h->s;

libavcodec/h264_mb_template.c:362:13: Call
    360.                                linesize, 0, 1, SIMPLE, PIXEL_SHIFT);
    361.         } else {
    362.             FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2],
                     ^
    363.                       s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
    364.                       s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,

libavcodec/h264_mc_template.c:61:1: Parameter `h->list_count`
      59. }
      60. 
      61. static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,
          ^
      62.                               uint8_t *dest_cb, uint8_t *dest_cr,
      63.                               qpel_mc_func(*qpix_put)[16],

libavcodec/h264_mc_template.c:77:9: Call
      75. 
      76.     if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
      77.         await_references(h);
                  ^
      78.     prefetch_motion(h, 0, PIXEL_SHIFT, CHROMA_IDC);
      79. 

libavcodec/h264.c:338:1: <LHS trace>
336.  * @param h the H264 context
337.  */
338. static void await_references(H264Context *h)
     ^
339. {
340.     MpegEncContext *const s = &h->s;

libavcodec/h264.c:338:1: Parameter `h->list_count`
        336.  * @param h the H264 context
        337.  */
        338. static void await_references(H264Context *h)
             ^
        339. {
        340.     MpegEncContext *const s = &h->s;

libavcodec/h264.c:409:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_h264_hl_decode_mb` 
        407.     }
        408. 
        409.     for (list = h->list_count - 1; list >= 0; list--)
                      ^
        410.         for (ref = 0; ref < 48 && nrefs[list]; ref++) {
        411.             int row = refs[list][ref];

static void await_references(H264Context *h)
{
    MpegEncContext *const s = &h->s;
    const int mb_xy   = h->mb_xy;
    const int mb_type = s->current_picture.f.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, 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, refs, 0, 8, 0,
                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, 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, refs, 0, 16, 0,
                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
        get_lowest_part_y(h, 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 = h->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, 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, 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, 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, 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, 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, refs, n + j, 4, sub_y_offset,
                                      IS_DIR(sub_mb_type, 0, 0),
                                      IS_DIR(sub_mb_type, 0, 1),
                                      nrefs);
                }
            }
        }
    }
    for (list = h->list_count - 1; list >= 0; list--)
        for (ref = 0; ref < 48 && nrefs[list]; ref++) {
            int row = refs[list][ref];
            if (row >= 0) {
                Picture *ref_pic      = &h->ref_list[list][ref];
                int ref_field         = ref_pic->f.reference - 1;
                int ref_field_picture = ref_pic->field_picture;
                int pic_height        = 16 * s->mb_height >> ref_field_picture;
                row <<= MB_MBAFF;
                nrefs[list]--;
                if (!FIELD_PICTURE && ref_field_picture) {
                    ff_thread_await_progress(&ref_pic->f,
                                             FFMIN((row >> 1) - !(row & 1),
                                                   pic_height - 1),
                                             1);
                    ff_thread_await_progress(&ref_pic->f,
                                             FFMIN((row >> 1), pic_height - 1),
                                             0);
                } else if (FIELD_PICTURE && !ref_field_picture) {
                    ff_thread_await_progress(&ref_pic->f,
                                             FFMIN(row * 2 + ref_field,
                                                   pic_height - 1),
                                             0);
                } else if (FIELD_PICTURE) {
                    ff_thread_await_progress(&ref_pic->f,
                                             FFMIN(row, pic_height - 1),
                                             ref_field);
                } else {
                    ff_thread_await_progress(&ref_pic->f,
                                             FFMIN(row, pic_height - 1),
                                             0);
                }
            }
        }
}
['static int svq3_decode_frame(AVCodecContext *avctx,\n                             void *data, int *data_size,\n                             AVPacket *avpkt)\n{\n    const uint8_t *buf = avpkt->data;\n    SVQ3Context *svq3 = avctx->priv_data;\n    H264Context *h = &svq3->h;\n    MpegEncContext *s = &h->s;\n    int buf_size = avpkt->size;\n    int m, mb_type;\n    if (buf_size == 0) {\n        if (s->next_picture_ptr && !s->low_delay) {\n            *(AVFrame *) data   = s->next_picture.f;\n            s->next_picture_ptr = NULL;\n            *data_size = sizeof(AVFrame);\n        }\n        return 0;\n    }\n    init_get_bits (&s->gb, buf, 8*buf_size);\n    s->mb_x = s->mb_y = h->mb_xy = 0;\n    if (svq3_decode_slice_header(avctx))\n        return -1;\n    s->pict_type = h->slice_type;\n    s->picture_number = h->slice_num;\n    if (avctx->debug&FF_DEBUG_PICT_INFO){\n        av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\\n",\n               av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag,\n               s->adaptive_quant, s->qscale, h->slice_num);\n    }\n    s->current_picture.f.pict_type = s->pict_type;\n    s->current_picture.f.key_frame = (s->pict_type == AV_PICTURE_TYPE_I);\n    if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)\n        return 0;\n    if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)\n        ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)\n        || avctx->skip_frame >= AVDISCARD_ALL)\n        return 0;\n    if (s->next_p_frame_damaged) {\n        if (s->pict_type == AV_PICTURE_TYPE_B)\n            return 0;\n        else\n            s->next_p_frame_damaged = 0;\n    }\n    if (ff_h264_frame_start(h) < 0)\n        return -1;\n    if (s->pict_type == AV_PICTURE_TYPE_B) {\n        h->frame_num_offset = (h->slice_num - h->prev_frame_num);\n        if (h->frame_num_offset < 0) {\n            h->frame_num_offset += 256;\n        }\n        if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {\n            av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\\n");\n            return -1;\n        }\n    } else {\n        h->prev_frame_num = h->frame_num;\n        h->frame_num = h->slice_num;\n        h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);\n        if (h->prev_frame_num_offset < 0) {\n            h->prev_frame_num_offset += 256;\n        }\n    }\n    for (m = 0; m < 2; m++){\n        int i;\n        for (i = 0; i < 4; i++){\n            int j;\n            for (j = -1; j < 4; j++)\n                h->ref_cache[m][scan8[0] + 8*i + j]= 1;\n            if (i < 3)\n                h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;\n        }\n    }\n    for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {\n        for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {\n            h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;\n            if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&\n                ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {\n                skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb));\n                s->gb.size_in_bits = 8*buf_size;\n                if (svq3_decode_slice_header(avctx))\n                    return -1;\n            }\n            mb_type = svq3_get_ue_golomb(&s->gb);\n            if (s->pict_type == AV_PICTURE_TYPE_I) {\n                mb_type += 8;\n            } else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) {\n                mb_type += 4;\n            }\n            if ((unsigned)mb_type > 33 || svq3_decode_mb(svq3, mb_type)) {\n                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\\n", s->mb_x, s->mb_y);\n                return -1;\n            }\n            if (mb_type != 0) {\n                ff_h264_hl_decode_mb (h);\n            }\n            if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) {\n                s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] =\n                    (s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;\n            }\n        }\n        ff_draw_horiz_band(s, 16*s->mb_y, 16);\n    }\n    ff_MPV_frame_end(s);\n    if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {\n        *(AVFrame *) data = s->current_picture.f;\n    } else {\n        *(AVFrame *) data = s->last_picture.f;\n    }\n    if (s->last_picture_ptr || s->low_delay) {\n        *data_size = sizeof(AVFrame);\n    }\n    return buf_size;\n}', 'void ff_h264_hl_decode_mb(H264Context *h)\n{\n    MpegEncContext *const s = &h->s;\n    const int mb_xy   = h->mb_xy;\n    const int mb_type = s->current_picture.f.mb_type[mb_xy];\n    int is_complex    = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;\n    if (CHROMA444) {\n        if (is_complex || h->pixel_shift)\n            hl_decode_mb_444_complex(h);\n        else\n            hl_decode_mb_444_simple_8(h);\n    } else if (is_complex) {\n        hl_decode_mb_complex(h);\n    } else if (h->pixel_shift) {\n        hl_decode_mb_simple_16(h);\n    } else\n        hl_decode_mb_simple_8(h);\n}', 'static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h)\n{\n    MpegEncContext *const s = &h->s;\n    const int mb_x    = s->mb_x;\n    const int mb_y    = s->mb_y;\n    const int mb_xy   = h->mb_xy;\n    const int mb_type = s->current_picture.f.mb_type[mb_xy];\n    uint8_t *dest[3];\n    int linesize;\n    int i, j, p;\n    int *block_offset = &h->block_offset[0];\n    const int transform_bypass = !SIMPLE && (s->qscale == 0 && h->sps.transform_bypass);\n    const int plane_count      = (SIMPLE || !CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) ? 3 : 1;\n    for (p = 0; p < plane_count; p++) {\n        dest[p] = s->current_picture.f.data[p] +\n                  ((mb_x << PIXEL_SHIFT) + mb_y * s->linesize) * 16;\n        s->dsp.prefetch(dest[p] + (s->mb_x & 3) * 4 * s->linesize + (64 << PIXEL_SHIFT),\n                        s->linesize, 4);\n    }\n    h->list_counts[mb_xy] = h->list_count;\n    if (!SIMPLE && MB_FIELD) {\n        linesize     = h->mb_linesize = h->mb_uvlinesize = s->linesize * 2;\n        block_offset = &h->block_offset[48];\n        if (mb_y & 1)\n            for (p = 0; p < 3; p++)\n                dest[p] -= s->linesize * 15;\n        if (FRAME_MBAFF) {\n            int list;\n            for (list = 0; list < h->list_count; list++) {\n                if (!USES_LIST(mb_type, list))\n                    continue;\n                if (IS_16X16(mb_type)) {\n                    int8_t *ref = &h->ref_cache[list][scan8[0]];\n                    fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (s->mb_y & 1), 1);\n                } else {\n                    for (i = 0; i < 16; i += 4) {\n                        int ref = h->ref_cache[list][scan8[i]];\n                        if (ref >= 0)\n                            fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2,\n                                           8, (16 + ref) ^ (s->mb_y & 1), 1);\n                    }\n                }\n            }\n        }\n    } else {\n        linesize = h->mb_linesize = h->mb_uvlinesize = s->linesize;\n    }\n    if (!SIMPLE && IS_INTRA_PCM(mb_type)) {\n        if (PIXEL_SHIFT) {\n            const int bit_depth = h->sps.bit_depth_luma;\n            GetBitContext gb;\n            init_get_bits(&gb, (uint8_t *)h->mb, 768 * bit_depth);\n            for (p = 0; p < plane_count; p++)\n                for (i = 0; i < 16; i++) {\n                    uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize);\n                    for (j = 0; j < 16; j++)\n                        tmp[j] = get_bits(&gb, bit_depth);\n                }\n        } else {\n            for (p = 0; p < plane_count; p++)\n                for (i = 0; i < 16; i++)\n                    memcpy(dest[p] + i * linesize,\n                           (uint8_t *)h->mb + p * 256 + i * 16, 16);\n        }\n    } else {\n        if (IS_INTRA(mb_type)) {\n            if (h->deblocking_filter)\n                xchg_mb_border(h, dest[0], dest[1], dest[2], linesize,\n                               linesize, 1, 1, SIMPLE, PIXEL_SHIFT);\n            for (p = 0; p < plane_count; p++)\n                hl_decode_mb_predict_luma(h, mb_type, 1, SIMPLE,\n                                          transform_bypass, PIXEL_SHIFT,\n                                          block_offset, linesize, dest[p], p);\n            if (h->deblocking_filter)\n                xchg_mb_border(h, dest[0], dest[1], dest[2], linesize,\n                               linesize, 0, 1, SIMPLE, PIXEL_SHIFT);\n        } else {\n            FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2],\n                      s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,\n                      s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,\n                      h->h264dsp.weight_h264_pixels_tab,\n                      h->h264dsp.biweight_h264_pixels_tab);\n        }\n        for (p = 0; p < plane_count; p++)\n            hl_decode_mb_idct_luma(h, mb_type, 1, SIMPLE, transform_bypass,\n                                   PIXEL_SHIFT, block_offset, linesize,\n                                   dest[p], p);\n    }\n    if (h->cbp || IS_INTRA(mb_type)) {\n        s->dsp.clear_blocks(h->mb);\n        s->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT));\n    }\n}', 'static void MCFUNC(hl_motion)(H264Context *h, uint8_t *dest_y,\n                              uint8_t *dest_cb, uint8_t *dest_cr,\n                              qpel_mc_func(*qpix_put)[16],\n                              h264_chroma_mc_func(*chroma_put),\n                              qpel_mc_func(*qpix_avg)[16],\n                              h264_chroma_mc_func(*chroma_avg),\n                              h264_weight_func *weight_op,\n                              h264_biweight_func *weight_avg)\n{\n    MpegEncContext *const s = &h->s;\n    const int mb_xy   = h->mb_xy;\n    const int mb_type = s->current_picture.f.mb_type[mb_xy];\n    assert(IS_INTER(mb_type));\n    if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))\n        await_references(h);\n    prefetch_motion(h, 0, PIXEL_SHIFT, CHROMA_IDC);\n    if (IS_16X16(mb_type)) {\n        mc_part(h, 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, 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, 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, 0, 0, 16, 8 * h->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, 4, 0, 16, 8 * h->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 = h->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, 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, 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, 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, n, 0, 8, 4 * h->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, n + 1, 0, 8, 4 * h->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, 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, 1, PIXEL_SHIFT, CHROMA_IDC);\n}', 'static void await_references(H264Context *h)\n{\n    MpegEncContext *const s = &h->s;\n    const int mb_xy   = h->mb_xy;\n    const int mb_type = s->current_picture.f.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, 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, refs, 0, 8, 0,\n                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, 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, refs, 0, 16, 0,\n                          IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);\n        get_lowest_part_y(h, 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 = h->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, 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, 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, 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, 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, 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, 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 = h->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                Picture *ref_pic      = &h->ref_list[list][ref];\n                int ref_field         = ref_pic->f.reference - 1;\n                int ref_field_picture = ref_pic->field_picture;\n                int pic_height        = 16 * s->mb_height >> ref_field_picture;\n                row <<= MB_MBAFF;\n                nrefs[list]--;\n                if (!FIELD_PICTURE && ref_field_picture) {\n                    ff_thread_await_progress(&ref_pic->f,\n                                             FFMIN((row >> 1) - !(row & 1),\n                                                   pic_height - 1),\n                                             1);\n                    ff_thread_await_progress(&ref_pic->f,\n                                             FFMIN((row >> 1), pic_height - 1),\n                                             0);\n                } else if (FIELD_PICTURE && !ref_field_picture) {\n                    ff_thread_await_progress(&ref_pic->f,\n                                             FFMIN(row * 2 + ref_field,\n                                                   pic_height - 1),\n                                             0);\n                } else if (FIELD_PICTURE) {\n                    ff_thread_await_progress(&ref_pic->f,\n                                             FFMIN(row, pic_height - 1),\n                                             ref_field);\n                } else {\n                    ff_thread_await_progress(&ref_pic->f,\n                                             FFMIN(row, pic_height - 1),\n                                             0);\n                }\n            }\n        }\n}']