libavcodec/aaccoder.c:828: error: Uninitialized Value
  The value read from maxvals[_] was never initialized.

libavcodec/aaccoder.c:828:42: 
826.                 if (sce->sf_idx[w*16+g] != prevsc)
827.                     fflag = 1;
828.                 sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
                                              ^
829.             }
830.         }

static void search_for_quantizers_twoloop(AVCodecContext *avctx,
                                          AACEncContext *s,
                                          SingleChannelElement *sce,
                                          const float lambda)
{
    int start = 0, i, w, w2, g;
    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
    float dists[128], uplims[128];
    float maxvals[128];
    int fflag, minscaler;
    int its  = 0;
    int allz = 0;
    float minthr = INFINITY;
    memset(dists, 0, sizeof(dists));
    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
        for (g = 0;  g < sce->ics.num_swb; g++) {
            int nz = 0;
            float uplim = 0.0f;
            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
                FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
                uplim += band->threshold;
                if (band->energy <= band->threshold || band->threshold == 0.0f) {
                    sce->zeroes[(w+w2)*16+g] = 1;
                    continue;
                }
                nz = 1;
            }
            uplims[w*16+g] = uplim *512;
            sce->zeroes[w*16+g] = !nz;
            if (nz)
                minthr = FFMIN(minthr, uplim);
            allz = FFMAX(allz, nz);
        }
    }
    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
        for (g = 0;  g < sce->ics.num_swb; g++) {
            if (sce->zeroes[w*16+g]) {
                sce->sf_idx[w*16+g] = SCALE_ONE_POS;
                continue;
            }
            sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);
        }
    }
    if (!allz)
        return;
    abs_pow34_v(s->scoefs, sce->coeffs, 1024);
    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
        start = w*128;
        for (g = 0;  g < sce->ics.num_swb; g++) {
            const float *scaled = s->scoefs + start;
            maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
            start += sce->ics.swb_sizes[g];
        }
    }
    do {
        int tbits, qstep;
        minscaler = sce->sf_idx[0];
        qstep = its ? 1 : 32;
        do {
            int prev = -1;
            tbits = 0;
            fflag = 0;
            for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
                start = w*128;
                for (g = 0;  g < sce->ics.num_swb; g++) {
                    const float *coefs = sce->coeffs + start;
                    const float *scaled = s->scoefs + start;
                    int bits = 0;
                    int cb;
                    float dist = 0.0f;
                    if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
                        start += sce->ics.swb_sizes[g];
                        continue;
                    }
                    minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
                    cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
                    for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
                        int b;
                        dist += quantize_band_cost(s, coefs + w2*128,
                                                   scaled + w2*128,
                                                   sce->ics.swb_sizes[g],
                                                   sce->sf_idx[w*16+g],
                                                   cb,
                                                   1.0f,
                                                   INFINITY,
                                                   &b);
                        bits += b;
                    }
                    dists[w*16+g] = dist - bits;
                    if (prev != -1) {
                        bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];
                    }
                    tbits += bits;
                    start += sce->ics.swb_sizes[g];
                    prev = sce->sf_idx[w*16+g];
                }
            }
            if (tbits > destbits) {
                for (i = 0; i < 128; i++)
                    if (sce->sf_idx[i] < 218 - qstep)
                        sce->sf_idx[i] += qstep;
            } else {
                for (i = 0; i < 128; i++)
                    if (sce->sf_idx[i] > 60 - qstep)
                        sce->sf_idx[i] -= qstep;
            }
            qstep >>= 1;
            if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)
                qstep = 1;
        } while (qstep);
        fflag = 0;
        minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
        for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
            for (g = 0; g < sce->ics.num_swb; g++) {
                int prevsc = sce->sf_idx[w*16+g];
                if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {
                    if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))
                    sce->sf_idx[w*16+g]--;
                    else
                        sce->sf_idx[w*16+g]-=2;
                }
                sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
                sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
                if (sce->sf_idx[w*16+g] != prevsc)
                    fflag = 1;
                sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);
            }
        }
        its++;
    } while (fflag && its < 10);
}
['static void search_for_quantizers_twoloop(AVCodecContext *avctx,\n                                          AACEncContext *s,\n                                          SingleChannelElement *sce,\n                                          const float lambda)\n{\n    int start = 0, i, w, w2, g;\n    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;\n    float dists[128], uplims[128];\n    float maxvals[128];\n    int fflag, minscaler;\n    int its  = 0;\n    int allz = 0;\n    float minthr = INFINITY;\n    memset(dists, 0, sizeof(dists));\n    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {\n        for (g = 0;  g < sce->ics.num_swb; g++) {\n            int nz = 0;\n            float uplim = 0.0f;\n            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {\n                FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];\n                uplim += band->threshold;\n                if (band->energy <= band->threshold || band->threshold == 0.0f) {\n                    sce->zeroes[(w+w2)*16+g] = 1;\n                    continue;\n                }\n                nz = 1;\n            }\n            uplims[w*16+g] = uplim *512;\n            sce->zeroes[w*16+g] = !nz;\n            if (nz)\n                minthr = FFMIN(minthr, uplim);\n            allz = FFMAX(allz, nz);\n        }\n    }\n    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {\n        for (g = 0;  g < sce->ics.num_swb; g++) {\n            if (sce->zeroes[w*16+g]) {\n                sce->sf_idx[w*16+g] = SCALE_ONE_POS;\n                continue;\n            }\n            sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2f(uplims[w*16+g]/minthr)*4,59);\n        }\n    }\n    if (!allz)\n        return;\n    abs_pow34_v(s->scoefs, sce->coeffs, 1024);\n    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {\n        start = w*128;\n        for (g = 0;  g < sce->ics.num_swb; g++) {\n            const float *scaled = s->scoefs + start;\n            maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);\n            start += sce->ics.swb_sizes[g];\n        }\n    }\n    do {\n        int tbits, qstep;\n        minscaler = sce->sf_idx[0];\n        qstep = its ? 1 : 32;\n        do {\n            int prev = -1;\n            tbits = 0;\n            fflag = 0;\n            for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {\n                start = w*128;\n                for (g = 0;  g < sce->ics.num_swb; g++) {\n                    const float *coefs = sce->coeffs + start;\n                    const float *scaled = s->scoefs + start;\n                    int bits = 0;\n                    int cb;\n                    float dist = 0.0f;\n                    if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {\n                        start += sce->ics.swb_sizes[g];\n                        continue;\n                    }\n                    minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);\n                    cb = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);\n                    for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {\n                        int b;\n                        dist += quantize_band_cost(s, coefs + w2*128,\n                                                   scaled + w2*128,\n                                                   sce->ics.swb_sizes[g],\n                                                   sce->sf_idx[w*16+g],\n                                                   cb,\n                                                   1.0f,\n                                                   INFINITY,\n                                                   &b);\n                        bits += b;\n                    }\n                    dists[w*16+g] = dist - bits;\n                    if (prev != -1) {\n                        bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];\n                    }\n                    tbits += bits;\n                    start += sce->ics.swb_sizes[g];\n                    prev = sce->sf_idx[w*16+g];\n                }\n            }\n            if (tbits > destbits) {\n                for (i = 0; i < 128; i++)\n                    if (sce->sf_idx[i] < 218 - qstep)\n                        sce->sf_idx[i] += qstep;\n            } else {\n                for (i = 0; i < 128; i++)\n                    if (sce->sf_idx[i] > 60 - qstep)\n                        sce->sf_idx[i] -= qstep;\n            }\n            qstep >>= 1;\n            if (!qstep && tbits > destbits*1.02 && sce->sf_idx[0] < 217)\n                qstep = 1;\n        } while (qstep);\n        fflag = 0;\n        minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);\n        for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {\n            for (g = 0; g < sce->ics.num_swb; g++) {\n                int prevsc = sce->sf_idx[w*16+g];\n                if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60) {\n                    if (find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]-1))\n                    sce->sf_idx[w*16+g]--;\n                    else\n                        sce->sf_idx[w*16+g]-=2;\n                }\n                sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);\n                sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);\n                if (sce->sf_idx[w*16+g] != prevsc)\n                    fflag = 1;\n                sce->band_type[w*16+g] = find_min_book(maxvals[w*16+g], sce->sf_idx[w*16+g]);\n            }\n        }\n        its++;\n    } while (fflag && its < 10);\n}']