const void *bits, const void *codes, int codes_wrap,
int codes_size, uint32_t code_prefix, int n_prefix)
{
- int ret, i, j, k, n, table_size, table_index, nb, n1, idx, code_prefix2,
+ int i, j, k, n, table_size, table_index, nb, n1, idx, code_prefix2,
symbol;
uint32_t code;
VLC_TYPE(*table)[2];
table[i][0] = -1; //codes
}
- /* first pass: map codes and compute auxillary table sizes */
+ /* map codes and compute auxillary table sizes */
for (i = 0; i < nb_codes; i++) {
GET_DATA(n, bits, i, 1, 1);
GET_DATA(code, codes, i, codes_wrap, codes_size);
j = (code << (table_nb_bits - n)) & (table_size - 1);
nb = 1 << (table_nb_bits - n);
for (k = 0; k < nb; k++) {
- if (table[j][1] /* bits */ != 0)
- return -E_BAD_CODES;
+ if (table[j][1] /* bits */ != 0) {
+ PARA_EMERG_LOG("detected incorrect code\n");
+ exit(EXIT_FAILURE);
+ }
table[j][1] = n; //bits
table[j][0] = symbol;
j++;
}
}
- /* second pass : fill auxillary tables recursively */
+ /* fill auxillary tables recursively */
for (i = 0; i < table_size; i++) {
n = table[i][1]; //bits
if (n < 0) {
n = table_nb_bits;
table[i][1] = -n; //bits
}
- ret = build_table(vlc, n, nb_codes,
+ idx = build_table(vlc, n, nb_codes,
bits, codes, codes_wrap, codes_size,
(code_prefix << table_nb_bits) | i,
n_prefix + table_nb_bits);
- if (ret < 0)
- return ret;
- idx = ret;
- /* note: realloc has been done, so reload tables */
+ /* vlc->table might have changed */
table = &vlc->table[table_index];
table[i][0] = idx; //code
}
#define SERVER_COMMAND_LIST_ERRORS
#define AFS_COMMAND_LIST_ERRORS
#define AUDIOD_COMMAND_LIST_ERRORS
+#define BITSTREAM_ERRORS
extern const char **para_errlist[];
PARA_ERROR(INCOHERENT_BLOCK_LEN, "incoherent block length"), \
-#define BITSTREAM_ERRORS \
- PARA_ERROR(BAD_CODES, "detected incorrect codes")
-
-
#define IMDCT_ERRORS \
PARA_ERROR(FFT_BAD_PARAMS, "invalid params for fft"), \