libavcodec/dnxhdenc.c:750: error: Integer Overflow L2
  ([0, 2147483647] + [0, 2147483647]):signed32.

libavcodec/dnxhdenc.c:687:5: <LHS trace>
685. {
686.     int lambda, up_step, down_step;
687.     int last_lower = INT_MAX, last_higher = 0;
         ^
688.     int x, y, q;
689. 

libavcodec/dnxhdenc.c:687:5: Assignment
685. {
686.     int lambda, up_step, down_step;
687.     int last_lower = INT_MAX, last_higher = 0;
         ^
688.     int x, y, q;
689. 

libavcodec/dnxhdenc.c:687:5: <RHS trace>
685. {
686.     int lambda, up_step, down_step;
687.     int last_lower = INT_MAX, last_higher = 0;
         ^
688.     int x, y, q;
689. 

libavcodec/dnxhdenc.c:687:5: Assignment
685. {
686.     int lambda, up_step, down_step;
687.     int last_lower = INT_MAX, last_higher = 0;
         ^
688.     int x, y, q;
689. 

libavcodec/dnxhdenc.c:750:17: Binary operation: ([0, 2147483647] + [0, 2147483647]):signed32
748.                 return AVERROR(EINVAL);
749.             else
750.                 lambda += up_step;
                     ^
751.             up_step = FFMIN((int64_t)up_step*5, INT_MAX);
752.             down_step = 1<<LAMBDA_FRAC_BITS;

static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
{
    int lambda, up_step, down_step;
    int last_lower = INT_MAX, last_higher = 0;
    int x, y, q;
    for (q = 1; q < avctx->qmax; q++) {
        ctx->qscale = q;
        avctx->execute2(avctx, dnxhd_calc_bits_thread, NULL, NULL, ctx->m.mb_height);
    }
    up_step = down_step = 2<<LAMBDA_FRAC_BITS;
    lambda = ctx->lambda;
    for (;;) {
        int bits = 0;
        int end = 0;
        if (lambda == last_higher) {
            lambda++;
            end = 1;
        }
        for (y = 0; y < ctx->m.mb_height; y++) {
            for (x = 0; x < ctx->m.mb_width; x++) {
                unsigned min = UINT_MAX;
                int qscale = 1;
                int mb = y*ctx->m.mb_width+x;
                for (q = 1; q < avctx->qmax; q++) {
                    unsigned score = ctx->mb_rc[q][mb].bits*lambda+
                        ((unsigned)ctx->mb_rc[q][mb].ssd<<LAMBDA_FRAC_BITS);
                    if (score < min) {
                        min = score;
                        qscale = q;
                    }
                }
                bits += ctx->mb_rc[qscale][mb].bits;
                ctx->mb_qscale[mb] = qscale;
                ctx->mb_bits[mb] = ctx->mb_rc[qscale][mb].bits;
            }
            bits = (bits+31)&~31;
            if (bits > ctx->frame_bits)
                break;
        }
        if (end) {
            if (bits > ctx->frame_bits)
                return AVERROR(EINVAL);
            break;
        }
        if (bits < ctx->frame_bits) {
            last_lower = FFMIN(lambda, last_lower);
            if (last_higher != 0)
                lambda = (lambda+last_higher)>>1;
            else
                lambda -= down_step;
            down_step = FFMIN((int64_t)down_step*5, INT_MAX);
            up_step = 1<<LAMBDA_FRAC_BITS;
            lambda = FFMAX(1, lambda);
            if (lambda == last_lower)
                break;
        } else {
            last_higher = FFMAX(lambda, last_higher);
            if (last_lower != INT_MAX)
                lambda = (lambda+last_lower)>>1;
            else if ((int64_t)lambda + up_step > INT_MAX)
                return AVERROR(EINVAL);
            else
                lambda += up_step;
            up_step = FFMIN((int64_t)up_step*5, INT_MAX);
            down_step = 1<<LAMBDA_FRAC_BITS;
        }
    }
    ctx->lambda = lambda;
    return 0;
}
['static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)\n{\n    int lambda, up_step, down_step;\n    int last_lower = INT_MAX, last_higher = 0;\n    int x, y, q;\n    for (q = 1; q < avctx->qmax; q++) {\n        ctx->qscale = q;\n        avctx->execute2(avctx, dnxhd_calc_bits_thread, NULL, NULL, ctx->m.mb_height);\n    }\n    up_step = down_step = 2<<LAMBDA_FRAC_BITS;\n    lambda = ctx->lambda;\n    for (;;) {\n        int bits = 0;\n        int end = 0;\n        if (lambda == last_higher) {\n            lambda++;\n            end = 1;\n        }\n        for (y = 0; y < ctx->m.mb_height; y++) {\n            for (x = 0; x < ctx->m.mb_width; x++) {\n                unsigned min = UINT_MAX;\n                int qscale = 1;\n                int mb = y*ctx->m.mb_width+x;\n                for (q = 1; q < avctx->qmax; q++) {\n                    unsigned score = ctx->mb_rc[q][mb].bits*lambda+\n                        ((unsigned)ctx->mb_rc[q][mb].ssd<<LAMBDA_FRAC_BITS);\n                    if (score < min) {\n                        min = score;\n                        qscale = q;\n                    }\n                }\n                bits += ctx->mb_rc[qscale][mb].bits;\n                ctx->mb_qscale[mb] = qscale;\n                ctx->mb_bits[mb] = ctx->mb_rc[qscale][mb].bits;\n            }\n            bits = (bits+31)&~31;\n            if (bits > ctx->frame_bits)\n                break;\n        }\n        if (end) {\n            if (bits > ctx->frame_bits)\n                return AVERROR(EINVAL);\n            break;\n        }\n        if (bits < ctx->frame_bits) {\n            last_lower = FFMIN(lambda, last_lower);\n            if (last_higher != 0)\n                lambda = (lambda+last_higher)>>1;\n            else\n                lambda -= down_step;\n            down_step = FFMIN((int64_t)down_step*5, INT_MAX);\n            up_step = 1<<LAMBDA_FRAC_BITS;\n            lambda = FFMAX(1, lambda);\n            if (lambda == last_lower)\n                break;\n        } else {\n            last_higher = FFMAX(lambda, last_higher);\n            if (last_lower != INT_MAX)\n                lambda = (lambda+last_lower)>>1;\n            else if ((int64_t)lambda + up_step > INT_MAX)\n                return AVERROR(EINVAL);\n            else\n                lambda += up_step;\n            up_step = FFMIN((int64_t)up_step*5, INT_MAX);\n            down_step = 1<<LAMBDA_FRAC_BITS;\n        }\n    }\n    ctx->lambda = lambda;\n    return 0;\n}']