libavcodec/atrac3plus.c:1656: error: Uninitialized Value
  The value read from refwaves[_] was never initialized.

libavcodec/atrac3plus.c:1656:21: 
1654.             for (i = 0; i < dst[sb].num_wavs; i++)
1655.                 ctx->waves_info->waves[dst[sb].start_index + i].amp_sf =
1656.                     refwaves[dst[sb].start_index + i] >= 0
                          ^
1657.                     ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf
1658.                     : 32;

static void decode_tones_amplitude(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,
                                   int ch_num, int band_has_tones[])
{
    int mode, sb, j, i, diff, maxdiff, fi, delta, pred;
    Atrac3pWaveParam *wsrc, *wref;
    int refwaves[48];
    Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info;
    Atrac3pWavesData *ref = ctx->channels[0].tones_info;
    if (ch_num) {
        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {
            if (!band_has_tones[sb] || !dst[sb].num_wavs)
                continue;
            wsrc = &ctx->waves_info->waves[dst[sb].start_index];
            wref = &ctx->waves_info->waves[ref[sb].start_index];
            for (j = 0; j < dst[sb].num_wavs; j++) {
                for (i = 0, fi = 0, maxdiff = 1024; i < ref[sb].num_wavs; i++) {
                    diff = FFABS(wsrc[j].freq_index - wref[i].freq_index);
                    if (diff < maxdiff) {
                        maxdiff = diff;
                        fi      = i;
                    }
                }
                if (maxdiff < 8)
                    refwaves[dst[sb].start_index + j] = fi + ref[sb].start_index;
                else if (j < ref[sb].num_wavs)
                    refwaves[dst[sb].start_index + j] = j + ref[sb].start_index;
                else
                    refwaves[dst[sb].start_index + j] = -1;
            }
        }
    }
    mode = get_bits(gb, ch_num + 1);
    switch (mode) {
    case 0:
        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {
            if (!band_has_tones[sb] || !dst[sb].num_wavs)
                continue;
            if (ctx->waves_info->amplitude_mode)
                for (i = 0; i < dst[sb].num_wavs; i++)
                    ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = get_bits(gb, 6);
            else
                ctx->waves_info->waves[dst[sb].start_index].amp_sf = get_bits(gb, 6);
        }
        break;
    case 1:
        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {
            if (!band_has_tones[sb] || !dst[sb].num_wavs)
                continue;
            if (ctx->waves_info->amplitude_mode)
                for (i = 0; i < dst[sb].num_wavs; i++)
                    ctx->waves_info->waves[dst[sb].start_index + i].amp_sf =
                        get_vlc2(gb, tone_vlc_tabs[3].table,
                                 tone_vlc_tabs[3].bits, 1) + 20;
            else
                ctx->waves_info->waves[dst[sb].start_index].amp_sf =
                    get_vlc2(gb, tone_vlc_tabs[4].table,
                             tone_vlc_tabs[4].bits, 1) + 24;
        }
        break;
    case 2:
        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {
            if (!band_has_tones[sb] || !dst[sb].num_wavs)
                continue;
            for (i = 0; i < dst[sb].num_wavs; i++) {
                delta = get_vlc2(gb, tone_vlc_tabs[5].table,
                                 tone_vlc_tabs[5].bits, 1);
                delta = sign_extend(delta, 5);
                pred  = refwaves[dst[sb].start_index + i] >= 0 ?
                        ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf : 34;
                ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = (pred + delta) & 0x3F;
            }
        }
        break;
    case 3:
        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {
            if (!band_has_tones[sb])
                continue;
            for (i = 0; i < dst[sb].num_wavs; i++)
                ctx->waves_info->waves[dst[sb].start_index + i].amp_sf =
                    refwaves[dst[sb].start_index + i] >= 0
                    ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf
                    : 32;
        }
        break;
    }
}
['static void decode_tones_amplitude(GetBitContext *gb, Atrac3pChanUnitCtx *ctx,\n                                   int ch_num, int band_has_tones[])\n{\n    int mode, sb, j, i, diff, maxdiff, fi, delta, pred;\n    Atrac3pWaveParam *wsrc, *wref;\n    int refwaves[48];\n    Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info;\n    Atrac3pWavesData *ref = ctx->channels[0].tones_info;\n    if (ch_num) {\n        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {\n            if (!band_has_tones[sb] || !dst[sb].num_wavs)\n                continue;\n            wsrc = &ctx->waves_info->waves[dst[sb].start_index];\n            wref = &ctx->waves_info->waves[ref[sb].start_index];\n            for (j = 0; j < dst[sb].num_wavs; j++) {\n                for (i = 0, fi = 0, maxdiff = 1024; i < ref[sb].num_wavs; i++) {\n                    diff = FFABS(wsrc[j].freq_index - wref[i].freq_index);\n                    if (diff < maxdiff) {\n                        maxdiff = diff;\n                        fi      = i;\n                    }\n                }\n                if (maxdiff < 8)\n                    refwaves[dst[sb].start_index + j] = fi + ref[sb].start_index;\n                else if (j < ref[sb].num_wavs)\n                    refwaves[dst[sb].start_index + j] = j + ref[sb].start_index;\n                else\n                    refwaves[dst[sb].start_index + j] = -1;\n            }\n        }\n    }\n    mode = get_bits(gb, ch_num + 1);\n    switch (mode) {\n    case 0:\n        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {\n            if (!band_has_tones[sb] || !dst[sb].num_wavs)\n                continue;\n            if (ctx->waves_info->amplitude_mode)\n                for (i = 0; i < dst[sb].num_wavs; i++)\n                    ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = get_bits(gb, 6);\n            else\n                ctx->waves_info->waves[dst[sb].start_index].amp_sf = get_bits(gb, 6);\n        }\n        break;\n    case 1:\n        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {\n            if (!band_has_tones[sb] || !dst[sb].num_wavs)\n                continue;\n            if (ctx->waves_info->amplitude_mode)\n                for (i = 0; i < dst[sb].num_wavs; i++)\n                    ctx->waves_info->waves[dst[sb].start_index + i].amp_sf =\n                        get_vlc2(gb, tone_vlc_tabs[3].table,\n                                 tone_vlc_tabs[3].bits, 1) + 20;\n            else\n                ctx->waves_info->waves[dst[sb].start_index].amp_sf =\n                    get_vlc2(gb, tone_vlc_tabs[4].table,\n                             tone_vlc_tabs[4].bits, 1) + 24;\n        }\n        break;\n    case 2:\n        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {\n            if (!band_has_tones[sb] || !dst[sb].num_wavs)\n                continue;\n            for (i = 0; i < dst[sb].num_wavs; i++) {\n                delta = get_vlc2(gb, tone_vlc_tabs[5].table,\n                                 tone_vlc_tabs[5].bits, 1);\n                delta = sign_extend(delta, 5);\n                pred  = refwaves[dst[sb].start_index + i] >= 0 ?\n                        ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf : 34;\n                ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = (pred + delta) & 0x3F;\n            }\n        }\n        break;\n    case 3:\n        for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) {\n            if (!band_has_tones[sb])\n                continue;\n            for (i = 0; i < dst[sb].num_wavs; i++)\n                ctx->waves_info->waves[dst[sb].start_index + i].amp_sf =\n                    refwaves[dst[sb].start_index + i] >= 0\n                    ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf\n                    : 32;\n        }\n        break;\n    }\n}']