libavcodec/proresenc.c:497: error: Integer Overflow L2
  ([0, +oo] - [0, 7]):unsigned32 by call to `estimate_acs`.

libavcodec/proresenc.c:497:13: Call
495. 
496.     bits  = estimate_dcs(error, ctx->blocks[plane], blocks_per_slice, qmat[0]);
497.     bits += estimate_acs(error, ctx->blocks[plane], blocks_per_slice,
                 ^
498.                          plane_size_factor, ctx->scantable.permutated, qmat);
499. 

libavcodec/proresenc.c:449:1: Global `ff_prores_ac_codebook`
  447. }
  448. 
  449. static int estimate_acs(int *error, DCTELEM *blocks, int blocks_per_slice,
       ^
  450.                         int plane_size_factor,
  451.                         const uint8_t *scan, const int16_t *qmat)

libavcodec/proresenc.c:469:25: Call
  467.             if (level) {
  468.                 abs_level = FFABS(level);
  469.                 bits += estimate_vlc(ff_prores_ac_codebook[run_cb], run);
                               ^
  470.                 bits += estimate_vlc(ff_prores_ac_codebook[lev_cb],
  471.                                      abs_level - 1) + 1;

libavcodec/proresenc.c:410:20: <LHS trace>
408.     if (val >= switch_val) {
409.         val -= switch_val - (1 << exp_order);
410.         exponent = av_log2(val);
                        ^
411. 
412.         return exponent * 2 - exp_order + switch_bits + 1;

libavcodec/proresenc.c:410:20: Call
    408.     if (val >= switch_val) {
    409.         val -= switch_val - (1 << exp_order);
    410.         exponent = av_log2(val);
                            ^
    411. 
    412.         return exponent * 2 - exp_order + switch_bits + 1;

libavutil/common.h:67:1: Global `ff_log2_tab`
      65. extern const uint8_t av_reverse[256];
      66. 
      67. static av_always_inline av_const int av_log2_c(unsigned int v)
          ^
      68. {
      69.     int n = 0;

libavutil/common.h:78:5: Assignment
      76.         n += 8;
      77.     }
      78.     n += ff_log2_tab[v];
              ^
      79. 
      80.     return n;

libavutil/common.h:80:5: Assignment
      78.     n += ff_log2_tab[v];
      79. 
      80.     return n;
              ^
      81. }
      82. 

libavcodec/proresenc.c:410:9: Assignment
    408.     if (val >= switch_val) {
    409.         val -= switch_val - (1 << exp_order);
    410.         exponent = av_log2(val);
                 ^
    411. 
    412.         return exponent * 2 - exp_order + switch_bits + 1;

libavcodec/proresenc.c:396:1: <RHS trace>
394. }
395. 
396. static inline int estimate_vlc(unsigned codebook, int val)
     ^
397. {
398.     unsigned int rice_order, exp_order, switch_bits, switch_val;

libavcodec/proresenc.c:396:1: Parameter `codebook`
    394. }
    395. 
    396. static inline int estimate_vlc(unsigned codebook, int val)
         ^
    397. {
    398.     unsigned int rice_order, exp_order, switch_bits, switch_val;

libavcodec/proresenc.c:404:5: Assignment
    402.     switch_bits = (codebook & 3) + 1;
    403.     rice_order  =  codebook >> 5;       /* rice code order */
    404.     exp_order   = (codebook >> 2) & 7;  /* exp golomb code order */
             ^
    405. 
    406.     switch_val  = switch_bits << rice_order;

libavcodec/proresenc.c:412:9: Binary operation: ([0, +oo] - [0, 7]):unsigned32 by call to `estimate_acs` 
    410.         exponent = av_log2(val);
    411. 
    412.         return exponent * 2 - exp_order + switch_bits + 1;
                 ^
    413.     } else {
    414.         return (val >> rice_order) + rice_order + 1;

static inline int estimate_vlc(unsigned codebook, int val)
{
    unsigned int rice_order, exp_order, switch_bits, switch_val;
    int exponent;
    switch_bits = (codebook & 3) + 1;
    rice_order  =  codebook >> 5;
    exp_order   = (codebook >> 2) & 7;
    switch_val  = switch_bits << rice_order;
    if (val >= switch_val) {
        val -= switch_val - (1 << exp_order);
        exponent = av_log2(val);
        return exponent * 2 - exp_order + switch_bits + 1;
    } else {
        return (val >> rice_order) + rice_order + 1;
    }
}
['static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,\n                                const uint16_t *src, int linesize,\n                                int mbs_per_slice,\n                                int blocks_per_mb, int plane_size_factor,\n                                const int16_t *qmat)\n{\n    int blocks_per_slice;\n    int bits;\n    blocks_per_slice = mbs_per_slice * blocks_per_mb;\n    bits  = estimate_dcs(error, ctx->blocks[plane], blocks_per_slice, qmat[0]);\n    bits += estimate_acs(error, ctx->blocks[plane], blocks_per_slice,\n                         plane_size_factor, ctx->scantable.permutated, qmat);\n    return FFALIGN(bits, 8);\n}', 'static int estimate_acs(int *error, DCTELEM *blocks, int blocks_per_slice,\n                        int plane_size_factor,\n                        const uint8_t *scan, const int16_t *qmat)\n{\n    int idx, i;\n    int run, level, run_cb, lev_cb;\n    int max_coeffs, abs_level;\n    int bits = 0;\n    max_coeffs = blocks_per_slice << 6;\n    run_cb     = ff_prores_run_to_cb_index[4];\n    lev_cb     = ff_prores_lev_to_cb_index[2];\n    run        = 0;\n    for (i = 1; i < 64; i++) {\n        for (idx = scan[i]; idx < max_coeffs; idx += 64) {\n            level   = blocks[idx] / qmat[scan[i]];\n            *error += FFABS(blocks[idx]) % qmat[scan[i]];\n            if (level) {\n                abs_level = FFABS(level);\n                bits += estimate_vlc(ff_prores_ac_codebook[run_cb], run);\n                bits += estimate_vlc(ff_prores_ac_codebook[lev_cb],\n                                     abs_level - 1) + 1;\n                run_cb = ff_prores_run_to_cb_index[FFMIN(run, 15)];\n                lev_cb = ff_prores_lev_to_cb_index[FFMIN(abs_level, 9)];\n                run    = 0;\n            } else {\n                run++;\n            }\n        }\n    }\n    return bits;\n}', 'static inline int estimate_vlc(unsigned codebook, int val)\n{\n    unsigned int rice_order, exp_order, switch_bits, switch_val;\n    int exponent;\n    switch_bits = (codebook & 3) + 1;\n    rice_order  =  codebook >> 5;\n    exp_order   = (codebook >> 2) & 7;\n    switch_val  = switch_bits << rice_order;\n    if (val >= switch_val) {\n        val -= switch_val - (1 << exp_order);\n        exponent = av_log2(val);\n        return exponent * 2 - exp_order + switch_bits + 1;\n    } else {\n        return (val >> rice_order) + rice_order + 1;\n    }\n}', 'static av_always_inline av_const int av_log2_c(unsigned int v)\n{\n    int n = 0;\n    if (v & 0xffff0000) {\n        v >>= 16;\n        n += 16;\n    }\n    if (v & 0xff00) {\n        v >>= 8;\n        n += 8;\n    }\n    n += ff_log2_tab[v];\n    return n;\n}']