uint_fast8_t classifs[ptns_to_read];
uint_fast8_t classifs[ptns_to_read*vc->audio_channels];
static int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, uint_fast8_t ch, uint_fast8_t *do_not_decode, float *vec, uint_fast16_t vlen) {    GetBitContext *gb=&vc->gb;    uint_fast8_t c_p_c=vc->codebooks[vr->classbook].dimensions;    uint_fast16_t n_to_read=vr->end-vr->begin;    uint_fast16_t ptns_to_read=n_to_read/vr->partition_size;    uint_fast8_t classifs[ptns_to_read];    uint_fast8_t pass;    uint_fast8_t ch_used;    uint_fast8_t i,j,l;    uint_fast16_t k;    if (vr->type==2) {        for(j=1;j<ch;++j) {                do_not_decode[0]&=do_not_decode[j];  // FIXME - clobbering input        }        if (do_not_decode[0]) return 0;        ch_used=1;    } else {        ch_used=ch;    }    AV_DEBUG(" residue type 0/1/2 decode begin, ch: %d  cpc %d  \n", ch, c_p_c);    for(pass=0;pass<=vr->maxpass;++pass) { // FIXME OPTIMIZE?        uint_fast16_t voffset;        uint_fast16_t partition_count;        uint_fast16_t j_times_ptns_to_read;        voffset=vr->begin;        for(partition_count=0;partition_count<ptns_to_read;) {  // SPEC        error            if (!pass) {                for(j_times_ptns_to_read=0, j=0;j<ch_used;++j) {                    if (!do_not_decode[j]) {                        uint_fast32_t temp=get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table,                        V_NB_BITS, vc->codebooks[vr->classbook].maxdepth);                        AV_DEBUG("Classword: %d \n", temp);                        for(i=0;i<c_p_c;++i) {                            uint_fast32_t temp2;                            temp2=temp/vr->classifications;                            classifs[j_times_ptns_to_read+partition_count+c_p_c-1-i]=temp-temp2*vr->classifications;                            temp=temp2;                        }                    }                    j_times_ptns_to_read+=ptns_to_read;                }            }            for(i=0;(i<c_p_c) && (partition_count<ptns_to_read);++i) {                for(j_times_ptns_to_read=0, j=0;j<ch_used;++j) {                    uint_fast16_t voffs;                    if (!do_not_decode[j]) {                        uint_fast8_t vqclass=classifs[j_times_ptns_to_read+partition_count];                        int_fast16_t vqbook=vr->books[vqclass][pass];                        if (vqbook>=0) {                            uint_fast16_t coffs;                            if (vr->type==0) {                                uint_fast16_t step=vr->partition_size/vc->codebooks[vqbook].dimensions;                                voffs=voffset+j*vlen;                                for(k=0;k<step;++k) {                                    coffs=get_vlc2(gb, vc->codebooks[vqbook].vlc.table,                                    V_NB_BITS, vc->codebooks[vr->classbook].maxdepth) * vc->codebooks[vqbook].dimensions;                                    for(l=0;l<vc->codebooks[vqbook].dimensions;++l) {                                        vec[voffs+k+l*step]+=vc->codebooks[vqbook].codevectors[coffs+l];  // FPMATH                                    }                                }                            }                            else if (vr->type==1) {                                voffs=voffset+j*vlen;                                for(k=0;k<vr->partition_size/vc->codebooks[vqbook].dimensions;++k) {                                    coffs=get_vlc2(gb, vc->codebooks[vqbook].vlc.table,                                    V_NB_BITS, vc->codebooks[vr->classbook].maxdepth) * vc->codebooks[vqbook].dimensions;                                    for(l=0;l<vc->codebooks[vqbook].dimensions;++l, ++voffs) {                                        vec[voffs]+=vc->codebooks[vqbook].codevectors[coffs+l];  // FPMATH                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d  \n", pass, voffs, vec[voffs], vc->codebooks[vqbook].codevectors[coffs+l], coffs);                                    }                                }                            }                            else if (vr->type==2 && ch==2) { // most frequent case optimized                                voffs=voffset;                                for(k=0;k<vr->partition_size/vc->codebooks[vqbook].dimensions;++k) {                                    coffs=get_vlc2(gb, vc->codebooks[vqbook].vlc.table,                                    V_NB_BITS, vc->codebooks[vr->classbook].maxdepth) * vc->codebooks[vqbook].dimensions;                                    for(l=0;l<vc->codebooks[vqbook].dimensions;++l, ++voffs) {                                        vec[(voffs>>1)+((voffs&1) ? vlen : 0)]+=vc->codebooks[vqbook].codevectors[coffs+l];  // FPMATH                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset/ch+(voffs%ch)*vlen, vec[voffset/ch+(voffs%ch)*vlen], vc->codebooks[vqbook].codevectors[coffs+l], coffs, l);                                    }                                }                            }                            else if (vr->type==2) {                                voffs=voffset;                                for(k=0;k<vr->partition_size/vc->codebooks[vqbook].dimensions;++k) {                                    coffs=get_vlc2(gb, vc->codebooks[vqbook].vlc.table,                                    V_NB_BITS, vc->codebooks[vr->classbook].maxdepth) * vc->codebooks[vqbook].dimensions;                                    for(l=0;l<vc->codebooks[vqbook].dimensions;++l, ++voffs) {                                        vec[voffs/ch+(voffs%ch)*vlen]+=vc->codebooks[vqbook].codevectors[coffs+l];  // FPMATH FIXME use if and counter instead of / and %                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset/ch+(voffs%ch)*vlen, vec[voffset/ch+(voffs%ch)*vlen], vc->codebooks[vqbook].codevectors[coffs+l], coffs, l);                                    }                                }                            } else {                                av_log(vc->avccontext, AV_LOG_ERROR, " Invalid residue type while residue decode?! \n");                                return 1;                            }                        }                        j_times_ptns_to_read+=ptns_to_read;                    }                }                ++partition_count;                voffset+=vr->partition_size;            }        }    }    return 0;}