* Parse a vlc code.
*
* \param gbc The getbit context structure.
- * \param table The vlc tables to use.
- * \param bits The number of bits which will be read at once.
- *
- * The \a bits parameter must be identical to the \a nb_bits value supplied to
- * \ref init_vlc().
+ * \param vlc The vlc tables to use.
*
* \return The vlc code.
*/
-int get_vlc(struct getbit_context *gbc, int16_t (*table)[2], int bits)
+int get_vlc(struct getbit_context *gbc, const struct vlc *vlc)
{
int n, idx, nb_bits, code;
- idx = show_bits(gbc, bits);
- code = table[idx][0];
- n = table[idx][1];
+ idx = show_bits(gbc, vlc->bits);
+ code = vlc->table[idx][0];
+ n = vlc->table[idx][1];
if (n < 0) {
- skip_bits(gbc, bits);
+ skip_bits(gbc, vlc->bits);
nb_bits = -n;
idx = show_bits(gbc, nb_bits) + code;
- code = table[idx][0];
- n = table[idx][1];
+ code = vlc->table[idx][0];
+ n = vlc->table[idx][1];
if (n < 0) {
skip_bits(gbc, nb_bits);
nb_bits = -n;
idx = show_bits(gbc, nb_bits) + code;
- code = table[idx][0];
- n = table[idx][1];
+ code = vlc->table[idx][0];
+ n = vlc->table[idx][1];
}
}
skip_bits(gbc, n);
void init_vlc(struct vlc *vlc, int nb_bits, int nb_codes, const void *bits,
const void *codes, int codes_size);
void free_vlc(struct vlc *vlc);
-int get_vlc(struct getbit_context *gbc, int16_t (*table)[2], int bits);
+int get_vlc(struct getbit_context *gbc, const struct vlc *vlc);
last_exp = 36;
while (q < q_end) {
- code = get_vlc(&pwd->gb, pwd->exp_vlc.table, EXPVLCBITS);
+ code = get_vlc(&pwd->gb, &pwd->exp_vlc);
if (code < 0)
return code;
/* NOTE: this offset is the same as MPEG4 AAC ! */
if (val == (int)0x80000000)
val = get_bits(&pwd->gb, 7) - 19;
else {
- int code = get_vlc(&pwd->gb,
- pwd->hgain_vlc.table, HGAINVLCBITS);
+ int code = get_vlc(&pwd->gb, &pwd->hgain_vlc);
if (code < 0)
return code;
val += code - 18;
eptr = ptr + nb_coefs[ch];
memset(ptr, 0, pwd->block_len * sizeof(int16_t));
for (;;) {
- code = get_vlc(&pwd->gb, coef_vlc->table, VLCBITS);
+ code = get_vlc(&pwd->gb, coef_vlc);
if (code < 0)
return code;
if (code == 1) /* EOB */