int vqbook = vr->books[vqclass][pass];
if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
- unsigned coffs;
+ int coffs;
unsigned dim = vc->codebooks[vqbook].dimensions;
unsigned step = FASTDIV(vr->partition_size << 1, dim << 1);
vorbis_codebook codebook = vc->codebooks[vqbook];
voffs = voffset+j*vlen;
for (k = 0; k < step; ++k) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= dim;
for (l = 0; l < dim; ++l)
vec[voffs + k + l * step] += codebook.codevectors[coffs + l];
}
} else if (vr_type == 1) {
voffs = voffset + j * vlen;
for (k = 0; k < step; ++k) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= dim;
for (l = 0; l < dim; ++l, ++voffs) {
vec[voffs]+=codebook.codevectors[coffs+l];
if (dim == 2) {
for (k = 0; k < step; ++k) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= 2;
vec[voffs + k ] += codebook.codevectors[coffs ];
vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];
}
} else if (dim == 4) {
for (k = 0; k < step; ++k, voffs += 2) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= 4;
vec[voffs ] += codebook.codevectors[coffs ];
vec[voffs + 1 ] += codebook.codevectors[coffs + 2];
vec[voffs + vlen ] += codebook.codevectors[coffs + 1];
}
} else
for (k = 0; k < step; ++k) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= dim;
for (l = 0; l < dim; l += 2, voffs++) {
vec[voffs ] += codebook.codevectors[coffs + l ];
vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];
unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) {
- coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
+ coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3);
+ if (coffs < 0)
+ return coffs;
+ coffs *= dim;
for (l = 0; l < dim; ++l) {
vec[voffs_div + voffs_mod * vlen] +=
codebook.codevectors[coffs + l];