libavcodec/h264.c:3894: error: Integer Overflow L2
  ([0, min(1, `*h->cur_pic.mb_type`)] - 1):unsigned32.

libavcodec/h264.c:3872:1: <LHS trace>
3870.  * @return non zero if the loop filter can be skipped
3871.  */
3872. static int fill_filter_caches(H264Context *h, int mb_type)
      ^
3873. {
3874.     const int mb_xy = h->mb_xy;

libavcodec/h264.c:3872:1: Parameter `*h->cur_pic.mb_type`
3870.  * @return non zero if the loop filter can be skipped
3871.  */
3872. static int fill_filter_caches(H264Context *h, int mb_type)
      ^
3873. {
3874.     const int mb_xy = h->mb_xy;

libavcodec/h264.c:3894:17: Binary operation: ([0, min(1, *h->cur_pic.mb_type)] - 1):unsigned32
3892.         } else {
3893.             if (curr_mb_field_flag)
3894.                 top_xy += h->mb_stride &
                      ^
3895.                           (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1);
3896.             if (left_mb_field_flag != curr_mb_field_flag)

static int fill_filter_caches(H264Context *h, int mb_type)
{
    const int mb_xy = h->mb_xy;
    int top_xy, left_xy[LEFT_MBS];
    int top_type, left_type[LEFT_MBS];
    uint8_t *nnz;
    uint8_t *nnz_cache;
    top_xy = mb_xy - (h->mb_stride << MB_FIELD(h));
    left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;
    if (FRAME_MBAFF(h)) {
        const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]);
        const int curr_mb_field_flag = IS_INTERLACED(mb_type);
        if (h->mb_y & 1) {
            if (left_mb_field_flag != curr_mb_field_flag)
                left_xy[LTOP] -= h->mb_stride;
        } else {
            if (curr_mb_field_flag)
                top_xy += h->mb_stride &
                          (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1);
            if (left_mb_field_flag != curr_mb_field_flag)
                left_xy[LBOT] += h->mb_stride;
        }
    }
    h->top_mb_xy        = top_xy;
    h->left_mb_xy[LTOP] = left_xy[LTOP];
    h->left_mb_xy[LBOT] = left_xy[LBOT];
    {
        int qp_thresh = h->qp_thresh;
        int qp        = h->cur_pic.qscale_table[mb_xy];
        if (qp <= qp_thresh &&
            (left_xy[LTOP] < 0 ||
             ((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) &&
            (top_xy < 0 ||
             ((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) {
            if (!FRAME_MBAFF(h))
                return 1;
            if ((left_xy[LTOP] < 0 ||
                 ((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) &&
                (top_xy < h->mb_stride ||
                 ((qp + h->cur_pic.qscale_table[top_xy - h->mb_stride] + 1) >> 1) <= qp_thresh))
                return 1;
        }
    }
    top_type        = h->cur_pic.mb_type[top_xy];
    left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]];
    left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]];
    if (h->deblocking_filter == 2) {
        if (h->slice_table[top_xy] != h->slice_num)
            top_type = 0;
        if (h->slice_table[left_xy[LBOT]] != h->slice_num)
            left_type[LTOP] = left_type[LBOT] = 0;
    } else {
        if (h->slice_table[top_xy] == 0xFFFF)
            top_type = 0;
        if (h->slice_table[left_xy[LBOT]] == 0xFFFF)
            left_type[LTOP] = left_type[LBOT] = 0;
    }
    h->top_type        = top_type;
    h->left_type[LTOP] = left_type[LTOP];
    h->left_type[LBOT] = left_type[LBOT];
    if (IS_INTRA(mb_type))
        return 0;
    fill_filter_caches_inter(h, mb_type, top_xy, left_xy,
                             top_type, left_type, mb_xy, 0);
    if (h->list_count == 2)
        fill_filter_caches_inter(h, mb_type, top_xy, left_xy,
                                 top_type, left_type, mb_xy, 1);
    nnz       = h->non_zero_count[mb_xy];
    nnz_cache = h->non_zero_count_cache;
    AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);
    AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);
    AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);
    AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);
    h->cbp = h->cbp_table[mb_xy];
    if (top_type) {
        nnz = h->non_zero_count[top_xy];
        AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);
    }
    if (left_type[LTOP]) {
        nnz = h->non_zero_count[left_xy[LTOP]];
        nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];
        nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];
        nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];
        nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];
    }
    if (!CABAC(h) && h->pps.transform_8x8_mode) {
        if (IS_8x8DCT(top_type)) {
            nnz_cache[4 + 8 * 0] =
            nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;
            nnz_cache[6 + 8 * 0] =
            nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12;
        }
        if (IS_8x8DCT(left_type[LTOP])) {
            nnz_cache[3 + 8 * 1] =
            nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12;
        }
        if (IS_8x8DCT(left_type[LBOT])) {
            nnz_cache[3 + 8 * 3] =
            nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12;
        }
        if (IS_8x8DCT(mb_type)) {
            nnz_cache[scan8[0]] =
            nnz_cache[scan8[1]] =
            nnz_cache[scan8[2]] =
            nnz_cache[scan8[3]] = (h->cbp & 0x1000) >> 12;
            nnz_cache[scan8[0 + 4]] =
            nnz_cache[scan8[1 + 4]] =
            nnz_cache[scan8[2 + 4]] =
            nnz_cache[scan8[3 + 4]] = (h->cbp & 0x2000) >> 12;
            nnz_cache[scan8[0 + 8]] =
            nnz_cache[scan8[1 + 8]] =
            nnz_cache[scan8[2 + 8]] =
            nnz_cache[scan8[3 + 8]] = (h->cbp & 0x4000) >> 12;
            nnz_cache[scan8[0 + 12]] =
            nnz_cache[scan8[1 + 12]] =
            nnz_cache[scan8[2 + 12]] =
            nnz_cache[scan8[3 + 12]] = (h->cbp & 0x8000) >> 12;
        }
    }
    return 0;
}
['static int fill_filter_caches(H264Context *h, int mb_type)\n{\n    const int mb_xy = h->mb_xy;\n    int top_xy, left_xy[LEFT_MBS];\n    int top_type, left_type[LEFT_MBS];\n    uint8_t *nnz;\n    uint8_t *nnz_cache;\n    top_xy = mb_xy - (h->mb_stride << MB_FIELD(h));\n    left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;\n    if (FRAME_MBAFF(h)) {\n        const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]);\n        const int curr_mb_field_flag = IS_INTERLACED(mb_type);\n        if (h->mb_y & 1) {\n            if (left_mb_field_flag != curr_mb_field_flag)\n                left_xy[LTOP] -= h->mb_stride;\n        } else {\n            if (curr_mb_field_flag)\n                top_xy += h->mb_stride &\n                          (((h->cur_pic.mb_type[top_xy] >> 7) & 1) - 1);\n            if (left_mb_field_flag != curr_mb_field_flag)\n                left_xy[LBOT] += h->mb_stride;\n        }\n    }\n    h->top_mb_xy        = top_xy;\n    h->left_mb_xy[LTOP] = left_xy[LTOP];\n    h->left_mb_xy[LBOT] = left_xy[LBOT];\n    {\n        int qp_thresh = h->qp_thresh;\n        int qp        = h->cur_pic.qscale_table[mb_xy];\n        if (qp <= qp_thresh &&\n            (left_xy[LTOP] < 0 ||\n             ((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) &&\n            (top_xy < 0 ||\n             ((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) {\n            if (!FRAME_MBAFF(h))\n                return 1;\n            if ((left_xy[LTOP] < 0 ||\n                 ((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) &&\n                (top_xy < h->mb_stride ||\n                 ((qp + h->cur_pic.qscale_table[top_xy - h->mb_stride] + 1) >> 1) <= qp_thresh))\n                return 1;\n        }\n    }\n    top_type        = h->cur_pic.mb_type[top_xy];\n    left_type[LTOP] = h->cur_pic.mb_type[left_xy[LTOP]];\n    left_type[LBOT] = h->cur_pic.mb_type[left_xy[LBOT]];\n    if (h->deblocking_filter == 2) {\n        if (h->slice_table[top_xy] != h->slice_num)\n            top_type = 0;\n        if (h->slice_table[left_xy[LBOT]] != h->slice_num)\n            left_type[LTOP] = left_type[LBOT] = 0;\n    } else {\n        if (h->slice_table[top_xy] == 0xFFFF)\n            top_type = 0;\n        if (h->slice_table[left_xy[LBOT]] == 0xFFFF)\n            left_type[LTOP] = left_type[LBOT] = 0;\n    }\n    h->top_type        = top_type;\n    h->left_type[LTOP] = left_type[LTOP];\n    h->left_type[LBOT] = left_type[LBOT];\n    if (IS_INTRA(mb_type))\n        return 0;\n    fill_filter_caches_inter(h, mb_type, top_xy, left_xy,\n                             top_type, left_type, mb_xy, 0);\n    if (h->list_count == 2)\n        fill_filter_caches_inter(h, mb_type, top_xy, left_xy,\n                                 top_type, left_type, mb_xy, 1);\n    nnz       = h->non_zero_count[mb_xy];\n    nnz_cache = h->non_zero_count_cache;\n    AV_COPY32(&nnz_cache[4 + 8 * 1], &nnz[0]);\n    AV_COPY32(&nnz_cache[4 + 8 * 2], &nnz[4]);\n    AV_COPY32(&nnz_cache[4 + 8 * 3], &nnz[8]);\n    AV_COPY32(&nnz_cache[4 + 8 * 4], &nnz[12]);\n    h->cbp = h->cbp_table[mb_xy];\n    if (top_type) {\n        nnz = h->non_zero_count[top_xy];\n        AV_COPY32(&nnz_cache[4 + 8 * 0], &nnz[3 * 4]);\n    }\n    if (left_type[LTOP]) {\n        nnz = h->non_zero_count[left_xy[LTOP]];\n        nnz_cache[3 + 8 * 1] = nnz[3 + 0 * 4];\n        nnz_cache[3 + 8 * 2] = nnz[3 + 1 * 4];\n        nnz_cache[3 + 8 * 3] = nnz[3 + 2 * 4];\n        nnz_cache[3 + 8 * 4] = nnz[3 + 3 * 4];\n    }\n    if (!CABAC(h) && h->pps.transform_8x8_mode) {\n        if (IS_8x8DCT(top_type)) {\n            nnz_cache[4 + 8 * 0] =\n            nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;\n            nnz_cache[6 + 8 * 0] =\n            nnz_cache[7 + 8 * 0] = (h->cbp_table[top_xy] & 0x8000) >> 12;\n        }\n        if (IS_8x8DCT(left_type[LTOP])) {\n            nnz_cache[3 + 8 * 1] =\n            nnz_cache[3 + 8 * 2] = (h->cbp_table[left_xy[LTOP]] & 0x2000) >> 12;\n        }\n        if (IS_8x8DCT(left_type[LBOT])) {\n            nnz_cache[3 + 8 * 3] =\n            nnz_cache[3 + 8 * 4] = (h->cbp_table[left_xy[LBOT]] & 0x8000) >> 12;\n        }\n        if (IS_8x8DCT(mb_type)) {\n            nnz_cache[scan8[0]] =\n            nnz_cache[scan8[1]] =\n            nnz_cache[scan8[2]] =\n            nnz_cache[scan8[3]] = (h->cbp & 0x1000) >> 12;\n            nnz_cache[scan8[0 + 4]] =\n            nnz_cache[scan8[1 + 4]] =\n            nnz_cache[scan8[2 + 4]] =\n            nnz_cache[scan8[3 + 4]] = (h->cbp & 0x2000) >> 12;\n            nnz_cache[scan8[0 + 8]] =\n            nnz_cache[scan8[1 + 8]] =\n            nnz_cache[scan8[2 + 8]] =\n            nnz_cache[scan8[3 + 8]] = (h->cbp & 0x4000) >> 12;\n            nnz_cache[scan8[0 + 12]] =\n            nnz_cache[scan8[1 + 12]] =\n            nnz_cache[scan8[2 + 12]] =\n            nnz_cache[scan8[3 + 12]] = (h->cbp & 0x8000) >> 12;\n        }\n    }\n    return 0;\n}']