Revision 3c35da2f

View differences:

libavcodec/vorbis_dec.c
102 102
    uint_fast8_t  classbook;
103 103
    int_fast16_t  books[64][8];
104 104
    uint_fast8_t  maxpass;
105
    uint_fast16_t ptns_to_read;
106
    uint_fast8_t *classifs;
105 107
} vorbis_residue;
106 108

  
107 109
typedef struct {
......
194 196
    av_freep(&vc->channel_floors);
195 197
    av_freep(&vc->saved);
196 198

  
199
    for (i = 0; i < vc->residue_count; i++)
200
        av_free(vc->residues[i].classifs);
197 201
    av_freep(&vc->residues);
198 202
    av_freep(&vc->modes);
199 203

  
......
236 240
    uint8_t  *tmp_vlc_bits;
237 241
    uint32_t *tmp_vlc_codes;
238 242
    GetBitContext *gb = &vc->gb;
243
    uint_fast16_t *codebook_multiplicands;
239 244

  
240 245
    vc->codebook_count = get_bits(gb, 8) + 1;
241 246

  
......
244 249
    vc->codebooks = av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
245 250
    tmp_vlc_bits  = av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
246 251
    tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
252
    codebook_multiplicands = av_malloc(V_MAX_VLCS * sizeof(*codebook_multiplicands));
247 253

  
248 254
    for (cb = 0; cb < vc->codebook_count; ++cb) {
249 255
        vorbis_codebook *codebook_setup = &vc->codebooks[cb];
......
336 342
        if (codebook_setup->lookup_type == 1) {
337 343
            uint_fast16_t i, j, k;
338 344
            uint_fast16_t codebook_lookup_values = ff_vorbis_nth_root(entries, codebook_setup->dimensions);
339
            uint_fast16_t codebook_multiplicands[codebook_lookup_values];
340 345

  
341 346
            float codebook_minimum_value = vorbisfloat2float(get_bits_long(gb, 32));
342 347
            float codebook_delta_value   = vorbisfloat2float(get_bits_long(gb, 32));
......
420 425

  
421 426
    av_free(tmp_vlc_bits);
422 427
    av_free(tmp_vlc_codes);
428
    av_free(codebook_multiplicands);
423 429
    return 0;
424 430

  
425 431
// Error:
426 432
error:
427 433
    av_free(tmp_vlc_bits);
428 434
    av_free(tmp_vlc_codes);
435
    av_free(codebook_multiplicands);
429 436
    return -1;
430 437
}
431 438

  
......
654 661
        res_setup->classifications = get_bits(gb, 6) + 1;
655 662
        GET_VALIDATED_INDEX(res_setup->classbook, 8, vc->codebook_count)
656 663

  
664
        res_setup->ptns_to_read =
665
            (res_setup->end - res_setup->begin) / res_setup->partition_size;
666
        res_setup->classifs = av_malloc(res_setup->ptns_to_read *
667
                                        vc->audio_channels *
668
                                        sizeof(*res_setup->classifs));
669

  
657 670
        AV_DEBUG("    begin %d end %d part.size %d classif.s %d classbook %d \n", res_setup->begin, res_setup->end, res_setup->partition_size,
658 671
          res_setup->classifications, res_setup->classbook);
659 672

  
......
1116 1129
    GetBitContext *gb = &vc->gb;
1117 1130
    uint_fast16_t range_v[4] = { 256, 128, 86, 64 };
1118 1131
    uint_fast16_t range = range_v[vf->multiplier-1];
1119
    uint_fast16_t floor1_Y[vf->x_list_dim];
1120
    uint_fast16_t floor1_Y_final[vf->x_list_dim];
1121
    int floor1_flag[vf->x_list_dim];
1132
    uint_fast16_t floor1_Y[258];
1133
    uint_fast16_t floor1_Y_final[258];
1134
    int floor1_flag[258];
1122 1135
    uint_fast8_t class_;
1123 1136
    uint_fast8_t cdim;
1124 1137
    uint_fast8_t cbits;
......
1252 1265
{
1253 1266
    GetBitContext *gb = &vc->gb;
1254 1267
    uint_fast8_t c_p_c = vc->codebooks[vr->classbook].dimensions;
1255
    uint_fast16_t n_to_read = vr->end-vr->begin;
1256
    uint_fast16_t ptns_to_read = n_to_read/vr->partition_size;
1257
    uint_fast8_t classifs[ptns_to_read*vc->audio_channels];
1268
    uint_fast16_t ptns_to_read = vr->ptns_to_read;
1269
    uint_fast8_t *classifs = vr->classifs;
1258 1270
    uint_fast8_t pass;
1259 1271
    uint_fast8_t ch_used;
1260 1272
    uint_fast8_t i,j,l;
......
1450 1462
    uint_fast8_t blockflag;
1451 1463
    uint_fast16_t blocksize;
1452 1464
    int_fast32_t i,j;
1453
    uint_fast8_t no_residue[vc->audio_channels];
1454
    uint_fast8_t do_not_decode[vc->audio_channels];
1465
    uint_fast8_t no_residue[255];
1466
    uint_fast8_t do_not_decode[255];
1455 1467
    vorbis_mapping *mapping;
1456 1468
    float *ch_res_ptr   = vc->channel_residues;
1457 1469
    float *ch_floor_ptr = vc->channel_floors;
1458
    uint_fast8_t res_chan[vc->audio_channels];
1470
    uint_fast8_t res_chan[255];
1459 1471
    uint_fast8_t res_num = 0;
1460 1472
    int_fast16_t retlen  = 0;
1461 1473
    float fadd_bias = vc->add_bias;
......
1587 1599
    int buf_size       = avpkt->size;
1588 1600
    vorbis_context *vc = avccontext->priv_data ;
1589 1601
    GetBitContext *gb = &(vc->gb);
1590
    const float *channel_ptrs[vc->audio_channels];
1602
    const float *channel_ptrs[255];
1591 1603
    int i;
1592 1604

  
1593 1605
    int_fast16_t len;

Also available in: Unified diff