Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-04-09 18:12:59 +0400
commitefbc9d9043ff8ff92716ddd00a5f61412d535593 (patch)
tree8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/filters/transform/MpaDecFilter/libmad
parentdf6b139a6d9027156f614b68687e039e3a5854db (diff)
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MpaDecFilter/libmad')
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/bit.c248
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/bit.h11
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/decoder.c763
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/decoder.h89
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/fixed.c59
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/fixed.h55
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/frame.c647
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/frame.h101
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/huffman.c5966
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/huffman.h71
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/hufftab.c5966
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/hufftab.h71
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/layer12.c778
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/layer3.c4174
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/mad.h779
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/minimad.c157
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h779
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/stream.c162
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/stream.h103
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/synth.c1114
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/synth.h41
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/timer.c611
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/timer.h78
-rw-r--r--src/filters/transform/MpaDecFilter/libmad/version.c40
24 files changed, 11120 insertions, 11743 deletions
diff --git a/src/filters/transform/MpaDecFilter/libmad/bit.c b/src/filters/transform/MpaDecFilter/libmad/bit.c
index 2c28d7f9c..c75d54df1 100644
--- a/src/filters/transform/MpaDecFilter/libmad/bit.c
+++ b/src/filters/transform/MpaDecFilter/libmad/bit.c
@@ -40,43 +40,42 @@
* G(X) = X^16 + X^15 + X^2 + 1
*/
static
-unsigned short const crc_table[256] =
-{
- 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
- 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
- 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
- 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
- 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
- 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
- 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
- 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
-
- 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
- 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
- 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
- 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
- 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
- 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
- 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
- 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
-
- 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
- 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
- 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
- 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
- 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
- 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
- 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
- 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
-
- 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
- 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
- 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
- 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
- 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
- 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
- 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
- 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
+unsigned short const crc_table[256] = {
+ 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
+ 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
+ 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
+ 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
+ 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
+ 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
+ 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
+ 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
+
+ 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
+ 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
+ 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
+ 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
+ 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
+ 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
+ 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
+ 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
+
+ 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
+ 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
+ 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
+ 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
+ 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
+ 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
+ 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
+ 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
+
+ 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
+ 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
+ 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
+ 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
+ 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
+ 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
+ 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
+ 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
# define CRC_POLY 0x8005
@@ -87,9 +86,9 @@ unsigned short const crc_table[256] =
*/
void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
{
- bitptr->byte = byte;
- bitptr->cache = 0;
- bitptr->left = CHAR_BIT;
+ bitptr->byte = byte;
+ bitptr->cache = 0;
+ bitptr->left = CHAR_BIT;
}
/*
@@ -97,10 +96,10 @@ void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
* DESCRIPTION: return number of bits between start and end points
*/
unsigned int mad_bit_length(struct mad_bitptr const *begin,
- struct mad_bitptr const *end)
+ struct mad_bitptr const *end)
{
- return begin->left +
- CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
+ return begin->left +
+ CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
}
/*
@@ -109,7 +108,7 @@ unsigned int mad_bit_length(struct mad_bitptr const *begin,
*/
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
{
- return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
+ return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
}
/*
@@ -118,17 +117,16 @@ unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
*/
void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
{
- bitptr->byte += len / CHAR_BIT;
- bitptr->left -= len % CHAR_BIT;
+ bitptr->byte += len / CHAR_BIT;
+ bitptr->left -= len % CHAR_BIT;
- if(bitptr->left > CHAR_BIT)
- {
- bitptr->byte++;
- bitptr->left += CHAR_BIT;
- }
+ if (bitptr->left > CHAR_BIT) {
+ bitptr->byte++;
+ bitptr->left += CHAR_BIT;
+ }
- if(bitptr->left < CHAR_BIT)
- bitptr->cache = *bitptr->byte;
+ if (bitptr->left < CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
}
/*
@@ -137,45 +135,42 @@ void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
*/
unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
{
- register unsigned long value;
+ register unsigned long value;
- if(bitptr->left == CHAR_BIT)
- bitptr->cache = *bitptr->byte;
+ if (bitptr->left == CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
- if(len < bitptr->left)
- {
- value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
- (bitptr->left - len);
- bitptr->left -= len;
+ if (len < bitptr->left) {
+ value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
+ (bitptr->left - len);
+ bitptr->left -= len;
- return value;
- }
+ return value;
+ }
- /* remaining bits in current byte */
+ /* remaining bits in current byte */
- value = bitptr->cache & ((1 << bitptr->left) - 1);
- len -= bitptr->left;
+ value = bitptr->cache & ((1 << bitptr->left) - 1);
+ len -= bitptr->left;
- bitptr->byte++;
- bitptr->left = CHAR_BIT;
+ bitptr->byte++;
+ bitptr->left = CHAR_BIT;
- /* more bytes */
+ /* more bytes */
- while(len >= CHAR_BIT)
- {
- value = (value << CHAR_BIT) | *bitptr->byte++;
- len -= CHAR_BIT;
- }
+ while (len >= CHAR_BIT) {
+ value = (value << CHAR_BIT) | *bitptr->byte++;
+ len -= CHAR_BIT;
+ }
- if(len > 0)
- {
- bitptr->cache = *bitptr->byte;
+ if (len > 0) {
+ bitptr->cache = *bitptr->byte;
- value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
- bitptr->left -= len;
- }
+ value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
+ bitptr->left -= len;
+ }
- return value;
+ return value;
}
# if 0
@@ -184,13 +179,13 @@ unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
* DESCRIPTION: write an arbitrary number of bits
*/
void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
- unsigned long value)
+ unsigned long value)
{
- unsigned char *ptr;
+ unsigned char *ptr;
- ptr = (unsigned char *) bitptr->byte;
+ ptr = (unsigned char *) bitptr->byte;
- /* ... */
+ /* ... */
}
# endif
@@ -199,50 +194,43 @@ void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
* DESCRIPTION: compute CRC-check word
*/
unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
- unsigned short init)
+ unsigned short init)
{
- register unsigned int crc;
-
- for(crc = init; len >= 32; len -= 32)
- {
- register unsigned long data;
-
- data = mad_bit_read(&bitptr, 32);
-
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 24)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 16)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 8)) & 0xff];
- crc = (crc << 8) ^ crc_table[((crc >> 8) ^(data >> 0)) & 0xff];
- }
-
- switch(len / 8)
- {
- case 3:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
- case 2:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
- case 1:
- crc = (crc << 8) ^
- crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
-
- len %= 8;
-
- case 0:
- break;
- }
-
- while(len--)
- {
- register unsigned int msb;
-
- msb = mad_bit_read(&bitptr, 1) ^(crc >> 15);
-
- crc <<= 1;
- if(msb & 1)
- crc ^= CRC_POLY;
- }
-
- return crc & 0xffff;
+ register unsigned int crc;
+
+ for (crc = init; len >= 32; len -= 32) {
+ register unsigned long data;
+
+ data = mad_bit_read(&bitptr, 32);
+
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff];
+ }
+
+ switch (len / 8) {
+ case 3: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 2: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 1: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+
+ len %= 8;
+
+ case 0: break;
+ }
+
+ while (len--) {
+ register unsigned int msb;
+
+ msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
+
+ crc <<= 1;
+ if (msb & 1)
+ crc ^= CRC_POLY;
+ }
+
+ return crc & 0xffff;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/bit.h b/src/filters/transform/MpaDecFilter/libmad/bit.h
index 33a8eb4a5..4d61b4f70 100644
--- a/src/filters/transform/MpaDecFilter/libmad/bit.h
+++ b/src/filters/transform/MpaDecFilter/libmad/bit.h
@@ -21,11 +21,10 @@
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
-struct mad_bitptr
-{
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
};
void mad_bit_init(struct mad_bitptr *, unsigned char const *);
@@ -33,7 +32,7 @@ void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/decoder.c b/src/filters/transform/MpaDecFilter/libmad/decoder.c
index 136457dfa..b42c861fe 100644
--- a/src/filters/transform/MpaDecFilter/libmad/decoder.c
+++ b/src/filters/transform/MpaDecFilter/libmad/decoder.c
@@ -56,504 +56,472 @@
* DESCRIPTION: initialize a decoder object with callback routines
*/
void mad_decoder_init(struct mad_decoder *decoder, void *data,
- enum mad_flow(*input_func)(void *,
- struct mad_stream *),
- enum mad_flow(*header_func)(void *,
- struct mad_header const *),
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*output_func)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*error_func)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*message_func)(void *,
- void *, unsigned int *))
+ enum mad_flow (*input_func)(void *,
+ struct mad_stream *),
+ enum mad_flow (*header_func)(void *,
+ struct mad_header const *),
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*error_func)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*message_func)(void *,
+ void *, unsigned int *))
{
- decoder->mode = -1;
+ decoder->mode = -1;
- decoder->options = 0;
+ decoder->options = 0;
- decoder->async.pid = 0;
- decoder->async.in = -1;
- decoder->async.out = -1;
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
- decoder->sync = 0;
+ decoder->sync = 0;
- decoder->cb_data = data;
+ decoder->cb_data = data;
- decoder->input_func = input_func;
- decoder->header_func = header_func;
- decoder->filter_func = filter_func;
- decoder->output_func = output_func;
- decoder->error_func = error_func;
- decoder->message_func = message_func;
+ decoder->input_func = input_func;
+ decoder->header_func = header_func;
+ decoder->filter_func = filter_func;
+ decoder->output_func = output_func;
+ decoder->error_func = error_func;
+ decoder->message_func = message_func;
}
int mad_decoder_finish(struct mad_decoder *decoder)
{
# if defined(USE_ASYNC)
- if(decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid)
- {
- pid_t pid;
- int status;
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) {
+ pid_t pid;
+ int status;
- close(decoder->async.in);
+ close(decoder->async.in);
- do
- pid = waitpid(decoder->async.pid, &status, 0);
- while(pid == -1 && errno == EINTR);
+ do
+ pid = waitpid(decoder->async.pid, &status, 0);
+ while (pid == -1 && errno == EINTR);
- decoder->mode = -1;
+ decoder->mode = -1;
- close(decoder->async.out);
+ close(decoder->async.out);
- decoder->async.pid = 0;
- decoder->async.in = -1;
- decoder->async.out = -1;
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
- if(pid == -1)
- return -1;
+ if (pid == -1)
+ return -1;
- return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0;
- }
+ return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0;
+ }
# endif
- return 0;
+ return 0;
}
# if defined(USE_ASYNC)
static
enum mad_flow send_io(int fd, void const *data, size_t len)
{
- char const *ptr = data;
- ssize_t count;
+ char const *ptr = data;
+ ssize_t count;
- while(len)
- {
- do
- count = write(fd, ptr, len);
- while(count == -1 && errno == EINTR);
+ while (len) {
+ do
+ count = write(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
- if(count == -1)
- return MAD_FLOW_BREAK;
+ if (count == -1)
+ return MAD_FLOW_BREAK;
- len -= count;
- ptr += count;
- }
+ len -= count;
+ ptr += count;
+ }
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
static
enum mad_flow receive_io(int fd, void *buffer, size_t len)
{
- char *ptr = buffer;
- ssize_t count;
-
- while(len)
- {
- do
- count = read(fd, ptr, len);
- while(count == -1 && errno == EINTR);
-
- if(count == -1)
- return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK;
- else if(count == 0)
- return MAD_FLOW_STOP;
-
- len -= count;
- ptr += count;
- }
+ char *ptr = buffer;
+ ssize_t count;
- return MAD_FLOW_CONTINUE;
+ while (len) {
+ do
+ count = read(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
+
+ if (count == -1)
+ return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK;
+ else if (count == 0)
+ return MAD_FLOW_STOP;
+
+ len -= count;
+ ptr += count;
+ }
+
+ return MAD_FLOW_CONTINUE;
}
static
enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len)
{
- int flags, blocking;
- enum mad_flow result;
+ int flags, blocking;
+ enum mad_flow result;
- flags = fcntl(fd, F_GETFL);
- if(flags == -1)
- return MAD_FLOW_BREAK;
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1)
+ return MAD_FLOW_BREAK;
- blocking = flags & ~O_NONBLOCK;
+ blocking = flags & ~O_NONBLOCK;
- if(blocking != flags &&
- fcntl(fd, F_SETFL, blocking) == -1)
- return MAD_FLOW_BREAK;
+ if (blocking != flags &&
+ fcntl(fd, F_SETFL, blocking) == -1)
+ return MAD_FLOW_BREAK;
- result = receive_io(fd, buffer, len);
+ result = receive_io(fd, buffer, len);
- if(flags != blocking &&
- fcntl(fd, F_SETFL, flags) == -1)
- return MAD_FLOW_BREAK;
+ if (flags != blocking &&
+ fcntl(fd, F_SETFL, flags) == -1)
+ return MAD_FLOW_BREAK;
- return result;
+ return result;
}
static
enum mad_flow send(int fd, void const *message, unsigned int size)
{
- enum mad_flow result;
+ enum mad_flow result;
- /* send size */
+ /* send size */
- result = send_io(fd, &size, sizeof(size));
+ result = send_io(fd, &size, sizeof(size));
- /* send message */
+ /* send message */
- if(result == MAD_FLOW_CONTINUE)
- result = send_io(fd, message, size);
+ if (result == MAD_FLOW_CONTINUE)
+ result = send_io(fd, message, size);
- return result;
+ return result;
}
static
enum mad_flow receive(int fd, void **message, unsigned int *size)
{
- enum mad_flow result;
- unsigned int actual;
+ enum mad_flow result;
+ unsigned int actual;
- if(*message == 0)
- *size = 0;
+ if (*message == 0)
+ *size = 0;
- /* receive size */
+ /* receive size */
- result = receive_io(fd, &actual, sizeof(actual));
+ result = receive_io(fd, &actual, sizeof(actual));
- /* receive message */
+ /* receive message */
- if(result == MAD_FLOW_CONTINUE)
- {
- if(actual > *size)
- actual -= *size;
- else
- {
- *size = actual;
- actual = 0;
- }
+ if (result == MAD_FLOW_CONTINUE) {
+ if (actual > *size)
+ actual -= *size;
+ else {
+ *size = actual;
+ actual = 0;
+ }
- if(*size > 0)
- {
- if(*message == 0)
- {
- *message = malloc(*size);
- if(*message == 0)
- return MAD_FLOW_BREAK;
- }
+ if (*size > 0) {
+ if (*message == 0) {
+ *message = malloc(*size);
+ if (*message == 0)
+ return MAD_FLOW_BREAK;
+ }
- result = receive_io_blocking(fd, *message, *size);
- }
+ result = receive_io_blocking(fd, *message, *size);
+ }
- /* throw away remainder of message */
+ /* throw away remainder of message */
- while(actual && result == MAD_FLOW_CONTINUE)
- {
- char sink[256];
- unsigned int len;
+ while (actual && result == MAD_FLOW_CONTINUE) {
+ char sink[256];
+ unsigned int len;
- len = actual > sizeof(sink) ? sizeof(sink) : actual;
+ len = actual > sizeof(sink) ? sizeof(sink) : actual;
- result = receive_io_blocking(fd, sink, len);
+ result = receive_io_blocking(fd, sink, len);
- actual -= len;
- }
+ actual -= len;
}
+ }
- return result;
+ return result;
}
static
enum mad_flow check_message(struct mad_decoder *decoder)
{
- enum mad_flow result;
- void *message = 0;
- unsigned int size;
-
- result = receive(decoder->async.in, &message, &size);
-
- if(result == MAD_FLOW_CONTINUE)
- {
- if(decoder->message_func == 0)
- size = 0;
- else
- {
- result = decoder->message_func(decoder->cb_data, message, &size);
-
- if(result == MAD_FLOW_IGNORE ||
- result == MAD_FLOW_BREAK)
- size = 0;
- }
-
- if(send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE)
- result = MAD_FLOW_BREAK;
+ enum mad_flow result;
+ void *message = 0;
+ unsigned int size;
+
+ result = receive(decoder->async.in, &message, &size);
+
+ if (result == MAD_FLOW_CONTINUE) {
+ if (decoder->message_func == 0)
+ size = 0;
+ else {
+ result = decoder->message_func(decoder->cb_data, message, &size);
+
+ if (result == MAD_FLOW_IGNORE ||
+ result == MAD_FLOW_BREAK)
+ size = 0;
}
- if(message)
- free(message);
+ if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE)
+ result = MAD_FLOW_BREAK;
+ }
- return result;
+ if (message)
+ free(message);
+
+ return result;
}
# endif
static
enum mad_flow error_default(void *data, struct mad_stream *stream,
- struct mad_frame *frame)
+ struct mad_frame *frame)
{
- int *bad_last_frame = data;
+ int *bad_last_frame = data;
- switch(stream->error)
- {
- case MAD_ERROR_BADCRC:
- if(*bad_last_frame)
- mad_frame_mute(frame);
- else
- *bad_last_frame = 1;
+ switch (stream->error) {
+ case MAD_ERROR_BADCRC:
+ if (*bad_last_frame)
+ mad_frame_mute(frame);
+ else
+ *bad_last_frame = 1;
- return MAD_FLOW_IGNORE;
+ return MAD_FLOW_IGNORE;
- default:
- return MAD_FLOW_CONTINUE;
- }
+ default:
+ return MAD_FLOW_CONTINUE;
+ }
}
static
int run_sync(struct mad_decoder *decoder)
{
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- void *error_data;
- int bad_last_frame = 0;
- struct mad_stream *stream;
- struct mad_frame *frame;
- struct mad_synth *synth;
- int result = 0;
-
- if(decoder->input_func == 0)
- return 0;
-
- if(decoder->error_func)
- {
- error_func = decoder->error_func;
- error_data = decoder->cb_data;
- }
- else
- {
- error_func = error_default;
- error_data = &bad_last_frame;
- }
-
- stream = &decoder->sync->stream;
- frame = &decoder->sync->frame;
- synth = &decoder->sync->synth;
-
- mad_stream_init(stream);
- mad_frame_init(frame);
- mad_synth_init(synth);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ void *error_data;
+ int bad_last_frame = 0;
+ struct mad_stream *stream;
+ struct mad_frame *frame;
+ struct mad_synth *synth;
+ int result = 0;
+
+ if (decoder->input_func == 0)
+ return 0;
- mad_stream_options(stream, decoder->options);
+ if (decoder->error_func) {
+ error_func = decoder->error_func;
+ error_data = decoder->cb_data;
+ }
+ else {
+ error_func = error_default;
+ error_data = &bad_last_frame;
+ }
+
+ stream = &decoder->sync->stream;
+ frame = &decoder->sync->frame;
+ synth = &decoder->sync->synth;
+
+ mad_stream_init(stream);
+ mad_frame_init(frame);
+ mad_synth_init(synth);
+
+ mad_stream_options(stream, decoder->options);
+
+ do {
+ switch (decoder->input_func(decoder->cb_data, stream)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
- do
- {
- switch(decoder->input_func(decoder->cb_data, stream))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
-
- while(1)
- {
+ while (1) {
# if defined(USE_ASYNC)
- if(decoder->mode == MAD_DECODER_MODE_ASYNC)
- {
- switch(check_message(decoder))
- {
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- break;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_STOP:
- goto done;
- }
- }
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
+ switch (check_message(decoder)) {
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_STOP:
+ goto done;
+ }
+ }
# endif
- if(decoder->header_func)
- {
- if(mad_header_decode(&frame->header, stream) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- break;
-
- switch(error_func(error_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- default:
- continue;
- }
- }
-
- switch(decoder->header_func(decoder->cb_data, &frame->header))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
-
- if(mad_frame_decode(frame, stream) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- break;
-
- switch(error_func(error_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- break;
- case MAD_FLOW_CONTINUE:
- default:
- continue;
- }
- }
- else
- bad_last_frame = 0;
-
- if(decoder->filter_func)
- {
- switch(decoder->filter_func(decoder->cb_data, stream, frame))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- continue;
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
-
- mad_synth_frame(synth, frame);
-
- if(decoder->output_func)
- {
- switch(decoder->output_func(decoder->cb_data,
- &frame->header, &synth->pcm))
- {
- case MAD_FLOW_STOP:
- goto done;
- case MAD_FLOW_BREAK:
- goto fail;
- case MAD_FLOW_IGNORE:
- case MAD_FLOW_CONTINUE:
- break;
- }
- }
- }
+ if (decoder->header_func) {
+ if (mad_header_decode(&frame->header, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+
+ switch (decoder->header_func(decoder->cb_data, &frame->header)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ if (mad_frame_decode(frame, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ break;
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+ else
+ bad_last_frame = 0;
+
+ if (decoder->filter_func) {
+ switch (decoder->filter_func(decoder->cb_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ mad_synth_frame(synth, frame);
+
+ if (decoder->output_func) {
+ switch (decoder->output_func(decoder->cb_data,
+ &frame->header, &synth->pcm)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
}
- while(stream->error == MAD_ERROR_BUFLEN);
+ }
+ while (stream->error == MAD_ERROR_BUFLEN);
-fail:
- result = -1;
+ fail:
+ result = -1;
-done:
- mad_synth_finish(synth);
- mad_frame_finish(frame);
- mad_stream_finish(stream);
+ done:
+ mad_synth_finish(synth);
+ mad_frame_finish(frame);
+ mad_stream_finish(stream);
- return result;
+ return result;
}
# if defined(USE_ASYNC)
static
int run_async(struct mad_decoder *decoder)
{
- pid_t pid;
- int ptoc[2], ctop[2], flags;
+ pid_t pid;
+ int ptoc[2], ctop[2], flags;
- if(pipe(ptoc) == -1)
- return -1;
+ if (pipe(ptoc) == -1)
+ return -1;
- if(pipe(ctop) == -1)
- {
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ if (pipe(ctop) == -1) {
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- flags = fcntl(ptoc[0], F_GETFL);
- if(flags == -1 ||
- fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1)
- {
- close(ctop[0]);
- close(ctop[1]);
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ flags = fcntl(ptoc[0], F_GETFL);
+ if (flags == -1 ||
+ fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- pid = fork();
- if(pid == -1)
- {
- close(ctop[0]);
- close(ctop[1]);
- close(ptoc[0]);
- close(ptoc[1]);
- return -1;
- }
+ pid = fork();
+ if (pid == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
- decoder->async.pid = pid;
+ decoder->async.pid = pid;
- if(pid)
- {
- /* parent */
+ if (pid) {
+ /* parent */
- close(ptoc[0]);
- close(ctop[1]);
+ close(ptoc[0]);
+ close(ctop[1]);
- decoder->async.in = ctop[0];
- decoder->async.out = ptoc[1];
+ decoder->async.in = ctop[0];
+ decoder->async.out = ptoc[1];
- return 0;
- }
+ return 0;
+ }
- /* child */
+ /* child */
- close(ptoc[1]);
- close(ctop[0]);
+ close(ptoc[1]);
+ close(ctop[0]);
- decoder->async.in = ptoc[0];
- decoder->async.out = ctop[1];
+ decoder->async.in = ptoc[0];
+ decoder->async.out = ctop[1];
- _exit(run_sync(decoder));
+ _exit(run_sync(decoder));
- /* not reached */
- return -1;
+ /* not reached */
+ return -1;
}
# endif
@@ -563,35 +531,34 @@ int run_async(struct mad_decoder *decoder)
*/
int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
{
- int result;
- int (*run)(struct mad_decoder *) = 0;
+ int result;
+ int (*run)(struct mad_decoder *) = 0;
- switch(decoder->mode = mode)
- {
- case MAD_DECODER_MODE_SYNC:
- run = run_sync;
- break;
+ switch (decoder->mode = mode) {
+ case MAD_DECODER_MODE_SYNC:
+ run = run_sync;
+ break;
- case MAD_DECODER_MODE_ASYNC:
+ case MAD_DECODER_MODE_ASYNC:
# if defined(USE_ASYNC)
- run = run_async;
+ run = run_async;
# endif
- break;
- }
+ break;
+ }
- if(run == 0)
- return -1;
+ if (run == 0)
+ return -1;
- decoder->sync = malloc(sizeof(*decoder->sync));
- if(decoder->sync == 0)
- return -1;
+ decoder->sync = malloc(sizeof(*decoder->sync));
+ if (decoder->sync == 0)
+ return -1;
- result = run(decoder);
+ result = run(decoder);
- free(decoder->sync);
- decoder->sync = 0;
+ free(decoder->sync);
+ decoder->sync = 0;
- return result;
+ return result;
}
/*
@@ -599,16 +566,16 @@ int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
* DESCRIPTION: send a message to and receive a reply from the decoder process
*/
int mad_decoder_message(struct mad_decoder *decoder,
- void *message, unsigned int *len)
+ void *message, unsigned int *len)
{
# if defined(USE_ASYNC)
- if(decoder->mode != MAD_DECODER_MODE_ASYNC ||
- send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE ||
- receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE)
- return -1;
+ if (decoder->mode != MAD_DECODER_MODE_ASYNC ||
+ send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE ||
+ receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE)
+ return -1;
- return 0;
+ return 0;
# else
- return -1;
+ return -1;
# endif
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/decoder.h b/src/filters/transform/MpaDecFilter/libmad/decoder.h
index 57961f099..33971567a 100644
--- a/src/filters/transform/MpaDecFilter/libmad/decoder.h
+++ b/src/filters/transform/MpaDecFilter/libmad/decoder.h
@@ -25,65 +25,60 @@
# include "frame.h"
# include "synth.h"
-enum mad_decoder_mode
-{
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
};
-enum mad_flow
-{
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
};
-struct mad_decoder
-{
- enum mad_decoder_mode mode;
+struct mad_decoder {
+ enum mad_decoder_mode mode;
- int options;
+ int options;
- struct
- {
- long pid;
- int in;
- int out;
- } async;
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
- void *cb_data;
+ void *cb_data;
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
};
void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
diff --git a/src/filters/transform/MpaDecFilter/libmad/fixed.c b/src/filters/transform/MpaDecFilter/libmad/fixed.c
index 2da82ceaf..6036d66d0 100644
--- a/src/filters/transform/MpaDecFilter/libmad/fixed.c
+++ b/src/filters/transform/MpaDecFilter/libmad/fixed.c
@@ -32,7 +32,7 @@
*/
mad_fixed_t mad_f_abs(mad_fixed_t x)
{
- return x < 0 ? -x : x;
+ return x < 0 ? -x : x;
}
/*
@@ -41,43 +41,40 @@ mad_fixed_t mad_f_abs(mad_fixed_t x)
*/
mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y)
{
- mad_fixed_t q, r;
- unsigned int bits;
+ mad_fixed_t q, r;
+ unsigned int bits;
- q = mad_f_abs(x / y);
+ q = mad_f_abs(x / y);
- if(x < 0)
- {
- x = -x;
- y = -y;
- }
+ if (x < 0) {
+ x = -x;
+ y = -y;
+ }
- r = x % y;
+ r = x % y;
- if(y < 0)
- {
- x = -x;
- y = -y;
- }
+ if (y < 0) {
+ x = -x;
+ y = -y;
+ }
- if(q > mad_f_intpart(MAD_F_MAX) &&
- !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0)))
- return 0;
+ if (q > mad_f_intpart(MAD_F_MAX) &&
+ !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0)))
+ return 0;
- for(bits = MAD_F_FRACBITS; bits && r; --bits)
- {
- q <<= 1, r <<= 1;
- if(r >= y)
- r -= y, ++q;
- }
+ for (bits = MAD_F_FRACBITS; bits && r; --bits) {
+ q <<= 1, r <<= 1;
+ if (r >= y)
+ r -= y, ++q;
+ }
- /* round */
- if(2 * r >= y)
- ++q;
+ /* round */
+ if (2 * r >= y)
+ ++q;
- /* fix sign */
- if((x < 0) != (y < 0))
- q = -q;
+ /* fix sign */
+ if ((x < 0) != (y < 0))
+ q = -q;
- return q << bits;
+ return q << bits;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/fixed.h b/src/filters/transform/MpaDecFilter/libmad/fixed.h
index a4d291f88..7f88de06c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/fixed.h
+++ b/src/filters/transform/MpaDecFilter/libmad/fixed.h
@@ -98,7 +98,7 @@ typedef mad_fixed_t mad_sample_t;
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
-/* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -142,35 +142,32 @@ typedef mad_fixed_t mad_sample_t;
# pragma warning(push)
# pragma warning(disable: 4035) /* no return value */
# if defined(_WIN64)
-static __forceinline
-mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
-{
- enum
- {
- fracbits = MAD_F_FRACBITS
- };
- return ((__int64)x * (__int64)y) >> fracbits; //TODO: unsigned?
-
- /* implicit return of eax */
-}
+ static __forceinline
+ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+ {
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+ return ((__int64)x*(__int64)y)>>fracbits; //TODO: unsigned?
+
+ /* implicit return of eax */
+ }
# else
-static __forceinline
-mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
-{
- enum
- {
- fracbits = MAD_F_FRACBITS
- };
-
- __asm
- {
- mov eax, x
- imul y
- shrd eax, edx, fracbits
- }
-
- /* implicit return of eax */
-}
+ static __forceinline
+ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+ {
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+ }
# endif
# pragma warning(pop)
diff --git a/src/filters/transform/MpaDecFilter/libmad/frame.c b/src/filters/transform/MpaDecFilter/libmad/frame.c
index 0bd55a266..23bfa7537 100644
--- a/src/filters/transform/MpaDecFilter/libmad/frame.c
+++ b/src/filters/transform/MpaDecFilter/libmad/frame.c
@@ -34,42 +34,30 @@
# include "layer3.h"
static
-unsigned long const bitrate_table[5][15] =
-{
- /* MPEG-1 */
- {
- 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */
- 256000, 288000, 320000, 352000, 384000, 416000, 448000
- },
- {
- 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */
- 128000, 160000, 192000, 224000, 256000, 320000, 384000
- },
- {
- 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */
- 112000, 128000, 160000, 192000, 224000, 256000, 320000
- },
-
- /* MPEG-2 LSF */
- {
- 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */
- 128000, 144000, 160000, 176000, 192000, 224000, 256000
- },
- {
- 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */
- 64000, 80000, 96000, 112000, 128000, 144000, 160000
- } /* II & III */
+unsigned long const bitrate_table[5][15] = {
+ /* MPEG-1 */
+ { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */
+ 256000, 288000, 320000, 352000, 384000, 416000, 448000 },
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */
+ 128000, 160000, 192000, 224000, 256000, 320000, 384000 },
+ { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */
+ 112000, 128000, 160000, 192000, 224000, 256000, 320000 },
+
+ /* MPEG-2 LSF */
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */
+ 128000, 144000, 160000, 176000, 192000, 224000, 256000 },
+ { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */
+ 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */
};
static
unsigned int const samplerate_table[3] = { 44100, 48000, 32000 };
static
-int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) =
-{
- mad_layer_I,
- mad_layer_II,
- mad_layer_III
+int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = {
+ mad_layer_I,
+ mad_layer_II,
+ mad_layer_III
};
/*
@@ -78,21 +66,21 @@ int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) =
*/
void mad_header_init(struct mad_header *header)
{
- header->layer = 0;
- header->mode = 0;
- header->mode_extension = 0;
- header->emphasis = 0;
+ header->layer = 0;
+ header->mode = 0;
+ header->mode_extension = 0;
+ header->emphasis = 0;
- header->bitrate = 0;
- header->samplerate = 0;
+ header->bitrate = 0;
+ header->samplerate = 0;
- header->crc_check = 0;
- header->crc_target = 0;
+ header->crc_check = 0;
+ header->crc_target = 0;
- header->flags = 0;
- header->private_bits = 0;
+ header->flags = 0;
+ header->private_bits = 0;
- header->duration = mad_timer_zero;
+ header->duration = mad_timer_zero;
}
/*
@@ -101,12 +89,12 @@ void mad_header_init(struct mad_header *header)
*/
void mad_frame_init(struct mad_frame *frame)
{
- mad_header_init(&frame->header);
+ mad_header_init(&frame->header);
- frame->options = 0;
+ frame->options = 0;
- frame->overlap = 0;
- mad_frame_mute(frame);
+ frame->overlap = 0;
+ mad_frame_mute(frame);
}
/*
@@ -115,13 +103,12 @@ void mad_frame_init(struct mad_frame *frame)
*/
void mad_frame_finish(struct mad_frame *frame)
{
- mad_header_finish(&frame->header);
+ mad_header_finish(&frame->header);
- if(frame->overlap)
- {
- free(frame->overlap);
- frame->overlap = 0;
- }
+ if (frame->overlap) {
+ free(frame->overlap);
+ frame->overlap = 0;
+ }
}
/*
@@ -131,123 +118,116 @@ void mad_frame_finish(struct mad_frame *frame)
static
int decode_header(struct mad_header *header, struct mad_stream *stream)
{
- unsigned int index;
+ unsigned int index;
- header->flags = 0;
- header->private_bits = 0;
+ header->flags = 0;
+ header->private_bits = 0;
- /* header() */
+ /* header() */
- /* syncword */
- mad_bit_skip(&stream->ptr, 11);
+ /* syncword */
+ mad_bit_skip(&stream->ptr, 11);
- /* MPEG 2.5 indicator (really part of syncword) */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- header->flags |= MAD_FLAG_MPEG_2_5_EXT;
+ /* MPEG 2.5 indicator (really part of syncword) */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_MPEG_2_5_EXT;
- /* ID */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- header->flags |= MAD_FLAG_LSF_EXT;
- else if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- {
- stream->error = MAD_ERROR_LOSTSYNC;
- return -1;
- }
+ /* ID */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_LSF_EXT;
+ else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
- /* layer */
- header->layer = 4 - mad_bit_read(&stream->ptr, 2);
+ /* layer */
+ header->layer = 4 - mad_bit_read(&stream->ptr, 2);
- if(header->layer == 4)
- {
- stream->error = MAD_ERROR_BADLAYER;
- return -1;
- }
+ if (header->layer == 4) {
+ stream->error = MAD_ERROR_BADLAYER;
+ return -1;
+ }
- /* protection_bit */
- if(mad_bit_read(&stream->ptr, 1) == 0)
- {
- header->flags |= MAD_FLAG_PROTECTION;
- header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff);
- }
+ /* protection_bit */
+ if (mad_bit_read(&stream->ptr, 1) == 0) {
+ header->flags |= MAD_FLAG_PROTECTION;
+ header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff);
+ }
- /* bitrate_index */
- index = mad_bit_read(&stream->ptr, 4);
+ /* bitrate_index */
+ index = mad_bit_read(&stream->ptr, 4);
- if(index == 15)
- {
- stream->error = MAD_ERROR_BADBITRATE;
- return -1;
- }
+ if (index == 15) {
+ stream->error = MAD_ERROR_BADBITRATE;
+ return -1;
+ }
- if(header->flags & MAD_FLAG_LSF_EXT)
- header->bitrate = bitrate_table[3 + (header->layer >> 1)][index];
- else
- header->bitrate = bitrate_table[header->layer - 1][index];
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ header->bitrate = bitrate_table[3 + (header->layer >> 1)][index];
+ else
+ header->bitrate = bitrate_table[header->layer - 1][index];
- /* sampling_frequency */
- index = mad_bit_read(&stream->ptr, 2);
+ /* sampling_frequency */
+ index = mad_bit_read(&stream->ptr, 2);
- if(index == 3)
- {
- stream->error = MAD_ERROR_BADSAMPLERATE;
- return -1;
- }
+ if (index == 3) {
+ stream->error = MAD_ERROR_BADSAMPLERATE;
+ return -1;
+ }
- header->samplerate = samplerate_table[index];
+ header->samplerate = samplerate_table[index];
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- header->samplerate /= 2;
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ header->samplerate /= 2;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- header->samplerate /= 2;
- }
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ header->samplerate /= 2;
+ }
- /* padding_bit */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_PADDING;
+ /* padding_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_PADDING;
- /* private_bit */
- if(mad_bit_read(&stream->ptr, 1))
- header->private_bits |= MAD_PRIVATE_HEADER;
+ /* private_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->private_bits |= MAD_PRIVATE_HEADER;
- /* mode */
- header->mode = 3 - mad_bit_read(&stream->ptr, 2);
+ /* mode */
+ header->mode = 3 - mad_bit_read(&stream->ptr, 2);
- /* mode_extension */
- header->mode_extension = mad_bit_read(&stream->ptr, 2);
+ /* mode_extension */
+ header->mode_extension = mad_bit_read(&stream->ptr, 2);
- /* copyright */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_COPYRIGHT;
+ /* copyright */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_COPYRIGHT;
- /* original/copy */
- if(mad_bit_read(&stream->ptr, 1))
- header->flags |= MAD_FLAG_ORIGINAL;
+ /* original/copy */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_ORIGINAL;
- /* emphasis */
- header->emphasis = mad_bit_read(&stream->ptr, 2);
+ /* emphasis */
+ header->emphasis = mad_bit_read(&stream->ptr, 2);
# if defined(OPT_STRICT)
- /*
- * ISO/IEC 11172-3 says this is a reserved emphasis value, but
- * streams exist which use it anyway. Since the value is not important
- * to the decoder proper, we allow it unless OPT_STRICT is defined.
- */
- if(header->emphasis == MAD_EMPHASIS_RESERVED)
- {
- stream->error = MAD_ERROR_BADEMPHASIS;
- return -1;
- }
+ /*
+ * ISO/IEC 11172-3 says this is a reserved emphasis value, but
+ * streams exist which use it anyway. Since the value is not important
+ * to the decoder proper, we allow it unless OPT_STRICT is defined.
+ */
+ if (header->emphasis == MAD_EMPHASIS_RESERVED) {
+ stream->error = MAD_ERROR_BADEMPHASIS;
+ return -1;
+ }
# endif
- /* error_check() */
+ /* error_check() */
- /* crc_check */
- if(header->flags & MAD_FLAG_PROTECTION)
- header->crc_target = mad_bit_read(&stream->ptr, 16);
+ /* crc_check */
+ if (header->flags & MAD_FLAG_PROTECTION)
+ header->crc_target = mad_bit_read(&stream->ptr, 16);
- return 0;
+ return 0;
}
/*
@@ -257,64 +237,59 @@ int decode_header(struct mad_header *header, struct mad_stream *stream)
static
int free_bitrate(struct mad_stream *stream, struct mad_header const *header)
{
- struct mad_bitptr keep_ptr;
- unsigned long rate = 0;
- unsigned int pad_slot, slots_per_frame;
- unsigned char const *ptr = 0;
+ struct mad_bitptr keep_ptr;
+ unsigned long rate = 0;
+ unsigned int pad_slot, slots_per_frame;
+ unsigned char const *ptr = 0;
- keep_ptr = stream->ptr;
+ keep_ptr = stream->ptr;
- pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
- slots_per_frame = (header->layer == MAD_LAYER_III &&
- (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
-
- while(mad_stream_sync(stream) == 0)
- {
- struct mad_stream peek_stream;
- struct mad_header peek_header;
-
- peek_stream = *stream;
- peek_header = *header;
-
- if(decode_header(&peek_header, &peek_stream) == 0 &&
- peek_header.layer == header->layer &&
- peek_header.samplerate == header->samplerate)
- {
- unsigned int N;
-
- ptr = mad_bit_nextbyte(&stream->ptr);
-
- N = ptr - stream->this_frame;
-
- if(header->layer == MAD_LAYER_I)
- {
- rate = (unsigned long) header->samplerate *
- (N - 4 * pad_slot + 4) / 48 / 1000;
- }
- else
- {
- rate = (unsigned long) header->samplerate *
- (N - pad_slot + 1) / slots_per_frame / 1000;
- }
-
- if(rate >= 8)
- break;
- }
-
- mad_bit_skip(&stream->ptr, 8);
- }
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+
+ while (mad_stream_sync(stream) == 0) {
+ struct mad_stream peek_stream;
+ struct mad_header peek_header;
+
+ peek_stream = *stream;
+ peek_header = *header;
+
+ if (decode_header(&peek_header, &peek_stream) == 0 &&
+ peek_header.layer == header->layer &&
+ peek_header.samplerate == header->samplerate) {
+ unsigned int N;
+
+ ptr = mad_bit_nextbyte(&stream->ptr);
- stream->ptr = keep_ptr;
+ N = ptr - stream->this_frame;
- if(rate < 8 || (header->layer == MAD_LAYER_III && rate > 640))
- {
- stream->error = MAD_ERROR_LOSTSYNC;
- return -1;
+ if (header->layer == MAD_LAYER_I) {
+ rate = (unsigned long) header->samplerate *
+ (N - 4 * pad_slot + 4) / 48 / 1000;
+ }
+ else {
+ rate = (unsigned long) header->samplerate *
+ (N - pad_slot + 1) / slots_per_frame / 1000;
+ }
+
+ if (rate >= 8)
+ break;
}
- stream->freerate = rate * 1000;
+ mad_bit_skip(&stream->ptr, 8);
+ }
+
+ stream->ptr = keep_ptr;
+
+ if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
+
+ stream->freerate = rate * 1000;
- return 0;
+ return 0;
}
/*
@@ -323,149 +298,136 @@ int free_bitrate(struct mad_stream *stream, struct mad_header const *header)
*/
int mad_header_decode(struct mad_header *header, struct mad_stream *stream)
{
- register unsigned char const *ptr, *end;
- unsigned int pad_slot, N;
+ register unsigned char const *ptr, *end;
+ unsigned int pad_slot, N;
- ptr = stream->next_frame;
- end = stream->bufend;
+ ptr = stream->next_frame;
+ end = stream->bufend;
- if(ptr == 0)
- {
- stream->error = MAD_ERROR_BUFPTR;
- goto fail;
- }
+ if (ptr == 0) {
+ stream->error = MAD_ERROR_BUFPTR;
+ goto fail;
+ }
- /* stream skip */
- if(stream->skiplen)
- {
- if(!stream->sync)
- ptr = stream->this_frame;
+ /* stream skip */
+ if (stream->skiplen) {
+ if (!stream->sync)
+ ptr = stream->this_frame;
- if(end - ptr < stream->skiplen)
- {
- stream->skiplen -= end - ptr;
- stream->next_frame = end;
+ if (end - ptr < stream->skiplen) {
+ stream->skiplen -= end - ptr;
+ stream->next_frame = end;
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
- ptr += stream->skiplen;
- stream->skiplen = 0;
+ ptr += stream->skiplen;
+ stream->skiplen = 0;
- stream->sync = 1;
- }
+ stream->sync = 1;
+ }
-sync:
- /* synchronize */
- if(stream->sync)
- {
- if(end - ptr < MAD_BUFFER_GUARD)
- {
- stream->next_frame = ptr;
-
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
- else if(!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- {
- /* mark point where frame sync word was expected */
- stream->this_frame = ptr;
- stream->next_frame = ptr + 1;
-
- stream->error = MAD_ERROR_LOSTSYNC;
- goto fail;
- }
+ sync:
+ /* synchronize */
+ if (stream->sync) {
+ if (end - ptr < MAD_BUFFER_GUARD) {
+ stream->next_frame = ptr;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
}
- else
- {
- mad_bit_init(&stream->ptr, ptr);
+ else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ /* mark point where frame sync word was expected */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1;
- if(mad_stream_sync(stream) == -1)
- {
- if(end - stream->next_frame >= MAD_BUFFER_GUARD)
- stream->next_frame = end - MAD_BUFFER_GUARD;
+ stream->error = MAD_ERROR_LOSTSYNC;
+ goto fail;
+ }
+ }
+ else {
+ mad_bit_init(&stream->ptr, ptr);
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ if (mad_stream_sync(stream) == -1) {
+ if (end - stream->next_frame >= MAD_BUFFER_GUARD)
+ stream->next_frame = end - MAD_BUFFER_GUARD;
- ptr = mad_bit_nextbyte(&stream->ptr);
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
}
- /* begin processing */
- stream->this_frame = ptr;
- stream->next_frame = ptr + 1; /* possibly bogus sync word */
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ }
- mad_bit_init(&stream->ptr, stream->this_frame);
+ /* begin processing */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1; /* possibly bogus sync word */
- if(decode_header(header, stream) == -1)
- goto fail;
+ mad_bit_init(&stream->ptr, stream->this_frame);
- /* calculate frame duration */
- mad_timer_set(&header->duration, 0,
- 32 * MAD_NSBSAMPLES(header), header->samplerate);
+ if (decode_header(header, stream) == -1)
+ goto fail;
- /* calculate free bit rate */
- if(header->bitrate == 0)
- {
- if((stream->freerate == 0 || !stream->sync ||
- (header->layer == MAD_LAYER_III && stream->freerate > 640000)) &&
- free_bitrate(stream, header) == -1)
- goto fail;
+ /* calculate frame duration */
+ mad_timer_set(&header->duration, 0,
+ 32 * MAD_NSBSAMPLES(header), header->samplerate);
- header->bitrate = stream->freerate;
- header->flags |= MAD_FLAG_FREEFORMAT;
- }
+ /* calculate free bit rate */
+ if (header->bitrate == 0) {
+ if ((stream->freerate == 0 || !stream->sync ||
+ (header->layer == MAD_LAYER_III && stream->freerate > 640000)) &&
+ free_bitrate(stream, header) == -1)
+ goto fail;
- /* calculate beginning of next frame */
- pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+ header->bitrate = stream->freerate;
+ header->flags |= MAD_FLAG_FREEFORMAT;
+ }
- if(header->layer == MAD_LAYER_I)
- N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
- else
- {
- unsigned int slots_per_frame;
+ /* calculate beginning of next frame */
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
- slots_per_frame = (header->layer == MAD_LAYER_III &&
- (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+ if (header->layer == MAD_LAYER_I)
+ N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
+ else {
+ unsigned int slots_per_frame;
- N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
- }
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
- /* verify there is enough data left in buffer to decode this frame */
- if(N + MAD_BUFFER_GUARD > end - stream->this_frame)
- {
- stream->next_frame = stream->this_frame;
+ N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
+ }
- stream->error = MAD_ERROR_BUFLEN;
- goto fail;
- }
+ /* verify there is enough data left in buffer to decode this frame */
+ if (N + MAD_BUFFER_GUARD > end - stream->this_frame) {
+ stream->next_frame = stream->this_frame;
- stream->next_frame = stream->this_frame + N;
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
- if(!stream->sync)
- {
- /* check that a valid frame header follows this frame */
+ stream->next_frame = stream->this_frame + N;
- ptr = stream->next_frame;
- if(!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- {
- ptr = stream->next_frame = stream->this_frame + 1;
- goto sync;
- }
+ if (!stream->sync) {
+ /* check that a valid frame header follows this frame */
- stream->sync = 1;
+ ptr = stream->next_frame;
+ if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ ptr = stream->next_frame = stream->this_frame + 1;
+ goto sync;
}
- header->flags |= MAD_FLAG_INCOMPLETE;
+ stream->sync = 1;
+ }
- return 0;
+ header->flags |= MAD_FLAG_INCOMPLETE;
-fail:
- stream->sync = 0;
+ return 0;
- return -1;
+ fail:
+ stream->sync = 0;
+
+ return -1;
}
/*
@@ -474,46 +436,44 @@ fail:
*/
int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream)
{
- frame->options = stream->options;
+ frame->options = stream->options;
- /* header() */
- /* error_check() */
+ /* header() */
+ /* error_check() */
- if(!(frame->header.flags & MAD_FLAG_INCOMPLETE) &&
- mad_header_decode(&frame->header, stream) == -1)
- goto fail;
+ if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) &&
+ mad_header_decode(&frame->header, stream) == -1)
+ goto fail;
- /* audio_data() */
+ /* audio_data() */
- frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
+ frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
- if(decoder_table[frame->header.layer - 1](stream, frame) == -1)
- {
- if(!MAD_RECOVERABLE(stream->error))
- stream->next_frame = stream->this_frame;
+ if (decoder_table[frame->header.layer - 1](stream, frame) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ stream->next_frame = stream->this_frame;
- goto fail;
- }
+ goto fail;
+ }
- /* ancillary_data() */
+ /* ancillary_data() */
- if(frame->header.layer != MAD_LAYER_III)
- {
- struct mad_bitptr next_frame;
+ if (frame->header.layer != MAD_LAYER_III) {
+ struct mad_bitptr next_frame;
- mad_bit_init(&next_frame, stream->next_frame);
+ mad_bit_init(&next_frame, stream->next_frame);
- stream->anc_ptr = stream->ptr;
- stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame);
+ stream->anc_ptr = stream->ptr;
+ stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame);
- mad_bit_finish(&next_frame);
- }
+ mad_bit_finish(&next_frame);
+ }
- return 0;
+ return 0;
-fail:
- stream->anc_bitlen = 0;
- return -1;
+ fail:
+ stream->anc_bitlen = 0;
+ return -1;
}
/*
@@ -522,26 +482,21 @@ fail:
*/
void mad_frame_mute(struct mad_frame *frame)
{
- unsigned int s, sb;
-
- for(s = 0; s < 36; ++s)
- {
- for(sb = 0; sb < 32; ++sb)
- {
- frame->sbsample[0][s][sb] =
- frame->sbsample[1][s][sb] = 0;
- }
- }
+ unsigned int s, sb;
- if(frame->overlap)
- {
- for(s = 0; s < 18; ++s)
- {
- for(sb = 0; sb < 32; ++sb)
- {
- (*frame->overlap)[0][sb][s] =
- (*frame->overlap)[1][sb][s] = 0;
- }
- }
+ for (s = 0; s < 36; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ frame->sbsample[0][s][sb] =
+ frame->sbsample[1][s][sb] = 0;
+ }
+ }
+
+ if (frame->overlap) {
+ for (s = 0; s < 18; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ (*frame->overlap)[0][sb][s] =
+ (*frame->overlap)[1][sb][s] = 0;
+ }
}
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/frame.h b/src/filters/transform/MpaDecFilter/libmad/frame.h
index 11f3c402d..6f262b674 100644
--- a/src/filters/transform/MpaDecFilter/libmad/frame.h
+++ b/src/filters/transform/MpaDecFilter/libmad/frame.h
@@ -25,56 +25,51 @@
# include "timer.h"
# include "stream.h"
-enum mad_layer
-{
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
};
-enum mad_mode
-{
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
};
-enum mad_emphasis
-{
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
};
-struct mad_header
-{
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
+ mad_timer_t duration; /* audio playing time of frame */
};
-struct mad_frame
-{
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
@@ -83,29 +78,27 @@ struct mad_frame
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
-enum
-{
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
};
-enum
-{
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
};
void mad_header_init(struct mad_header *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/huffman.c b/src/filters/transform/MpaDecFilter/libmad/huffman.c
index f0a77bb3e..58b6fa3ae 100644
--- a/src/filters/transform/MpaDecFilter/libmad/huffman.c
+++ b/src/filters/transform/MpaDecFilter/libmad/huffman.c
@@ -49,65 +49,63 @@
# endif
static
-union huffquad const hufftabA[] =
-{
- /* 0000 */ PTR(16, 2),
- /* 0001 */ PTR(20, 2),
- /* 0010 */ PTR(24, 1),
- /* 0011 */ PTR(26, 1),
- /* 0100 */ V(0, 0, 1, 0, 4),
- /* 0101 */ V(0, 0, 0, 1, 4),
- /* 0110 */ V(0, 1, 0, 0, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 0, 0, 0, 1),
- /* 1001 */ V(0, 0, 0, 0, 1),
- /* 1010 */ V(0, 0, 0, 0, 1),
- /* 1011 */ V(0, 0, 0, 0, 1),
- /* 1100 */ V(0, 0, 0, 0, 1),
- /* 1101 */ V(0, 0, 0, 0, 1),
- /* 1110 */ V(0, 0, 0, 0, 1),
- /* 1111 */ V(0, 0, 0, 0, 1),
-
- /* 0000 ... */
- /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
- /* 01 */ V(1, 1, 1, 1, 2),
- /* 10 */ V(1, 1, 0, 1, 2),
- /* 11 */ V(1, 1, 1, 0, 2),
-
- /* 0001 ... */
- /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
- /* 01 */ V(0, 1, 0, 1, 2),
- /* 10 */ V(1, 0, 0, 1, 1),
- /* 11 */ V(1, 0, 0, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
- /* 1 */ V(0, 0, 1, 1, 1),
-
- /* 0011 ... */
- /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
- /* 1 */ V(1, 1, 0, 0, 1)
+union huffquad const hufftabA[] = {
+ /* 0000 */ PTR(16, 2),
+ /* 0001 */ PTR(20, 2),
+ /* 0010 */ PTR(24, 1),
+ /* 0011 */ PTR(26, 1),
+ /* 0100 */ V(0, 0, 1, 0, 4),
+ /* 0101 */ V(0, 0, 0, 1, 4),
+ /* 0110 */ V(0, 1, 0, 0, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 0, 0, 0, 1),
+ /* 1001 */ V(0, 0, 0, 0, 1),
+ /* 1010 */ V(0, 0, 0, 0, 1),
+ /* 1011 */ V(0, 0, 0, 0, 1),
+ /* 1100 */ V(0, 0, 0, 0, 1),
+ /* 1101 */ V(0, 0, 0, 0, 1),
+ /* 1110 */ V(0, 0, 0, 0, 1),
+ /* 1111 */ V(0, 0, 0, 0, 1),
+
+ /* 0000 ... */
+ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
+ /* 01 */ V(1, 1, 1, 1, 2),
+ /* 10 */ V(1, 1, 0, 1, 2),
+ /* 11 */ V(1, 1, 1, 0, 2),
+
+ /* 0001 ... */
+ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
+ /* 01 */ V(0, 1, 0, 1, 2),
+ /* 10 */ V(1, 0, 0, 1, 1),
+ /* 11 */ V(1, 0, 0, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
+ /* 1 */ V(0, 0, 1, 1, 1),
+
+ /* 0011 ... */
+ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
+ /* 1 */ V(1, 1, 0, 0, 1)
};
static
-union huffquad const hufftabB[] =
-{
- /* 0000 */ V(1, 1, 1, 1, 4),
- /* 0001 */ V(1, 1, 1, 0, 4),
- /* 0010 */ V(1, 1, 0, 1, 4),
- /* 0011 */ V(1, 1, 0, 0, 4),
- /* 0100 */ V(1, 0, 1, 1, 4),
- /* 0101 */ V(1, 0, 1, 0, 4),
- /* 0110 */ V(1, 0, 0, 1, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 1, 1, 1, 4),
- /* 1001 */ V(0, 1, 1, 0, 4),
- /* 1010 */ V(0, 1, 0, 1, 4),
- /* 1011 */ V(0, 1, 0, 0, 4),
- /* 1100 */ V(0, 0, 1, 1, 4),
- /* 1101 */ V(0, 0, 1, 0, 4),
- /* 1110 */ V(0, 0, 0, 1, 4),
- /* 1111 */ V(0, 0, 0, 0, 4)
+union huffquad const hufftabB[] = {
+ /* 0000 */ V(1, 1, 1, 1, 4),
+ /* 0001 */ V(1, 1, 1, 0, 4),
+ /* 0010 */ V(1, 1, 0, 1, 4),
+ /* 0011 */ V(1, 1, 0, 0, 4),
+ /* 0100 */ V(1, 0, 1, 1, 4),
+ /* 0101 */ V(1, 0, 1, 0, 4),
+ /* 0110 */ V(1, 0, 0, 1, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 1, 1, 1, 4),
+ /* 1001 */ V(0, 1, 1, 0, 4),
+ /* 1010 */ V(0, 1, 0, 1, 4),
+ /* 1011 */ V(0, 1, 0, 0, 4),
+ /* 1100 */ V(0, 0, 1, 1, 4),
+ /* 1101 */ V(0, 0, 1, 0, 4),
+ /* 1110 */ V(0, 0, 0, 1, 4),
+ /* 1111 */ V(0, 0, 0, 0, 4)
};
# undef V
@@ -127,2961 +125,2944 @@ union huffquad const hufftabB[] =
# endif
static
-union huffpair const hufftab0[] =
-{
- /* */ V(0, 0, 0)
+union huffpair const hufftab0[] = {
+ /* */ V(0, 0, 0)
};
static
-union huffpair const hufftab1[] =
-{
- /* 000 */ V(1, 1, 3),
- /* 001 */ V(0, 1, 3),
- /* 010 */ V(1, 0, 2),
- /* 011 */ V(1, 0, 2),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1)
+union huffpair const hufftab1[] = {
+ /* 000 */ V(1, 1, 3),
+ /* 001 */ V(0, 1, 3),
+ /* 010 */ V(1, 0, 2),
+ /* 011 */ V(1, 0, 2),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1)
};
static
-union huffpair const hufftab2[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab2[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab3[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 0, 3),
- /* 010 */ V(1, 1, 2),
- /* 011 */ V(1, 1, 2),
- /* 100 */ V(0, 1, 2),
- /* 101 */ V(0, 1, 2),
- /* 110 */ V(0, 0, 2),
- /* 111 */ V(0, 0, 2),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab3[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 0, 3),
+ /* 010 */ V(1, 1, 2),
+ /* 011 */ V(1, 1, 2),
+ /* 100 */ V(0, 1, 2),
+ /* 101 */ V(0, 1, 2),
+ /* 110 */ V(0, 0, 2),
+ /* 111 */ V(0, 0, 2),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab5[] =
-{
- /* 000 */ PTR(8, 4),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 0000 */ PTR(24, 1), /* 8 */
- /* 0001 */ V(3, 2, 4),
- /* 0010 */ V(3, 1, 3),
- /* 0011 */ V(3, 1, 3),
- /* 0100 */ V(1, 3, 4),
- /* 0101 */ V(0, 3, 4),
- /* 0110 */ V(3, 0, 4),
- /* 0111 */ V(2, 2, 4),
- /* 1000 */ V(1, 2, 3),
- /* 1001 */ V(1, 2, 3),
- /* 1010 */ V(2, 1, 3),
- /* 1011 */ V(2, 1, 3),
- /* 1100 */ V(0, 2, 3),
- /* 1101 */ V(0, 2, 3),
- /* 1110 */ V(2, 0, 3),
- /* 1111 */ V(2, 0, 3),
-
- /* 000 0000 ... */
- /* 0 */ V(3, 3, 1), /* 24 */
- /* 1 */ V(2, 3, 1)
+union huffpair const hufftab5[] = {
+ /* 000 */ PTR(8, 4),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 0000 */ PTR(24, 1), /* 8 */
+ /* 0001 */ V(3, 2, 4),
+ /* 0010 */ V(3, 1, 3),
+ /* 0011 */ V(3, 1, 3),
+ /* 0100 */ V(1, 3, 4),
+ /* 0101 */ V(0, 3, 4),
+ /* 0110 */ V(3, 0, 4),
+ /* 0111 */ V(2, 2, 4),
+ /* 1000 */ V(1, 2, 3),
+ /* 1001 */ V(1, 2, 3),
+ /* 1010 */ V(2, 1, 3),
+ /* 1011 */ V(2, 1, 3),
+ /* 1100 */ V(0, 2, 3),
+ /* 1101 */ V(0, 2, 3),
+ /* 1110 */ V(2, 0, 3),
+ /* 1111 */ V(2, 0, 3),
+
+ /* 000 0000 ... */
+ /* 0 */ V(3, 3, 1), /* 24 */
+ /* 1 */ V(2, 3, 1)
};
static
-union huffpair const hufftab6[] =
-{
- /* 0000 */ PTR(16, 3),
- /* 0001 */ PTR(24, 1),
- /* 0010 */ PTR(26, 1),
- /* 0011 */ V(1, 2, 4),
- /* 0100 */ V(2, 1, 4),
- /* 0101 */ V(2, 0, 4),
- /* 0110 */ V(0, 1, 3),
- /* 0111 */ V(0, 1, 3),
- /* 1000 */ V(1, 1, 2),
- /* 1001 */ V(1, 1, 2),
- /* 1010 */ V(1, 1, 2),
- /* 1011 */ V(1, 1, 2),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 000 */ V(3, 3, 3), /* 16 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(2, 3, 2),
- /* 011 */ V(2, 3, 2),
- /* 100 */ V(3, 2, 2),
- /* 101 */ V(3, 2, 2),
- /* 110 */ V(3, 0, 2),
- /* 111 */ V(3, 0, 2),
-
- /* 0001 ... */
- /* 0 */ V(1, 3, 1), /* 24 */
- /* 1 */ V(3, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(2, 2, 1), /* 26 */
- /* 1 */ V(0, 2, 1)
+union huffpair const hufftab6[] = {
+ /* 0000 */ PTR(16, 3),
+ /* 0001 */ PTR(24, 1),
+ /* 0010 */ PTR(26, 1),
+ /* 0011 */ V(1, 2, 4),
+ /* 0100 */ V(2, 1, 4),
+ /* 0101 */ V(2, 0, 4),
+ /* 0110 */ V(0, 1, 3),
+ /* 0111 */ V(0, 1, 3),
+ /* 1000 */ V(1, 1, 2),
+ /* 1001 */ V(1, 1, 2),
+ /* 1010 */ V(1, 1, 2),
+ /* 1011 */ V(1, 1, 2),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 000 */ V(3, 3, 3), /* 16 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(2, 3, 2),
+ /* 011 */ V(2, 3, 2),
+ /* 100 */ V(3, 2, 2),
+ /* 101 */ V(3, 2, 2),
+ /* 110 */ V(3, 0, 2),
+ /* 111 */ V(3, 0, 2),
+
+ /* 0001 ... */
+ /* 0 */ V(1, 3, 1), /* 24 */
+ /* 1 */ V(3, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(2, 2, 1), /* 26 */
+ /* 1 */ V(0, 2, 1)
};
static
-union huffpair const hufftab7[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 2), /* 16 */
- /* 0001 */ PTR(56, 1),
- /* 0010 */ PTR(58, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(60, 1),
- /* 0110 */ V(5, 0, 4),
- /* 0111 */ PTR(62, 1),
- /* 1000 */ V(2, 4, 4),
- /* 1001 */ V(4, 2, 4),
- /* 1010 */ V(1, 4, 3),
- /* 1011 */ V(1, 4, 3),
- /* 1100 */ V(4, 1, 3),
- /* 1101 */ V(4, 1, 3),
- /* 1110 */ V(4, 0, 3),
- /* 1111 */ V(4, 0, 3),
-
- /* 0001 ... */
- /* 0000 */ V(0, 4, 4), /* 32 */
- /* 0001 */ V(2, 3, 4),
- /* 0010 */ V(3, 2, 4),
- /* 0011 */ V(0, 3, 4),
- /* 0100 */ V(1, 3, 3),
- /* 0101 */ V(1, 3, 3),
- /* 0110 */ V(3, 1, 3),
- /* 0111 */ V(3, 1, 3),
- /* 1000 */ V(3, 0, 3),
- /* 1001 */ V(3, 0, 3),
- /* 1010 */ V(2, 2, 3),
- /* 1011 */ V(2, 2, 3),
- /* 1100 */ V(1, 2, 2),
- /* 1101 */ V(1, 2, 2),
- /* 1110 */ V(1, 2, 2),
- /* 1111 */ V(1, 2, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 1, 1), /* 48 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 00 */ V(5, 5, 2), /* 52 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0001 ... */
- /* 0 */ V(3, 5, 1), /* 56 */
- /* 1 */ V(4, 4, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(2, 5, 1), /* 58 */
- /* 1 */ V(5, 2, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(0, 5, 1), /* 60 */
- /* 1 */ V(3, 4, 1),
-
- /* 0000 0111 ... */
- /* 0 */ V(4, 3, 1), /* 62 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab7[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 2), /* 16 */
+ /* 0001 */ PTR(56, 1),
+ /* 0010 */ PTR(58, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(60, 1),
+ /* 0110 */ V(5, 0, 4),
+ /* 0111 */ PTR(62, 1),
+ /* 1000 */ V(2, 4, 4),
+ /* 1001 */ V(4, 2, 4),
+ /* 1010 */ V(1, 4, 3),
+ /* 1011 */ V(1, 4, 3),
+ /* 1100 */ V(4, 1, 3),
+ /* 1101 */ V(4, 1, 3),
+ /* 1110 */ V(4, 0, 3),
+ /* 1111 */ V(4, 0, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(0, 4, 4), /* 32 */
+ /* 0001 */ V(2, 3, 4),
+ /* 0010 */ V(3, 2, 4),
+ /* 0011 */ V(0, 3, 4),
+ /* 0100 */ V(1, 3, 3),
+ /* 0101 */ V(1, 3, 3),
+ /* 0110 */ V(3, 1, 3),
+ /* 0111 */ V(3, 1, 3),
+ /* 1000 */ V(3, 0, 3),
+ /* 1001 */ V(3, 0, 3),
+ /* 1010 */ V(2, 2, 3),
+ /* 1011 */ V(2, 2, 3),
+ /* 1100 */ V(1, 2, 2),
+ /* 1101 */ V(1, 2, 2),
+ /* 1110 */ V(1, 2, 2),
+ /* 1111 */ V(1, 2, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 1, 1), /* 48 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(5, 5, 2), /* 52 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(3, 5, 1), /* 56 */
+ /* 1 */ V(4, 4, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(2, 5, 1), /* 58 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(0, 5, 1), /* 60 */
+ /* 1 */ V(3, 4, 1),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(4, 3, 1), /* 62 */
+ /* 1 */ V(3, 3, 1)
};
# if 0
/* this version saves 8 entries (16 bytes) at the expense of
an extra lookup in 4 out of 36 cases */
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 2),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(36, 3), /* 16 */
- /* 0001 */ PTR(44, 2),
- /* 0010 */ PTR(48, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(50, 1),
- /* 0110 */ PTR(52, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 00 */ PTR(54, 2), /* 32 */
- /* 01 */ V(2, 2, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 36 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 44 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 48 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 50 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 52 */
- /* 1 */ V(3, 3, 1),
-
- /* 0001 00 ... */
- /* 00 */ V(1, 3, 2), /* 54 */
- /* 01 */ V(3, 1, 2),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 2),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(36, 3), /* 16 */
+ /* 0001 */ PTR(44, 2),
+ /* 0010 */ PTR(48, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(50, 1),
+ /* 0110 */ PTR(52, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 00 */ PTR(54, 2), /* 32 */
+ /* 01 */ V(2, 2, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 36 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 44 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 48 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 50 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 52 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0001 00 ... */
+ /* 00 */ V(1, 3, 2), /* 54 */
+ /* 01 */ V(3, 1, 2),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
};
# else
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(48, 3), /* 16 */
- /* 0001 */ PTR(56, 2),
- /* 0010 */ PTR(60, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(62, 1),
- /* 0110 */ PTR(64, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 0000 */ V(1, 3, 4), /* 32 */
- /* 0001 */ V(3, 1, 4),
- /* 0010 */ V(0, 3, 4),
- /* 0011 */ V(3, 0, 4),
- /* 0100 */ V(2, 2, 2),
- /* 0101 */ V(2, 2, 2),
- /* 0110 */ V(2, 2, 2),
- /* 0111 */ V(2, 2, 2),
- /* 1000 */ V(0, 2, 2),
- /* 1001 */ V(0, 2, 2),
- /* 1010 */ V(0, 2, 2),
- /* 1011 */ V(0, 2, 2),
- /* 1100 */ V(2, 0, 2),
- /* 1101 */ V(2, 0, 2),
- /* 1110 */ V(2, 0, 2),
- /* 1111 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 48 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 56 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 60 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 62 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 64 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(48, 3), /* 16 */
+ /* 0001 */ PTR(56, 2),
+ /* 0010 */ PTR(60, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(62, 1),
+ /* 0110 */ PTR(64, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(1, 3, 4), /* 32 */
+ /* 0001 */ V(3, 1, 4),
+ /* 0010 */ V(0, 3, 4),
+ /* 0011 */ V(3, 0, 4),
+ /* 0100 */ V(2, 2, 2),
+ /* 0101 */ V(2, 2, 2),
+ /* 0110 */ V(2, 2, 2),
+ /* 0111 */ V(2, 2, 2),
+ /* 1000 */ V(0, 2, 2),
+ /* 1001 */ V(0, 2, 2),
+ /* 1010 */ V(0, 2, 2),
+ /* 1011 */ V(0, 2, 2),
+ /* 1100 */ V(2, 0, 2),
+ /* 1101 */ V(2, 0, 2),
+ /* 1110 */ V(2, 0, 2),
+ /* 1111 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 48 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 56 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 60 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 62 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 64 */
+ /* 1 */ V(3, 3, 1)
};
# endif
static
-union huffpair const hufftab9[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 3),
- /* 0010 */ PTR(40, 2),
- /* 0011 */ PTR(44, 2),
- /* 0100 */ PTR(48, 1),
- /* 0101 */ V(1, 2, 4),
- /* 0110 */ V(2, 1, 4),
- /* 0111 */ V(2, 0, 4),
- /* 1000 */ V(1, 1, 3),
- /* 1001 */ V(1, 1, 3),
- /* 1010 */ V(0, 1, 3),
- /* 1011 */ V(0, 1, 3),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(50, 1), /* 16 */
- /* 0001 */ V(3, 5, 4),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ PTR(52, 1),
- /* 0100 */ V(4, 4, 4),
- /* 0101 */ V(2, 5, 4),
- /* 0110 */ V(5, 2, 4),
- /* 0111 */ V(1, 5, 4),
- /* 1000 */ V(5, 1, 3),
- /* 1001 */ V(5, 1, 3),
- /* 1010 */ V(3, 4, 3),
- /* 1011 */ V(3, 4, 3),
- /* 1100 */ V(4, 3, 3),
- /* 1101 */ V(4, 3, 3),
- /* 1110 */ V(5, 0, 4),
- /* 1111 */ V(0, 4, 4),
-
- /* 0001 ... */
- /* 000 */ V(2, 4, 3), /* 32 */
- /* 001 */ V(4, 2, 3),
- /* 010 */ V(3, 3, 3),
- /* 011 */ V(4, 0, 3),
- /* 100 */ V(1, 4, 2),
- /* 101 */ V(1, 4, 2),
- /* 110 */ V(4, 1, 2),
- /* 111 */ V(4, 1, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 3, 2), /* 40 */
- /* 01 */ V(3, 2, 2),
- /* 10 */ V(1, 3, 1),
- /* 11 */ V(1, 3, 1),
-
- /* 0011 ... */
- /* 00 */ V(3, 1, 1), /* 44 */
- /* 01 */ V(3, 1, 1),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
-
- /* 0100 ... */
- /* 0 */ V(2, 2, 1), /* 48 */
- /* 1 */ V(0, 2, 1),
-
- /* 0000 0000 ... */
- /* 0 */ V(5, 5, 1), /* 50 */
- /* 1 */ V(4, 5, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(5, 4, 1), /* 52 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab9[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 3),
+ /* 0010 */ PTR(40, 2),
+ /* 0011 */ PTR(44, 2),
+ /* 0100 */ PTR(48, 1),
+ /* 0101 */ V(1, 2, 4),
+ /* 0110 */ V(2, 1, 4),
+ /* 0111 */ V(2, 0, 4),
+ /* 1000 */ V(1, 1, 3),
+ /* 1001 */ V(1, 1, 3),
+ /* 1010 */ V(0, 1, 3),
+ /* 1011 */ V(0, 1, 3),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(50, 1), /* 16 */
+ /* 0001 */ V(3, 5, 4),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ PTR(52, 1),
+ /* 0100 */ V(4, 4, 4),
+ /* 0101 */ V(2, 5, 4),
+ /* 0110 */ V(5, 2, 4),
+ /* 0111 */ V(1, 5, 4),
+ /* 1000 */ V(5, 1, 3),
+ /* 1001 */ V(5, 1, 3),
+ /* 1010 */ V(3, 4, 3),
+ /* 1011 */ V(3, 4, 3),
+ /* 1100 */ V(4, 3, 3),
+ /* 1101 */ V(4, 3, 3),
+ /* 1110 */ V(5, 0, 4),
+ /* 1111 */ V(0, 4, 4),
+
+ /* 0001 ... */
+ /* 000 */ V(2, 4, 3), /* 32 */
+ /* 001 */ V(4, 2, 3),
+ /* 010 */ V(3, 3, 3),
+ /* 011 */ V(4, 0, 3),
+ /* 100 */ V(1, 4, 2),
+ /* 101 */ V(1, 4, 2),
+ /* 110 */ V(4, 1, 2),
+ /* 111 */ V(4, 1, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 3, 2), /* 40 */
+ /* 01 */ V(3, 2, 2),
+ /* 10 */ V(1, 3, 1),
+ /* 11 */ V(1, 3, 1),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 1, 1), /* 44 */
+ /* 01 */ V(3, 1, 1),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+
+ /* 0100 ... */
+ /* 0 */ V(2, 2, 1), /* 48 */
+ /* 1 */ V(0, 2, 1),
+
+ /* 0000 0000 ... */
+ /* 0 */ V(5, 5, 1), /* 50 */
+ /* 1 */ V(4, 5, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(5, 4, 1), /* 52 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab10[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 3), /* 16 */
- /* 0001 */ PTR(60, 2),
- /* 0010 */ PTR(64, 3),
- /* 0011 */ PTR(72, 1),
- /* 0100 */ PTR(74, 2),
- /* 0101 */ PTR(78, 2),
- /* 0110 */ PTR(82, 2),
- /* 0111 */ V(1, 7, 4),
- /* 1000 */ V(7, 1, 4),
- /* 1001 */ PTR(86, 1),
- /* 1010 */ PTR(88, 2),
- /* 1011 */ PTR(92, 2),
- /* 1100 */ V(1, 6, 4),
- /* 1101 */ V(6, 1, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(96, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(98, 1), /* 32 */
- /* 0001 */ PTR(100, 1),
- /* 0010 */ V(1, 4, 4),
- /* 0011 */ V(4, 1, 4),
- /* 0100 */ V(4, 0, 4),
- /* 0101 */ V(2, 3, 4),
- /* 0110 */ V(3, 2, 4),
- /* 0111 */ V(0, 3, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0010 ... */
- /* 00 */ V(1, 2, 2), /* 48 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(7, 7, 3), /* 52 */
- /* 001 */ V(6, 7, 3),
- /* 010 */ V(7, 6, 3),
- /* 011 */ V(5, 7, 3),
- /* 100 */ V(7, 5, 3),
- /* 101 */ V(6, 6, 3),
- /* 110 */ V(4, 7, 2),
- /* 111 */ V(4, 7, 2),
-
- /* 0000 0001 ... */
- /* 00 */ V(7, 4, 2), /* 60 */
- /* 01 */ V(5, 6, 2),
- /* 10 */ V(6, 5, 2),
- /* 11 */ V(3, 7, 2),
-
- /* 0000 0010 ... */
- /* 000 */ V(7, 3, 2), /* 64 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(4, 6, 2),
- /* 011 */ V(4, 6, 2),
- /* 100 */ V(5, 5, 3),
- /* 101 */ V(5, 4, 3),
- /* 110 */ V(6, 3, 2),
- /* 111 */ V(6, 3, 2),
-
- /* 0000 0011 ... */
- /* 0 */ V(2, 7, 1), /* 72 */
- /* 1 */ V(7, 2, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(6, 4, 2), /* 74 */
- /* 01 */ V(0, 7, 2),
- /* 10 */ V(7, 0, 1),
- /* 11 */ V(7, 0, 1),
-
- /* 0000 0101 ... */
- /* 00 */ V(6, 2, 1), /* 78 */
- /* 01 */ V(6, 2, 1),
- /* 10 */ V(4, 5, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0000 0110 ... */
- /* 00 */ V(0, 6, 1), /* 82 */
- /* 01 */ V(0, 6, 1),
- /* 10 */ V(5, 3, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0000 1001 ... */
- /* 0 */ V(3, 6, 1), /* 86 */
- /* 1 */ V(2, 6, 1),
-
- /* 0000 1010 ... */
- /* 00 */ V(2, 5, 2), /* 88 */
- /* 01 */ V(5, 2, 2),
- /* 10 */ V(1, 5, 1),
- /* 11 */ V(1, 5, 1),
-
- /* 0000 1011 ... */
- /* 00 */ V(5, 1, 1), /* 92 */
- /* 01 */ V(5, 1, 1),
- /* 10 */ V(3, 4, 2),
- /* 11 */ V(4, 3, 2),
-
- /* 0000 1111 ... */
- /* 0 */ V(0, 5, 1), /* 96 */
- /* 1 */ V(5, 0, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(2, 4, 1), /* 98 */
- /* 1 */ V(4, 2, 1),
-
- /* 0001 0001 ... */
- /* 0 */ V(3, 3, 1), /* 100 */
- /* 1 */ V(0, 4, 1)
+union huffpair const hufftab10[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 3), /* 16 */
+ /* 0001 */ PTR(60, 2),
+ /* 0010 */ PTR(64, 3),
+ /* 0011 */ PTR(72, 1),
+ /* 0100 */ PTR(74, 2),
+ /* 0101 */ PTR(78, 2),
+ /* 0110 */ PTR(82, 2),
+ /* 0111 */ V(1, 7, 4),
+ /* 1000 */ V(7, 1, 4),
+ /* 1001 */ PTR(86, 1),
+ /* 1010 */ PTR(88, 2),
+ /* 1011 */ PTR(92, 2),
+ /* 1100 */ V(1, 6, 4),
+ /* 1101 */ V(6, 1, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(96, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(98, 1), /* 32 */
+ /* 0001 */ PTR(100, 1),
+ /* 0010 */ V(1, 4, 4),
+ /* 0011 */ V(4, 1, 4),
+ /* 0100 */ V(4, 0, 4),
+ /* 0101 */ V(2, 3, 4),
+ /* 0110 */ V(3, 2, 4),
+ /* 0111 */ V(0, 3, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0010 ... */
+ /* 00 */ V(1, 2, 2), /* 48 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(7, 7, 3), /* 52 */
+ /* 001 */ V(6, 7, 3),
+ /* 010 */ V(7, 6, 3),
+ /* 011 */ V(5, 7, 3),
+ /* 100 */ V(7, 5, 3),
+ /* 101 */ V(6, 6, 3),
+ /* 110 */ V(4, 7, 2),
+ /* 111 */ V(4, 7, 2),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(7, 4, 2), /* 60 */
+ /* 01 */ V(5, 6, 2),
+ /* 10 */ V(6, 5, 2),
+ /* 11 */ V(3, 7, 2),
+
+ /* 0000 0010 ... */
+ /* 000 */ V(7, 3, 2), /* 64 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(4, 6, 2),
+ /* 011 */ V(4, 6, 2),
+ /* 100 */ V(5, 5, 3),
+ /* 101 */ V(5, 4, 3),
+ /* 110 */ V(6, 3, 2),
+ /* 111 */ V(6, 3, 2),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(2, 7, 1), /* 72 */
+ /* 1 */ V(7, 2, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(6, 4, 2), /* 74 */
+ /* 01 */ V(0, 7, 2),
+ /* 10 */ V(7, 0, 1),
+ /* 11 */ V(7, 0, 1),
+
+ /* 0000 0101 ... */
+ /* 00 */ V(6, 2, 1), /* 78 */
+ /* 01 */ V(6, 2, 1),
+ /* 10 */ V(4, 5, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0000 0110 ... */
+ /* 00 */ V(0, 6, 1), /* 82 */
+ /* 01 */ V(0, 6, 1),
+ /* 10 */ V(5, 3, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0000 1001 ... */
+ /* 0 */ V(3, 6, 1), /* 86 */
+ /* 1 */ V(2, 6, 1),
+
+ /* 0000 1010 ... */
+ /* 00 */ V(2, 5, 2), /* 88 */
+ /* 01 */ V(5, 2, 2),
+ /* 10 */ V(1, 5, 1),
+ /* 11 */ V(1, 5, 1),
+
+ /* 0000 1011 ... */
+ /* 00 */ V(5, 1, 1), /* 92 */
+ /* 01 */ V(5, 1, 1),
+ /* 10 */ V(3, 4, 2),
+ /* 11 */ V(4, 3, 2),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(0, 5, 1), /* 96 */
+ /* 1 */ V(5, 0, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(2, 4, 1), /* 98 */
+ /* 1 */ V(4, 2, 1),
+
+ /* 0001 0001 ... */
+ /* 0 */ V(3, 3, 1), /* 100 */
+ /* 1 */ V(0, 4, 1)
};
static
-union huffpair const hufftab11[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 3),
- /* 0100 */ V(1, 2, 4),
- /* 0101 */ PTR(72, 1),
- /* 0110 */ V(1, 1, 3),
- /* 0111 */ V(1, 1, 3),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(74, 2), /* 16 */
- /* 0001 */ PTR(78, 3),
- /* 0010 */ PTR(86, 2),
- /* 0011 */ PTR(90, 1),
- /* 0100 */ PTR(92, 2),
- /* 0101 */ V(2, 7, 4),
- /* 0110 */ V(7, 2, 4),
- /* 0111 */ PTR(96, 1),
- /* 1000 */ V(7, 1, 3),
- /* 1001 */ V(7, 1, 3),
- /* 1010 */ V(1, 7, 4),
- /* 1011 */ V(7, 0, 4),
- /* 1100 */ V(3, 6, 4),
- /* 1101 */ V(6, 3, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(98, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(100, 1), /* 32 */
- /* 0001 */ V(1, 5, 4),
- /* 0010 */ V(6, 2, 3),
- /* 0011 */ V(6, 2, 3),
- /* 0100 */ V(2, 6, 4),
- /* 0101 */ V(0, 6, 4),
- /* 0110 */ V(1, 6, 3),
- /* 0111 */ V(1, 6, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(5, 1, 4),
- /* 1011 */ V(3, 4, 4),
- /* 1100 */ V(5, 0, 4),
- /* 1101 */ PTR(102, 1),
- /* 1110 */ V(2, 4, 4),
- /* 1111 */ V(4, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 4, 4), /* 48 */
- /* 0001 */ V(4, 1, 4),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 0011 ... */
- /* 000 */ V(0, 3, 3), /* 64 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(2, 1, 1),
- /* 101 */ V(2, 1, 1),
- /* 110 */ V(2, 1, 1),
- /* 111 */ V(2, 1, 1),
-
- /* 0101 ... */
- /* 0 */ V(0, 2, 1), /* 72 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 74 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 2),
- /* 11 */ V(7, 5, 2),
-
- /* 0000 0001 ... */
- /* 000 */ V(6, 6, 2), /* 78 */
- /* 001 */ V(6, 6, 2),
- /* 010 */ V(4, 7, 2),
- /* 011 */ V(4, 7, 2),
- /* 100 */ V(7, 4, 2),
- /* 101 */ V(7, 4, 2),
- /* 110 */ V(5, 7, 3),
- /* 111 */ V(5, 5, 3),
-
- /* 0000 0010 ... */
- /* 00 */ V(5, 6, 2), /* 86 */
- /* 01 */ V(6, 5, 2),
- /* 10 */ V(3, 7, 1),
- /* 11 */ V(3, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(4, 6, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(4, 5, 2), /* 92 */
- /* 01 */ V(5, 4, 2),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0111 ... */
- /* 0 */ V(6, 4, 1), /* 96 */
- /* 1 */ V(0, 7, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(4, 4, 1), /* 98 */
- /* 1 */ V(2, 5, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(5, 2, 1), /* 100 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(4, 3, 1), /* 102 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab11[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 3),
+ /* 0100 */ V(1, 2, 4),
+ /* 0101 */ PTR(72, 1),
+ /* 0110 */ V(1, 1, 3),
+ /* 0111 */ V(1, 1, 3),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(74, 2), /* 16 */
+ /* 0001 */ PTR(78, 3),
+ /* 0010 */ PTR(86, 2),
+ /* 0011 */ PTR(90, 1),
+ /* 0100 */ PTR(92, 2),
+ /* 0101 */ V(2, 7, 4),
+ /* 0110 */ V(7, 2, 4),
+ /* 0111 */ PTR(96, 1),
+ /* 1000 */ V(7, 1, 3),
+ /* 1001 */ V(7, 1, 3),
+ /* 1010 */ V(1, 7, 4),
+ /* 1011 */ V(7, 0, 4),
+ /* 1100 */ V(3, 6, 4),
+ /* 1101 */ V(6, 3, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(98, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(100, 1), /* 32 */
+ /* 0001 */ V(1, 5, 4),
+ /* 0010 */ V(6, 2, 3),
+ /* 0011 */ V(6, 2, 3),
+ /* 0100 */ V(2, 6, 4),
+ /* 0101 */ V(0, 6, 4),
+ /* 0110 */ V(1, 6, 3),
+ /* 0111 */ V(1, 6, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(5, 1, 4),
+ /* 1011 */ V(3, 4, 4),
+ /* 1100 */ V(5, 0, 4),
+ /* 1101 */ PTR(102, 1),
+ /* 1110 */ V(2, 4, 4),
+ /* 1111 */ V(4, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 4, 4), /* 48 */
+ /* 0001 */ V(4, 1, 4),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 0011 ... */
+ /* 000 */ V(0, 3, 3), /* 64 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(2, 1, 1),
+ /* 101 */ V(2, 1, 1),
+ /* 110 */ V(2, 1, 1),
+ /* 111 */ V(2, 1, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(0, 2, 1), /* 72 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 74 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 2),
+ /* 11 */ V(7, 5, 2),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(6, 6, 2), /* 78 */
+ /* 001 */ V(6, 6, 2),
+ /* 010 */ V(4, 7, 2),
+ /* 011 */ V(4, 7, 2),
+ /* 100 */ V(7, 4, 2),
+ /* 101 */ V(7, 4, 2),
+ /* 110 */ V(5, 7, 3),
+ /* 111 */ V(5, 5, 3),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(5, 6, 2), /* 86 */
+ /* 01 */ V(6, 5, 2),
+ /* 10 */ V(3, 7, 1),
+ /* 11 */ V(3, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(4, 5, 2), /* 92 */
+ /* 01 */ V(5, 4, 2),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(6, 4, 1), /* 96 */
+ /* 1 */ V(0, 7, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(4, 4, 1), /* 98 */
+ /* 1 */ V(2, 5, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(5, 2, 1), /* 100 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(4, 3, 1), /* 102 */
+ /* 1 */ V(3, 3, 1)
};
static
-union huffpair const hufftab12[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ PTR(68, 3),
- /* 0101 */ PTR(76, 1),
- /* 0110 */ V(1, 2, 4),
- /* 0111 */ V(2, 1, 4),
- /* 1000 */ PTR(78, 1),
- /* 1001 */ V(0, 0, 4),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 3),
- /* 1101 */ V(0, 1, 3),
- /* 1110 */ V(1, 0, 3),
- /* 1111 */ V(1, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(80, 2), /* 16 */
- /* 0001 */ PTR(84, 1),
- /* 0010 */ PTR(86, 1),
- /* 0011 */ PTR(88, 1),
- /* 0100 */ V(5, 6, 4),
- /* 0101 */ V(3, 7, 4),
- /* 0110 */ PTR(90, 1),
- /* 0111 */ V(2, 7, 4),
- /* 1000 */ V(7, 2, 4),
- /* 1001 */ V(4, 6, 4),
- /* 1010 */ V(6, 4, 4),
- /* 1011 */ V(1, 7, 4),
- /* 1100 */ V(7, 1, 4),
- /* 1101 */ PTR(92, 1),
- /* 1110 */ V(3, 6, 4),
- /* 1111 */ V(6, 3, 4),
-
- /* 0001 ... */
- /* 0000 */ V(4, 5, 4), /* 32 */
- /* 0001 */ V(5, 4, 4),
- /* 0010 */ V(4, 4, 4),
- /* 0011 */ PTR(94, 1),
- /* 0100 */ V(2, 6, 3),
- /* 0101 */ V(2, 6, 3),
- /* 0110 */ V(6, 2, 3),
- /* 0111 */ V(6, 2, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 0, 4),
- /* 1100 */ V(3, 5, 4),
- /* 1101 */ V(5, 3, 4),
- /* 1110 */ V(2, 5, 4),
- /* 1111 */ V(5, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 5, 3), /* 48 */
- /* 0001 */ V(1, 5, 3),
- /* 0010 */ V(5, 1, 3),
- /* 0011 */ V(5, 1, 3),
- /* 0100 */ V(3, 4, 3),
- /* 0101 */ V(3, 4, 3),
- /* 0110 */ V(4, 3, 3),
- /* 0111 */ V(4, 3, 3),
- /* 1000 */ V(5, 0, 4),
- /* 1001 */ V(0, 4, 4),
- /* 1010 */ V(2, 4, 3),
- /* 1011 */ V(2, 4, 3),
- /* 1100 */ V(4, 2, 3),
- /* 1101 */ V(4, 2, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 0011 ... */
- /* 00 */ V(3, 3, 2), /* 64 */
- /* 01 */ V(4, 1, 2),
- /* 10 */ V(2, 3, 2),
- /* 11 */ V(3, 2, 2),
-
- /* 0100 ... */
- /* 000 */ V(4, 0, 3), /* 68 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(3, 0, 2),
- /* 011 */ V(3, 0, 2),
- /* 100 */ V(1, 3, 1),
- /* 101 */ V(1, 3, 1),
- /* 110 */ V(1, 3, 1),
- /* 111 */ V(1, 3, 1),
-
- /* 0101 ... */
- /* 0 */ V(3, 1, 1), /* 76 */
- /* 1 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(0, 2, 1), /* 78 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 80 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 1),
- /* 11 */ V(7, 6, 1),
-
- /* 0000 0001 ... */
- /* 0 */ V(5, 7, 1), /* 84 */
- /* 1 */ V(7, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(6, 6, 1), /* 86 */
- /* 1 */ V(4, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 4, 1), /* 88 */
- /* 1 */ V(6, 5, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(5, 5, 1),
-
- /* 0000 1101 ... */
- /* 0 */ V(0, 7, 1), /* 92 */
- /* 1 */ V(7, 0, 1),
-
- /* 0001 0011 ... */
- /* 0 */ V(0, 6, 1), /* 94 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab12[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ PTR(68, 3),
+ /* 0101 */ PTR(76, 1),
+ /* 0110 */ V(1, 2, 4),
+ /* 0111 */ V(2, 1, 4),
+ /* 1000 */ PTR(78, 1),
+ /* 1001 */ V(0, 0, 4),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 3),
+ /* 1101 */ V(0, 1, 3),
+ /* 1110 */ V(1, 0, 3),
+ /* 1111 */ V(1, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(80, 2), /* 16 */
+ /* 0001 */ PTR(84, 1),
+ /* 0010 */ PTR(86, 1),
+ /* 0011 */ PTR(88, 1),
+ /* 0100 */ V(5, 6, 4),
+ /* 0101 */ V(3, 7, 4),
+ /* 0110 */ PTR(90, 1),
+ /* 0111 */ V(2, 7, 4),
+ /* 1000 */ V(7, 2, 4),
+ /* 1001 */ V(4, 6, 4),
+ /* 1010 */ V(6, 4, 4),
+ /* 1011 */ V(1, 7, 4),
+ /* 1100 */ V(7, 1, 4),
+ /* 1101 */ PTR(92, 1),
+ /* 1110 */ V(3, 6, 4),
+ /* 1111 */ V(6, 3, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(4, 5, 4), /* 32 */
+ /* 0001 */ V(5, 4, 4),
+ /* 0010 */ V(4, 4, 4),
+ /* 0011 */ PTR(94, 1),
+ /* 0100 */ V(2, 6, 3),
+ /* 0101 */ V(2, 6, 3),
+ /* 0110 */ V(6, 2, 3),
+ /* 0111 */ V(6, 2, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 0, 4),
+ /* 1100 */ V(3, 5, 4),
+ /* 1101 */ V(5, 3, 4),
+ /* 1110 */ V(2, 5, 4),
+ /* 1111 */ V(5, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 5, 3), /* 48 */
+ /* 0001 */ V(1, 5, 3),
+ /* 0010 */ V(5, 1, 3),
+ /* 0011 */ V(5, 1, 3),
+ /* 0100 */ V(3, 4, 3),
+ /* 0101 */ V(3, 4, 3),
+ /* 0110 */ V(4, 3, 3),
+ /* 0111 */ V(4, 3, 3),
+ /* 1000 */ V(5, 0, 4),
+ /* 1001 */ V(0, 4, 4),
+ /* 1010 */ V(2, 4, 3),
+ /* 1011 */ V(2, 4, 3),
+ /* 1100 */ V(4, 2, 3),
+ /* 1101 */ V(4, 2, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 3, 2), /* 64 */
+ /* 01 */ V(4, 1, 2),
+ /* 10 */ V(2, 3, 2),
+ /* 11 */ V(3, 2, 2),
+
+ /* 0100 ... */
+ /* 000 */ V(4, 0, 3), /* 68 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(3, 0, 2),
+ /* 011 */ V(3, 0, 2),
+ /* 100 */ V(1, 3, 1),
+ /* 101 */ V(1, 3, 1),
+ /* 110 */ V(1, 3, 1),
+ /* 111 */ V(1, 3, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(3, 1, 1), /* 76 */
+ /* 1 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(0, 2, 1), /* 78 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 80 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 1),
+ /* 11 */ V(7, 6, 1),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(5, 7, 1), /* 84 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(6, 6, 1), /* 86 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 4, 1), /* 88 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(5, 5, 1),
+
+ /* 0000 1101 ... */
+ /* 0 */ V(0, 7, 1), /* 92 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0001 0011 ... */
+ /* 0 */ V(0, 6, 1), /* 94 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab13[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 4), /* 16 */
- /* 0001 */ PTR(84, 4),
- /* 0010 */ PTR(100, 4),
- /* 0011 */ PTR(116, 4),
- /* 0100 */ PTR(132, 4),
- /* 0101 */ PTR(148, 4),
- /* 0110 */ PTR(164, 3),
- /* 0111 */ PTR(172, 3),
- /* 1000 */ PTR(180, 3),
- /* 1001 */ PTR(188, 3),
- /* 1010 */ PTR(196, 3),
- /* 1011 */ PTR(204, 3),
- /* 1100 */ PTR(212, 1),
- /* 1101 */ PTR(214, 2),
- /* 1110 */ PTR(218, 3),
- /* 1111 */ PTR(226, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(228, 2), /* 32 */
- /* 0001 */ PTR(232, 2),
- /* 0010 */ PTR(236, 2),
- /* 0011 */ PTR(240, 2),
- /* 0100 */ V(8, 1, 4),
- /* 0101 */ PTR(244, 1),
- /* 0110 */ PTR(246, 1),
- /* 0111 */ PTR(248, 1),
- /* 1000 */ PTR(250, 2),
- /* 1001 */ PTR(254, 1),
- /* 1010 */ V(1, 5, 4),
- /* 1011 */ V(5, 1, 4),
- /* 1100 */ PTR(256, 1),
- /* 1101 */ PTR(258, 1),
- /* 1110 */ PTR(260, 1),
- /* 1111 */ V(1, 4, 4),
-
- /* 0010 ... */
- /* 0000 */ V(4, 1, 3), /* 48 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 4),
- /* 0101 */ V(3, 2, 4),
- /* 0110 */ V(1, 3, 3),
- /* 0111 */ V(1, 3, 3),
- /* 1000 */ V(3, 1, 3),
- /* 1001 */ V(3, 1, 3),
- /* 1010 */ V(0, 3, 3),
- /* 1011 */ V(0, 3, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(262, 4), /* 68 */
- /* 0001 */ PTR(278, 4),
- /* 0010 */ PTR(294, 4),
- /* 0011 */ PTR(310, 3),
- /* 0100 */ PTR(318, 2),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 3),
- /* 0111 */ PTR(334, 2),
- /* 1000 */ PTR(338, 1),
- /* 1001 */ PTR(340, 2),
- /* 1010 */ PTR(344, 2),
- /* 1011 */ PTR(348, 2),
- /* 1100 */ PTR(352, 2),
- /* 1101 */ PTR(356, 2),
- /* 1110 */ V(1, 15, 4),
- /* 1111 */ V(15, 1, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 0, 4), /* 84 */
- /* 0001 */ PTR(360, 1),
- /* 0010 */ PTR(362, 1),
- /* 0011 */ PTR(364, 1),
- /* 0100 */ V(14, 2, 4),
- /* 0101 */ PTR(366, 1),
- /* 0110 */ V(1, 14, 4),
- /* 0111 */ V(14, 1, 4),
- /* 1000 */ PTR(368, 1),
- /* 1001 */ PTR(370, 1),
- /* 1010 */ PTR(372, 1),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 1),
- /* 1101 */ PTR(378, 1),
- /* 1110 */ V(12, 6, 4),
- /* 1111 */ V(3, 13, 4),
-
- /* 0000 0010 ... */
- /* 0000 */ PTR(380, 1), /* 100 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(1, 13, 4),
- /* 0100 */ V(11, 7, 4),
- /* 0101 */ PTR(382, 1),
- /* 0110 */ PTR(384, 1),
- /* 0111 */ V(12, 3, 4),
- /* 1000 */ PTR(386, 1),
- /* 1001 */ V(4, 11, 4),
- /* 1010 */ V(13, 1, 3),
- /* 1011 */ V(13, 1, 3),
- /* 1100 */ V(0, 13, 4),
- /* 1101 */ V(13, 0, 4),
- /* 1110 */ V(8, 10, 4),
- /* 1111 */ V(10, 8, 4),
-
- /* 0000 0011 ... */
- /* 0000 */ V(4, 12, 4), /* 116 */
- /* 0001 */ V(12, 4, 4),
- /* 0010 */ V(6, 11, 4),
- /* 0011 */ V(11, 6, 4),
- /* 0100 */ V(3, 12, 3),
- /* 0101 */ V(3, 12, 3),
- /* 0110 */ V(2, 12, 3),
- /* 0111 */ V(2, 12, 3),
- /* 1000 */ V(12, 2, 3),
- /* 1001 */ V(12, 2, 3),
- /* 1010 */ V(5, 11, 3),
- /* 1011 */ V(5, 11, 3),
- /* 1100 */ V(11, 5, 4),
- /* 1101 */ V(8, 9, 4),
- /* 1110 */ V(1, 12, 3),
- /* 1111 */ V(1, 12, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(12, 1, 3), /* 132 */
- /* 0001 */ V(12, 1, 3),
- /* 0010 */ V(9, 8, 4),
- /* 0011 */ V(0, 12, 4),
- /* 0100 */ V(12, 0, 3),
- /* 0101 */ V(12, 0, 3),
- /* 0110 */ V(11, 4, 4),
- /* 0111 */ V(6, 10, 4),
- /* 1000 */ V(10, 6, 4),
- /* 1001 */ V(7, 9, 4),
- /* 1010 */ V(3, 11, 3),
- /* 1011 */ V(3, 11, 3),
- /* 1100 */ V(11, 3, 3),
- /* 1101 */ V(11, 3, 3),
- /* 1110 */ V(8, 8, 4),
- /* 1111 */ V(5, 10, 4),
-
- /* 0000 0101 ... */
- /* 0000 */ V(2, 11, 3), /* 148 */
- /* 0001 */ V(2, 11, 3),
- /* 0010 */ V(10, 5, 4),
- /* 0011 */ V(6, 9, 4),
- /* 0100 */ V(10, 4, 3),
- /* 0101 */ V(10, 4, 3),
- /* 0110 */ V(7, 8, 4),
- /* 0111 */ V(8, 7, 4),
- /* 1000 */ V(9, 4, 3),
- /* 1001 */ V(9, 4, 3),
- /* 1010 */ V(7, 7, 4),
- /* 1011 */ V(7, 6, 4),
- /* 1100 */ V(11, 2, 2),
- /* 1101 */ V(11, 2, 2),
- /* 1110 */ V(11, 2, 2),
- /* 1111 */ V(11, 2, 2),
-
- /* 0000 0110 ... */
- /* 000 */ V(1, 11, 2), /* 164 */
- /* 001 */ V(1, 11, 2),
- /* 010 */ V(11, 1, 2),
- /* 011 */ V(11, 1, 2),
- /* 100 */ V(0, 11, 3),
- /* 101 */ V(11, 0, 3),
- /* 110 */ V(9, 6, 3),
- /* 111 */ V(4, 10, 3),
-
- /* 0000 0111 ... */
- /* 000 */ V(3, 10, 3), /* 172 */
- /* 001 */ V(10, 3, 3),
- /* 010 */ V(5, 9, 3),
- /* 011 */ V(9, 5, 3),
- /* 100 */ V(2, 10, 2),
- /* 101 */ V(2, 10, 2),
- /* 110 */ V(10, 2, 2),
- /* 111 */ V(10, 2, 2),
-
- /* 0000 1000 ... */
- /* 000 */ V(1, 10, 2), /* 180 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(10, 1, 2),
- /* 011 */ V(10, 1, 2),
- /* 100 */ V(0, 10, 3),
- /* 101 */ V(6, 8, 3),
- /* 110 */ V(10, 0, 2),
- /* 111 */ V(10, 0, 2),
-
- /* 0000 1001 ... */
- /* 000 */ V(8, 6, 3), /* 188 */
- /* 001 */ V(4, 9, 3),
- /* 010 */ V(9, 3, 2),
- /* 011 */ V(9, 3, 2),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(5, 8, 3),
- /* 110 */ V(8, 5, 3),
- /* 111 */ V(6, 7, 3),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 9, 2), /* 196 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(5, 7, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 2),
- /* 111 */ V(3, 8, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(8, 3, 2), /* 204 */
- /* 001 */ V(8, 3, 2),
- /* 010 */ V(6, 6, 3),
- /* 011 */ V(4, 7, 3),
- /* 100 */ V(7, 4, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(6, 5, 3),
- /* 111 */ V(7, 3, 3),
-
- /* 0000 1100 ... */
- /* 0 */ V(1, 9, 1), /* 212 */
- /* 1 */ V(9, 1, 1),
-
- /* 0000 1101 ... */
- /* 00 */ V(0, 9, 2), /* 214 */
- /* 01 */ V(9, 0, 2),
- /* 10 */ V(4, 8, 2),
- /* 11 */ V(8, 4, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 2, 2), /* 218 */
- /* 001 */ V(7, 2, 2),
- /* 010 */ V(4, 6, 3),
- /* 011 */ V(6, 4, 3),
- /* 100 */ V(2, 8, 1),
- /* 101 */ V(2, 8, 1),
- /* 110 */ V(2, 8, 1),
- /* 111 */ V(2, 8, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(8, 2, 1), /* 226 */
- /* 1 */ V(1, 8, 1),
-
- /* 0001 0000 ... */
- /* 00 */ V(3, 7, 2), /* 228 */
- /* 01 */ V(2, 7, 2),
- /* 10 */ V(1, 7, 1),
- /* 11 */ V(1, 7, 1),
-
- /* 0001 0001 ... */
- /* 00 */ V(7, 1, 1), /* 232 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(5, 5, 2),
- /* 11 */ V(0, 7, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(7, 0, 2), /* 236 */
- /* 01 */ V(3, 6, 2),
- /* 10 */ V(6, 3, 2),
- /* 11 */ V(4, 5, 2),
-
- /* 0001 0011 ... */
- /* 00 */ V(5, 4, 2), /* 240 */
- /* 01 */ V(2, 6, 2),
- /* 10 */ V(6, 2, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0001 0101 ... */
- /* 0 */ V(0, 8, 1), /* 244 */
- /* 1 */ V(8, 0, 1),
-
- /* 0001 0110 ... */
- /* 0 */ V(1, 6, 1), /* 246 */
- /* 1 */ V(6, 1, 1),
-
- /* 0001 0111 ... */
- /* 0 */ V(0, 6, 1), /* 248 */
- /* 1 */ V(6, 0, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(5, 3, 2), /* 250 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(5, 2, 1), /* 254 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(3, 4, 1), /* 256 */
- /* 1 */ V(4, 3, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(5, 0, 1), /* 258 */
- /* 1 */ V(2, 4, 1),
-
- /* 0001 1110 ... */
- /* 0 */ V(4, 2, 1), /* 260 */
- /* 1 */ V(3, 3, 1),
-
- /* 0000 0000 0000 ... */
- /* 0000 */ PTR(388, 3), /* 262 */
- /* 0001 */ V(15, 15, 4),
- /* 0010 */ V(14, 15, 4),
- /* 0011 */ V(13, 15, 4),
- /* 0100 */ V(14, 14, 4),
- /* 0101 */ V(12, 15, 4),
- /* 0110 */ V(13, 14, 4),
- /* 0111 */ V(11, 15, 4),
- /* 1000 */ V(15, 11, 4),
- /* 1001 */ V(12, 14, 4),
- /* 1010 */ V(13, 12, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 12, 3),
- /* 1101 */ V(14, 12, 3),
- /* 1110 */ V(13, 13, 3),
- /* 1111 */ V(13, 13, 3),
-
- /* 0000 0000 0001 ... */
- /* 0000 */ V(15, 10, 4), /* 278 */
- /* 0001 */ V(12, 13, 4),
- /* 0010 */ V(11, 14, 3),
- /* 0011 */ V(11, 14, 3),
- /* 0100 */ V(14, 11, 3),
- /* 0101 */ V(14, 11, 3),
- /* 0110 */ V(9, 15, 3),
- /* 0111 */ V(9, 15, 3),
- /* 1000 */ V(15, 9, 3),
- /* 1001 */ V(15, 9, 3),
- /* 1010 */ V(14, 10, 3),
- /* 1011 */ V(14, 10, 3),
- /* 1100 */ V(11, 13, 3),
- /* 1101 */ V(11, 13, 3),
- /* 1110 */ V(13, 11, 3),
- /* 1111 */ V(13, 11, 3),
-
- /* 0000 0000 0010 ... */
- /* 0000 */ V(8, 15, 3), /* 294 */
- /* 0001 */ V(8, 15, 3),
- /* 0010 */ V(15, 8, 3),
- /* 0011 */ V(15, 8, 3),
- /* 0100 */ V(12, 12, 3),
- /* 0101 */ V(12, 12, 3),
- /* 0110 */ V(10, 14, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(8, 14, 3),
- /* 1001 */ V(8, 14, 3),
- /* 1010 */ V(7, 15, 4),
- /* 1011 */ V(7, 14, 4),
- /* 1100 */ V(15, 7, 2),
- /* 1101 */ V(15, 7, 2),
- /* 1110 */ V(15, 7, 2),
- /* 1111 */ V(15, 7, 2),
-
- /* 0000 0000 0011 ... */
- /* 000 */ V(13, 10, 2), /* 310 */
- /* 001 */ V(13, 10, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(11, 12, 3),
- /* 100 */ V(12, 11, 3),
- /* 101 */ V(15, 6, 3),
- /* 110 */ V(6, 15, 2),
- /* 111 */ V(6, 15, 2),
-
- /* 0000 0000 0100 ... */
- /* 00 */ V(14, 8, 2), /* 318 */
- /* 01 */ V(5, 15, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(13, 9, 2),
-
- /* 0000 0000 0101 ... */
- /* 00 */ V(15, 5, 2), /* 322 */
- /* 01 */ V(14, 7, 2),
- /* 10 */ V(10, 12, 2),
- /* 11 */ V(11, 11, 2),
-
- /* 0000 0000 0110 ... */
- /* 000 */ V(4, 15, 2), /* 326 */
- /* 001 */ V(4, 15, 2),
- /* 010 */ V(15, 4, 2),
- /* 011 */ V(15, 4, 2),
- /* 100 */ V(12, 10, 3),
- /* 101 */ V(14, 6, 3),
- /* 110 */ V(15, 3, 2),
- /* 111 */ V(15, 3, 2),
-
- /* 0000 0000 0111 ... */
- /* 00 */ V(3, 15, 1), /* 334 */
- /* 01 */ V(3, 15, 1),
- /* 10 */ V(8, 13, 2),
- /* 11 */ V(13, 8, 2),
-
- /* 0000 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 338 */
- /* 1 */ V(15, 2, 1),
-
- /* 0000 0000 1001 ... */
- /* 00 */ V(6, 14, 2), /* 340 */
- /* 01 */ V(9, 12, 2),
- /* 10 */ V(0, 15, 1),
- /* 11 */ V(0, 15, 1),
-
- /* 0000 0000 1010 ... */
- /* 00 */ V(12, 9, 2), /* 344 */
- /* 01 */ V(5, 14, 2),
- /* 10 */ V(10, 11, 1),
- /* 11 */ V(10, 11, 1),
-
- /* 0000 0000 1011 ... */
- /* 00 */ V(7, 13, 2), /* 348 */
- /* 01 */ V(13, 7, 2),
- /* 10 */ V(4, 14, 1),
- /* 11 */ V(4, 14, 1),
-
- /* 0000 0000 1100 ... */
- /* 00 */ V(12, 8, 2), /* 352 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(3, 14, 1),
- /* 11 */ V(3, 14, 1),
-
- /* 0000 0000 1101 ... */
- /* 00 */ V(11, 9, 1), /* 356 */
- /* 01 */ V(11, 9, 1),
- /* 10 */ V(9, 11, 2),
- /* 11 */ V(10, 10, 2),
-
- /* 0000 0001 0001 ... */
- /* 0 */ V(11, 10, 1), /* 360 */
- /* 1 */ V(14, 5, 1),
-
- /* 0000 0001 0010 ... */
- /* 0 */ V(14, 4, 1), /* 362 */
- /* 1 */ V(8, 12, 1),
-
- /* 0000 0001 0011 ... */
- /* 0 */ V(6, 13, 1), /* 364 */
- /* 1 */ V(14, 3, 1),
-
- /* 0000 0001 0101 ... */
- /* 0 */ V(2, 14, 1), /* 366 */
- /* 1 */ V(0, 14, 1),
-
- /* 0000 0001 1000 ... */
- /* 0 */ V(14, 0, 1), /* 368 */
- /* 1 */ V(5, 13, 1),
-
- /* 0000 0001 1001 ... */
- /* 0 */ V(13, 5, 1), /* 370 */
- /* 1 */ V(7, 12, 1),
-
- /* 0000 0001 1010 ... */
- /* 0 */ V(12, 7, 1), /* 372 */
- /* 1 */ V(4, 13, 1),
-
- /* 0000 0001 1011 ... */
- /* 0 */ V(8, 11, 1), /* 374 */
- /* 1 */ V(11, 8, 1),
-
- /* 0000 0001 1100 ... */
- /* 0 */ V(13, 4, 1), /* 376 */
- /* 1 */ V(9, 10, 1),
-
- /* 0000 0001 1101 ... */
- /* 0 */ V(10, 9, 1), /* 378 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 0010 0000 ... */
- /* 0 */ V(13, 3, 1), /* 380 */
- /* 1 */ V(7, 11, 1),
-
- /* 0000 0010 0101 ... */
- /* 0 */ V(5, 12, 1), /* 382 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 0010 0110 ... */
- /* 0 */ V(9, 9, 1), /* 384 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 0010 1000 ... */
- /* 0 */ V(10, 7, 1), /* 386 */
- /* 1 */ V(9, 7, 1),
-
- /* 0000 0000 0000 0000 ... */
- /* 000 */ V(15, 14, 3), /* 388 */
- /* 001 */ V(15, 12, 3),
- /* 010 */ V(15, 13, 2),
- /* 011 */ V(15, 13, 2),
- /* 100 */ V(14, 13, 1),
- /* 101 */ V(14, 13, 1),
- /* 110 */ V(14, 13, 1),
- /* 111 */ V(14, 13, 1),
-
- /* 0000 0000 0000 1011 ... */
- /* 0 */ V(10, 15, 1), /* 396 */
- /* 1 */ V(14, 9, 1)
+union huffpair const hufftab13[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 4), /* 16 */
+ /* 0001 */ PTR(84, 4),
+ /* 0010 */ PTR(100, 4),
+ /* 0011 */ PTR(116, 4),
+ /* 0100 */ PTR(132, 4),
+ /* 0101 */ PTR(148, 4),
+ /* 0110 */ PTR(164, 3),
+ /* 0111 */ PTR(172, 3),
+ /* 1000 */ PTR(180, 3),
+ /* 1001 */ PTR(188, 3),
+ /* 1010 */ PTR(196, 3),
+ /* 1011 */ PTR(204, 3),
+ /* 1100 */ PTR(212, 1),
+ /* 1101 */ PTR(214, 2),
+ /* 1110 */ PTR(218, 3),
+ /* 1111 */ PTR(226, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(228, 2), /* 32 */
+ /* 0001 */ PTR(232, 2),
+ /* 0010 */ PTR(236, 2),
+ /* 0011 */ PTR(240, 2),
+ /* 0100 */ V(8, 1, 4),
+ /* 0101 */ PTR(244, 1),
+ /* 0110 */ PTR(246, 1),
+ /* 0111 */ PTR(248, 1),
+ /* 1000 */ PTR(250, 2),
+ /* 1001 */ PTR(254, 1),
+ /* 1010 */ V(1, 5, 4),
+ /* 1011 */ V(5, 1, 4),
+ /* 1100 */ PTR(256, 1),
+ /* 1101 */ PTR(258, 1),
+ /* 1110 */ PTR(260, 1),
+ /* 1111 */ V(1, 4, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(4, 1, 3), /* 48 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 4),
+ /* 0101 */ V(3, 2, 4),
+ /* 0110 */ V(1, 3, 3),
+ /* 0111 */ V(1, 3, 3),
+ /* 1000 */ V(3, 1, 3),
+ /* 1001 */ V(3, 1, 3),
+ /* 1010 */ V(0, 3, 3),
+ /* 1011 */ V(0, 3, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(262, 4), /* 68 */
+ /* 0001 */ PTR(278, 4),
+ /* 0010 */ PTR(294, 4),
+ /* 0011 */ PTR(310, 3),
+ /* 0100 */ PTR(318, 2),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 3),
+ /* 0111 */ PTR(334, 2),
+ /* 1000 */ PTR(338, 1),
+ /* 1001 */ PTR(340, 2),
+ /* 1010 */ PTR(344, 2),
+ /* 1011 */ PTR(348, 2),
+ /* 1100 */ PTR(352, 2),
+ /* 1101 */ PTR(356, 2),
+ /* 1110 */ V(1, 15, 4),
+ /* 1111 */ V(15, 1, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 0, 4), /* 84 */
+ /* 0001 */ PTR(360, 1),
+ /* 0010 */ PTR(362, 1),
+ /* 0011 */ PTR(364, 1),
+ /* 0100 */ V(14, 2, 4),
+ /* 0101 */ PTR(366, 1),
+ /* 0110 */ V(1, 14, 4),
+ /* 0111 */ V(14, 1, 4),
+ /* 1000 */ PTR(368, 1),
+ /* 1001 */ PTR(370, 1),
+ /* 1010 */ PTR(372, 1),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 1),
+ /* 1101 */ PTR(378, 1),
+ /* 1110 */ V(12, 6, 4),
+ /* 1111 */ V(3, 13, 4),
+
+ /* 0000 0010 ... */
+ /* 0000 */ PTR(380, 1), /* 100 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(1, 13, 4),
+ /* 0100 */ V(11, 7, 4),
+ /* 0101 */ PTR(382, 1),
+ /* 0110 */ PTR(384, 1),
+ /* 0111 */ V(12, 3, 4),
+ /* 1000 */ PTR(386, 1),
+ /* 1001 */ V(4, 11, 4),
+ /* 1010 */ V(13, 1, 3),
+ /* 1011 */ V(13, 1, 3),
+ /* 1100 */ V(0, 13, 4),
+ /* 1101 */ V(13, 0, 4),
+ /* 1110 */ V(8, 10, 4),
+ /* 1111 */ V(10, 8, 4),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(4, 12, 4), /* 116 */
+ /* 0001 */ V(12, 4, 4),
+ /* 0010 */ V(6, 11, 4),
+ /* 0011 */ V(11, 6, 4),
+ /* 0100 */ V(3, 12, 3),
+ /* 0101 */ V(3, 12, 3),
+ /* 0110 */ V(2, 12, 3),
+ /* 0111 */ V(2, 12, 3),
+ /* 1000 */ V(12, 2, 3),
+ /* 1001 */ V(12, 2, 3),
+ /* 1010 */ V(5, 11, 3),
+ /* 1011 */ V(5, 11, 3),
+ /* 1100 */ V(11, 5, 4),
+ /* 1101 */ V(8, 9, 4),
+ /* 1110 */ V(1, 12, 3),
+ /* 1111 */ V(1, 12, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(12, 1, 3), /* 132 */
+ /* 0001 */ V(12, 1, 3),
+ /* 0010 */ V(9, 8, 4),
+ /* 0011 */ V(0, 12, 4),
+ /* 0100 */ V(12, 0, 3),
+ /* 0101 */ V(12, 0, 3),
+ /* 0110 */ V(11, 4, 4),
+ /* 0111 */ V(6, 10, 4),
+ /* 1000 */ V(10, 6, 4),
+ /* 1001 */ V(7, 9, 4),
+ /* 1010 */ V(3, 11, 3),
+ /* 1011 */ V(3, 11, 3),
+ /* 1100 */ V(11, 3, 3),
+ /* 1101 */ V(11, 3, 3),
+ /* 1110 */ V(8, 8, 4),
+ /* 1111 */ V(5, 10, 4),
+
+ /* 0000 0101 ... */
+ /* 0000 */ V(2, 11, 3), /* 148 */
+ /* 0001 */ V(2, 11, 3),
+ /* 0010 */ V(10, 5, 4),
+ /* 0011 */ V(6, 9, 4),
+ /* 0100 */ V(10, 4, 3),
+ /* 0101 */ V(10, 4, 3),
+ /* 0110 */ V(7, 8, 4),
+ /* 0111 */ V(8, 7, 4),
+ /* 1000 */ V(9, 4, 3),
+ /* 1001 */ V(9, 4, 3),
+ /* 1010 */ V(7, 7, 4),
+ /* 1011 */ V(7, 6, 4),
+ /* 1100 */ V(11, 2, 2),
+ /* 1101 */ V(11, 2, 2),
+ /* 1110 */ V(11, 2, 2),
+ /* 1111 */ V(11, 2, 2),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(1, 11, 2), /* 164 */
+ /* 001 */ V(1, 11, 2),
+ /* 010 */ V(11, 1, 2),
+ /* 011 */ V(11, 1, 2),
+ /* 100 */ V(0, 11, 3),
+ /* 101 */ V(11, 0, 3),
+ /* 110 */ V(9, 6, 3),
+ /* 111 */ V(4, 10, 3),
+
+ /* 0000 0111 ... */
+ /* 000 */ V(3, 10, 3), /* 172 */
+ /* 001 */ V(10, 3, 3),
+ /* 010 */ V(5, 9, 3),
+ /* 011 */ V(9, 5, 3),
+ /* 100 */ V(2, 10, 2),
+ /* 101 */ V(2, 10, 2),
+ /* 110 */ V(10, 2, 2),
+ /* 111 */ V(10, 2, 2),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(1, 10, 2), /* 180 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(10, 1, 2),
+ /* 011 */ V(10, 1, 2),
+ /* 100 */ V(0, 10, 3),
+ /* 101 */ V(6, 8, 3),
+ /* 110 */ V(10, 0, 2),
+ /* 111 */ V(10, 0, 2),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(8, 6, 3), /* 188 */
+ /* 001 */ V(4, 9, 3),
+ /* 010 */ V(9, 3, 2),
+ /* 011 */ V(9, 3, 2),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(5, 8, 3),
+ /* 110 */ V(8, 5, 3),
+ /* 111 */ V(6, 7, 3),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 9, 2), /* 196 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(5, 7, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 2),
+ /* 111 */ V(3, 8, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(8, 3, 2), /* 204 */
+ /* 001 */ V(8, 3, 2),
+ /* 010 */ V(6, 6, 3),
+ /* 011 */ V(4, 7, 3),
+ /* 100 */ V(7, 4, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(6, 5, 3),
+ /* 111 */ V(7, 3, 3),
+
+ /* 0000 1100 ... */
+ /* 0 */ V(1, 9, 1), /* 212 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0000 1101 ... */
+ /* 00 */ V(0, 9, 2), /* 214 */
+ /* 01 */ V(9, 0, 2),
+ /* 10 */ V(4, 8, 2),
+ /* 11 */ V(8, 4, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 2, 2), /* 218 */
+ /* 001 */ V(7, 2, 2),
+ /* 010 */ V(4, 6, 3),
+ /* 011 */ V(6, 4, 3),
+ /* 100 */ V(2, 8, 1),
+ /* 101 */ V(2, 8, 1),
+ /* 110 */ V(2, 8, 1),
+ /* 111 */ V(2, 8, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(8, 2, 1), /* 226 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(3, 7, 2), /* 228 */
+ /* 01 */ V(2, 7, 2),
+ /* 10 */ V(1, 7, 1),
+ /* 11 */ V(1, 7, 1),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(7, 1, 1), /* 232 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(5, 5, 2),
+ /* 11 */ V(0, 7, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(7, 0, 2), /* 236 */
+ /* 01 */ V(3, 6, 2),
+ /* 10 */ V(6, 3, 2),
+ /* 11 */ V(4, 5, 2),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(5, 4, 2), /* 240 */
+ /* 01 */ V(2, 6, 2),
+ /* 10 */ V(6, 2, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0001 0101 ... */
+ /* 0 */ V(0, 8, 1), /* 244 */
+ /* 1 */ V(8, 0, 1),
+
+ /* 0001 0110 ... */
+ /* 0 */ V(1, 6, 1), /* 246 */
+ /* 1 */ V(6, 1, 1),
+
+ /* 0001 0111 ... */
+ /* 0 */ V(0, 6, 1), /* 248 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(5, 3, 2), /* 250 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(5, 2, 1), /* 254 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(3, 4, 1), /* 256 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(5, 0, 1), /* 258 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0001 1110 ... */
+ /* 0 */ V(4, 2, 1), /* 260 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0000 */ PTR(388, 3), /* 262 */
+ /* 0001 */ V(15, 15, 4),
+ /* 0010 */ V(14, 15, 4),
+ /* 0011 */ V(13, 15, 4),
+ /* 0100 */ V(14, 14, 4),
+ /* 0101 */ V(12, 15, 4),
+ /* 0110 */ V(13, 14, 4),
+ /* 0111 */ V(11, 15, 4),
+ /* 1000 */ V(15, 11, 4),
+ /* 1001 */ V(12, 14, 4),
+ /* 1010 */ V(13, 12, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 12, 3),
+ /* 1101 */ V(14, 12, 3),
+ /* 1110 */ V(13, 13, 3),
+ /* 1111 */ V(13, 13, 3),
+
+ /* 0000 0000 0001 ... */
+ /* 0000 */ V(15, 10, 4), /* 278 */
+ /* 0001 */ V(12, 13, 4),
+ /* 0010 */ V(11, 14, 3),
+ /* 0011 */ V(11, 14, 3),
+ /* 0100 */ V(14, 11, 3),
+ /* 0101 */ V(14, 11, 3),
+ /* 0110 */ V(9, 15, 3),
+ /* 0111 */ V(9, 15, 3),
+ /* 1000 */ V(15, 9, 3),
+ /* 1001 */ V(15, 9, 3),
+ /* 1010 */ V(14, 10, 3),
+ /* 1011 */ V(14, 10, 3),
+ /* 1100 */ V(11, 13, 3),
+ /* 1101 */ V(11, 13, 3),
+ /* 1110 */ V(13, 11, 3),
+ /* 1111 */ V(13, 11, 3),
+
+ /* 0000 0000 0010 ... */
+ /* 0000 */ V(8, 15, 3), /* 294 */
+ /* 0001 */ V(8, 15, 3),
+ /* 0010 */ V(15, 8, 3),
+ /* 0011 */ V(15, 8, 3),
+ /* 0100 */ V(12, 12, 3),
+ /* 0101 */ V(12, 12, 3),
+ /* 0110 */ V(10, 14, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(8, 14, 3),
+ /* 1001 */ V(8, 14, 3),
+ /* 1010 */ V(7, 15, 4),
+ /* 1011 */ V(7, 14, 4),
+ /* 1100 */ V(15, 7, 2),
+ /* 1101 */ V(15, 7, 2),
+ /* 1110 */ V(15, 7, 2),
+ /* 1111 */ V(15, 7, 2),
+
+ /* 0000 0000 0011 ... */
+ /* 000 */ V(13, 10, 2), /* 310 */
+ /* 001 */ V(13, 10, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(11, 12, 3),
+ /* 100 */ V(12, 11, 3),
+ /* 101 */ V(15, 6, 3),
+ /* 110 */ V(6, 15, 2),
+ /* 111 */ V(6, 15, 2),
+
+ /* 0000 0000 0100 ... */
+ /* 00 */ V(14, 8, 2), /* 318 */
+ /* 01 */ V(5, 15, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(13, 9, 2),
+
+ /* 0000 0000 0101 ... */
+ /* 00 */ V(15, 5, 2), /* 322 */
+ /* 01 */ V(14, 7, 2),
+ /* 10 */ V(10, 12, 2),
+ /* 11 */ V(11, 11, 2),
+
+ /* 0000 0000 0110 ... */
+ /* 000 */ V(4, 15, 2), /* 326 */
+ /* 001 */ V(4, 15, 2),
+ /* 010 */ V(15, 4, 2),
+ /* 011 */ V(15, 4, 2),
+ /* 100 */ V(12, 10, 3),
+ /* 101 */ V(14, 6, 3),
+ /* 110 */ V(15, 3, 2),
+ /* 111 */ V(15, 3, 2),
+
+ /* 0000 0000 0111 ... */
+ /* 00 */ V(3, 15, 1), /* 334 */
+ /* 01 */ V(3, 15, 1),
+ /* 10 */ V(8, 13, 2),
+ /* 11 */ V(13, 8, 2),
+
+ /* 0000 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 338 */
+ /* 1 */ V(15, 2, 1),
+
+ /* 0000 0000 1001 ... */
+ /* 00 */ V(6, 14, 2), /* 340 */
+ /* 01 */ V(9, 12, 2),
+ /* 10 */ V(0, 15, 1),
+ /* 11 */ V(0, 15, 1),
+
+ /* 0000 0000 1010 ... */
+ /* 00 */ V(12, 9, 2), /* 344 */
+ /* 01 */ V(5, 14, 2),
+ /* 10 */ V(10, 11, 1),
+ /* 11 */ V(10, 11, 1),
+
+ /* 0000 0000 1011 ... */
+ /* 00 */ V(7, 13, 2), /* 348 */
+ /* 01 */ V(13, 7, 2),
+ /* 10 */ V(4, 14, 1),
+ /* 11 */ V(4, 14, 1),
+
+ /* 0000 0000 1100 ... */
+ /* 00 */ V(12, 8, 2), /* 352 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(3, 14, 1),
+ /* 11 */ V(3, 14, 1),
+
+ /* 0000 0000 1101 ... */
+ /* 00 */ V(11, 9, 1), /* 356 */
+ /* 01 */ V(11, 9, 1),
+ /* 10 */ V(9, 11, 2),
+ /* 11 */ V(10, 10, 2),
+
+ /* 0000 0001 0001 ... */
+ /* 0 */ V(11, 10, 1), /* 360 */
+ /* 1 */ V(14, 5, 1),
+
+ /* 0000 0001 0010 ... */
+ /* 0 */ V(14, 4, 1), /* 362 */
+ /* 1 */ V(8, 12, 1),
+
+ /* 0000 0001 0011 ... */
+ /* 0 */ V(6, 13, 1), /* 364 */
+ /* 1 */ V(14, 3, 1),
+
+ /* 0000 0001 0101 ... */
+ /* 0 */ V(2, 14, 1), /* 366 */
+ /* 1 */ V(0, 14, 1),
+
+ /* 0000 0001 1000 ... */
+ /* 0 */ V(14, 0, 1), /* 368 */
+ /* 1 */ V(5, 13, 1),
+
+ /* 0000 0001 1001 ... */
+ /* 0 */ V(13, 5, 1), /* 370 */
+ /* 1 */ V(7, 12, 1),
+
+ /* 0000 0001 1010 ... */
+ /* 0 */ V(12, 7, 1), /* 372 */
+ /* 1 */ V(4, 13, 1),
+
+ /* 0000 0001 1011 ... */
+ /* 0 */ V(8, 11, 1), /* 374 */
+ /* 1 */ V(11, 8, 1),
+
+ /* 0000 0001 1100 ... */
+ /* 0 */ V(13, 4, 1), /* 376 */
+ /* 1 */ V(9, 10, 1),
+
+ /* 0000 0001 1101 ... */
+ /* 0 */ V(10, 9, 1), /* 378 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 0010 0000 ... */
+ /* 0 */ V(13, 3, 1), /* 380 */
+ /* 1 */ V(7, 11, 1),
+
+ /* 0000 0010 0101 ... */
+ /* 0 */ V(5, 12, 1), /* 382 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 0010 0110 ... */
+ /* 0 */ V(9, 9, 1), /* 384 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 0010 1000 ... */
+ /* 0 */ V(10, 7, 1), /* 386 */
+ /* 1 */ V(9, 7, 1),
+
+ /* 0000 0000 0000 0000 ... */
+ /* 000 */ V(15, 14, 3), /* 388 */
+ /* 001 */ V(15, 12, 3),
+ /* 010 */ V(15, 13, 2),
+ /* 011 */ V(15, 13, 2),
+ /* 100 */ V(14, 13, 1),
+ /* 101 */ V(14, 13, 1),
+ /* 110 */ V(14, 13, 1),
+ /* 111 */ V(14, 13, 1),
+
+ /* 0000 0000 0000 1011 ... */
+ /* 0 */ V(10, 15, 1), /* 396 */
+ /* 1 */ V(14, 9, 1)
};
static
-union huffpair const hufftab15[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 4),
- /* 0100 */ PTR(80, 4),
- /* 0101 */ PTR(96, 3),
- /* 0110 */ PTR(104, 3),
- /* 0111 */ PTR(112, 2),
- /* 1000 */ PTR(116, 1),
- /* 1001 */ PTR(118, 1),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 4),
- /* 1101 */ V(1, 0, 4),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(120, 4), /* 16 */
- /* 0001 */ PTR(136, 4),
- /* 0010 */ PTR(152, 4),
- /* 0011 */ PTR(168, 4),
- /* 0100 */ PTR(184, 4),
- /* 0101 */ PTR(200, 3),
- /* 0110 */ PTR(208, 3),
- /* 0111 */ PTR(216, 4),
- /* 1000 */ PTR(232, 3),
- /* 1001 */ PTR(240, 3),
- /* 1010 */ PTR(248, 3),
- /* 1011 */ PTR(256, 3),
- /* 1100 */ PTR(264, 2),
- /* 1101 */ PTR(268, 3),
- /* 1110 */ PTR(276, 3),
- /* 1111 */ PTR(284, 2),
-
- /* 0001 ... */
- /* 0000 */ PTR(288, 2), /* 32 */
- /* 0001 */ PTR(292, 2),
- /* 0010 */ PTR(296, 2),
- /* 0011 */ PTR(300, 2),
- /* 0100 */ PTR(304, 2),
- /* 0101 */ PTR(308, 2),
- /* 0110 */ PTR(312, 2),
- /* 0111 */ PTR(316, 2),
- /* 1000 */ PTR(320, 1),
- /* 1001 */ PTR(322, 1),
- /* 1010 */ PTR(324, 1),
- /* 1011 */ PTR(326, 2),
- /* 1100 */ PTR(330, 1),
- /* 1101 */ PTR(332, 1),
- /* 1110 */ PTR(334, 2),
- /* 1111 */ PTR(338, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(340, 1), /* 48 */
- /* 0001 */ PTR(342, 1),
- /* 0010 */ V(9, 1, 4),
- /* 0011 */ PTR(344, 1),
- /* 0100 */ PTR(346, 1),
- /* 0101 */ PTR(348, 1),
- /* 0110 */ PTR(350, 1),
- /* 0111 */ PTR(352, 1),
- /* 1000 */ V(2, 8, 4),
- /* 1001 */ V(8, 2, 4),
- /* 1010 */ V(1, 8, 4),
- /* 1011 */ V(8, 1, 4),
- /* 1100 */ PTR(354, 1),
- /* 1101 */ PTR(356, 1),
- /* 1110 */ PTR(358, 1),
- /* 1111 */ PTR(360, 1),
-
- /* 0011 ... */
- /* 0000 */ V(2, 7, 4), /* 64 */
- /* 0001 */ V(7, 2, 4),
- /* 0010 */ V(6, 4, 4),
- /* 0011 */ V(1, 7, 4),
- /* 0100 */ V(5, 5, 4),
- /* 0101 */ V(7, 1, 4),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ V(3, 6, 4),
- /* 1000 */ V(6, 3, 4),
- /* 1001 */ V(4, 5, 4),
- /* 1010 */ V(5, 4, 4),
- /* 1011 */ V(2, 6, 4),
- /* 1100 */ V(6, 2, 4),
- /* 1101 */ V(1, 6, 4),
- /* 1110 */ PTR(364, 1),
- /* 1111 */ V(3, 5, 4),
-
- /* 0100 ... */
- /* 0000 */ V(6, 1, 3), /* 80 */
- /* 0001 */ V(6, 1, 3),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ V(4, 4, 4),
- /* 0100 */ V(2, 5, 3),
- /* 0101 */ V(2, 5, 3),
- /* 0110 */ V(5, 2, 3),
- /* 0111 */ V(5, 2, 3),
- /* 1000 */ V(1, 5, 3),
- /* 1001 */ V(1, 5, 3),
- /* 1010 */ V(5, 1, 3),
- /* 1011 */ V(5, 1, 3),
- /* 1100 */ V(0, 5, 4),
- /* 1101 */ V(5, 0, 4),
- /* 1110 */ V(3, 4, 3),
- /* 1111 */ V(3, 4, 3),
-
- /* 0101 ... */
- /* 000 */ V(4, 3, 3), /* 96 */
- /* 001 */ V(2, 4, 3),
- /* 010 */ V(4, 2, 3),
- /* 011 */ V(3, 3, 3),
- /* 100 */ V(4, 1, 2),
- /* 101 */ V(4, 1, 2),
- /* 110 */ V(1, 4, 3),
- /* 111 */ V(0, 4, 3),
-
- /* 0110 ... */
- /* 000 */ V(2, 3, 2), /* 104 */
- /* 001 */ V(2, 3, 2),
- /* 010 */ V(3, 2, 2),
- /* 011 */ V(3, 2, 2),
- /* 100 */ V(4, 0, 3),
- /* 101 */ V(0, 3, 3),
- /* 110 */ V(1, 3, 2),
- /* 111 */ V(1, 3, 2),
-
- /* 0111 ... */
- /* 00 */ V(3, 1, 2), /* 112 */
- /* 01 */ V(3, 0, 2),
- /* 10 */ V(2, 2, 1),
- /* 11 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(1, 2, 1), /* 116 */
- /* 1 */ V(2, 1, 1),
-
- /* 1001 ... */
- /* 0 */ V(0, 2, 1), /* 118 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(366, 1), /* 120 */
- /* 0001 */ PTR(368, 1),
- /* 0010 */ V(14, 14, 4),
- /* 0011 */ PTR(370, 1),
- /* 0100 */ PTR(372, 1),
- /* 0101 */ PTR(374, 1),
- /* 0110 */ V(15, 11, 4),
- /* 0111 */ PTR(376, 1),
- /* 1000 */ V(13, 13, 4),
- /* 1001 */ V(10, 15, 4),
- /* 1010 */ V(15, 10, 4),
- /* 1011 */ V(11, 14, 4),
- /* 1100 */ V(14, 11, 4),
- /* 1101 */ V(12, 13, 4),
- /* 1110 */ V(13, 12, 4),
- /* 1111 */ V(9, 15, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 9, 4), /* 136 */
- /* 0001 */ V(14, 10, 4),
- /* 0010 */ V(11, 13, 4),
- /* 0011 */ V(13, 11, 4),
- /* 0100 */ V(8, 15, 4),
- /* 0101 */ V(15, 8, 4),
- /* 0110 */ V(12, 12, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(14, 9, 4),
- /* 1001 */ V(7, 15, 4),
- /* 1010 */ V(15, 7, 4),
- /* 1011 */ V(10, 13, 4),
- /* 1100 */ V(13, 10, 4),
- /* 1101 */ V(11, 12, 4),
- /* 1110 */ V(6, 15, 4),
- /* 1111 */ PTR(378, 1),
-
- /* 0000 0010 ... */
- /* 0000 */ V(12, 11, 3), /* 152 */
- /* 0001 */ V(12, 11, 3),
- /* 0010 */ V(15, 6, 3),
- /* 0011 */ V(15, 6, 3),
- /* 0100 */ V(8, 14, 4),
- /* 0101 */ V(14, 8, 4),
- /* 0110 */ V(5, 15, 4),
- /* 0111 */ V(9, 13, 4),
- /* 1000 */ V(15, 5, 3),
- /* 1001 */ V(15, 5, 3),
- /* 1010 */ V(7, 14, 3),
- /* 1011 */ V(7, 14, 3),
- /* 1100 */ V(14, 7, 3),
- /* 1101 */ V(14, 7, 3),
- /* 1110 */ V(10, 12, 3),
- /* 1111 */ V(10, 12, 3),
-
- /* 0000 0011 ... */
- /* 0000 */ V(12, 10, 3), /* 168 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(13, 9, 4),
- /* 0101 */ V(8, 13, 4),
- /* 0110 */ V(4, 15, 3),
- /* 0111 */ V(4, 15, 3),
- /* 1000 */ V(15, 4, 3),
- /* 1001 */ V(15, 4, 3),
- /* 1010 */ V(3, 15, 3),
- /* 1011 */ V(3, 15, 3),
- /* 1100 */ V(15, 3, 3),
- /* 1101 */ V(15, 3, 3),
- /* 1110 */ V(13, 8, 3),
- /* 1111 */ V(13, 8, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(14, 6, 3), /* 184 */
- /* 0001 */ V(14, 6, 3),
- /* 0010 */ V(2, 15, 3),
- /* 0011 */ V(2, 15, 3),
- /* 0100 */ V(15, 2, 3),
- /* 0101 */ V(15, 2, 3),
- /* 0110 */ V(6, 14, 4),
- /* 0111 */ V(15, 0, 4),
- /* 1000 */ V(1, 15, 3),
- /* 1001 */ V(1, 15, 3),
- /* 1010 */ V(15, 1, 3),
- /* 1011 */ V(15, 1, 3),
- /* 1100 */ V(9, 12, 3),
- /* 1101 */ V(9, 12, 3),
- /* 1110 */ V(12, 9, 3),
- /* 1111 */ V(12, 9, 3),
-
- /* 0000 0101 ... */
- /* 000 */ V(5, 14, 3), /* 200 */
- /* 001 */ V(10, 11, 3),
- /* 010 */ V(11, 10, 3),
- /* 011 */ V(14, 5, 3),
- /* 100 */ V(7, 13, 3),
- /* 101 */ V(13, 7, 3),
- /* 110 */ V(4, 14, 3),
- /* 111 */ V(14, 4, 3),
-
- /* 0000 0110 ... */
- /* 000 */ V(8, 12, 3), /* 208 */
- /* 001 */ V(12, 8, 3),
- /* 010 */ V(3, 14, 3),
- /* 011 */ V(6, 13, 3),
- /* 100 */ V(13, 6, 3),
- /* 101 */ V(14, 3, 3),
- /* 110 */ V(9, 11, 3),
- /* 111 */ V(11, 9, 3),
-
- /* 0000 0111 ... */
- /* 0000 */ V(2, 14, 3), /* 216 */
- /* 0001 */ V(2, 14, 3),
- /* 0010 */ V(10, 10, 3),
- /* 0011 */ V(10, 10, 3),
- /* 0100 */ V(14, 2, 3),
- /* 0101 */ V(14, 2, 3),
- /* 0110 */ V(1, 14, 3),
- /* 0111 */ V(1, 14, 3),
- /* 1000 */ V(14, 1, 3),
- /* 1001 */ V(14, 1, 3),
- /* 1010 */ V(0, 14, 4),
- /* 1011 */ V(14, 0, 4),
- /* 1100 */ V(5, 13, 3),
- /* 1101 */ V(5, 13, 3),
- /* 1110 */ V(13, 5, 3),
- /* 1111 */ V(13, 5, 3),
-
- /* 0000 1000 ... */
- /* 000 */ V(7, 12, 3), /* 232 */
- /* 001 */ V(12, 7, 3),
- /* 010 */ V(4, 13, 3),
- /* 011 */ V(8, 11, 3),
- /* 100 */ V(13, 4, 2),
- /* 101 */ V(13, 4, 2),
- /* 110 */ V(11, 8, 3),
- /* 111 */ V(9, 10, 3),
-
- /* 0000 1001 ... */
- /* 000 */ V(10, 9, 3), /* 240 */
- /* 001 */ V(6, 12, 3),
- /* 010 */ V(12, 6, 3),
- /* 011 */ V(3, 13, 3),
- /* 100 */ V(13, 3, 2),
- /* 101 */ V(13, 3, 2),
- /* 110 */ V(13, 2, 2),
- /* 111 */ V(13, 2, 2),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 13, 3), /* 248 */
- /* 001 */ V(0, 13, 3),
- /* 010 */ V(1, 13, 2),
- /* 011 */ V(1, 13, 2),
- /* 100 */ V(7, 11, 2),
- /* 101 */ V(7, 11, 2),
- /* 110 */ V(11, 7, 2),
- /* 111 */ V(11, 7, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(13, 1, 2), /* 256 */
- /* 001 */ V(13, 1, 2),
- /* 010 */ V(5, 12, 3),
- /* 011 */ V(13, 0, 3),
- /* 100 */ V(12, 5, 2),
- /* 101 */ V(12, 5, 2),
- /* 110 */ V(8, 10, 2),
- /* 111 */ V(8, 10, 2),
-
- /* 0000 1100 ... */
- /* 00 */ V(10, 8, 2), /* 264 */
- /* 01 */ V(4, 12, 2),
- /* 10 */ V(12, 4, 2),
- /* 11 */ V(6, 11, 2),
-
- /* 0000 1101 ... */
- /* 000 */ V(11, 6, 2), /* 268 */
- /* 001 */ V(11, 6, 2),
- /* 010 */ V(9, 9, 3),
- /* 011 */ V(0, 12, 3),
- /* 100 */ V(3, 12, 2),
- /* 101 */ V(3, 12, 2),
- /* 110 */ V(12, 3, 2),
- /* 111 */ V(12, 3, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 10, 2), /* 276 */
- /* 001 */ V(7, 10, 2),
- /* 010 */ V(10, 7, 2),
- /* 011 */ V(10, 7, 2),
- /* 100 */ V(10, 6, 2),
- /* 101 */ V(10, 6, 2),
- /* 110 */ V(12, 0, 3),
- /* 111 */ V(0, 11, 3),
-
- /* 0000 1111 ... */
- /* 00 */ V(12, 2, 1), /* 284 */
- /* 01 */ V(12, 2, 1),
- /* 10 */ V(2, 12, 2),
- /* 11 */ V(5, 11, 2),
-
- /* 0001 0000 ... */
- /* 00 */ V(11, 5, 2), /* 288 */
- /* 01 */ V(1, 12, 2),
- /* 10 */ V(8, 9, 2),
- /* 11 */ V(9, 8, 2),
-
- /* 0001 0001 ... */
- /* 00 */ V(12, 1, 2), /* 292 */
- /* 01 */ V(4, 11, 2),
- /* 10 */ V(11, 4, 2),
- /* 11 */ V(6, 10, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(3, 11, 2), /* 296 */
- /* 01 */ V(7, 9, 2),
- /* 10 */ V(11, 3, 1),
- /* 11 */ V(11, 3, 1),
-
- /* 0001 0011 ... */
- /* 00 */ V(9, 7, 2), /* 300 */
- /* 01 */ V(8, 8, 2),
- /* 10 */ V(2, 11, 2),
- /* 11 */ V(5, 10, 2),
-
- /* 0001 0100 ... */
- /* 00 */ V(11, 2, 1), /* 304 */
- /* 01 */ V(11, 2, 1),
- /* 10 */ V(10, 5, 2),
- /* 11 */ V(1, 11, 2),
-
- /* 0001 0101 ... */
- /* 00 */ V(11, 1, 1), /* 308 */
- /* 01 */ V(11, 1, 1),
- /* 10 */ V(11, 0, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0001 0110 ... */
- /* 00 */ V(9, 6, 2), /* 312 */
- /* 01 */ V(4, 10, 2),
- /* 10 */ V(10, 4, 2),
- /* 11 */ V(7, 8, 2),
-
- /* 0001 0111 ... */
- /* 00 */ V(8, 7, 2), /* 316 */
- /* 01 */ V(3, 10, 2),
- /* 10 */ V(10, 3, 1),
- /* 11 */ V(10, 3, 1),
-
- /* 0001 1000 ... */
- /* 0 */ V(5, 9, 1), /* 320 */
- /* 1 */ V(9, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(2, 10, 1), /* 322 */
- /* 1 */ V(10, 2, 1),
-
- /* 0001 1010 ... */
- /* 0 */ V(1, 10, 1), /* 324 */
- /* 1 */ V(10, 1, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(0, 10, 2), /* 326 */
- /* 01 */ V(10, 0, 2),
- /* 10 */ V(6, 8, 1),
- /* 11 */ V(6, 8, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(8, 6, 1), /* 330 */
- /* 1 */ V(4, 9, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(9, 4, 1), /* 332 */
- /* 1 */ V(3, 9, 1),
-
- /* 0001 1110 ... */
- /* 00 */ V(9, 3, 1), /* 334 */
- /* 01 */ V(9, 3, 1),
- /* 10 */ V(7, 7, 2),
- /* 11 */ V(0, 9, 2),
-
- /* 0001 1111 ... */
- /* 0 */ V(5, 8, 1), /* 338 */
- /* 1 */ V(8, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(2, 9, 1), /* 340 */
- /* 1 */ V(6, 7, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(7, 6, 1), /* 342 */
- /* 1 */ V(9, 2, 1),
-
- /* 0010 0011 ... */
- /* 0 */ V(1, 9, 1), /* 344 */
- /* 1 */ V(9, 0, 1),
-
- /* 0010 0100 ... */
- /* 0 */ V(4, 8, 1), /* 346 */
- /* 1 */ V(8, 4, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(5, 7, 1), /* 348 */
- /* 1 */ V(7, 5, 1),
-
- /* 0010 0110 ... */
- /* 0 */ V(3, 8, 1), /* 350 */
- /* 1 */ V(8, 3, 1),
-
- /* 0010 0111 ... */
- /* 0 */ V(6, 6, 1), /* 352 */
- /* 1 */ V(4, 7, 1),
-
- /* 0010 1100 ... */
- /* 0 */ V(7, 4, 1), /* 354 */
- /* 1 */ V(0, 8, 1),
-
- /* 0010 1101 ... */
- /* 0 */ V(8, 0, 1), /* 356 */
- /* 1 */ V(5, 6, 1),
-
- /* 0010 1110 ... */
- /* 0 */ V(6, 5, 1), /* 358 */
- /* 1 */ V(3, 7, 1),
-
- /* 0010 1111 ... */
- /* 0 */ V(7, 3, 1), /* 360 */
- /* 1 */ V(4, 6, 1),
-
- /* 0011 0110 ... */
- /* 0 */ V(0, 7, 1), /* 362 */
- /* 1 */ V(7, 0, 1),
-
- /* 0011 1110 ... */
- /* 0 */ V(0, 6, 1), /* 364 */
- /* 1 */ V(6, 0, 1),
-
- /* 0000 0000 0000 ... */
- /* 0 */ V(15, 15, 1), /* 366 */
- /* 1 */ V(14, 15, 1),
-
- /* 0000 0000 0001 ... */
- /* 0 */ V(15, 14, 1), /* 368 */
- /* 1 */ V(13, 15, 1),
-
- /* 0000 0000 0011 ... */
- /* 0 */ V(15, 13, 1), /* 370 */
- /* 1 */ V(12, 15, 1),
-
- /* 0000 0000 0100 ... */
- /* 0 */ V(15, 12, 1), /* 372 */
- /* 1 */ V(13, 14, 1),
-
- /* 0000 0000 0101 ... */
- /* 0 */ V(14, 13, 1), /* 374 */
- /* 1 */ V(11, 15, 1),
-
- /* 0000 0000 0111 ... */
- /* 0 */ V(12, 14, 1), /* 376 */
- /* 1 */ V(14, 12, 1),
-
- /* 0000 0001 1111 ... */
- /* 0 */ V(10, 14, 1), /* 378 */
- /* 1 */ V(0, 15, 1)
+union huffpair const hufftab15[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 4),
+ /* 0100 */ PTR(80, 4),
+ /* 0101 */ PTR(96, 3),
+ /* 0110 */ PTR(104, 3),
+ /* 0111 */ PTR(112, 2),
+ /* 1000 */ PTR(116, 1),
+ /* 1001 */ PTR(118, 1),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 4),
+ /* 1101 */ V(1, 0, 4),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(120, 4), /* 16 */
+ /* 0001 */ PTR(136, 4),
+ /* 0010 */ PTR(152, 4),
+ /* 0011 */ PTR(168, 4),
+ /* 0100 */ PTR(184, 4),
+ /* 0101 */ PTR(200, 3),
+ /* 0110 */ PTR(208, 3),
+ /* 0111 */ PTR(216, 4),
+ /* 1000 */ PTR(232, 3),
+ /* 1001 */ PTR(240, 3),
+ /* 1010 */ PTR(248, 3),
+ /* 1011 */ PTR(256, 3),
+ /* 1100 */ PTR(264, 2),
+ /* 1101 */ PTR(268, 3),
+ /* 1110 */ PTR(276, 3),
+ /* 1111 */ PTR(284, 2),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(288, 2), /* 32 */
+ /* 0001 */ PTR(292, 2),
+ /* 0010 */ PTR(296, 2),
+ /* 0011 */ PTR(300, 2),
+ /* 0100 */ PTR(304, 2),
+ /* 0101 */ PTR(308, 2),
+ /* 0110 */ PTR(312, 2),
+ /* 0111 */ PTR(316, 2),
+ /* 1000 */ PTR(320, 1),
+ /* 1001 */ PTR(322, 1),
+ /* 1010 */ PTR(324, 1),
+ /* 1011 */ PTR(326, 2),
+ /* 1100 */ PTR(330, 1),
+ /* 1101 */ PTR(332, 1),
+ /* 1110 */ PTR(334, 2),
+ /* 1111 */ PTR(338, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(340, 1), /* 48 */
+ /* 0001 */ PTR(342, 1),
+ /* 0010 */ V(9, 1, 4),
+ /* 0011 */ PTR(344, 1),
+ /* 0100 */ PTR(346, 1),
+ /* 0101 */ PTR(348, 1),
+ /* 0110 */ PTR(350, 1),
+ /* 0111 */ PTR(352, 1),
+ /* 1000 */ V(2, 8, 4),
+ /* 1001 */ V(8, 2, 4),
+ /* 1010 */ V(1, 8, 4),
+ /* 1011 */ V(8, 1, 4),
+ /* 1100 */ PTR(354, 1),
+ /* 1101 */ PTR(356, 1),
+ /* 1110 */ PTR(358, 1),
+ /* 1111 */ PTR(360, 1),
+
+ /* 0011 ... */
+ /* 0000 */ V(2, 7, 4), /* 64 */
+ /* 0001 */ V(7, 2, 4),
+ /* 0010 */ V(6, 4, 4),
+ /* 0011 */ V(1, 7, 4),
+ /* 0100 */ V(5, 5, 4),
+ /* 0101 */ V(7, 1, 4),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ V(3, 6, 4),
+ /* 1000 */ V(6, 3, 4),
+ /* 1001 */ V(4, 5, 4),
+ /* 1010 */ V(5, 4, 4),
+ /* 1011 */ V(2, 6, 4),
+ /* 1100 */ V(6, 2, 4),
+ /* 1101 */ V(1, 6, 4),
+ /* 1110 */ PTR(364, 1),
+ /* 1111 */ V(3, 5, 4),
+
+ /* 0100 ... */
+ /* 0000 */ V(6, 1, 3), /* 80 */
+ /* 0001 */ V(6, 1, 3),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ V(4, 4, 4),
+ /* 0100 */ V(2, 5, 3),
+ /* 0101 */ V(2, 5, 3),
+ /* 0110 */ V(5, 2, 3),
+ /* 0111 */ V(5, 2, 3),
+ /* 1000 */ V(1, 5, 3),
+ /* 1001 */ V(1, 5, 3),
+ /* 1010 */ V(5, 1, 3),
+ /* 1011 */ V(5, 1, 3),
+ /* 1100 */ V(0, 5, 4),
+ /* 1101 */ V(5, 0, 4),
+ /* 1110 */ V(3, 4, 3),
+ /* 1111 */ V(3, 4, 3),
+
+ /* 0101 ... */
+ /* 000 */ V(4, 3, 3), /* 96 */
+ /* 001 */ V(2, 4, 3),
+ /* 010 */ V(4, 2, 3),
+ /* 011 */ V(3, 3, 3),
+ /* 100 */ V(4, 1, 2),
+ /* 101 */ V(4, 1, 2),
+ /* 110 */ V(1, 4, 3),
+ /* 111 */ V(0, 4, 3),
+
+ /* 0110 ... */
+ /* 000 */ V(2, 3, 2), /* 104 */
+ /* 001 */ V(2, 3, 2),
+ /* 010 */ V(3, 2, 2),
+ /* 011 */ V(3, 2, 2),
+ /* 100 */ V(4, 0, 3),
+ /* 101 */ V(0, 3, 3),
+ /* 110 */ V(1, 3, 2),
+ /* 111 */ V(1, 3, 2),
+
+ /* 0111 ... */
+ /* 00 */ V(3, 1, 2), /* 112 */
+ /* 01 */ V(3, 0, 2),
+ /* 10 */ V(2, 2, 1),
+ /* 11 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(1, 2, 1), /* 116 */
+ /* 1 */ V(2, 1, 1),
+
+ /* 1001 ... */
+ /* 0 */ V(0, 2, 1), /* 118 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(366, 1), /* 120 */
+ /* 0001 */ PTR(368, 1),
+ /* 0010 */ V(14, 14, 4),
+ /* 0011 */ PTR(370, 1),
+ /* 0100 */ PTR(372, 1),
+ /* 0101 */ PTR(374, 1),
+ /* 0110 */ V(15, 11, 4),
+ /* 0111 */ PTR(376, 1),
+ /* 1000 */ V(13, 13, 4),
+ /* 1001 */ V(10, 15, 4),
+ /* 1010 */ V(15, 10, 4),
+ /* 1011 */ V(11, 14, 4),
+ /* 1100 */ V(14, 11, 4),
+ /* 1101 */ V(12, 13, 4),
+ /* 1110 */ V(13, 12, 4),
+ /* 1111 */ V(9, 15, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 9, 4), /* 136 */
+ /* 0001 */ V(14, 10, 4),
+ /* 0010 */ V(11, 13, 4),
+ /* 0011 */ V(13, 11, 4),
+ /* 0100 */ V(8, 15, 4),
+ /* 0101 */ V(15, 8, 4),
+ /* 0110 */ V(12, 12, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(14, 9, 4),
+ /* 1001 */ V(7, 15, 4),
+ /* 1010 */ V(15, 7, 4),
+ /* 1011 */ V(10, 13, 4),
+ /* 1100 */ V(13, 10, 4),
+ /* 1101 */ V(11, 12, 4),
+ /* 1110 */ V(6, 15, 4),
+ /* 1111 */ PTR(378, 1),
+
+ /* 0000 0010 ... */
+ /* 0000 */ V(12, 11, 3), /* 152 */
+ /* 0001 */ V(12, 11, 3),
+ /* 0010 */ V(15, 6, 3),
+ /* 0011 */ V(15, 6, 3),
+ /* 0100 */ V(8, 14, 4),
+ /* 0101 */ V(14, 8, 4),
+ /* 0110 */ V(5, 15, 4),
+ /* 0111 */ V(9, 13, 4),
+ /* 1000 */ V(15, 5, 3),
+ /* 1001 */ V(15, 5, 3),
+ /* 1010 */ V(7, 14, 3),
+ /* 1011 */ V(7, 14, 3),
+ /* 1100 */ V(14, 7, 3),
+ /* 1101 */ V(14, 7, 3),
+ /* 1110 */ V(10, 12, 3),
+ /* 1111 */ V(10, 12, 3),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(12, 10, 3), /* 168 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(13, 9, 4),
+ /* 0101 */ V(8, 13, 4),
+ /* 0110 */ V(4, 15, 3),
+ /* 0111 */ V(4, 15, 3),
+ /* 1000 */ V(15, 4, 3),
+ /* 1001 */ V(15, 4, 3),
+ /* 1010 */ V(3, 15, 3),
+ /* 1011 */ V(3, 15, 3),
+ /* 1100 */ V(15, 3, 3),
+ /* 1101 */ V(15, 3, 3),
+ /* 1110 */ V(13, 8, 3),
+ /* 1111 */ V(13, 8, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(14, 6, 3), /* 184 */
+ /* 0001 */ V(14, 6, 3),
+ /* 0010 */ V(2, 15, 3),
+ /* 0011 */ V(2, 15, 3),
+ /* 0100 */ V(15, 2, 3),
+ /* 0101 */ V(15, 2, 3),
+ /* 0110 */ V(6, 14, 4),
+ /* 0111 */ V(15, 0, 4),
+ /* 1000 */ V(1, 15, 3),
+ /* 1001 */ V(1, 15, 3),
+ /* 1010 */ V(15, 1, 3),
+ /* 1011 */ V(15, 1, 3),
+ /* 1100 */ V(9, 12, 3),
+ /* 1101 */ V(9, 12, 3),
+ /* 1110 */ V(12, 9, 3),
+ /* 1111 */ V(12, 9, 3),
+
+ /* 0000 0101 ... */
+ /* 000 */ V(5, 14, 3), /* 200 */
+ /* 001 */ V(10, 11, 3),
+ /* 010 */ V(11, 10, 3),
+ /* 011 */ V(14, 5, 3),
+ /* 100 */ V(7, 13, 3),
+ /* 101 */ V(13, 7, 3),
+ /* 110 */ V(4, 14, 3),
+ /* 111 */ V(14, 4, 3),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(8, 12, 3), /* 208 */
+ /* 001 */ V(12, 8, 3),
+ /* 010 */ V(3, 14, 3),
+ /* 011 */ V(6, 13, 3),
+ /* 100 */ V(13, 6, 3),
+ /* 101 */ V(14, 3, 3),
+ /* 110 */ V(9, 11, 3),
+ /* 111 */ V(11, 9, 3),
+
+ /* 0000 0111 ... */
+ /* 0000 */ V(2, 14, 3), /* 216 */
+ /* 0001 */ V(2, 14, 3),
+ /* 0010 */ V(10, 10, 3),
+ /* 0011 */ V(10, 10, 3),
+ /* 0100 */ V(14, 2, 3),
+ /* 0101 */ V(14, 2, 3),
+ /* 0110 */ V(1, 14, 3),
+ /* 0111 */ V(1, 14, 3),
+ /* 1000 */ V(14, 1, 3),
+ /* 1001 */ V(14, 1, 3),
+ /* 1010 */ V(0, 14, 4),
+ /* 1011 */ V(14, 0, 4),
+ /* 1100 */ V(5, 13, 3),
+ /* 1101 */ V(5, 13, 3),
+ /* 1110 */ V(13, 5, 3),
+ /* 1111 */ V(13, 5, 3),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(7, 12, 3), /* 232 */
+ /* 001 */ V(12, 7, 3),
+ /* 010 */ V(4, 13, 3),
+ /* 011 */ V(8, 11, 3),
+ /* 100 */ V(13, 4, 2),
+ /* 101 */ V(13, 4, 2),
+ /* 110 */ V(11, 8, 3),
+ /* 111 */ V(9, 10, 3),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(10, 9, 3), /* 240 */
+ /* 001 */ V(6, 12, 3),
+ /* 010 */ V(12, 6, 3),
+ /* 011 */ V(3, 13, 3),
+ /* 100 */ V(13, 3, 2),
+ /* 101 */ V(13, 3, 2),
+ /* 110 */ V(13, 2, 2),
+ /* 111 */ V(13, 2, 2),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 13, 3), /* 248 */
+ /* 001 */ V(0, 13, 3),
+ /* 010 */ V(1, 13, 2),
+ /* 011 */ V(1, 13, 2),
+ /* 100 */ V(7, 11, 2),
+ /* 101 */ V(7, 11, 2),
+ /* 110 */ V(11, 7, 2),
+ /* 111 */ V(11, 7, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(13, 1, 2), /* 256 */
+ /* 001 */ V(13, 1, 2),
+ /* 010 */ V(5, 12, 3),
+ /* 011 */ V(13, 0, 3),
+ /* 100 */ V(12, 5, 2),
+ /* 101 */ V(12, 5, 2),
+ /* 110 */ V(8, 10, 2),
+ /* 111 */ V(8, 10, 2),
+
+ /* 0000 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 264 */
+ /* 01 */ V(4, 12, 2),
+ /* 10 */ V(12, 4, 2),
+ /* 11 */ V(6, 11, 2),
+
+ /* 0000 1101 ... */
+ /* 000 */ V(11, 6, 2), /* 268 */
+ /* 001 */ V(11, 6, 2),
+ /* 010 */ V(9, 9, 3),
+ /* 011 */ V(0, 12, 3),
+ /* 100 */ V(3, 12, 2),
+ /* 101 */ V(3, 12, 2),
+ /* 110 */ V(12, 3, 2),
+ /* 111 */ V(12, 3, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 10, 2), /* 276 */
+ /* 001 */ V(7, 10, 2),
+ /* 010 */ V(10, 7, 2),
+ /* 011 */ V(10, 7, 2),
+ /* 100 */ V(10, 6, 2),
+ /* 101 */ V(10, 6, 2),
+ /* 110 */ V(12, 0, 3),
+ /* 111 */ V(0, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 00 */ V(12, 2, 1), /* 284 */
+ /* 01 */ V(12, 2, 1),
+ /* 10 */ V(2, 12, 2),
+ /* 11 */ V(5, 11, 2),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(11, 5, 2), /* 288 */
+ /* 01 */ V(1, 12, 2),
+ /* 10 */ V(8, 9, 2),
+ /* 11 */ V(9, 8, 2),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(12, 1, 2), /* 292 */
+ /* 01 */ V(4, 11, 2),
+ /* 10 */ V(11, 4, 2),
+ /* 11 */ V(6, 10, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(3, 11, 2), /* 296 */
+ /* 01 */ V(7, 9, 2),
+ /* 10 */ V(11, 3, 1),
+ /* 11 */ V(11, 3, 1),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(9, 7, 2), /* 300 */
+ /* 01 */ V(8, 8, 2),
+ /* 10 */ V(2, 11, 2),
+ /* 11 */ V(5, 10, 2),
+
+ /* 0001 0100 ... */
+ /* 00 */ V(11, 2, 1), /* 304 */
+ /* 01 */ V(11, 2, 1),
+ /* 10 */ V(10, 5, 2),
+ /* 11 */ V(1, 11, 2),
+
+ /* 0001 0101 ... */
+ /* 00 */ V(11, 1, 1), /* 308 */
+ /* 01 */ V(11, 1, 1),
+ /* 10 */ V(11, 0, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0001 0110 ... */
+ /* 00 */ V(9, 6, 2), /* 312 */
+ /* 01 */ V(4, 10, 2),
+ /* 10 */ V(10, 4, 2),
+ /* 11 */ V(7, 8, 2),
+
+ /* 0001 0111 ... */
+ /* 00 */ V(8, 7, 2), /* 316 */
+ /* 01 */ V(3, 10, 2),
+ /* 10 */ V(10, 3, 1),
+ /* 11 */ V(10, 3, 1),
+
+ /* 0001 1000 ... */
+ /* 0 */ V(5, 9, 1), /* 320 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(2, 10, 1), /* 322 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(1, 10, 1), /* 324 */
+ /* 1 */ V(10, 1, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(0, 10, 2), /* 326 */
+ /* 01 */ V(10, 0, 2),
+ /* 10 */ V(6, 8, 1),
+ /* 11 */ V(6, 8, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(8, 6, 1), /* 330 */
+ /* 1 */ V(4, 9, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(9, 4, 1), /* 332 */
+ /* 1 */ V(3, 9, 1),
+
+ /* 0001 1110 ... */
+ /* 00 */ V(9, 3, 1), /* 334 */
+ /* 01 */ V(9, 3, 1),
+ /* 10 */ V(7, 7, 2),
+ /* 11 */ V(0, 9, 2),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(5, 8, 1), /* 338 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(2, 9, 1), /* 340 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(7, 6, 1), /* 342 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0010 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 344 */
+ /* 1 */ V(9, 0, 1),
+
+ /* 0010 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 346 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 348 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0010 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 350 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0010 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 352 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0010 1100 ... */
+ /* 0 */ V(7, 4, 1), /* 354 */
+ /* 1 */ V(0, 8, 1),
+
+ /* 0010 1101 ... */
+ /* 0 */ V(8, 0, 1), /* 356 */
+ /* 1 */ V(5, 6, 1),
+
+ /* 0010 1110 ... */
+ /* 0 */ V(6, 5, 1), /* 358 */
+ /* 1 */ V(3, 7, 1),
+
+ /* 0010 1111 ... */
+ /* 0 */ V(7, 3, 1), /* 360 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0011 0110 ... */
+ /* 0 */ V(0, 7, 1), /* 362 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0011 1110 ... */
+ /* 0 */ V(0, 6, 1), /* 364 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0 */ V(15, 15, 1), /* 366 */
+ /* 1 */ V(14, 15, 1),
+
+ /* 0000 0000 0001 ... */
+ /* 0 */ V(15, 14, 1), /* 368 */
+ /* 1 */ V(13, 15, 1),
+
+ /* 0000 0000 0011 ... */
+ /* 0 */ V(15, 13, 1), /* 370 */
+ /* 1 */ V(12, 15, 1),
+
+ /* 0000 0000 0100 ... */
+ /* 0 */ V(15, 12, 1), /* 372 */
+ /* 1 */ V(13, 14, 1),
+
+ /* 0000 0000 0101 ... */
+ /* 0 */ V(14, 13, 1), /* 374 */
+ /* 1 */ V(11, 15, 1),
+
+ /* 0000 0000 0111 ... */
+ /* 0 */ V(12, 14, 1), /* 376 */
+ /* 1 */ V(14, 12, 1),
+
+ /* 0000 0001 1111 ... */
+ /* 0 */ V(10, 14, 1), /* 378 */
+ /* 1 */ V(0, 15, 1)
};
static
-union huffpair const hufftab16[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 3), /* 16 */
- /* 0001 */ PTR(76, 3),
- /* 0010 */ PTR(84, 2),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(88, 2),
- /* 0101 */ PTR(92, 1),
- /* 0110 */ PTR(94, 4),
- /* 0111 */ V(15, 2, 4),
- /* 1000 */ PTR(110, 1),
- /* 1001 */ V(1, 15, 4),
- /* 1010 */ V(15, 1, 4),
- /* 1011 */ PTR(112, 4),
- /* 1100 */ PTR(128, 4),
- /* 1101 */ PTR(144, 4),
- /* 1110 */ PTR(160, 4),
- /* 1111 */ PTR(176, 4),
-
- /* 0001 ... */
- /* 0000 */ PTR(192, 4), /* 32 */
- /* 0001 */ PTR(208, 3),
- /* 0010 */ PTR(216, 3),
- /* 0011 */ PTR(224, 3),
- /* 0100 */ PTR(232, 3),
- /* 0101 */ PTR(240, 3),
- /* 0110 */ PTR(248, 3),
- /* 0111 */ PTR(256, 3),
- /* 1000 */ PTR(264, 2),
- /* 1001 */ PTR(268, 2),
- /* 1010 */ PTR(272, 1),
- /* 1011 */ PTR(274, 2),
- /* 1100 */ PTR(278, 2),
- /* 1101 */ PTR(282, 1),
- /* 1110 */ V(5, 1, 4),
- /* 1111 */ PTR(284, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(286, 1), /* 48 */
- /* 0001 */ PTR(288, 1),
- /* 0010 */ PTR(290, 1),
- /* 0011 */ V(1, 4, 4),
- /* 0100 */ V(4, 1, 4),
- /* 0101 */ PTR(292, 1),
- /* 0110 */ V(2, 3, 4),
- /* 0111 */ V(3, 2, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(0, 3, 4),
- /* 1101 */ V(3, 0, 4),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(14, 15, 3), /* 68 */
- /* 001 */ V(15, 14, 3),
- /* 010 */ V(13, 15, 3),
- /* 011 */ V(15, 13, 3),
- /* 100 */ V(12, 15, 3),
- /* 101 */ V(15, 12, 3),
- /* 110 */ V(11, 15, 3),
- /* 111 */ V(15, 11, 3),
-
- /* 0000 0001 ... */
- /* 000 */ V(10, 15, 2), /* 76 */
- /* 001 */ V(10, 15, 2),
- /* 010 */ V(15, 10, 3),
- /* 011 */ V(9, 15, 3),
- /* 100 */ V(15, 9, 3),
- /* 101 */ V(15, 8, 3),
- /* 110 */ V(8, 15, 2),
- /* 111 */ V(8, 15, 2),
-
- /* 0000 0010 ... */
- /* 00 */ V(7, 15, 2), /* 84 */
- /* 01 */ V(15, 7, 2),
- /* 10 */ V(6, 15, 2),
- /* 11 */ V(15, 6, 2),
-
- /* 0000 0100 ... */
- /* 00 */ V(5, 15, 2), /* 88 */
- /* 01 */ V(15, 5, 2),
- /* 10 */ V(4, 15, 1),
- /* 11 */ V(4, 15, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(15, 4, 1), /* 92 */
- /* 1 */ V(15, 3, 1),
-
- /* 0000 0110 ... */
- /* 0000 */ V(15, 0, 1), /* 94 */
- /* 0001 */ V(15, 0, 1),
- /* 0010 */ V(15, 0, 1),
- /* 0011 */ V(15, 0, 1),
- /* 0100 */ V(15, 0, 1),
- /* 0101 */ V(15, 0, 1),
- /* 0110 */ V(15, 0, 1),
- /* 0111 */ V(15, 0, 1),
- /* 1000 */ V(3, 15, 2),
- /* 1001 */ V(3, 15, 2),
- /* 1010 */ V(3, 15, 2),
- /* 1011 */ V(3, 15, 2),
- /* 1100 */ PTR(294, 4),
- /* 1101 */ PTR(310, 3),
- /* 1110 */ PTR(318, 3),
- /* 1111 */ PTR(326, 3),
-
- /* 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 110 */
- /* 1 */ V(0, 15, 1),
-
- /* 0000 1011 ... */
- /* 0000 */ PTR(334, 2), /* 112 */
- /* 0001 */ PTR(338, 2),
- /* 0010 */ PTR(342, 2),
- /* 0011 */ PTR(346, 1),
- /* 0100 */ PTR(348, 2),
- /* 0101 */ PTR(352, 2),
- /* 0110 */ PTR(356, 1),
- /* 0111 */ PTR(358, 2),
- /* 1000 */ PTR(362, 2),
- /* 1001 */ PTR(366, 2),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ V(14, 3, 4),
- /* 1100 */ PTR(374, 1),
- /* 1101 */ PTR(376, 1),
- /* 1110 */ PTR(378, 1),
- /* 1111 */ PTR(380, 1),
-
- /* 0000 1100 ... */
- /* 0000 */ PTR(382, 1), /* 128 */
- /* 0001 */ PTR(384, 1),
- /* 0010 */ PTR(386, 1),
- /* 0011 */ V(0, 13, 4),
- /* 0100 */ PTR(388, 1),
- /* 0101 */ PTR(390, 1),
- /* 0110 */ PTR(392, 1),
- /* 0111 */ V(3, 12, 4),
- /* 1000 */ PTR(394, 1),
- /* 1001 */ V(1, 12, 4),
- /* 1010 */ V(12, 0, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 2, 3),
- /* 1101 */ V(14, 2, 3),
- /* 1110 */ V(2, 14, 4),
- /* 1111 */ V(1, 14, 4),
-
- /* 0000 1101 ... */
- /* 0000 */ V(13, 3, 4), /* 144 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(13, 1, 4),
- /* 0100 */ V(3, 11, 4),
- /* 0101 */ PTR(398, 1),
- /* 0110 */ V(1, 13, 3),
- /* 0111 */ V(1, 13, 3),
- /* 1000 */ V(12, 4, 4),
- /* 1001 */ V(6, 11, 4),
- /* 1010 */ V(12, 3, 4),
- /* 1011 */ V(10, 7, 4),
- /* 1100 */ V(2, 12, 3),
- /* 1101 */ V(2, 12, 3),
- /* 1110 */ V(12, 2, 4),
- /* 1111 */ V(11, 5, 4),
-
- /* 0000 1110 ... */
- /* 0000 */ V(12, 1, 4), /* 160 */
- /* 0001 */ V(0, 12, 4),
- /* 0010 */ V(4, 11, 4),
- /* 0011 */ V(11, 4, 4),
- /* 0100 */ V(6, 10, 4),
- /* 0101 */ V(10, 6, 4),
- /* 0110 */ V(11, 3, 3),
- /* 0111 */ V(11, 3, 3),
- /* 1000 */ V(5, 10, 4),
- /* 1001 */ V(10, 5, 4),
- /* 1010 */ V(2, 11, 3),
- /* 1011 */ V(2, 11, 3),
- /* 1100 */ V(11, 2, 3),
- /* 1101 */ V(11, 2, 3),
- /* 1110 */ V(1, 11, 3),
- /* 1111 */ V(1, 11, 3),
-
- /* 0000 1111 ... */
- /* 0000 */ V(11, 1, 3), /* 176 */
- /* 0001 */ V(11, 1, 3),
- /* 0010 */ V(0, 11, 4),
- /* 0011 */ V(11, 0, 4),
- /* 0100 */ V(6, 9, 4),
- /* 0101 */ V(9, 6, 4),
- /* 0110 */ V(4, 10, 4),
- /* 0111 */ V(10, 4, 4),
- /* 1000 */ V(7, 8, 4),
- /* 1001 */ V(8, 7, 4),
- /* 1010 */ V(10, 3, 3),
- /* 1011 */ V(10, 3, 3),
- /* 1100 */ V(3, 10, 4),
- /* 1101 */ V(5, 9, 4),
- /* 1110 */ V(2, 10, 3),
- /* 1111 */ V(2, 10, 3),
-
- /* 0001 0000 ... */
- /* 0000 */ V(9, 5, 4), /* 192 */
- /* 0001 */ V(6, 8, 4),
- /* 0010 */ V(10, 1, 3),
- /* 0011 */ V(10, 1, 3),
- /* 0100 */ V(8, 6, 4),
- /* 0101 */ V(7, 7, 4),
- /* 0110 */ V(9, 4, 3),
- /* 0111 */ V(9, 4, 3),
- /* 1000 */ V(4, 9, 4),
- /* 1001 */ V(5, 7, 4),
- /* 1010 */ V(6, 7, 3),
- /* 1011 */ V(6, 7, 3),
- /* 1100 */ V(10, 2, 2),
- /* 1101 */ V(10, 2, 2),
- /* 1110 */ V(10, 2, 2),
- /* 1111 */ V(10, 2, 2),
-
- /* 0001 0001 ... */
- /* 000 */ V(1, 10, 2), /* 208 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(0, 10, 3),
- /* 011 */ V(10, 0, 3),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(9, 3, 3),
- /* 110 */ V(5, 8, 3),
- /* 111 */ V(8, 5, 3),
-
- /* 0001 0010 ... */
- /* 000 */ V(2, 9, 2), /* 216 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(7, 6, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(1, 9, 2),
- /* 111 */ V(1, 9, 2),
-
- /* 0001 0011 ... */
- /* 000 */ V(9, 1, 2), /* 224 */
- /* 001 */ V(9, 1, 2),
- /* 010 */ V(9, 0, 3),
- /* 011 */ V(4, 8, 3),
- /* 100 */ V(8, 4, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 3),
- /* 111 */ V(8, 3, 3),
-
- /* 0001 0100 ... */
- /* 000 */ V(6, 6, 3), /* 232 */
- /* 001 */ V(2, 8, 3),
- /* 010 */ V(8, 2, 2),
- /* 011 */ V(8, 2, 2),
- /* 100 */ V(4, 7, 3),
- /* 101 */ V(7, 4, 3),
- /* 110 */ V(1, 8, 2),
- /* 111 */ V(1, 8, 2),
-
- /* 0001 0101 ... */
- /* 000 */ V(8, 1, 2), /* 240 */
- /* 001 */ V(8, 1, 2),
- /* 010 */ V(8, 0, 2),
- /* 011 */ V(8, 0, 2),
- /* 100 */ V(0, 8, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(3, 7, 2),
- /* 111 */ V(3, 7, 2),
-
- /* 0001 0110 ... */
- /* 000 */ V(7, 3, 2), /* 248 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(6, 5, 3),
- /* 011 */ V(4, 6, 3),
- /* 100 */ V(2, 7, 2),
- /* 101 */ V(2, 7, 2),
- /* 110 */ V(7, 2, 2),
- /* 111 */ V(7, 2, 2),
-
- /* 0001 0111 ... */
- /* 000 */ V(6, 4, 3), /* 256 */
- /* 001 */ V(5, 5, 3),
- /* 010 */ V(0, 7, 2),
- /* 011 */ V(0, 7, 2),
- /* 100 */ V(1, 7, 1),
- /* 101 */ V(1, 7, 1),
- /* 110 */ V(1, 7, 1),
- /* 111 */ V(1, 7, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(7, 1, 1), /* 264 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(7, 0, 2),
- /* 11 */ V(3, 6, 2),
-
- /* 0001 1001 ... */
- /* 00 */ V(6, 3, 2), /* 268 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(2, 6, 2),
-
- /* 0001 1010 ... */
- /* 0 */ V(6, 2, 1), /* 272 */
- /* 1 */ V(1, 6, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(6, 1, 1), /* 274 */
- /* 01 */ V(6, 1, 1),
- /* 10 */ V(0, 6, 2),
- /* 11 */ V(6, 0, 2),
-
- /* 0001 1100 ... */
- /* 00 */ V(5, 3, 1), /* 278 */
- /* 01 */ V(5, 3, 1),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0001 1101 ... */
- /* 0 */ V(2, 5, 1), /* 282 */
- /* 1 */ V(5, 2, 1),
-
- /* 0001 1111 ... */
- /* 0 */ V(1, 5, 1), /* 284 */
- /* 1 */ V(0, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(3, 4, 1), /* 286 */
- /* 1 */ V(4, 3, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(5, 0, 1), /* 288 */
- /* 1 */ V(2, 4, 1),
-
- /* 0010 0010 ... */
- /* 0 */ V(4, 2, 1), /* 290 */
- /* 1 */ V(3, 3, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(0, 4, 1), /* 292 */
- /* 1 */ V(4, 0, 1),
-
- /* 0000 0110 1100 ... */
- /* 0000 */ V(12, 14, 4), /* 294 */
- /* 0001 */ PTR(400, 1),
- /* 0010 */ V(13, 14, 3),
- /* 0011 */ V(13, 14, 3),
- /* 0100 */ V(14, 9, 3),
- /* 0101 */ V(14, 9, 3),
- /* 0110 */ V(14, 10, 4),
- /* 0111 */ V(13, 9, 4),
- /* 1000 */ V(14, 14, 2),
- /* 1001 */ V(14, 14, 2),
- /* 1010 */ V(14, 14, 2),
- /* 1011 */ V(14, 14, 2),
- /* 1100 */ V(14, 13, 3),
- /* 1101 */ V(14, 13, 3),
- /* 1110 */ V(14, 11, 3),
- /* 1111 */ V(14, 11, 3),
-
- /* 0000 0110 1101 ... */
- /* 000 */ V(11, 14, 2), /* 310 */
- /* 001 */ V(11, 14, 2),
- /* 010 */ V(12, 13, 2),
- /* 011 */ V(12, 13, 2),
- /* 100 */ V(13, 12, 3),
- /* 101 */ V(13, 11, 3),
- /* 110 */ V(10, 14, 2),
- /* 111 */ V(10, 14, 2),
-
- /* 0000 0110 1110 ... */
- /* 000 */ V(12, 12, 2), /* 318 */
- /* 001 */ V(12, 12, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(13, 10, 3),
- /* 100 */ V(7, 14, 3),
- /* 101 */ V(10, 12, 3),
- /* 110 */ V(12, 10, 2),
- /* 111 */ V(12, 10, 2),
-
- /* 0000 0110 1111 ... */
- /* 000 */ V(12, 9, 3), /* 326 */
- /* 001 */ V(7, 13, 3),
- /* 010 */ V(5, 14, 2),
- /* 011 */ V(5, 14, 2),
- /* 100 */ V(11, 13, 1),
- /* 101 */ V(11, 13, 1),
- /* 110 */ V(11, 13, 1),
- /* 111 */ V(11, 13, 1),
-
- /* 0000 1011 0000 ... */
- /* 00 */ V(9, 14, 1), /* 334 */
- /* 01 */ V(9, 14, 1),
- /* 10 */ V(11, 12, 2),
- /* 11 */ V(12, 11, 2),
-
- /* 0000 1011 0001 ... */
- /* 00 */ V(8, 14, 2), /* 338 */
- /* 01 */ V(14, 8, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(14, 7, 2),
-
- /* 0000 1011 0010 ... */
- /* 00 */ V(11, 11, 2), /* 342 */
- /* 01 */ V(8, 13, 2),
- /* 10 */ V(13, 8, 2),
- /* 11 */ V(6, 14, 2),
-
- /* 0000 1011 0011 ... */
- /* 0 */ V(14, 6, 1), /* 346 */
- /* 1 */ V(9, 12, 1),
-
- /* 0000 1011 0100 ... */
- /* 00 */ V(10, 11, 2), /* 348 */
- /* 01 */ V(11, 10, 2),
- /* 10 */ V(14, 5, 2),
- /* 11 */ V(13, 7, 2),
-
- /* 0000 1011 0101 ... */
- /* 00 */ V(4, 14, 1), /* 352 */
- /* 01 */ V(4, 14, 1),
- /* 10 */ V(14, 4, 2),
- /* 11 */ V(8, 12, 2),
-
- /* 0000 1011 0110 ... */
- /* 0 */ V(12, 8, 1), /* 356 */
- /* 1 */ V(3, 14, 1),
-
- /* 0000 1011 0111 ... */
- /* 00 */ V(6, 13, 1), /* 358 */
- /* 01 */ V(6, 13, 1),
- /* 10 */ V(13, 6, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0000 1011 1000 ... */
- /* 00 */ V(11, 9, 2), /* 362 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 1, 1),
- /* 11 */ V(14, 1, 1),
-
- /* 0000 1011 1001 ... */
- /* 00 */ V(13, 4, 1), /* 366 */
- /* 01 */ V(13, 4, 1),
- /* 10 */ V(11, 8, 2),
- /* 11 */ V(10, 9, 2),
-
- /* 0000 1011 1010 ... */
- /* 00 */ V(7, 11, 1), /* 370 */
- /* 01 */ V(7, 11, 1),
- /* 10 */ V(11, 7, 2),
- /* 11 */ V(13, 0, 2),
-
- /* 0000 1011 1100 ... */
- /* 0 */ V(0, 14, 1), /* 374 */
- /* 1 */ V(14, 0, 1),
-
- /* 0000 1011 1101 ... */
- /* 0 */ V(5, 13, 1), /* 376 */
- /* 1 */ V(13, 5, 1),
-
- /* 0000 1011 1110 ... */
- /* 0 */ V(7, 12, 1), /* 378 */
- /* 1 */ V(12, 7, 1),
-
- /* 0000 1011 1111 ... */
- /* 0 */ V(4, 13, 1), /* 380 */
- /* 1 */ V(8, 11, 1),
-
- /* 0000 1100 0000 ... */
- /* 0 */ V(9, 10, 1), /* 382 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 1100 0001 ... */
- /* 0 */ V(12, 6, 1), /* 384 */
- /* 1 */ V(3, 13, 1),
-
- /* 0000 1100 0010 ... */
- /* 0 */ V(5, 12, 1), /* 386 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 1100 0100 ... */
- /* 0 */ V(8, 10, 1), /* 388 */
- /* 1 */ V(10, 8, 1),
-
- /* 0000 1100 0101 ... */
- /* 0 */ V(9, 9, 1), /* 390 */
- /* 1 */ V(4, 12, 1),
-
- /* 0000 1100 0110 ... */
- /* 0 */ V(11, 6, 1), /* 392 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 1100 1000 ... */
- /* 0 */ V(5, 11, 1), /* 394 */
- /* 1 */ V(8, 9, 1),
-
- /* 0000 1100 1011 ... */
- /* 0 */ V(9, 8, 1), /* 396 */
- /* 1 */ V(7, 9, 1),
-
- /* 0000 1101 0101 ... */
- /* 0 */ V(9, 7, 1), /* 398 */
- /* 1 */ V(8, 8, 1),
-
- /* 0000 0110 1100 0001 ... */
- /* 0 */ V(14, 12, 1), /* 400 */
- /* 1 */ V(13, 13, 1)
+union huffpair const hufftab16[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 3), /* 16 */
+ /* 0001 */ PTR(76, 3),
+ /* 0010 */ PTR(84, 2),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(88, 2),
+ /* 0101 */ PTR(92, 1),
+ /* 0110 */ PTR(94, 4),
+ /* 0111 */ V(15, 2, 4),
+ /* 1000 */ PTR(110, 1),
+ /* 1001 */ V(1, 15, 4),
+ /* 1010 */ V(15, 1, 4),
+ /* 1011 */ PTR(112, 4),
+ /* 1100 */ PTR(128, 4),
+ /* 1101 */ PTR(144, 4),
+ /* 1110 */ PTR(160, 4),
+ /* 1111 */ PTR(176, 4),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(192, 4), /* 32 */
+ /* 0001 */ PTR(208, 3),
+ /* 0010 */ PTR(216, 3),
+ /* 0011 */ PTR(224, 3),
+ /* 0100 */ PTR(232, 3),
+ /* 0101 */ PTR(240, 3),
+ /* 0110 */ PTR(248, 3),
+ /* 0111 */ PTR(256, 3),
+ /* 1000 */ PTR(264, 2),
+ /* 1001 */ PTR(268, 2),
+ /* 1010 */ PTR(272, 1),
+ /* 1011 */ PTR(274, 2),
+ /* 1100 */ PTR(278, 2),
+ /* 1101 */ PTR(282, 1),
+ /* 1110 */ V(5, 1, 4),
+ /* 1111 */ PTR(284, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(286, 1), /* 48 */
+ /* 0001 */ PTR(288, 1),
+ /* 0010 */ PTR(290, 1),
+ /* 0011 */ V(1, 4, 4),
+ /* 0100 */ V(4, 1, 4),
+ /* 0101 */ PTR(292, 1),
+ /* 0110 */ V(2, 3, 4),
+ /* 0111 */ V(3, 2, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(0, 3, 4),
+ /* 1101 */ V(3, 0, 4),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(14, 15, 3), /* 68 */
+ /* 001 */ V(15, 14, 3),
+ /* 010 */ V(13, 15, 3),
+ /* 011 */ V(15, 13, 3),
+ /* 100 */ V(12, 15, 3),
+ /* 101 */ V(15, 12, 3),
+ /* 110 */ V(11, 15, 3),
+ /* 111 */ V(15, 11, 3),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(10, 15, 2), /* 76 */
+ /* 001 */ V(10, 15, 2),
+ /* 010 */ V(15, 10, 3),
+ /* 011 */ V(9, 15, 3),
+ /* 100 */ V(15, 9, 3),
+ /* 101 */ V(15, 8, 3),
+ /* 110 */ V(8, 15, 2),
+ /* 111 */ V(8, 15, 2),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(7, 15, 2), /* 84 */
+ /* 01 */ V(15, 7, 2),
+ /* 10 */ V(6, 15, 2),
+ /* 11 */ V(15, 6, 2),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(5, 15, 2), /* 88 */
+ /* 01 */ V(15, 5, 2),
+ /* 10 */ V(4, 15, 1),
+ /* 11 */ V(4, 15, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(15, 4, 1), /* 92 */
+ /* 1 */ V(15, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0000 */ V(15, 0, 1), /* 94 */
+ /* 0001 */ V(15, 0, 1),
+ /* 0010 */ V(15, 0, 1),
+ /* 0011 */ V(15, 0, 1),
+ /* 0100 */ V(15, 0, 1),
+ /* 0101 */ V(15, 0, 1),
+ /* 0110 */ V(15, 0, 1),
+ /* 0111 */ V(15, 0, 1),
+ /* 1000 */ V(3, 15, 2),
+ /* 1001 */ V(3, 15, 2),
+ /* 1010 */ V(3, 15, 2),
+ /* 1011 */ V(3, 15, 2),
+ /* 1100 */ PTR(294, 4),
+ /* 1101 */ PTR(310, 3),
+ /* 1110 */ PTR(318, 3),
+ /* 1111 */ PTR(326, 3),
+
+ /* 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 110 */
+ /* 1 */ V(0, 15, 1),
+
+ /* 0000 1011 ... */
+ /* 0000 */ PTR(334, 2), /* 112 */
+ /* 0001 */ PTR(338, 2),
+ /* 0010 */ PTR(342, 2),
+ /* 0011 */ PTR(346, 1),
+ /* 0100 */ PTR(348, 2),
+ /* 0101 */ PTR(352, 2),
+ /* 0110 */ PTR(356, 1),
+ /* 0111 */ PTR(358, 2),
+ /* 1000 */ PTR(362, 2),
+ /* 1001 */ PTR(366, 2),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ V(14, 3, 4),
+ /* 1100 */ PTR(374, 1),
+ /* 1101 */ PTR(376, 1),
+ /* 1110 */ PTR(378, 1),
+ /* 1111 */ PTR(380, 1),
+
+ /* 0000 1100 ... */
+ /* 0000 */ PTR(382, 1), /* 128 */
+ /* 0001 */ PTR(384, 1),
+ /* 0010 */ PTR(386, 1),
+ /* 0011 */ V(0, 13, 4),
+ /* 0100 */ PTR(388, 1),
+ /* 0101 */ PTR(390, 1),
+ /* 0110 */ PTR(392, 1),
+ /* 0111 */ V(3, 12, 4),
+ /* 1000 */ PTR(394, 1),
+ /* 1001 */ V(1, 12, 4),
+ /* 1010 */ V(12, 0, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 2, 3),
+ /* 1101 */ V(14, 2, 3),
+ /* 1110 */ V(2, 14, 4),
+ /* 1111 */ V(1, 14, 4),
+
+ /* 0000 1101 ... */
+ /* 0000 */ V(13, 3, 4), /* 144 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(13, 1, 4),
+ /* 0100 */ V(3, 11, 4),
+ /* 0101 */ PTR(398, 1),
+ /* 0110 */ V(1, 13, 3),
+ /* 0111 */ V(1, 13, 3),
+ /* 1000 */ V(12, 4, 4),
+ /* 1001 */ V(6, 11, 4),
+ /* 1010 */ V(12, 3, 4),
+ /* 1011 */ V(10, 7, 4),
+ /* 1100 */ V(2, 12, 3),
+ /* 1101 */ V(2, 12, 3),
+ /* 1110 */ V(12, 2, 4),
+ /* 1111 */ V(11, 5, 4),
+
+ /* 0000 1110 ... */
+ /* 0000 */ V(12, 1, 4), /* 160 */
+ /* 0001 */ V(0, 12, 4),
+ /* 0010 */ V(4, 11, 4),
+ /* 0011 */ V(11, 4, 4),
+ /* 0100 */ V(6, 10, 4),
+ /* 0101 */ V(10, 6, 4),
+ /* 0110 */ V(11, 3, 3),
+ /* 0111 */ V(11, 3, 3),
+ /* 1000 */ V(5, 10, 4),
+ /* 1001 */ V(10, 5, 4),
+ /* 1010 */ V(2, 11, 3),
+ /* 1011 */ V(2, 11, 3),
+ /* 1100 */ V(11, 2, 3),
+ /* 1101 */ V(11, 2, 3),
+ /* 1110 */ V(1, 11, 3),
+ /* 1111 */ V(1, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 0000 */ V(11, 1, 3), /* 176 */
+ /* 0001 */ V(11, 1, 3),
+ /* 0010 */ V(0, 11, 4),
+ /* 0011 */ V(11, 0, 4),
+ /* 0100 */ V(6, 9, 4),
+ /* 0101 */ V(9, 6, 4),
+ /* 0110 */ V(4, 10, 4),
+ /* 0111 */ V(10, 4, 4),
+ /* 1000 */ V(7, 8, 4),
+ /* 1001 */ V(8, 7, 4),
+ /* 1010 */ V(10, 3, 3),
+ /* 1011 */ V(10, 3, 3),
+ /* 1100 */ V(3, 10, 4),
+ /* 1101 */ V(5, 9, 4),
+ /* 1110 */ V(2, 10, 3),
+ /* 1111 */ V(2, 10, 3),
+
+ /* 0001 0000 ... */
+ /* 0000 */ V(9, 5, 4), /* 192 */
+ /* 0001 */ V(6, 8, 4),
+ /* 0010 */ V(10, 1, 3),
+ /* 0011 */ V(10, 1, 3),
+ /* 0100 */ V(8, 6, 4),
+ /* 0101 */ V(7, 7, 4),
+ /* 0110 */ V(9, 4, 3),
+ /* 0111 */ V(9, 4, 3),
+ /* 1000 */ V(4, 9, 4),
+ /* 1001 */ V(5, 7, 4),
+ /* 1010 */ V(6, 7, 3),
+ /* 1011 */ V(6, 7, 3),
+ /* 1100 */ V(10, 2, 2),
+ /* 1101 */ V(10, 2, 2),
+ /* 1110 */ V(10, 2, 2),
+ /* 1111 */ V(10, 2, 2),
+
+ /* 0001 0001 ... */
+ /* 000 */ V(1, 10, 2), /* 208 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(0, 10, 3),
+ /* 011 */ V(10, 0, 3),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(9, 3, 3),
+ /* 110 */ V(5, 8, 3),
+ /* 111 */ V(8, 5, 3),
+
+ /* 0001 0010 ... */
+ /* 000 */ V(2, 9, 2), /* 216 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(7, 6, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(1, 9, 2),
+ /* 111 */ V(1, 9, 2),
+
+ /* 0001 0011 ... */
+ /* 000 */ V(9, 1, 2), /* 224 */
+ /* 001 */ V(9, 1, 2),
+ /* 010 */ V(9, 0, 3),
+ /* 011 */ V(4, 8, 3),
+ /* 100 */ V(8, 4, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 3),
+ /* 111 */ V(8, 3, 3),
+
+ /* 0001 0100 ... */
+ /* 000 */ V(6, 6, 3), /* 232 */
+ /* 001 */ V(2, 8, 3),
+ /* 010 */ V(8, 2, 2),
+ /* 011 */ V(8, 2, 2),
+ /* 100 */ V(4, 7, 3),
+ /* 101 */ V(7, 4, 3),
+ /* 110 */ V(1, 8, 2),
+ /* 111 */ V(1, 8, 2),
+
+ /* 0001 0101 ... */
+ /* 000 */ V(8, 1, 2), /* 240 */
+ /* 001 */ V(8, 1, 2),
+ /* 010 */ V(8, 0, 2),
+ /* 011 */ V(8, 0, 2),
+ /* 100 */ V(0, 8, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(3, 7, 2),
+ /* 111 */ V(3, 7, 2),
+
+ /* 0001 0110 ... */
+ /* 000 */ V(7, 3, 2), /* 248 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(6, 5, 3),
+ /* 011 */ V(4, 6, 3),
+ /* 100 */ V(2, 7, 2),
+ /* 101 */ V(2, 7, 2),
+ /* 110 */ V(7, 2, 2),
+ /* 111 */ V(7, 2, 2),
+
+ /* 0001 0111 ... */
+ /* 000 */ V(6, 4, 3), /* 256 */
+ /* 001 */ V(5, 5, 3),
+ /* 010 */ V(0, 7, 2),
+ /* 011 */ V(0, 7, 2),
+ /* 100 */ V(1, 7, 1),
+ /* 101 */ V(1, 7, 1),
+ /* 110 */ V(1, 7, 1),
+ /* 111 */ V(1, 7, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(7, 1, 1), /* 264 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(7, 0, 2),
+ /* 11 */ V(3, 6, 2),
+
+ /* 0001 1001 ... */
+ /* 00 */ V(6, 3, 2), /* 268 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(2, 6, 2),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(6, 2, 1), /* 272 */
+ /* 1 */ V(1, 6, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(6, 1, 1), /* 274 */
+ /* 01 */ V(6, 1, 1),
+ /* 10 */ V(0, 6, 2),
+ /* 11 */ V(6, 0, 2),
+
+ /* 0001 1100 ... */
+ /* 00 */ V(5, 3, 1), /* 278 */
+ /* 01 */ V(5, 3, 1),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(2, 5, 1), /* 282 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(1, 5, 1), /* 284 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(3, 4, 1), /* 286 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(5, 0, 1), /* 288 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0010 0010 ... */
+ /* 0 */ V(4, 2, 1), /* 290 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(0, 4, 1), /* 292 */
+ /* 1 */ V(4, 0, 1),
+
+ /* 0000 0110 1100 ... */
+ /* 0000 */ V(12, 14, 4), /* 294 */
+ /* 0001 */ PTR(400, 1),
+ /* 0010 */ V(13, 14, 3),
+ /* 0011 */ V(13, 14, 3),
+ /* 0100 */ V(14, 9, 3),
+ /* 0101 */ V(14, 9, 3),
+ /* 0110 */ V(14, 10, 4),
+ /* 0111 */ V(13, 9, 4),
+ /* 1000 */ V(14, 14, 2),
+ /* 1001 */ V(14, 14, 2),
+ /* 1010 */ V(14, 14, 2),
+ /* 1011 */ V(14, 14, 2),
+ /* 1100 */ V(14, 13, 3),
+ /* 1101 */ V(14, 13, 3),
+ /* 1110 */ V(14, 11, 3),
+ /* 1111 */ V(14, 11, 3),
+
+ /* 0000 0110 1101 ... */
+ /* 000 */ V(11, 14, 2), /* 310 */
+ /* 001 */ V(11, 14, 2),
+ /* 010 */ V(12, 13, 2),
+ /* 011 */ V(12, 13, 2),
+ /* 100 */ V(13, 12, 3),
+ /* 101 */ V(13, 11, 3),
+ /* 110 */ V(10, 14, 2),
+ /* 111 */ V(10, 14, 2),
+
+ /* 0000 0110 1110 ... */
+ /* 000 */ V(12, 12, 2), /* 318 */
+ /* 001 */ V(12, 12, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(13, 10, 3),
+ /* 100 */ V(7, 14, 3),
+ /* 101 */ V(10, 12, 3),
+ /* 110 */ V(12, 10, 2),
+ /* 111 */ V(12, 10, 2),
+
+ /* 0000 0110 1111 ... */
+ /* 000 */ V(12, 9, 3), /* 326 */
+ /* 001 */ V(7, 13, 3),
+ /* 010 */ V(5, 14, 2),
+ /* 011 */ V(5, 14, 2),
+ /* 100 */ V(11, 13, 1),
+ /* 101 */ V(11, 13, 1),
+ /* 110 */ V(11, 13, 1),
+ /* 111 */ V(11, 13, 1),
+
+ /* 0000 1011 0000 ... */
+ /* 00 */ V(9, 14, 1), /* 334 */
+ /* 01 */ V(9, 14, 1),
+ /* 10 */ V(11, 12, 2),
+ /* 11 */ V(12, 11, 2),
+
+ /* 0000 1011 0001 ... */
+ /* 00 */ V(8, 14, 2), /* 338 */
+ /* 01 */ V(14, 8, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(14, 7, 2),
+
+ /* 0000 1011 0010 ... */
+ /* 00 */ V(11, 11, 2), /* 342 */
+ /* 01 */ V(8, 13, 2),
+ /* 10 */ V(13, 8, 2),
+ /* 11 */ V(6, 14, 2),
+
+ /* 0000 1011 0011 ... */
+ /* 0 */ V(14, 6, 1), /* 346 */
+ /* 1 */ V(9, 12, 1),
+
+ /* 0000 1011 0100 ... */
+ /* 00 */ V(10, 11, 2), /* 348 */
+ /* 01 */ V(11, 10, 2),
+ /* 10 */ V(14, 5, 2),
+ /* 11 */ V(13, 7, 2),
+
+ /* 0000 1011 0101 ... */
+ /* 00 */ V(4, 14, 1), /* 352 */
+ /* 01 */ V(4, 14, 1),
+ /* 10 */ V(14, 4, 2),
+ /* 11 */ V(8, 12, 2),
+
+ /* 0000 1011 0110 ... */
+ /* 0 */ V(12, 8, 1), /* 356 */
+ /* 1 */ V(3, 14, 1),
+
+ /* 0000 1011 0111 ... */
+ /* 00 */ V(6, 13, 1), /* 358 */
+ /* 01 */ V(6, 13, 1),
+ /* 10 */ V(13, 6, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0000 1011 1000 ... */
+ /* 00 */ V(11, 9, 2), /* 362 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 1, 1),
+ /* 11 */ V(14, 1, 1),
+
+ /* 0000 1011 1001 ... */
+ /* 00 */ V(13, 4, 1), /* 366 */
+ /* 01 */ V(13, 4, 1),
+ /* 10 */ V(11, 8, 2),
+ /* 11 */ V(10, 9, 2),
+
+ /* 0000 1011 1010 ... */
+ /* 00 */ V(7, 11, 1), /* 370 */
+ /* 01 */ V(7, 11, 1),
+ /* 10 */ V(11, 7, 2),
+ /* 11 */ V(13, 0, 2),
+
+ /* 0000 1011 1100 ... */
+ /* 0 */ V(0, 14, 1), /* 374 */
+ /* 1 */ V(14, 0, 1),
+
+ /* 0000 1011 1101 ... */
+ /* 0 */ V(5, 13, 1), /* 376 */
+ /* 1 */ V(13, 5, 1),
+
+ /* 0000 1011 1110 ... */
+ /* 0 */ V(7, 12, 1), /* 378 */
+ /* 1 */ V(12, 7, 1),
+
+ /* 0000 1011 1111 ... */
+ /* 0 */ V(4, 13, 1), /* 380 */
+ /* 1 */ V(8, 11, 1),
+
+ /* 0000 1100 0000 ... */
+ /* 0 */ V(9, 10, 1), /* 382 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 1100 0001 ... */
+ /* 0 */ V(12, 6, 1), /* 384 */
+ /* 1 */ V(3, 13, 1),
+
+ /* 0000 1100 0010 ... */
+ /* 0 */ V(5, 12, 1), /* 386 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 1100 0100 ... */
+ /* 0 */ V(8, 10, 1), /* 388 */
+ /* 1 */ V(10, 8, 1),
+
+ /* 0000 1100 0101 ... */
+ /* 0 */ V(9, 9, 1), /* 390 */
+ /* 1 */ V(4, 12, 1),
+
+ /* 0000 1100 0110 ... */
+ /* 0 */ V(11, 6, 1), /* 392 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 1100 1000 ... */
+ /* 0 */ V(5, 11, 1), /* 394 */
+ /* 1 */ V(8, 9, 1),
+
+ /* 0000 1100 1011 ... */
+ /* 0 */ V(9, 8, 1), /* 396 */
+ /* 1 */ V(7, 9, 1),
+
+ /* 0000 1101 0101 ... */
+ /* 0 */ V(9, 7, 1), /* 398 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0000 0110 1100 0001 ... */
+ /* 0 */ V(14, 12, 1), /* 400 */
+ /* 1 */ V(13, 13, 1)
};
static
-union huffpair const hufftab24[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(64, 4),
- /* 0101 */ PTR(80, 4),
- /* 0110 */ PTR(96, 4),
- /* 0111 */ PTR(112, 4),
- /* 1000 */ PTR(128, 4),
- /* 1001 */ PTR(144, 4),
- /* 1010 */ PTR(160, 3),
- /* 1011 */ PTR(168, 2),
- /* 1100 */ V(1, 1, 4),
- /* 1101 */ V(0, 1, 4),
- /* 1110 */ V(1, 0, 4),
- /* 1111 */ V(0, 0, 4),
-
- /* 0000 ... */
- /* 0000 */ V(14, 15, 4), /* 16 */
- /* 0001 */ V(15, 14, 4),
- /* 0010 */ V(13, 15, 4),
- /* 0011 */ V(15, 13, 4),
- /* 0100 */ V(12, 15, 4),
- /* 0101 */ V(15, 12, 4),
- /* 0110 */ V(11, 15, 4),
- /* 0111 */ V(15, 11, 4),
- /* 1000 */ V(15, 10, 3),
- /* 1001 */ V(15, 10, 3),
- /* 1010 */ V(10, 15, 4),
- /* 1011 */ V(9, 15, 4),
- /* 1100 */ V(15, 9, 3),
- /* 1101 */ V(15, 9, 3),
- /* 1110 */ V(15, 8, 3),
- /* 1111 */ V(15, 8, 3),
-
- /* 0001 ... */
- /* 0000 */ V(8, 15, 4), /* 32 */
- /* 0001 */ V(7, 15, 4),
- /* 0010 */ V(15, 7, 3),
- /* 0011 */ V(15, 7, 3),
- /* 0100 */ V(6, 15, 3),
- /* 0101 */ V(6, 15, 3),
- /* 0110 */ V(15, 6, 3),
- /* 0111 */ V(15, 6, 3),
- /* 1000 */ V(5, 15, 3),
- /* 1001 */ V(5, 15, 3),
- /* 1010 */ V(15, 5, 3),
- /* 1011 */ V(15, 5, 3),
- /* 1100 */ V(4, 15, 3),
- /* 1101 */ V(4, 15, 3),
- /* 1110 */ V(15, 4, 3),
- /* 1111 */ V(15, 4, 3),
-
- /* 0010 ... */
- /* 0000 */ V(3, 15, 3), /* 48 */
- /* 0001 */ V(3, 15, 3),
- /* 0010 */ V(15, 3, 3),
- /* 0011 */ V(15, 3, 3),
- /* 0100 */ V(2, 15, 3),
- /* 0101 */ V(2, 15, 3),
- /* 0110 */ V(15, 2, 3),
- /* 0111 */ V(15, 2, 3),
- /* 1000 */ V(15, 1, 3),
- /* 1001 */ V(15, 1, 3),
- /* 1010 */ V(1, 15, 4),
- /* 1011 */ V(15, 0, 4),
- /* 1100 */ PTR(172, 3),
- /* 1101 */ PTR(180, 3),
- /* 1110 */ PTR(188, 3),
- /* 1111 */ PTR(196, 3),
-
- /* 0100 ... */
- /* 0000 */ PTR(204, 4), /* 64 */
- /* 0001 */ PTR(220, 3),
- /* 0010 */ PTR(228, 3),
- /* 0011 */ PTR(236, 3),
- /* 0100 */ PTR(244, 2),
- /* 0101 */ PTR(248, 2),
- /* 0110 */ PTR(252, 2),
- /* 0111 */ PTR(256, 2),
- /* 1000 */ PTR(260, 2),
- /* 1001 */ PTR(264, 2),
- /* 1010 */ PTR(268, 2),
- /* 1011 */ PTR(272, 2),
- /* 1100 */ PTR(276, 2),
- /* 1101 */ PTR(280, 3),
- /* 1110 */ PTR(288, 2),
- /* 1111 */ PTR(292, 2),
-
- /* 0101 ... */
- /* 0000 */ PTR(296, 2), /* 80 */
- /* 0001 */ PTR(300, 3),
- /* 0010 */ PTR(308, 2),
- /* 0011 */ PTR(312, 3),
- /* 0100 */ PTR(320, 1),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 2),
- /* 0111 */ PTR(330, 1),
- /* 1000 */ PTR(332, 2),
- /* 1001 */ PTR(336, 1),
- /* 1010 */ PTR(338, 1),
- /* 1011 */ PTR(340, 1),
- /* 1100 */ PTR(342, 1),
- /* 1101 */ PTR(344, 1),
- /* 1110 */ PTR(346, 1),
- /* 1111 */ PTR(348, 1),
-
- /* 0110 ... */
- /* 0000 */ PTR(350, 1), /* 96 */
- /* 0001 */ PTR(352, 1),
- /* 0010 */ PTR(354, 1),
- /* 0011 */ PTR(356, 1),
- /* 0100 */ PTR(358, 1),
- /* 0101 */ PTR(360, 1),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ PTR(364, 1),
- /* 1000 */ PTR(366, 1),
- /* 1001 */ PTR(368, 1),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 2),
- /* 1101 */ V(7, 3, 4),
- /* 1110 */ PTR(380, 1),
- /* 1111 */ V(7, 2, 4),
-
- /* 0111 ... */
- /* 0000 */ V(4, 6, 4), /* 112 */
- /* 0001 */ V(6, 4, 4),
- /* 0010 */ V(5, 5, 4),
- /* 0011 */ V(7, 1, 4),
- /* 0100 */ V(3, 6, 4),
- /* 0101 */ V(6, 3, 4),
- /* 0110 */ V(4, 5, 4),
- /* 0111 */ V(5, 4, 4),
- /* 1000 */ V(2, 6, 4),
- /* 1001 */ V(6, 2, 4),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 1, 4),
- /* 1100 */ PTR(382, 1),
- /* 1101 */ V(3, 5, 4),
- /* 1110 */ V(5, 3, 4),
- /* 1111 */ V(4, 4, 4),
-
- /* 1000 ... */
- /* 0000 */ V(2, 5, 4), /* 128 */
- /* 0001 */ V(5, 2, 4),
- /* 0010 */ V(1, 5, 4),
- /* 0011 */ PTR(384, 1),
- /* 0100 */ V(5, 1, 3),
- /* 0101 */ V(5, 1, 3),
- /* 0110 */ V(3, 4, 4),
- /* 0111 */ V(4, 3, 4),
- /* 1000 */ V(2, 4, 3),
- /* 1001 */ V(2, 4, 3),
- /* 1010 */ V(4, 2, 3),
- /* 1011 */ V(4, 2, 3),
- /* 1100 */ V(3, 3, 3),
- /* 1101 */ V(3, 3, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 1001 ... */
- /* 0000 */ V(4, 1, 3), /* 144 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 1010 ... */
- /* 000 */ V(0, 3, 3), /* 160 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(1, 2, 1),
- /* 101 */ V(1, 2, 1),
- /* 110 */ V(1, 2, 1),
- /* 111 */ V(1, 2, 1),
-
- /* 1011 ... */
- /* 00 */ V(2, 1, 1), /* 168 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0010 1100 ... */
- /* 000 */ V(0, 15, 1), /* 172 */
- /* 001 */ V(0, 15, 1),
- /* 010 */ V(0, 15, 1),
- /* 011 */ V(0, 15, 1),
- /* 100 */ V(14, 14, 3),
- /* 101 */ V(13, 14, 3),
- /* 110 */ V(14, 13, 3),
- /* 111 */ V(12, 14, 3),
-
- /* 0010 1101 ... */
- /* 000 */ V(14, 12, 3), /* 180 */
- /* 001 */ V(13, 13, 3),
- /* 010 */ V(11, 14, 3),
- /* 011 */ V(14, 11, 3),
- /* 100 */ V(12, 13, 3),
- /* 101 */ V(13, 12, 3),
- /* 110 */ V(10, 14, 3),
- /* 111 */ V(14, 10, 3),
-
- /* 0010 1110 ... */
- /* 000 */ V(11, 13, 3), /* 188 */
- /* 001 */ V(13, 11, 3),
- /* 010 */ V(12, 12, 3),
- /* 011 */ V(9, 14, 3),
- /* 100 */ V(14, 9, 3),
- /* 101 */ V(10, 13, 3),
- /* 110 */ V(13, 10, 3),
- /* 111 */ V(11, 12, 3),
-
- /* 0010 1111 ... */
- /* 000 */ V(12, 11, 3), /* 196 */
- /* 001 */ V(8, 14, 3),
- /* 010 */ V(14, 8, 3),
- /* 011 */ V(9, 13, 3),
- /* 100 */ V(13, 9, 3),
- /* 101 */ V(7, 14, 3),
- /* 110 */ V(14, 7, 3),
- /* 111 */ V(10, 12, 3),
-
- /* 0100 0000 ... */
- /* 0000 */ V(12, 10, 3), /* 204 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(8, 13, 3),
- /* 0101 */ V(8, 13, 3),
- /* 0110 */ V(13, 8, 3),
- /* 0111 */ V(13, 8, 3),
- /* 1000 */ V(0, 14, 4),
- /* 1001 */ V(14, 0, 4),
- /* 1010 */ V(0, 13, 3),
- /* 1011 */ V(0, 13, 3),
- /* 1100 */ V(14, 6, 2),
- /* 1101 */ V(14, 6, 2),
- /* 1110 */ V(14, 6, 2),
- /* 1111 */ V(14, 6, 2),
-
- /* 0100 0001 ... */
- /* 000 */ V(6, 14, 3), /* 220 */
- /* 001 */ V(9, 12, 3),
- /* 010 */ V(12, 9, 2),
- /* 011 */ V(12, 9, 2),
- /* 100 */ V(5, 14, 2),
- /* 101 */ V(5, 14, 2),
- /* 110 */ V(11, 10, 2),
- /* 111 */ V(11, 10, 2),
-
- /* 0100 0010 ... */
- /* 000 */ V(14, 5, 2), /* 228 */
- /* 001 */ V(14, 5, 2),
- /* 010 */ V(10, 11, 3),
- /* 011 */ V(7, 13, 3),
- /* 100 */ V(13, 7, 2),
- /* 101 */ V(13, 7, 2),
- /* 110 */ V(14, 4, 2),
- /* 111 */ V(14, 4, 2),
-
- /* 0100 0011 ... */
- /* 000 */ V(8, 12, 2), /* 236 */
- /* 001 */ V(8, 12, 2),
- /* 010 */ V(12, 8, 2),
- /* 011 */ V(12, 8, 2),
- /* 100 */ V(4, 14, 3),
- /* 101 */ V(2, 14, 3),
- /* 110 */ V(3, 14, 2),
- /* 111 */ V(3, 14, 2),
-
- /* 0100 0100 ... */
- /* 00 */ V(6, 13, 2), /* 244 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(14, 3, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0100 0101 ... */
- /* 00 */ V(11, 9, 2), /* 248 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 2, 2),
- /* 11 */ V(1, 14, 2),
-
- /* 0100 0110 ... */
- /* 00 */ V(14, 1, 2), /* 252 */
- /* 01 */ V(5, 13, 2),
- /* 10 */ V(13, 5, 2),
- /* 11 */ V(7, 12, 2),
-
- /* 0100 0111 ... */
- /* 00 */ V(12, 7, 2), /* 256 */
- /* 01 */ V(4, 13, 2),
- /* 10 */ V(8, 11, 2),
- /* 11 */ V(11, 8, 2),
-
- /* 0100 1000 ... */
- /* 00 */ V(13, 4, 2), /* 260 */
- /* 01 */ V(9, 10, 2),
- /* 10 */ V(10, 9, 2),
- /* 11 */ V(6, 12, 2),
-
- /* 0100 1001 ... */
- /* 00 */ V(12, 6, 2), /* 264 */
- /* 01 */ V(3, 13, 2),
- /* 10 */ V(13, 3, 2),
- /* 11 */ V(2, 13, 2),
-
- /* 0100 1010 ... */
- /* 00 */ V(13, 2, 2), /* 268 */
- /* 01 */ V(1, 13, 2),
- /* 10 */ V(7, 11, 2),
- /* 11 */ V(11, 7, 2),
-
- /* 0100 1011 ... */
- /* 00 */ V(13, 1, 2), /* 272 */
- /* 01 */ V(5, 12, 2),
- /* 10 */ V(12, 5, 2),
- /* 11 */ V(8, 10, 2),
-
- /* 0100 1100 ... */
- /* 00 */ V(10, 8, 2), /* 276 */
- /* 01 */ V(9, 9, 2),
- /* 10 */ V(4, 12, 2),
- /* 11 */ V(12, 4, 2),
-
- /* 0100 1101 ... */
- /* 000 */ V(6, 11, 2), /* 280 */
- /* 001 */ V(6, 11, 2),
- /* 010 */ V(11, 6, 2),
- /* 011 */ V(11, 6, 2),
- /* 100 */ V(13, 0, 3),
- /* 101 */ V(0, 12, 3),
- /* 110 */ V(3, 12, 2),
- /* 111 */ V(3, 12, 2),
-
- /* 0100 1110 ... */
- /* 00 */ V(12, 3, 2), /* 288 */
- /* 01 */ V(7, 10, 2),
- /* 10 */ V(10, 7, 2),
- /* 11 */ V(2, 12, 2),
-
- /* 0100 1111 ... */
- /* 00 */ V(12, 2, 2), /* 292 */
- /* 01 */ V(5, 11, 2),
- /* 10 */ V(11, 5, 2),
- /* 11 */ V(1, 12, 2),
-
- /* 0101 0000 ... */
- /* 00 */ V(8, 9, 2), /* 296 */
- /* 01 */ V(9, 8, 2),
- /* 10 */ V(12, 1, 2),
- /* 11 */ V(4, 11, 2),
-
- /* 0101 0001 ... */
- /* 000 */ V(12, 0, 3), /* 300 */
- /* 001 */ V(0, 11, 3),
- /* 010 */ V(3, 11, 2),
- /* 011 */ V(3, 11, 2),
- /* 100 */ V(11, 0, 3),
- /* 101 */ V(0, 10, 3),
- /* 110 */ V(1, 10, 2),
- /* 111 */ V(1, 10, 2),
-
- /* 0101 0010 ... */
- /* 00 */ V(11, 4, 1), /* 308 */
- /* 01 */ V(11, 4, 1),
- /* 10 */ V(6, 10, 2),
- /* 11 */ V(10, 6, 2),
-
- /* 0101 0011 ... */
- /* 000 */ V(7, 9, 2), /* 312 */
- /* 001 */ V(7, 9, 2),
- /* 010 */ V(9, 7, 2),
- /* 011 */ V(9, 7, 2),
- /* 100 */ V(10, 0, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(9, 0, 2),
- /* 111 */ V(9, 0, 2),
-
- /* 0101 0100 ... */
- /* 0 */ V(11, 3, 1), /* 320 */
- /* 1 */ V(8, 8, 1),
-
- /* 0101 0101 ... */
- /* 00 */ V(2, 11, 2), /* 322 */
- /* 01 */ V(5, 10, 2),
- /* 10 */ V(11, 2, 1),
- /* 11 */ V(11, 2, 1),
-
- /* 0101 0110 ... */
- /* 00 */ V(10, 5, 2), /* 326 */
- /* 01 */ V(1, 11, 2),
- /* 10 */ V(11, 1, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0101 0111 ... */
- /* 0 */ V(9, 6, 1), /* 330 */
- /* 1 */ V(10, 4, 1),
-
- /* 0101 1000 ... */
- /* 00 */ V(4, 10, 2), /* 332 */
- /* 01 */ V(7, 8, 2),
- /* 10 */ V(8, 7, 1),
- /* 11 */ V(8, 7, 1),
-
- /* 0101 1001 ... */
- /* 0 */ V(3, 10, 1), /* 336 */
- /* 1 */ V(10, 3, 1),
-
- /* 0101 1010 ... */
- /* 0 */ V(5, 9, 1), /* 338 */
- /* 1 */ V(9, 5, 1),
-
- /* 0101 1011 ... */
- /* 0 */ V(2, 10, 1), /* 340 */
- /* 1 */ V(10, 2, 1),
-
- /* 0101 1100 ... */
- /* 0 */ V(10, 1, 1), /* 342 */
- /* 1 */ V(6, 8, 1),
-
- /* 0101 1101 ... */
- /* 0 */ V(8, 6, 1), /* 344 */
- /* 1 */ V(7, 7, 1),
-
- /* 0101 1110 ... */
- /* 0 */ V(4, 9, 1), /* 346 */
- /* 1 */ V(9, 4, 1),
-
- /* 0101 1111 ... */
- /* 0 */ V(3, 9, 1), /* 348 */
- /* 1 */ V(9, 3, 1),
-
- /* 0110 0000 ... */
- /* 0 */ V(5, 8, 1), /* 350 */
- /* 1 */ V(8, 5, 1),
-
- /* 0110 0001 ... */
- /* 0 */ V(2, 9, 1), /* 352 */
- /* 1 */ V(6, 7, 1),
-
- /* 0110 0010 ... */
- /* 0 */ V(7, 6, 1), /* 354 */
- /* 1 */ V(9, 2, 1),
-
- /* 0110 0011 ... */
- /* 0 */ V(1, 9, 1), /* 356 */
- /* 1 */ V(9, 1, 1),
-
- /* 0110 0100 ... */
- /* 0 */ V(4, 8, 1), /* 358 */
- /* 1 */ V(8, 4, 1),
-
- /* 0110 0101 ... */
- /* 0 */ V(5, 7, 1), /* 360 */
- /* 1 */ V(7, 5, 1),
-
- /* 0110 0110 ... */
- /* 0 */ V(3, 8, 1), /* 362 */
- /* 1 */ V(8, 3, 1),
-
- /* 0110 0111 ... */
- /* 0 */ V(6, 6, 1), /* 364 */
- /* 1 */ V(2, 8, 1),
-
- /* 0110 1000 ... */
- /* 0 */ V(8, 2, 1), /* 366 */
- /* 1 */ V(1, 8, 1),
-
- /* 0110 1001 ... */
- /* 0 */ V(4, 7, 1), /* 368 */
- /* 1 */ V(7, 4, 1),
-
- /* 0110 1010 ... */
- /* 00 */ V(8, 1, 1), /* 370 */
- /* 01 */ V(8, 1, 1),
- /* 10 */ V(0, 8, 2),
- /* 11 */ V(8, 0, 2),
-
- /* 0110 1011 ... */
- /* 0 */ V(5, 6, 1), /* 374 */
- /* 1 */ V(6, 5, 1),
-
- /* 0110 1100 ... */
- /* 00 */ V(1, 7, 1), /* 376 */
- /* 01 */ V(1, 7, 1),
- /* 10 */ V(0, 7, 2),
- /* 11 */ V(7, 0, 2),
-
- /* 0110 1110 ... */
- /* 0 */ V(3, 7, 1), /* 380 */
- /* 1 */ V(2, 7, 1),
-
- /* 0111 1100 ... */
- /* 0 */ V(0, 6, 1), /* 382 */
- /* 1 */ V(6, 0, 1),
-
- /* 1000 0011 ... */
- /* 0 */ V(0, 5, 1), /* 384 */
- /* 1 */ V(5, 0, 1)
+union huffpair const hufftab24[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(64, 4),
+ /* 0101 */ PTR(80, 4),
+ /* 0110 */ PTR(96, 4),
+ /* 0111 */ PTR(112, 4),
+ /* 1000 */ PTR(128, 4),
+ /* 1001 */ PTR(144, 4),
+ /* 1010 */ PTR(160, 3),
+ /* 1011 */ PTR(168, 2),
+ /* 1100 */ V(1, 1, 4),
+ /* 1101 */ V(0, 1, 4),
+ /* 1110 */ V(1, 0, 4),
+ /* 1111 */ V(0, 0, 4),
+
+ /* 0000 ... */
+ /* 0000 */ V(14, 15, 4), /* 16 */
+ /* 0001 */ V(15, 14, 4),
+ /* 0010 */ V(13, 15, 4),
+ /* 0011 */ V(15, 13, 4),
+ /* 0100 */ V(12, 15, 4),
+ /* 0101 */ V(15, 12, 4),
+ /* 0110 */ V(11, 15, 4),
+ /* 0111 */ V(15, 11, 4),
+ /* 1000 */ V(15, 10, 3),
+ /* 1001 */ V(15, 10, 3),
+ /* 1010 */ V(10, 15, 4),
+ /* 1011 */ V(9, 15, 4),
+ /* 1100 */ V(15, 9, 3),
+ /* 1101 */ V(15, 9, 3),
+ /* 1110 */ V(15, 8, 3),
+ /* 1111 */ V(15, 8, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(8, 15, 4), /* 32 */
+ /* 0001 */ V(7, 15, 4),
+ /* 0010 */ V(15, 7, 3),
+ /* 0011 */ V(15, 7, 3),
+ /* 0100 */ V(6, 15, 3),
+ /* 0101 */ V(6, 15, 3),
+ /* 0110 */ V(15, 6, 3),
+ /* 0111 */ V(15, 6, 3),
+ /* 1000 */ V(5, 15, 3),
+ /* 1001 */ V(5, 15, 3),
+ /* 1010 */ V(15, 5, 3),
+ /* 1011 */ V(15, 5, 3),
+ /* 1100 */ V(4, 15, 3),
+ /* 1101 */ V(4, 15, 3),
+ /* 1110 */ V(15, 4, 3),
+ /* 1111 */ V(15, 4, 3),
+
+ /* 0010 ... */
+ /* 0000 */ V(3, 15, 3), /* 48 */
+ /* 0001 */ V(3, 15, 3),
+ /* 0010 */ V(15, 3, 3),
+ /* 0011 */ V(15, 3, 3),
+ /* 0100 */ V(2, 15, 3),
+ /* 0101 */ V(2, 15, 3),
+ /* 0110 */ V(15, 2, 3),
+ /* 0111 */ V(15, 2, 3),
+ /* 1000 */ V(15, 1, 3),
+ /* 1001 */ V(15, 1, 3),
+ /* 1010 */ V(1, 15, 4),
+ /* 1011 */ V(15, 0, 4),
+ /* 1100 */ PTR(172, 3),
+ /* 1101 */ PTR(180, 3),
+ /* 1110 */ PTR(188, 3),
+ /* 1111 */ PTR(196, 3),
+
+ /* 0100 ... */
+ /* 0000 */ PTR(204, 4), /* 64 */
+ /* 0001 */ PTR(220, 3),
+ /* 0010 */ PTR(228, 3),
+ /* 0011 */ PTR(236, 3),
+ /* 0100 */ PTR(244, 2),
+ /* 0101 */ PTR(248, 2),
+ /* 0110 */ PTR(252, 2),
+ /* 0111 */ PTR(256, 2),
+ /* 1000 */ PTR(260, 2),
+ /* 1001 */ PTR(264, 2),
+ /* 1010 */ PTR(268, 2),
+ /* 1011 */ PTR(272, 2),
+ /* 1100 */ PTR(276, 2),
+ /* 1101 */ PTR(280, 3),
+ /* 1110 */ PTR(288, 2),
+ /* 1111 */ PTR(292, 2),
+
+ /* 0101 ... */
+ /* 0000 */ PTR(296, 2), /* 80 */
+ /* 0001 */ PTR(300, 3),
+ /* 0010 */ PTR(308, 2),
+ /* 0011 */ PTR(312, 3),
+ /* 0100 */ PTR(320, 1),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 2),
+ /* 0111 */ PTR(330, 1),
+ /* 1000 */ PTR(332, 2),
+ /* 1001 */ PTR(336, 1),
+ /* 1010 */ PTR(338, 1),
+ /* 1011 */ PTR(340, 1),
+ /* 1100 */ PTR(342, 1),
+ /* 1101 */ PTR(344, 1),
+ /* 1110 */ PTR(346, 1),
+ /* 1111 */ PTR(348, 1),
+
+ /* 0110 ... */
+ /* 0000 */ PTR(350, 1), /* 96 */
+ /* 0001 */ PTR(352, 1),
+ /* 0010 */ PTR(354, 1),
+ /* 0011 */ PTR(356, 1),
+ /* 0100 */ PTR(358, 1),
+ /* 0101 */ PTR(360, 1),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ PTR(364, 1),
+ /* 1000 */ PTR(366, 1),
+ /* 1001 */ PTR(368, 1),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 2),
+ /* 1101 */ V(7, 3, 4),
+ /* 1110 */ PTR(380, 1),
+ /* 1111 */ V(7, 2, 4),
+
+ /* 0111 ... */
+ /* 0000 */ V(4, 6, 4), /* 112 */
+ /* 0001 */ V(6, 4, 4),
+ /* 0010 */ V(5, 5, 4),
+ /* 0011 */ V(7, 1, 4),
+ /* 0100 */ V(3, 6, 4),
+ /* 0101 */ V(6, 3, 4),
+ /* 0110 */ V(4, 5, 4),
+ /* 0111 */ V(5, 4, 4),
+ /* 1000 */ V(2, 6, 4),
+ /* 1001 */ V(6, 2, 4),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 1, 4),
+ /* 1100 */ PTR(382, 1),
+ /* 1101 */ V(3, 5, 4),
+ /* 1110 */ V(5, 3, 4),
+ /* 1111 */ V(4, 4, 4),
+
+ /* 1000 ... */
+ /* 0000 */ V(2, 5, 4), /* 128 */
+ /* 0001 */ V(5, 2, 4),
+ /* 0010 */ V(1, 5, 4),
+ /* 0011 */ PTR(384, 1),
+ /* 0100 */ V(5, 1, 3),
+ /* 0101 */ V(5, 1, 3),
+ /* 0110 */ V(3, 4, 4),
+ /* 0111 */ V(4, 3, 4),
+ /* 1000 */ V(2, 4, 3),
+ /* 1001 */ V(2, 4, 3),
+ /* 1010 */ V(4, 2, 3),
+ /* 1011 */ V(4, 2, 3),
+ /* 1100 */ V(3, 3, 3),
+ /* 1101 */ V(3, 3, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 1001 ... */
+ /* 0000 */ V(4, 1, 3), /* 144 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 1010 ... */
+ /* 000 */ V(0, 3, 3), /* 160 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(1, 2, 1),
+ /* 101 */ V(1, 2, 1),
+ /* 110 */ V(1, 2, 1),
+ /* 111 */ V(1, 2, 1),
+
+ /* 1011 ... */
+ /* 00 */ V(2, 1, 1), /* 168 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0010 1100 ... */
+ /* 000 */ V(0, 15, 1), /* 172 */
+ /* 001 */ V(0, 15, 1),
+ /* 010 */ V(0, 15, 1),
+ /* 011 */ V(0, 15, 1),
+ /* 100 */ V(14, 14, 3),
+ /* 101 */ V(13, 14, 3),
+ /* 110 */ V(14, 13, 3),
+ /* 111 */ V(12, 14, 3),
+
+ /* 0010 1101 ... */
+ /* 000 */ V(14, 12, 3), /* 180 */
+ /* 001 */ V(13, 13, 3),
+ /* 010 */ V(11, 14, 3),
+ /* 011 */ V(14, 11, 3),
+ /* 100 */ V(12, 13, 3),
+ /* 101 */ V(13, 12, 3),
+ /* 110 */ V(10, 14, 3),
+ /* 111 */ V(14, 10, 3),
+
+ /* 0010 1110 ... */
+ /* 000 */ V(11, 13, 3), /* 188 */
+ /* 001 */ V(13, 11, 3),
+ /* 010 */ V(12, 12, 3),
+ /* 011 */ V(9, 14, 3),
+ /* 100 */ V(14, 9, 3),
+ /* 101 */ V(10, 13, 3),
+ /* 110 */ V(13, 10, 3),
+ /* 111 */ V(11, 12, 3),
+
+ /* 0010 1111 ... */
+ /* 000 */ V(12, 11, 3), /* 196 */
+ /* 001 */ V(8, 14, 3),
+ /* 010 */ V(14, 8, 3),
+ /* 011 */ V(9, 13, 3),
+ /* 100 */ V(13, 9, 3),
+ /* 101 */ V(7, 14, 3),
+ /* 110 */ V(14, 7, 3),
+ /* 111 */ V(10, 12, 3),
+
+ /* 0100 0000 ... */
+ /* 0000 */ V(12, 10, 3), /* 204 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(8, 13, 3),
+ /* 0101 */ V(8, 13, 3),
+ /* 0110 */ V(13, 8, 3),
+ /* 0111 */ V(13, 8, 3),
+ /* 1000 */ V(0, 14, 4),
+ /* 1001 */ V(14, 0, 4),
+ /* 1010 */ V(0, 13, 3),
+ /* 1011 */ V(0, 13, 3),
+ /* 1100 */ V(14, 6, 2),
+ /* 1101 */ V(14, 6, 2),
+ /* 1110 */ V(14, 6, 2),
+ /* 1111 */ V(14, 6, 2),
+
+ /* 0100 0001 ... */
+ /* 000 */ V(6, 14, 3), /* 220 */
+ /* 001 */ V(9, 12, 3),
+ /* 010 */ V(12, 9, 2),
+ /* 011 */ V(12, 9, 2),
+ /* 100 */ V(5, 14, 2),
+ /* 101 */ V(5, 14, 2),
+ /* 110 */ V(11, 10, 2),
+ /* 111 */ V(11, 10, 2),
+
+ /* 0100 0010 ... */
+ /* 000 */ V(14, 5, 2), /* 228 */
+ /* 001 */ V(14, 5, 2),
+ /* 010 */ V(10, 11, 3),
+ /* 011 */ V(7, 13, 3),
+ /* 100 */ V(13, 7, 2),
+ /* 101 */ V(13, 7, 2),
+ /* 110 */ V(14, 4, 2),
+ /* 111 */ V(14, 4, 2),
+
+ /* 0100 0011 ... */
+ /* 000 */ V(8, 12, 2), /* 236 */
+ /* 001 */ V(8, 12, 2),
+ /* 010 */ V(12, 8, 2),
+ /* 011 */ V(12, 8, 2),
+ /* 100 */ V(4, 14, 3),
+ /* 101 */ V(2, 14, 3),
+ /* 110 */ V(3, 14, 2),
+ /* 111 */ V(3, 14, 2),
+
+ /* 0100 0100 ... */
+ /* 00 */ V(6, 13, 2), /* 244 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(14, 3, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0100 0101 ... */
+ /* 00 */ V(11, 9, 2), /* 248 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 2, 2),
+ /* 11 */ V(1, 14, 2),
+
+ /* 0100 0110 ... */
+ /* 00 */ V(14, 1, 2), /* 252 */
+ /* 01 */ V(5, 13, 2),
+ /* 10 */ V(13, 5, 2),
+ /* 11 */ V(7, 12, 2),
+
+ /* 0100 0111 ... */
+ /* 00 */ V(12, 7, 2), /* 256 */
+ /* 01 */ V(4, 13, 2),
+ /* 10 */ V(8, 11, 2),
+ /* 11 */ V(11, 8, 2),
+
+ /* 0100 1000 ... */
+ /* 00 */ V(13, 4, 2), /* 260 */
+ /* 01 */ V(9, 10, 2),
+ /* 10 */ V(10, 9, 2),
+ /* 11 */ V(6, 12, 2),
+
+ /* 0100 1001 ... */
+ /* 00 */ V(12, 6, 2), /* 264 */
+ /* 01 */ V(3, 13, 2),
+ /* 10 */ V(13, 3, 2),
+ /* 11 */ V(2, 13, 2),
+
+ /* 0100 1010 ... */
+ /* 00 */ V(13, 2, 2), /* 268 */
+ /* 01 */ V(1, 13, 2),
+ /* 10 */ V(7, 11, 2),
+ /* 11 */ V(11, 7, 2),
+
+ /* 0100 1011 ... */
+ /* 00 */ V(13, 1, 2), /* 272 */
+ /* 01 */ V(5, 12, 2),
+ /* 10 */ V(12, 5, 2),
+ /* 11 */ V(8, 10, 2),
+
+ /* 0100 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 276 */
+ /* 01 */ V(9, 9, 2),
+ /* 10 */ V(4, 12, 2),
+ /* 11 */ V(12, 4, 2),
+
+ /* 0100 1101 ... */
+ /* 000 */ V(6, 11, 2), /* 280 */
+ /* 001 */ V(6, 11, 2),
+ /* 010 */ V(11, 6, 2),
+ /* 011 */ V(11, 6, 2),
+ /* 100 */ V(13, 0, 3),
+ /* 101 */ V(0, 12, 3),
+ /* 110 */ V(3, 12, 2),
+ /* 111 */ V(3, 12, 2),
+
+ /* 0100 1110 ... */
+ /* 00 */ V(12, 3, 2), /* 288 */
+ /* 01 */ V(7, 10, 2),
+ /* 10 */ V(10, 7, 2),
+ /* 11 */ V(2, 12, 2),
+
+ /* 0100 1111 ... */
+ /* 00 */ V(12, 2, 2), /* 292 */
+ /* 01 */ V(5, 11, 2),
+ /* 10 */ V(11, 5, 2),
+ /* 11 */ V(1, 12, 2),
+
+ /* 0101 0000 ... */
+ /* 00 */ V(8, 9, 2), /* 296 */
+ /* 01 */ V(9, 8, 2),
+ /* 10 */ V(12, 1, 2),
+ /* 11 */ V(4, 11, 2),
+
+ /* 0101 0001 ... */
+ /* 000 */ V(12, 0, 3), /* 300 */
+ /* 001 */ V(0, 11, 3),
+ /* 010 */ V(3, 11, 2),
+ /* 011 */ V(3, 11, 2),
+ /* 100 */ V(11, 0, 3),
+ /* 101 */ V(0, 10, 3),
+ /* 110 */ V(1, 10, 2),
+ /* 111 */ V(1, 10, 2),
+
+ /* 0101 0010 ... */
+ /* 00 */ V(11, 4, 1), /* 308 */
+ /* 01 */ V(11, 4, 1),
+ /* 10 */ V(6, 10, 2),
+ /* 11 */ V(10, 6, 2),
+
+ /* 0101 0011 ... */
+ /* 000 */ V(7, 9, 2), /* 312 */
+ /* 001 */ V(7, 9, 2),
+ /* 010 */ V(9, 7, 2),
+ /* 011 */ V(9, 7, 2),
+ /* 100 */ V(10, 0, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(9, 0, 2),
+ /* 111 */ V(9, 0, 2),
+
+ /* 0101 0100 ... */
+ /* 0 */ V(11, 3, 1), /* 320 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0101 0101 ... */
+ /* 00 */ V(2, 11, 2), /* 322 */
+ /* 01 */ V(5, 10, 2),
+ /* 10 */ V(11, 2, 1),
+ /* 11 */ V(11, 2, 1),
+
+ /* 0101 0110 ... */
+ /* 00 */ V(10, 5, 2), /* 326 */
+ /* 01 */ V(1, 11, 2),
+ /* 10 */ V(11, 1, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0101 0111 ... */
+ /* 0 */ V(9, 6, 1), /* 330 */
+ /* 1 */ V(10, 4, 1),
+
+ /* 0101 1000 ... */
+ /* 00 */ V(4, 10, 2), /* 332 */
+ /* 01 */ V(7, 8, 2),
+ /* 10 */ V(8, 7, 1),
+ /* 11 */ V(8, 7, 1),
+
+ /* 0101 1001 ... */
+ /* 0 */ V(3, 10, 1), /* 336 */
+ /* 1 */ V(10, 3, 1),
+
+ /* 0101 1010 ... */
+ /* 0 */ V(5, 9, 1), /* 338 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0101 1011 ... */
+ /* 0 */ V(2, 10, 1), /* 340 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0101 1100 ... */
+ /* 0 */ V(10, 1, 1), /* 342 */
+ /* 1 */ V(6, 8, 1),
+
+ /* 0101 1101 ... */
+ /* 0 */ V(8, 6, 1), /* 344 */
+ /* 1 */ V(7, 7, 1),
+
+ /* 0101 1110 ... */
+ /* 0 */ V(4, 9, 1), /* 346 */
+ /* 1 */ V(9, 4, 1),
+
+ /* 0101 1111 ... */
+ /* 0 */ V(3, 9, 1), /* 348 */
+ /* 1 */ V(9, 3, 1),
+
+ /* 0110 0000 ... */
+ /* 0 */ V(5, 8, 1), /* 350 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0110 0001 ... */
+ /* 0 */ V(2, 9, 1), /* 352 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0110 0010 ... */
+ /* 0 */ V(7, 6, 1), /* 354 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0110 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 356 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0110 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 358 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0110 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 360 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0110 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 362 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0110 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 364 */
+ /* 1 */ V(2, 8, 1),
+
+ /* 0110 1000 ... */
+ /* 0 */ V(8, 2, 1), /* 366 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0110 1001 ... */
+ /* 0 */ V(4, 7, 1), /* 368 */
+ /* 1 */ V(7, 4, 1),
+
+ /* 0110 1010 ... */
+ /* 00 */ V(8, 1, 1), /* 370 */
+ /* 01 */ V(8, 1, 1),
+ /* 10 */ V(0, 8, 2),
+ /* 11 */ V(8, 0, 2),
+
+ /* 0110 1011 ... */
+ /* 0 */ V(5, 6, 1), /* 374 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0110 1100 ... */
+ /* 00 */ V(1, 7, 1), /* 376 */
+ /* 01 */ V(1, 7, 1),
+ /* 10 */ V(0, 7, 2),
+ /* 11 */ V(7, 0, 2),
+
+ /* 0110 1110 ... */
+ /* 0 */ V(3, 7, 1), /* 380 */
+ /* 1 */ V(2, 7, 1),
+
+ /* 0111 1100 ... */
+ /* 0 */ V(0, 6, 1), /* 382 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 1000 0011 ... */
+ /* 0 */ V(0, 5, 1), /* 384 */
+ /* 1 */ V(5, 0, 1)
};
# undef V
@@ -3091,38 +3072,37 @@ union huffpair const hufftab24[] =
union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB };
-struct hufftable const mad_huff_pair_table[32] =
-{
- /* 0 */ { hufftab0, 0, 0 },
- /* 1 */ { hufftab1, 0, 3 },
- /* 2 */ { hufftab2, 0, 3 },
- /* 3 */ { hufftab3, 0, 3 },
- /* 4 */ { 0 /* not used */ },
- /* 5 */ { hufftab5, 0, 3 },
- /* 6 */ { hufftab6, 0, 4 },
- /* 7 */ { hufftab7, 0, 4 },
- /* 8 */ { hufftab8, 0, 4 },
- /* 9 */ { hufftab9, 0, 4 },
- /* 10 */ { hufftab10, 0, 4 },
- /* 11 */ { hufftab11, 0, 4 },
- /* 12 */ { hufftab12, 0, 4 },
- /* 13 */ { hufftab13, 0, 4 },
- /* 14 */ { 0 /* not used */ },
- /* 15 */ { hufftab15, 0, 4 },
- /* 16 */ { hufftab16, 1, 4 },
- /* 17 */ { hufftab16, 2, 4 },
- /* 18 */ { hufftab16, 3, 4 },
- /* 19 */ { hufftab16, 4, 4 },
- /* 20 */ { hufftab16, 6, 4 },
- /* 21 */ { hufftab16, 8, 4 },
- /* 22 */ { hufftab16, 10, 4 },
- /* 23 */ { hufftab16, 13, 4 },
- /* 24 */ { hufftab24, 4, 4 },
- /* 25 */ { hufftab24, 5, 4 },
- /* 26 */ { hufftab24, 6, 4 },
- /* 27 */ { hufftab24, 7, 4 },
- /* 28 */ { hufftab24, 8, 4 },
- /* 29 */ { hufftab24, 9, 4 },
- /* 30 */ { hufftab24, 11, 4 },
- /* 31 */ { hufftab24, 13, 4 }
+struct hufftable const mad_huff_pair_table[32] = {
+ /* 0 */ { hufftab0, 0, 0 },
+ /* 1 */ { hufftab1, 0, 3 },
+ /* 2 */ { hufftab2, 0, 3 },
+ /* 3 */ { hufftab3, 0, 3 },
+ /* 4 */ { 0 /* not used */ },
+ /* 5 */ { hufftab5, 0, 3 },
+ /* 6 */ { hufftab6, 0, 4 },
+ /* 7 */ { hufftab7, 0, 4 },
+ /* 8 */ { hufftab8, 0, 4 },
+ /* 9 */ { hufftab9, 0, 4 },
+ /* 10 */ { hufftab10, 0, 4 },
+ /* 11 */ { hufftab11, 0, 4 },
+ /* 12 */ { hufftab12, 0, 4 },
+ /* 13 */ { hufftab13, 0, 4 },
+ /* 14 */ { 0 /* not used */ },
+ /* 15 */ { hufftab15, 0, 4 },
+ /* 16 */ { hufftab16, 1, 4 },
+ /* 17 */ { hufftab16, 2, 4 },
+ /* 18 */ { hufftab16, 3, 4 },
+ /* 19 */ { hufftab16, 4, 4 },
+ /* 20 */ { hufftab16, 6, 4 },
+ /* 21 */ { hufftab16, 8, 4 },
+ /* 22 */ { hufftab16, 10, 4 },
+ /* 23 */ { hufftab16, 13, 4 },
+ /* 24 */ { hufftab24, 4, 4 },
+ /* 25 */ { hufftab24, 5, 4 },
+ /* 26 */ { hufftab24, 6, 4 },
+ /* 27 */ { hufftab24, 7, 4 },
+ /* 28 */ { hufftab24, 8, 4 },
+ /* 29 */ { hufftab24, 9, 4 },
+ /* 30 */ { hufftab24, 11, 4 },
+ /* 31 */ { hufftab24, 13, 4 }
};
diff --git a/src/filters/transform/MpaDecFilter/libmad/huffman.h b/src/filters/transform/MpaDecFilter/libmad/huffman.h
index 374642f9f..1f98420e3 100644
--- a/src/filters/transform/MpaDecFilter/libmad/huffman.h
+++ b/src/filters/transform/MpaDecFilter/libmad/huffman.h
@@ -21,49 +21,42 @@
# ifndef LIBMAD_HUFFMAN_H
# define LIBMAD_HUFFMAN_H
-union huffquad
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short v : 1;
- unsigned short w : 1;
- unsigned short x : 1;
- unsigned short y : 1;
- } value;
- unsigned short final : 1;
+union huffquad {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short v : 1;
+ unsigned short w : 1;
+ unsigned short x : 1;
+ unsigned short y : 1;
+ } value;
+ unsigned short final : 1;
};
-union huffpair
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short x : 4;
- unsigned short y : 4;
- } value;
- unsigned short final : 1;
+union huffpair {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short x : 4;
+ unsigned short y : 4;
+ } value;
+ unsigned short final : 1;
};
-struct hufftable
-{
- union huffpair const *table;
- unsigned short linbits;
- unsigned short startbits;
+struct hufftable {
+ union huffpair const *table;
+ unsigned short linbits;
+ unsigned short startbits;
};
extern union huffquad const *const mad_huff_quad_table[2];
diff --git a/src/filters/transform/MpaDecFilter/libmad/hufftab.c b/src/filters/transform/MpaDecFilter/libmad/hufftab.c
index 433f92b20..3f0f12c12 100644
--- a/src/filters/transform/MpaDecFilter/libmad/hufftab.c
+++ b/src/filters/transform/MpaDecFilter/libmad/hufftab.c
@@ -44,65 +44,63 @@
# endif
static
-union huffquad const hufftabA[] =
-{
- /* 0000 */ PTR(16, 2),
- /* 0001 */ PTR(20, 2),
- /* 0010 */ PTR(24, 1),
- /* 0011 */ PTR(26, 1),
- /* 0100 */ V(0, 0, 1, 0, 4),
- /* 0101 */ V(0, 0, 0, 1, 4),
- /* 0110 */ V(0, 1, 0, 0, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 0, 0, 0, 1),
- /* 1001 */ V(0, 0, 0, 0, 1),
- /* 1010 */ V(0, 0, 0, 0, 1),
- /* 1011 */ V(0, 0, 0, 0, 1),
- /* 1100 */ V(0, 0, 0, 0, 1),
- /* 1101 */ V(0, 0, 0, 0, 1),
- /* 1110 */ V(0, 0, 0, 0, 1),
- /* 1111 */ V(0, 0, 0, 0, 1),
-
- /* 0000 ... */
- /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
- /* 01 */ V(1, 1, 1, 1, 2),
- /* 10 */ V(1, 1, 0, 1, 2),
- /* 11 */ V(1, 1, 1, 0, 2),
-
- /* 0001 ... */
- /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
- /* 01 */ V(0, 1, 0, 1, 2),
- /* 10 */ V(1, 0, 0, 1, 1),
- /* 11 */ V(1, 0, 0, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
- /* 1 */ V(0, 0, 1, 1, 1),
-
- /* 0011 ... */
- /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
- /* 1 */ V(1, 1, 0, 0, 1)
+union huffquad const hufftabA[] = {
+ /* 0000 */ PTR(16, 2),
+ /* 0001 */ PTR(20, 2),
+ /* 0010 */ PTR(24, 1),
+ /* 0011 */ PTR(26, 1),
+ /* 0100 */ V(0, 0, 1, 0, 4),
+ /* 0101 */ V(0, 0, 0, 1, 4),
+ /* 0110 */ V(0, 1, 0, 0, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 0, 0, 0, 1),
+ /* 1001 */ V(0, 0, 0, 0, 1),
+ /* 1010 */ V(0, 0, 0, 0, 1),
+ /* 1011 */ V(0, 0, 0, 0, 1),
+ /* 1100 */ V(0, 0, 0, 0, 1),
+ /* 1101 */ V(0, 0, 0, 0, 1),
+ /* 1110 */ V(0, 0, 0, 0, 1),
+ /* 1111 */ V(0, 0, 0, 0, 1),
+
+ /* 0000 ... */
+ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
+ /* 01 */ V(1, 1, 1, 1, 2),
+ /* 10 */ V(1, 1, 0, 1, 2),
+ /* 11 */ V(1, 1, 1, 0, 2),
+
+ /* 0001 ... */
+ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
+ /* 01 */ V(0, 1, 0, 1, 2),
+ /* 10 */ V(1, 0, 0, 1, 1),
+ /* 11 */ V(1, 0, 0, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
+ /* 1 */ V(0, 0, 1, 1, 1),
+
+ /* 0011 ... */
+ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
+ /* 1 */ V(1, 1, 0, 0, 1)
};
static
-union huffquad const hufftabB[] =
-{
- /* 0000 */ V(1, 1, 1, 1, 4),
- /* 0001 */ V(1, 1, 1, 0, 4),
- /* 0010 */ V(1, 1, 0, 1, 4),
- /* 0011 */ V(1, 1, 0, 0, 4),
- /* 0100 */ V(1, 0, 1, 1, 4),
- /* 0101 */ V(1, 0, 1, 0, 4),
- /* 0110 */ V(1, 0, 0, 1, 4),
- /* 0111 */ V(1, 0, 0, 0, 4),
- /* 1000 */ V(0, 1, 1, 1, 4),
- /* 1001 */ V(0, 1, 1, 0, 4),
- /* 1010 */ V(0, 1, 0, 1, 4),
- /* 1011 */ V(0, 1, 0, 0, 4),
- /* 1100 */ V(0, 0, 1, 1, 4),
- /* 1101 */ V(0, 0, 1, 0, 4),
- /* 1110 */ V(0, 0, 0, 1, 4),
- /* 1111 */ V(0, 0, 0, 0, 4)
+union huffquad const hufftabB[] = {
+ /* 0000 */ V(1, 1, 1, 1, 4),
+ /* 0001 */ V(1, 1, 1, 0, 4),
+ /* 0010 */ V(1, 1, 0, 1, 4),
+ /* 0011 */ V(1, 1, 0, 0, 4),
+ /* 0100 */ V(1, 0, 1, 1, 4),
+ /* 0101 */ V(1, 0, 1, 0, 4),
+ /* 0110 */ V(1, 0, 0, 1, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 1, 1, 1, 4),
+ /* 1001 */ V(0, 1, 1, 0, 4),
+ /* 1010 */ V(0, 1, 0, 1, 4),
+ /* 1011 */ V(0, 1, 0, 0, 4),
+ /* 1100 */ V(0, 0, 1, 1, 4),
+ /* 1101 */ V(0, 0, 1, 0, 4),
+ /* 1110 */ V(0, 0, 0, 1, 4),
+ /* 1111 */ V(0, 0, 0, 0, 4)
};
# undef V
@@ -117,2961 +115,2944 @@ union huffquad const hufftabB[] =
# endif
static
-union huffpair const hufftab0[] =
-{
- /* */ V(0, 0, 0)
+union huffpair const hufftab0[] = {
+ /* */ V(0, 0, 0)
};
static
-union huffpair const hufftab1[] =
-{
- /* 000 */ V(1, 1, 3),
- /* 001 */ V(0, 1, 3),
- /* 010 */ V(1, 0, 2),
- /* 011 */ V(1, 0, 2),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1)
+union huffpair const hufftab1[] = {
+ /* 000 */ V(1, 1, 3),
+ /* 001 */ V(0, 1, 3),
+ /* 010 */ V(1, 0, 2),
+ /* 011 */ V(1, 0, 2),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1)
};
static
-union huffpair const hufftab2[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab2[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab3[] =
-{
- /* 000 */ PTR(8, 3),
- /* 001 */ V(1, 0, 3),
- /* 010 */ V(1, 1, 2),
- /* 011 */ V(1, 1, 2),
- /* 100 */ V(0, 1, 2),
- /* 101 */ V(0, 1, 2),
- /* 110 */ V(0, 0, 2),
- /* 111 */ V(0, 0, 2),
-
- /* 000 ... */
- /* 000 */ V(2, 2, 3), /* 8 */
- /* 001 */ V(0, 2, 3),
- /* 010 */ V(1, 2, 2),
- /* 011 */ V(1, 2, 2),
- /* 100 */ V(2, 1, 2),
- /* 101 */ V(2, 1, 2),
- /* 110 */ V(2, 0, 2),
- /* 111 */ V(2, 0, 2)
+union huffpair const hufftab3[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 0, 3),
+ /* 010 */ V(1, 1, 2),
+ /* 011 */ V(1, 1, 2),
+ /* 100 */ V(0, 1, 2),
+ /* 101 */ V(0, 1, 2),
+ /* 110 */ V(0, 0, 2),
+ /* 111 */ V(0, 0, 2),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
};
static
-union huffpair const hufftab5[] =
-{
- /* 000 */ PTR(8, 4),
- /* 001 */ V(1, 1, 3),
- /* 010 */ V(0, 1, 3),
- /* 011 */ V(1, 0, 3),
- /* 100 */ V(0, 0, 1),
- /* 101 */ V(0, 0, 1),
- /* 110 */ V(0, 0, 1),
- /* 111 */ V(0, 0, 1),
-
- /* 000 ... */
- /* 0000 */ PTR(24, 1), /* 8 */
- /* 0001 */ V(3, 2, 4),
- /* 0010 */ V(3, 1, 3),
- /* 0011 */ V(3, 1, 3),
- /* 0100 */ V(1, 3, 4),
- /* 0101 */ V(0, 3, 4),
- /* 0110 */ V(3, 0, 4),
- /* 0111 */ V(2, 2, 4),
- /* 1000 */ V(1, 2, 3),
- /* 1001 */ V(1, 2, 3),
- /* 1010 */ V(2, 1, 3),
- /* 1011 */ V(2, 1, 3),
- /* 1100 */ V(0, 2, 3),
- /* 1101 */ V(0, 2, 3),
- /* 1110 */ V(2, 0, 3),
- /* 1111 */ V(2, 0, 3),
-
- /* 000 0000 ... */
- /* 0 */ V(3, 3, 1), /* 24 */
- /* 1 */ V(2, 3, 1)
+union huffpair const hufftab5[] = {
+ /* 000 */ PTR(8, 4),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 0000 */ PTR(24, 1), /* 8 */
+ /* 0001 */ V(3, 2, 4),
+ /* 0010 */ V(3, 1, 3),
+ /* 0011 */ V(3, 1, 3),
+ /* 0100 */ V(1, 3, 4),
+ /* 0101 */ V(0, 3, 4),
+ /* 0110 */ V(3, 0, 4),
+ /* 0111 */ V(2, 2, 4),
+ /* 1000 */ V(1, 2, 3),
+ /* 1001 */ V(1, 2, 3),
+ /* 1010 */ V(2, 1, 3),
+ /* 1011 */ V(2, 1, 3),
+ /* 1100 */ V(0, 2, 3),
+ /* 1101 */ V(0, 2, 3),
+ /* 1110 */ V(2, 0, 3),
+ /* 1111 */ V(2, 0, 3),
+
+ /* 000 0000 ... */
+ /* 0 */ V(3, 3, 1), /* 24 */
+ /* 1 */ V(2, 3, 1)
};
static
-union huffpair const hufftab6[] =
-{
- /* 0000 */ PTR(16, 3),
- /* 0001 */ PTR(24, 1),
- /* 0010 */ PTR(26, 1),
- /* 0011 */ V(1, 2, 4),
- /* 0100 */ V(2, 1, 4),
- /* 0101 */ V(2, 0, 4),
- /* 0110 */ V(0, 1, 3),
- /* 0111 */ V(0, 1, 3),
- /* 1000 */ V(1, 1, 2),
- /* 1001 */ V(1, 1, 2),
- /* 1010 */ V(1, 1, 2),
- /* 1011 */ V(1, 1, 2),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 000 */ V(3, 3, 3), /* 16 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(2, 3, 2),
- /* 011 */ V(2, 3, 2),
- /* 100 */ V(3, 2, 2),
- /* 101 */ V(3, 2, 2),
- /* 110 */ V(3, 0, 2),
- /* 111 */ V(3, 0, 2),
-
- /* 0001 ... */
- /* 0 */ V(1, 3, 1), /* 24 */
- /* 1 */ V(3, 1, 1),
-
- /* 0010 ... */
- /* 0 */ V(2, 2, 1), /* 26 */
- /* 1 */ V(0, 2, 1)
+union huffpair const hufftab6[] = {
+ /* 0000 */ PTR(16, 3),
+ /* 0001 */ PTR(24, 1),
+ /* 0010 */ PTR(26, 1),
+ /* 0011 */ V(1, 2, 4),
+ /* 0100 */ V(2, 1, 4),
+ /* 0101 */ V(2, 0, 4),
+ /* 0110 */ V(0, 1, 3),
+ /* 0111 */ V(0, 1, 3),
+ /* 1000 */ V(1, 1, 2),
+ /* 1001 */ V(1, 1, 2),
+ /* 1010 */ V(1, 1, 2),
+ /* 1011 */ V(1, 1, 2),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 000 */ V(3, 3, 3), /* 16 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(2, 3, 2),
+ /* 011 */ V(2, 3, 2),
+ /* 100 */ V(3, 2, 2),
+ /* 101 */ V(3, 2, 2),
+ /* 110 */ V(3, 0, 2),
+ /* 111 */ V(3, 0, 2),
+
+ /* 0001 ... */
+ /* 0 */ V(1, 3, 1), /* 24 */
+ /* 1 */ V(3, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(2, 2, 1), /* 26 */
+ /* 1 */ V(0, 2, 1)
};
static
-union huffpair const hufftab7[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 2), /* 16 */
- /* 0001 */ PTR(56, 1),
- /* 0010 */ PTR(58, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(60, 1),
- /* 0110 */ V(5, 0, 4),
- /* 0111 */ PTR(62, 1),
- /* 1000 */ V(2, 4, 4),
- /* 1001 */ V(4, 2, 4),
- /* 1010 */ V(1, 4, 3),
- /* 1011 */ V(1, 4, 3),
- /* 1100 */ V(4, 1, 3),
- /* 1101 */ V(4, 1, 3),
- /* 1110 */ V(4, 0, 3),
- /* 1111 */ V(4, 0, 3),
-
- /* 0001 ... */
- /* 0000 */ V(0, 4, 4), /* 32 */
- /* 0001 */ V(2, 3, 4),
- /* 0010 */ V(3, 2, 4),
- /* 0011 */ V(0, 3, 4),
- /* 0100 */ V(1, 3, 3),
- /* 0101 */ V(1, 3, 3),
- /* 0110 */ V(3, 1, 3),
- /* 0111 */ V(3, 1, 3),
- /* 1000 */ V(3, 0, 3),
- /* 1001 */ V(3, 0, 3),
- /* 1010 */ V(2, 2, 3),
- /* 1011 */ V(2, 2, 3),
- /* 1100 */ V(1, 2, 2),
- /* 1101 */ V(1, 2, 2),
- /* 1110 */ V(1, 2, 2),
- /* 1111 */ V(1, 2, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 1, 1), /* 48 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 00 */ V(5, 5, 2), /* 52 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0001 ... */
- /* 0 */ V(3, 5, 1), /* 56 */
- /* 1 */ V(4, 4, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(2, 5, 1), /* 58 */
- /* 1 */ V(5, 2, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(0, 5, 1), /* 60 */
- /* 1 */ V(3, 4, 1),
-
- /* 0000 0111 ... */
- /* 0 */ V(4, 3, 1), /* 62 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab7[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 2), /* 16 */
+ /* 0001 */ PTR(56, 1),
+ /* 0010 */ PTR(58, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(60, 1),
+ /* 0110 */ V(5, 0, 4),
+ /* 0111 */ PTR(62, 1),
+ /* 1000 */ V(2, 4, 4),
+ /* 1001 */ V(4, 2, 4),
+ /* 1010 */ V(1, 4, 3),
+ /* 1011 */ V(1, 4, 3),
+ /* 1100 */ V(4, 1, 3),
+ /* 1101 */ V(4, 1, 3),
+ /* 1110 */ V(4, 0, 3),
+ /* 1111 */ V(4, 0, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(0, 4, 4), /* 32 */
+ /* 0001 */ V(2, 3, 4),
+ /* 0010 */ V(3, 2, 4),
+ /* 0011 */ V(0, 3, 4),
+ /* 0100 */ V(1, 3, 3),
+ /* 0101 */ V(1, 3, 3),
+ /* 0110 */ V(3, 1, 3),
+ /* 0111 */ V(3, 1, 3),
+ /* 1000 */ V(3, 0, 3),
+ /* 1001 */ V(3, 0, 3),
+ /* 1010 */ V(2, 2, 3),
+ /* 1011 */ V(2, 2, 3),
+ /* 1100 */ V(1, 2, 2),
+ /* 1101 */ V(1, 2, 2),
+ /* 1110 */ V(1, 2, 2),
+ /* 1111 */ V(1, 2, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 1, 1), /* 48 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(5, 5, 2), /* 52 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(3, 5, 1), /* 56 */
+ /* 1 */ V(4, 4, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(2, 5, 1), /* 58 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(0, 5, 1), /* 60 */
+ /* 1 */ V(3, 4, 1),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(4, 3, 1), /* 62 */
+ /* 1 */ V(3, 3, 1)
};
# if 0
/* this version saves 8 entries (16 bytes) at the expense of
an extra lookup in 4 out of 36 cases */
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 2),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(36, 3), /* 16 */
- /* 0001 */ PTR(44, 2),
- /* 0010 */ PTR(48, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(50, 1),
- /* 0110 */ PTR(52, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 00 */ PTR(54, 2), /* 32 */
- /* 01 */ V(2, 2, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 36 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 44 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 48 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 50 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 52 */
- /* 1 */ V(3, 3, 1),
-
- /* 0001 00 ... */
- /* 00 */ V(1, 3, 2), /* 54 */
- /* 01 */ V(3, 1, 2),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 2),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(36, 3), /* 16 */
+ /* 0001 */ PTR(44, 2),
+ /* 0010 */ PTR(48, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(50, 1),
+ /* 0110 */ PTR(52, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 00 */ PTR(54, 2), /* 32 */
+ /* 01 */ V(2, 2, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 36 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 44 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 48 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 50 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 52 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0001 00 ... */
+ /* 00 */ V(1, 3, 2), /* 54 */
+ /* 01 */ V(3, 1, 2),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
};
# else
static
-union huffpair const hufftab8[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ V(1, 2, 4),
- /* 0011 */ V(2, 1, 4),
- /* 0100 */ V(1, 1, 2),
- /* 0101 */ V(1, 1, 2),
- /* 0110 */ V(1, 1, 2),
- /* 0111 */ V(1, 1, 2),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(48, 3), /* 16 */
- /* 0001 */ PTR(56, 2),
- /* 0010 */ PTR(60, 1),
- /* 0011 */ V(1, 5, 4),
- /* 0100 */ V(5, 1, 4),
- /* 0101 */ PTR(62, 1),
- /* 0110 */ PTR(64, 1),
- /* 0111 */ V(2, 4, 4),
- /* 1000 */ V(4, 2, 4),
- /* 1001 */ V(1, 4, 4),
- /* 1010 */ V(4, 1, 3),
- /* 1011 */ V(4, 1, 3),
- /* 1100 */ V(0, 4, 4),
- /* 1101 */ V(4, 0, 4),
- /* 1110 */ V(2, 3, 4),
- /* 1111 */ V(3, 2, 4),
-
- /* 0001 ... */
- /* 0000 */ V(1, 3, 4), /* 32 */
- /* 0001 */ V(3, 1, 4),
- /* 0010 */ V(0, 3, 4),
- /* 0011 */ V(3, 0, 4),
- /* 0100 */ V(2, 2, 2),
- /* 0101 */ V(2, 2, 2),
- /* 0110 */ V(2, 2, 2),
- /* 0111 */ V(2, 2, 2),
- /* 1000 */ V(0, 2, 2),
- /* 1001 */ V(0, 2, 2),
- /* 1010 */ V(0, 2, 2),
- /* 1011 */ V(0, 2, 2),
- /* 1100 */ V(2, 0, 2),
- /* 1101 */ V(2, 0, 2),
- /* 1110 */ V(2, 0, 2),
- /* 1111 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(5, 5, 3), /* 48 */
- /* 001 */ V(5, 4, 3),
- /* 010 */ V(4, 5, 2),
- /* 011 */ V(4, 5, 2),
- /* 100 */ V(5, 3, 1),
- /* 101 */ V(5, 3, 1),
- /* 110 */ V(5, 3, 1),
- /* 111 */ V(5, 3, 1),
-
- /* 0000 0001 ... */
- /* 00 */ V(3, 5, 2), /* 56 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(5, 2, 1), /* 60 */
- /* 1 */ V(0, 5, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(3, 4, 1), /* 62 */
- /* 1 */ V(4, 3, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(5, 0, 1), /* 64 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(48, 3), /* 16 */
+ /* 0001 */ PTR(56, 2),
+ /* 0010 */ PTR(60, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(62, 1),
+ /* 0110 */ PTR(64, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(1, 3, 4), /* 32 */
+ /* 0001 */ V(3, 1, 4),
+ /* 0010 */ V(0, 3, 4),
+ /* 0011 */ V(3, 0, 4),
+ /* 0100 */ V(2, 2, 2),
+ /* 0101 */ V(2, 2, 2),
+ /* 0110 */ V(2, 2, 2),
+ /* 0111 */ V(2, 2, 2),
+ /* 1000 */ V(0, 2, 2),
+ /* 1001 */ V(0, 2, 2),
+ /* 1010 */ V(0, 2, 2),
+ /* 1011 */ V(0, 2, 2),
+ /* 1100 */ V(2, 0, 2),
+ /* 1101 */ V(2, 0, 2),
+ /* 1110 */ V(2, 0, 2),
+ /* 1111 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 48 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 56 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 60 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 62 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 64 */
+ /* 1 */ V(3, 3, 1)
};
# endif
static
-union huffpair const hufftab9[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 3),
- /* 0010 */ PTR(40, 2),
- /* 0011 */ PTR(44, 2),
- /* 0100 */ PTR(48, 1),
- /* 0101 */ V(1, 2, 4),
- /* 0110 */ V(2, 1, 4),
- /* 0111 */ V(2, 0, 4),
- /* 1000 */ V(1, 1, 3),
- /* 1001 */ V(1, 1, 3),
- /* 1010 */ V(0, 1, 3),
- /* 1011 */ V(0, 1, 3),
- /* 1100 */ V(1, 0, 3),
- /* 1101 */ V(1, 0, 3),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(50, 1), /* 16 */
- /* 0001 */ V(3, 5, 4),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ PTR(52, 1),
- /* 0100 */ V(4, 4, 4),
- /* 0101 */ V(2, 5, 4),
- /* 0110 */ V(5, 2, 4),
- /* 0111 */ V(1, 5, 4),
- /* 1000 */ V(5, 1, 3),
- /* 1001 */ V(5, 1, 3),
- /* 1010 */ V(3, 4, 3),
- /* 1011 */ V(3, 4, 3),
- /* 1100 */ V(4, 3, 3),
- /* 1101 */ V(4, 3, 3),
- /* 1110 */ V(5, 0, 4),
- /* 1111 */ V(0, 4, 4),
-
- /* 0001 ... */
- /* 000 */ V(2, 4, 3), /* 32 */
- /* 001 */ V(4, 2, 3),
- /* 010 */ V(3, 3, 3),
- /* 011 */ V(4, 0, 3),
- /* 100 */ V(1, 4, 2),
- /* 101 */ V(1, 4, 2),
- /* 110 */ V(4, 1, 2),
- /* 111 */ V(4, 1, 2),
-
- /* 0010 ... */
- /* 00 */ V(2, 3, 2), /* 40 */
- /* 01 */ V(3, 2, 2),
- /* 10 */ V(1, 3, 1),
- /* 11 */ V(1, 3, 1),
-
- /* 0011 ... */
- /* 00 */ V(3, 1, 1), /* 44 */
- /* 01 */ V(3, 1, 1),
- /* 10 */ V(0, 3, 2),
- /* 11 */ V(3, 0, 2),
-
- /* 0100 ... */
- /* 0 */ V(2, 2, 1), /* 48 */
- /* 1 */ V(0, 2, 1),
-
- /* 0000 0000 ... */
- /* 0 */ V(5, 5, 1), /* 50 */
- /* 1 */ V(4, 5, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(5, 4, 1), /* 52 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab9[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 3),
+ /* 0010 */ PTR(40, 2),
+ /* 0011 */ PTR(44, 2),
+ /* 0100 */ PTR(48, 1),
+ /* 0101 */ V(1, 2, 4),
+ /* 0110 */ V(2, 1, 4),
+ /* 0111 */ V(2, 0, 4),
+ /* 1000 */ V(1, 1, 3),
+ /* 1001 */ V(1, 1, 3),
+ /* 1010 */ V(0, 1, 3),
+ /* 1011 */ V(0, 1, 3),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(50, 1), /* 16 */
+ /* 0001 */ V(3, 5, 4),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ PTR(52, 1),
+ /* 0100 */ V(4, 4, 4),
+ /* 0101 */ V(2, 5, 4),
+ /* 0110 */ V(5, 2, 4),
+ /* 0111 */ V(1, 5, 4),
+ /* 1000 */ V(5, 1, 3),
+ /* 1001 */ V(5, 1, 3),
+ /* 1010 */ V(3, 4, 3),
+ /* 1011 */ V(3, 4, 3),
+ /* 1100 */ V(4, 3, 3),
+ /* 1101 */ V(4, 3, 3),
+ /* 1110 */ V(5, 0, 4),
+ /* 1111 */ V(0, 4, 4),
+
+ /* 0001 ... */
+ /* 000 */ V(2, 4, 3), /* 32 */
+ /* 001 */ V(4, 2, 3),
+ /* 010 */ V(3, 3, 3),
+ /* 011 */ V(4, 0, 3),
+ /* 100 */ V(1, 4, 2),
+ /* 101 */ V(1, 4, 2),
+ /* 110 */ V(4, 1, 2),
+ /* 111 */ V(4, 1, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 3, 2), /* 40 */
+ /* 01 */ V(3, 2, 2),
+ /* 10 */ V(1, 3, 1),
+ /* 11 */ V(1, 3, 1),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 1, 1), /* 44 */
+ /* 01 */ V(3, 1, 1),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+
+ /* 0100 ... */
+ /* 0 */ V(2, 2, 1), /* 48 */
+ /* 1 */ V(0, 2, 1),
+
+ /* 0000 0000 ... */
+ /* 0 */ V(5, 5, 1), /* 50 */
+ /* 1 */ V(4, 5, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(5, 4, 1), /* 52 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab10[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 2),
- /* 0011 */ V(1, 1, 4),
- /* 0100 */ V(0, 1, 3),
- /* 0101 */ V(0, 1, 3),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(52, 3), /* 16 */
- /* 0001 */ PTR(60, 2),
- /* 0010 */ PTR(64, 3),
- /* 0011 */ PTR(72, 1),
- /* 0100 */ PTR(74, 2),
- /* 0101 */ PTR(78, 2),
- /* 0110 */ PTR(82, 2),
- /* 0111 */ V(1, 7, 4),
- /* 1000 */ V(7, 1, 4),
- /* 1001 */ PTR(86, 1),
- /* 1010 */ PTR(88, 2),
- /* 1011 */ PTR(92, 2),
- /* 1100 */ V(1, 6, 4),
- /* 1101 */ V(6, 1, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(96, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(98, 1), /* 32 */
- /* 0001 */ PTR(100, 1),
- /* 0010 */ V(1, 4, 4),
- /* 0011 */ V(4, 1, 4),
- /* 0100 */ V(4, 0, 4),
- /* 0101 */ V(2, 3, 4),
- /* 0110 */ V(3, 2, 4),
- /* 0111 */ V(0, 3, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0010 ... */
- /* 00 */ V(1, 2, 2), /* 48 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(7, 7, 3), /* 52 */
- /* 001 */ V(6, 7, 3),
- /* 010 */ V(7, 6, 3),
- /* 011 */ V(5, 7, 3),
- /* 100 */ V(7, 5, 3),
- /* 101 */ V(6, 6, 3),
- /* 110 */ V(4, 7, 2),
- /* 111 */ V(4, 7, 2),
-
- /* 0000 0001 ... */
- /* 00 */ V(7, 4, 2), /* 60 */
- /* 01 */ V(5, 6, 2),
- /* 10 */ V(6, 5, 2),
- /* 11 */ V(3, 7, 2),
-
- /* 0000 0010 ... */
- /* 000 */ V(7, 3, 2), /* 64 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(4, 6, 2),
- /* 011 */ V(4, 6, 2),
- /* 100 */ V(5, 5, 3),
- /* 101 */ V(5, 4, 3),
- /* 110 */ V(6, 3, 2),
- /* 111 */ V(6, 3, 2),
-
- /* 0000 0011 ... */
- /* 0 */ V(2, 7, 1), /* 72 */
- /* 1 */ V(7, 2, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(6, 4, 2), /* 74 */
- /* 01 */ V(0, 7, 2),
- /* 10 */ V(7, 0, 1),
- /* 11 */ V(7, 0, 1),
-
- /* 0000 0101 ... */
- /* 00 */ V(6, 2, 1), /* 78 */
- /* 01 */ V(6, 2, 1),
- /* 10 */ V(4, 5, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0000 0110 ... */
- /* 00 */ V(0, 6, 1), /* 82 */
- /* 01 */ V(0, 6, 1),
- /* 10 */ V(5, 3, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0000 1001 ... */
- /* 0 */ V(3, 6, 1), /* 86 */
- /* 1 */ V(2, 6, 1),
-
- /* 0000 1010 ... */
- /* 00 */ V(2, 5, 2), /* 88 */
- /* 01 */ V(5, 2, 2),
- /* 10 */ V(1, 5, 1),
- /* 11 */ V(1, 5, 1),
-
- /* 0000 1011 ... */
- /* 00 */ V(5, 1, 1), /* 92 */
- /* 01 */ V(5, 1, 1),
- /* 10 */ V(3, 4, 2),
- /* 11 */ V(4, 3, 2),
-
- /* 0000 1111 ... */
- /* 0 */ V(0, 5, 1), /* 96 */
- /* 1 */ V(5, 0, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(2, 4, 1), /* 98 */
- /* 1 */ V(4, 2, 1),
-
- /* 0001 0001 ... */
- /* 0 */ V(3, 3, 1), /* 100 */
- /* 1 */ V(0, 4, 1)
+union huffpair const hufftab10[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 3), /* 16 */
+ /* 0001 */ PTR(60, 2),
+ /* 0010 */ PTR(64, 3),
+ /* 0011 */ PTR(72, 1),
+ /* 0100 */ PTR(74, 2),
+ /* 0101 */ PTR(78, 2),
+ /* 0110 */ PTR(82, 2),
+ /* 0111 */ V(1, 7, 4),
+ /* 1000 */ V(7, 1, 4),
+ /* 1001 */ PTR(86, 1),
+ /* 1010 */ PTR(88, 2),
+ /* 1011 */ PTR(92, 2),
+ /* 1100 */ V(1, 6, 4),
+ /* 1101 */ V(6, 1, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(96, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(98, 1), /* 32 */
+ /* 0001 */ PTR(100, 1),
+ /* 0010 */ V(1, 4, 4),
+ /* 0011 */ V(4, 1, 4),
+ /* 0100 */ V(4, 0, 4),
+ /* 0101 */ V(2, 3, 4),
+ /* 0110 */ V(3, 2, 4),
+ /* 0111 */ V(0, 3, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0010 ... */
+ /* 00 */ V(1, 2, 2), /* 48 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(7, 7, 3), /* 52 */
+ /* 001 */ V(6, 7, 3),
+ /* 010 */ V(7, 6, 3),
+ /* 011 */ V(5, 7, 3),
+ /* 100 */ V(7, 5, 3),
+ /* 101 */ V(6, 6, 3),
+ /* 110 */ V(4, 7, 2),
+ /* 111 */ V(4, 7, 2),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(7, 4, 2), /* 60 */
+ /* 01 */ V(5, 6, 2),
+ /* 10 */ V(6, 5, 2),
+ /* 11 */ V(3, 7, 2),
+
+ /* 0000 0010 ... */
+ /* 000 */ V(7, 3, 2), /* 64 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(4, 6, 2),
+ /* 011 */ V(4, 6, 2),
+ /* 100 */ V(5, 5, 3),
+ /* 101 */ V(5, 4, 3),
+ /* 110 */ V(6, 3, 2),
+ /* 111 */ V(6, 3, 2),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(2, 7, 1), /* 72 */
+ /* 1 */ V(7, 2, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(6, 4, 2), /* 74 */
+ /* 01 */ V(0, 7, 2),
+ /* 10 */ V(7, 0, 1),
+ /* 11 */ V(7, 0, 1),
+
+ /* 0000 0101 ... */
+ /* 00 */ V(6, 2, 1), /* 78 */
+ /* 01 */ V(6, 2, 1),
+ /* 10 */ V(4, 5, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0000 0110 ... */
+ /* 00 */ V(0, 6, 1), /* 82 */
+ /* 01 */ V(0, 6, 1),
+ /* 10 */ V(5, 3, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0000 1001 ... */
+ /* 0 */ V(3, 6, 1), /* 86 */
+ /* 1 */ V(2, 6, 1),
+
+ /* 0000 1010 ... */
+ /* 00 */ V(2, 5, 2), /* 88 */
+ /* 01 */ V(5, 2, 2),
+ /* 10 */ V(1, 5, 1),
+ /* 11 */ V(1, 5, 1),
+
+ /* 0000 1011 ... */
+ /* 00 */ V(5, 1, 1), /* 92 */
+ /* 01 */ V(5, 1, 1),
+ /* 10 */ V(3, 4, 2),
+ /* 11 */ V(4, 3, 2),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(0, 5, 1), /* 96 */
+ /* 1 */ V(5, 0, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(2, 4, 1), /* 98 */
+ /* 1 */ V(4, 2, 1),
+
+ /* 0001 0001 ... */
+ /* 0 */ V(3, 3, 1), /* 100 */
+ /* 1 */ V(0, 4, 1)
};
static
-union huffpair const hufftab11[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 3),
- /* 0100 */ V(1, 2, 4),
- /* 0101 */ PTR(72, 1),
- /* 0110 */ V(1, 1, 3),
- /* 0111 */ V(1, 1, 3),
- /* 1000 */ V(0, 1, 3),
- /* 1001 */ V(0, 1, 3),
- /* 1010 */ V(1, 0, 3),
- /* 1011 */ V(1, 0, 3),
- /* 1100 */ V(0, 0, 2),
- /* 1101 */ V(0, 0, 2),
- /* 1110 */ V(0, 0, 2),
- /* 1111 */ V(0, 0, 2),
-
- /* 0000 ... */
- /* 0000 */ PTR(74, 2), /* 16 */
- /* 0001 */ PTR(78, 3),
- /* 0010 */ PTR(86, 2),
- /* 0011 */ PTR(90, 1),
- /* 0100 */ PTR(92, 2),
- /* 0101 */ V(2, 7, 4),
- /* 0110 */ V(7, 2, 4),
- /* 0111 */ PTR(96, 1),
- /* 1000 */ V(7, 1, 3),
- /* 1001 */ V(7, 1, 3),
- /* 1010 */ V(1, 7, 4),
- /* 1011 */ V(7, 0, 4),
- /* 1100 */ V(3, 6, 4),
- /* 1101 */ V(6, 3, 4),
- /* 1110 */ V(6, 0, 4),
- /* 1111 */ PTR(98, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(100, 1), /* 32 */
- /* 0001 */ V(1, 5, 4),
- /* 0010 */ V(6, 2, 3),
- /* 0011 */ V(6, 2, 3),
- /* 0100 */ V(2, 6, 4),
- /* 0101 */ V(0, 6, 4),
- /* 0110 */ V(1, 6, 3),
- /* 0111 */ V(1, 6, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(5, 1, 4),
- /* 1011 */ V(3, 4, 4),
- /* 1100 */ V(5, 0, 4),
- /* 1101 */ PTR(102, 1),
- /* 1110 */ V(2, 4, 4),
- /* 1111 */ V(4, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 4, 4), /* 48 */
- /* 0001 */ V(4, 1, 4),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 0011 ... */
- /* 000 */ V(0, 3, 3), /* 64 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(2, 1, 1),
- /* 101 */ V(2, 1, 1),
- /* 110 */ V(2, 1, 1),
- /* 111 */ V(2, 1, 1),
-
- /* 0101 ... */
- /* 0 */ V(0, 2, 1), /* 72 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 74 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 2),
- /* 11 */ V(7, 5, 2),
-
- /* 0000 0001 ... */
- /* 000 */ V(6, 6, 2), /* 78 */
- /* 001 */ V(6, 6, 2),
- /* 010 */ V(4, 7, 2),
- /* 011 */ V(4, 7, 2),
- /* 100 */ V(7, 4, 2),
- /* 101 */ V(7, 4, 2),
- /* 110 */ V(5, 7, 3),
- /* 111 */ V(5, 5, 3),
-
- /* 0000 0010 ... */
- /* 00 */ V(5, 6, 2), /* 86 */
- /* 01 */ V(6, 5, 2),
- /* 10 */ V(3, 7, 1),
- /* 11 */ V(3, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(4, 6, 1),
-
- /* 0000 0100 ... */
- /* 00 */ V(4, 5, 2), /* 92 */
- /* 01 */ V(5, 4, 2),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(5, 3, 2),
-
- /* 0000 0111 ... */
- /* 0 */ V(6, 4, 1), /* 96 */
- /* 1 */ V(0, 7, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(4, 4, 1), /* 98 */
- /* 1 */ V(2, 5, 1),
-
- /* 0001 0000 ... */
- /* 0 */ V(5, 2, 1), /* 100 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(4, 3, 1), /* 102 */
- /* 1 */ V(3, 3, 1)
+union huffpair const hufftab11[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 3),
+ /* 0100 */ V(1, 2, 4),
+ /* 0101 */ PTR(72, 1),
+ /* 0110 */ V(1, 1, 3),
+ /* 0111 */ V(1, 1, 3),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(74, 2), /* 16 */
+ /* 0001 */ PTR(78, 3),
+ /* 0010 */ PTR(86, 2),
+ /* 0011 */ PTR(90, 1),
+ /* 0100 */ PTR(92, 2),
+ /* 0101 */ V(2, 7, 4),
+ /* 0110 */ V(7, 2, 4),
+ /* 0111 */ PTR(96, 1),
+ /* 1000 */ V(7, 1, 3),
+ /* 1001 */ V(7, 1, 3),
+ /* 1010 */ V(1, 7, 4),
+ /* 1011 */ V(7, 0, 4),
+ /* 1100 */ V(3, 6, 4),
+ /* 1101 */ V(6, 3, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(98, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(100, 1), /* 32 */
+ /* 0001 */ V(1, 5, 4),
+ /* 0010 */ V(6, 2, 3),
+ /* 0011 */ V(6, 2, 3),
+ /* 0100 */ V(2, 6, 4),
+ /* 0101 */ V(0, 6, 4),
+ /* 0110 */ V(1, 6, 3),
+ /* 0111 */ V(1, 6, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(5, 1, 4),
+ /* 1011 */ V(3, 4, 4),
+ /* 1100 */ V(5, 0, 4),
+ /* 1101 */ PTR(102, 1),
+ /* 1110 */ V(2, 4, 4),
+ /* 1111 */ V(4, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 4, 4), /* 48 */
+ /* 0001 */ V(4, 1, 4),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 0011 ... */
+ /* 000 */ V(0, 3, 3), /* 64 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(2, 1, 1),
+ /* 101 */ V(2, 1, 1),
+ /* 110 */ V(2, 1, 1),
+ /* 111 */ V(2, 1, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(0, 2, 1), /* 72 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 74 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 2),
+ /* 11 */ V(7, 5, 2),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(6, 6, 2), /* 78 */
+ /* 001 */ V(6, 6, 2),
+ /* 010 */ V(4, 7, 2),
+ /* 011 */ V(4, 7, 2),
+ /* 100 */ V(7, 4, 2),
+ /* 101 */ V(7, 4, 2),
+ /* 110 */ V(5, 7, 3),
+ /* 111 */ V(5, 5, 3),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(5, 6, 2), /* 86 */
+ /* 01 */ V(6, 5, 2),
+ /* 10 */ V(3, 7, 1),
+ /* 11 */ V(3, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(4, 5, 2), /* 92 */
+ /* 01 */ V(5, 4, 2),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(6, 4, 1), /* 96 */
+ /* 1 */ V(0, 7, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(4, 4, 1), /* 98 */
+ /* 1 */ V(2, 5, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(5, 2, 1), /* 100 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(4, 3, 1), /* 102 */
+ /* 1 */ V(3, 3, 1)
};
static
-union huffpair const hufftab12[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ PTR(68, 3),
- /* 0101 */ PTR(76, 1),
- /* 0110 */ V(1, 2, 4),
- /* 0111 */ V(2, 1, 4),
- /* 1000 */ PTR(78, 1),
- /* 1001 */ V(0, 0, 4),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 3),
- /* 1101 */ V(0, 1, 3),
- /* 1110 */ V(1, 0, 3),
- /* 1111 */ V(1, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(80, 2), /* 16 */
- /* 0001 */ PTR(84, 1),
- /* 0010 */ PTR(86, 1),
- /* 0011 */ PTR(88, 1),
- /* 0100 */ V(5, 6, 4),
- /* 0101 */ V(3, 7, 4),
- /* 0110 */ PTR(90, 1),
- /* 0111 */ V(2, 7, 4),
- /* 1000 */ V(7, 2, 4),
- /* 1001 */ V(4, 6, 4),
- /* 1010 */ V(6, 4, 4),
- /* 1011 */ V(1, 7, 4),
- /* 1100 */ V(7, 1, 4),
- /* 1101 */ PTR(92, 1),
- /* 1110 */ V(3, 6, 4),
- /* 1111 */ V(6, 3, 4),
-
- /* 0001 ... */
- /* 0000 */ V(4, 5, 4), /* 32 */
- /* 0001 */ V(5, 4, 4),
- /* 0010 */ V(4, 4, 4),
- /* 0011 */ PTR(94, 1),
- /* 0100 */ V(2, 6, 3),
- /* 0101 */ V(2, 6, 3),
- /* 0110 */ V(6, 2, 3),
- /* 0111 */ V(6, 2, 3),
- /* 1000 */ V(6, 1, 3),
- /* 1001 */ V(6, 1, 3),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 0, 4),
- /* 1100 */ V(3, 5, 4),
- /* 1101 */ V(5, 3, 4),
- /* 1110 */ V(2, 5, 4),
- /* 1111 */ V(5, 2, 4),
-
- /* 0010 ... */
- /* 0000 */ V(1, 5, 3), /* 48 */
- /* 0001 */ V(1, 5, 3),
- /* 0010 */ V(5, 1, 3),
- /* 0011 */ V(5, 1, 3),
- /* 0100 */ V(3, 4, 3),
- /* 0101 */ V(3, 4, 3),
- /* 0110 */ V(4, 3, 3),
- /* 0111 */ V(4, 3, 3),
- /* 1000 */ V(5, 0, 4),
- /* 1001 */ V(0, 4, 4),
- /* 1010 */ V(2, 4, 3),
- /* 1011 */ V(2, 4, 3),
- /* 1100 */ V(4, 2, 3),
- /* 1101 */ V(4, 2, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 0011 ... */
- /* 00 */ V(3, 3, 2), /* 64 */
- /* 01 */ V(4, 1, 2),
- /* 10 */ V(2, 3, 2),
- /* 11 */ V(3, 2, 2),
-
- /* 0100 ... */
- /* 000 */ V(4, 0, 3), /* 68 */
- /* 001 */ V(0, 3, 3),
- /* 010 */ V(3, 0, 2),
- /* 011 */ V(3, 0, 2),
- /* 100 */ V(1, 3, 1),
- /* 101 */ V(1, 3, 1),
- /* 110 */ V(1, 3, 1),
- /* 111 */ V(1, 3, 1),
-
- /* 0101 ... */
- /* 0 */ V(3, 1, 1), /* 76 */
- /* 1 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(0, 2, 1), /* 78 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 00 */ V(7, 7, 2), /* 80 */
- /* 01 */ V(6, 7, 2),
- /* 10 */ V(7, 6, 1),
- /* 11 */ V(7, 6, 1),
-
- /* 0000 0001 ... */
- /* 0 */ V(5, 7, 1), /* 84 */
- /* 1 */ V(7, 5, 1),
-
- /* 0000 0010 ... */
- /* 0 */ V(6, 6, 1), /* 86 */
- /* 1 */ V(4, 7, 1),
-
- /* 0000 0011 ... */
- /* 0 */ V(7, 4, 1), /* 88 */
- /* 1 */ V(6, 5, 1),
-
- /* 0000 0110 ... */
- /* 0 */ V(7, 3, 1), /* 90 */
- /* 1 */ V(5, 5, 1),
-
- /* 0000 1101 ... */
- /* 0 */ V(0, 7, 1), /* 92 */
- /* 1 */ V(7, 0, 1),
-
- /* 0001 0011 ... */
- /* 0 */ V(0, 6, 1), /* 94 */
- /* 1 */ V(0, 5, 1)
+union huffpair const hufftab12[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ PTR(68, 3),
+ /* 0101 */ PTR(76, 1),
+ /* 0110 */ V(1, 2, 4),
+ /* 0111 */ V(2, 1, 4),
+ /* 1000 */ PTR(78, 1),
+ /* 1001 */ V(0, 0, 4),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 3),
+ /* 1101 */ V(0, 1, 3),
+ /* 1110 */ V(1, 0, 3),
+ /* 1111 */ V(1, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(80, 2), /* 16 */
+ /* 0001 */ PTR(84, 1),
+ /* 0010 */ PTR(86, 1),
+ /* 0011 */ PTR(88, 1),
+ /* 0100 */ V(5, 6, 4),
+ /* 0101 */ V(3, 7, 4),
+ /* 0110 */ PTR(90, 1),
+ /* 0111 */ V(2, 7, 4),
+ /* 1000 */ V(7, 2, 4),
+ /* 1001 */ V(4, 6, 4),
+ /* 1010 */ V(6, 4, 4),
+ /* 1011 */ V(1, 7, 4),
+ /* 1100 */ V(7, 1, 4),
+ /* 1101 */ PTR(92, 1),
+ /* 1110 */ V(3, 6, 4),
+ /* 1111 */ V(6, 3, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(4, 5, 4), /* 32 */
+ /* 0001 */ V(5, 4, 4),
+ /* 0010 */ V(4, 4, 4),
+ /* 0011 */ PTR(94, 1),
+ /* 0100 */ V(2, 6, 3),
+ /* 0101 */ V(2, 6, 3),
+ /* 0110 */ V(6, 2, 3),
+ /* 0111 */ V(6, 2, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 0, 4),
+ /* 1100 */ V(3, 5, 4),
+ /* 1101 */ V(5, 3, 4),
+ /* 1110 */ V(2, 5, 4),
+ /* 1111 */ V(5, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 5, 3), /* 48 */
+ /* 0001 */ V(1, 5, 3),
+ /* 0010 */ V(5, 1, 3),
+ /* 0011 */ V(5, 1, 3),
+ /* 0100 */ V(3, 4, 3),
+ /* 0101 */ V(3, 4, 3),
+ /* 0110 */ V(4, 3, 3),
+ /* 0111 */ V(4, 3, 3),
+ /* 1000 */ V(5, 0, 4),
+ /* 1001 */ V(0, 4, 4),
+ /* 1010 */ V(2, 4, 3),
+ /* 1011 */ V(2, 4, 3),
+ /* 1100 */ V(4, 2, 3),
+ /* 1101 */ V(4, 2, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 3, 2), /* 64 */
+ /* 01 */ V(4, 1, 2),
+ /* 10 */ V(2, 3, 2),
+ /* 11 */ V(3, 2, 2),
+
+ /* 0100 ... */
+ /* 000 */ V(4, 0, 3), /* 68 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(3, 0, 2),
+ /* 011 */ V(3, 0, 2),
+ /* 100 */ V(1, 3, 1),
+ /* 101 */ V(1, 3, 1),
+ /* 110 */ V(1, 3, 1),
+ /* 111 */ V(1, 3, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(3, 1, 1), /* 76 */
+ /* 1 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(0, 2, 1), /* 78 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 80 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 1),
+ /* 11 */ V(7, 6, 1),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(5, 7, 1), /* 84 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(6, 6, 1), /* 86 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 4, 1), /* 88 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(5, 5, 1),
+
+ /* 0000 1101 ... */
+ /* 0 */ V(0, 7, 1), /* 92 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0001 0011 ... */
+ /* 0 */ V(0, 6, 1), /* 94 */
+ /* 1 */ V(0, 5, 1)
};
static
-union huffpair const hufftab13[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 4), /* 16 */
- /* 0001 */ PTR(84, 4),
- /* 0010 */ PTR(100, 4),
- /* 0011 */ PTR(116, 4),
- /* 0100 */ PTR(132, 4),
- /* 0101 */ PTR(148, 4),
- /* 0110 */ PTR(164, 3),
- /* 0111 */ PTR(172, 3),
- /* 1000 */ PTR(180, 3),
- /* 1001 */ PTR(188, 3),
- /* 1010 */ PTR(196, 3),
- /* 1011 */ PTR(204, 3),
- /* 1100 */ PTR(212, 1),
- /* 1101 */ PTR(214, 2),
- /* 1110 */ PTR(218, 3),
- /* 1111 */ PTR(226, 1),
-
- /* 0001 ... */
- /* 0000 */ PTR(228, 2), /* 32 */
- /* 0001 */ PTR(232, 2),
- /* 0010 */ PTR(236, 2),
- /* 0011 */ PTR(240, 2),
- /* 0100 */ V(8, 1, 4),
- /* 0101 */ PTR(244, 1),
- /* 0110 */ PTR(246, 1),
- /* 0111 */ PTR(248, 1),
- /* 1000 */ PTR(250, 2),
- /* 1001 */ PTR(254, 1),
- /* 1010 */ V(1, 5, 4),
- /* 1011 */ V(5, 1, 4),
- /* 1100 */ PTR(256, 1),
- /* 1101 */ PTR(258, 1),
- /* 1110 */ PTR(260, 1),
- /* 1111 */ V(1, 4, 4),
-
- /* 0010 ... */
- /* 0000 */ V(4, 1, 3), /* 48 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 4),
- /* 0101 */ V(3, 2, 4),
- /* 0110 */ V(1, 3, 3),
- /* 0111 */ V(1, 3, 3),
- /* 1000 */ V(3, 1, 3),
- /* 1001 */ V(3, 1, 3),
- /* 1010 */ V(0, 3, 3),
- /* 1011 */ V(0, 3, 3),
- /* 1100 */ V(3, 0, 3),
- /* 1101 */ V(3, 0, 3),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(262, 4), /* 68 */
- /* 0001 */ PTR(278, 4),
- /* 0010 */ PTR(294, 4),
- /* 0011 */ PTR(310, 3),
- /* 0100 */ PTR(318, 2),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 3),
- /* 0111 */ PTR(334, 2),
- /* 1000 */ PTR(338, 1),
- /* 1001 */ PTR(340, 2),
- /* 1010 */ PTR(344, 2),
- /* 1011 */ PTR(348, 2),
- /* 1100 */ PTR(352, 2),
- /* 1101 */ PTR(356, 2),
- /* 1110 */ V(1, 15, 4),
- /* 1111 */ V(15, 1, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 0, 4), /* 84 */
- /* 0001 */ PTR(360, 1),
- /* 0010 */ PTR(362, 1),
- /* 0011 */ PTR(364, 1),
- /* 0100 */ V(14, 2, 4),
- /* 0101 */ PTR(366, 1),
- /* 0110 */ V(1, 14, 4),
- /* 0111 */ V(14, 1, 4),
- /* 1000 */ PTR(368, 1),
- /* 1001 */ PTR(370, 1),
- /* 1010 */ PTR(372, 1),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 1),
- /* 1101 */ PTR(378, 1),
- /* 1110 */ V(12, 6, 4),
- /* 1111 */ V(3, 13, 4),
-
- /* 0000 0010 ... */
- /* 0000 */ PTR(380, 1), /* 100 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(1, 13, 4),
- /* 0100 */ V(11, 7, 4),
- /* 0101 */ PTR(382, 1),
- /* 0110 */ PTR(384, 1),
- /* 0111 */ V(12, 3, 4),
- /* 1000 */ PTR(386, 1),
- /* 1001 */ V(4, 11, 4),
- /* 1010 */ V(13, 1, 3),
- /* 1011 */ V(13, 1, 3),
- /* 1100 */ V(0, 13, 4),
- /* 1101 */ V(13, 0, 4),
- /* 1110 */ V(8, 10, 4),
- /* 1111 */ V(10, 8, 4),
-
- /* 0000 0011 ... */
- /* 0000 */ V(4, 12, 4), /* 116 */
- /* 0001 */ V(12, 4, 4),
- /* 0010 */ V(6, 11, 4),
- /* 0011 */ V(11, 6, 4),
- /* 0100 */ V(3, 12, 3),
- /* 0101 */ V(3, 12, 3),
- /* 0110 */ V(2, 12, 3),
- /* 0111 */ V(2, 12, 3),
- /* 1000 */ V(12, 2, 3),
- /* 1001 */ V(12, 2, 3),
- /* 1010 */ V(5, 11, 3),
- /* 1011 */ V(5, 11, 3),
- /* 1100 */ V(11, 5, 4),
- /* 1101 */ V(8, 9, 4),
- /* 1110 */ V(1, 12, 3),
- /* 1111 */ V(1, 12, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(12, 1, 3), /* 132 */
- /* 0001 */ V(12, 1, 3),
- /* 0010 */ V(9, 8, 4),
- /* 0011 */ V(0, 12, 4),
- /* 0100 */ V(12, 0, 3),
- /* 0101 */ V(12, 0, 3),
- /* 0110 */ V(11, 4, 4),
- /* 0111 */ V(6, 10, 4),
- /* 1000 */ V(10, 6, 4),
- /* 1001 */ V(7, 9, 4),
- /* 1010 */ V(3, 11, 3),
- /* 1011 */ V(3, 11, 3),
- /* 1100 */ V(11, 3, 3),
- /* 1101 */ V(11, 3, 3),
- /* 1110 */ V(8, 8, 4),
- /* 1111 */ V(5, 10, 4),
-
- /* 0000 0101 ... */
- /* 0000 */ V(2, 11, 3), /* 148 */
- /* 0001 */ V(2, 11, 3),
- /* 0010 */ V(10, 5, 4),
- /* 0011 */ V(6, 9, 4),
- /* 0100 */ V(10, 4, 3),
- /* 0101 */ V(10, 4, 3),
- /* 0110 */ V(7, 8, 4),
- /* 0111 */ V(8, 7, 4),
- /* 1000 */ V(9, 4, 3),
- /* 1001 */ V(9, 4, 3),
- /* 1010 */ V(7, 7, 4),
- /* 1011 */ V(7, 6, 4),
- /* 1100 */ V(11, 2, 2),
- /* 1101 */ V(11, 2, 2),
- /* 1110 */ V(11, 2, 2),
- /* 1111 */ V(11, 2, 2),
-
- /* 0000 0110 ... */
- /* 000 */ V(1, 11, 2), /* 164 */
- /* 001 */ V(1, 11, 2),
- /* 010 */ V(11, 1, 2),
- /* 011 */ V(11, 1, 2),
- /* 100 */ V(0, 11, 3),
- /* 101 */ V(11, 0, 3),
- /* 110 */ V(9, 6, 3),
- /* 111 */ V(4, 10, 3),
-
- /* 0000 0111 ... */
- /* 000 */ V(3, 10, 3), /* 172 */
- /* 001 */ V(10, 3, 3),
- /* 010 */ V(5, 9, 3),
- /* 011 */ V(9, 5, 3),
- /* 100 */ V(2, 10, 2),
- /* 101 */ V(2, 10, 2),
- /* 110 */ V(10, 2, 2),
- /* 111 */ V(10, 2, 2),
-
- /* 0000 1000 ... */
- /* 000 */ V(1, 10, 2), /* 180 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(10, 1, 2),
- /* 011 */ V(10, 1, 2),
- /* 100 */ V(0, 10, 3),
- /* 101 */ V(6, 8, 3),
- /* 110 */ V(10, 0, 2),
- /* 111 */ V(10, 0, 2),
-
- /* 0000 1001 ... */
- /* 000 */ V(8, 6, 3), /* 188 */
- /* 001 */ V(4, 9, 3),
- /* 010 */ V(9, 3, 2),
- /* 011 */ V(9, 3, 2),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(5, 8, 3),
- /* 110 */ V(8, 5, 3),
- /* 111 */ V(6, 7, 3),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 9, 2), /* 196 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(5, 7, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 2),
- /* 111 */ V(3, 8, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(8, 3, 2), /* 204 */
- /* 001 */ V(8, 3, 2),
- /* 010 */ V(6, 6, 3),
- /* 011 */ V(4, 7, 3),
- /* 100 */ V(7, 4, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(6, 5, 3),
- /* 111 */ V(7, 3, 3),
-
- /* 0000 1100 ... */
- /* 0 */ V(1, 9, 1), /* 212 */
- /* 1 */ V(9, 1, 1),
-
- /* 0000 1101 ... */
- /* 00 */ V(0, 9, 2), /* 214 */
- /* 01 */ V(9, 0, 2),
- /* 10 */ V(4, 8, 2),
- /* 11 */ V(8, 4, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 2, 2), /* 218 */
- /* 001 */ V(7, 2, 2),
- /* 010 */ V(4, 6, 3),
- /* 011 */ V(6, 4, 3),
- /* 100 */ V(2, 8, 1),
- /* 101 */ V(2, 8, 1),
- /* 110 */ V(2, 8, 1),
- /* 111 */ V(2, 8, 1),
-
- /* 0000 1111 ... */
- /* 0 */ V(8, 2, 1), /* 226 */
- /* 1 */ V(1, 8, 1),
-
- /* 0001 0000 ... */
- /* 00 */ V(3, 7, 2), /* 228 */
- /* 01 */ V(2, 7, 2),
- /* 10 */ V(1, 7, 1),
- /* 11 */ V(1, 7, 1),
-
- /* 0001 0001 ... */
- /* 00 */ V(7, 1, 1), /* 232 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(5, 5, 2),
- /* 11 */ V(0, 7, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(7, 0, 2), /* 236 */
- /* 01 */ V(3, 6, 2),
- /* 10 */ V(6, 3, 2),
- /* 11 */ V(4, 5, 2),
-
- /* 0001 0011 ... */
- /* 00 */ V(5, 4, 2), /* 240 */
- /* 01 */ V(2, 6, 2),
- /* 10 */ V(6, 2, 2),
- /* 11 */ V(3, 5, 2),
-
- /* 0001 0101 ... */
- /* 0 */ V(0, 8, 1), /* 244 */
- /* 1 */ V(8, 0, 1),
-
- /* 0001 0110 ... */
- /* 0 */ V(1, 6, 1), /* 246 */
- /* 1 */ V(6, 1, 1),
-
- /* 0001 0111 ... */
- /* 0 */ V(0, 6, 1), /* 248 */
- /* 1 */ V(6, 0, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(5, 3, 2), /* 250 */
- /* 01 */ V(4, 4, 2),
- /* 10 */ V(2, 5, 1),
- /* 11 */ V(2, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(5, 2, 1), /* 254 */
- /* 1 */ V(0, 5, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(3, 4, 1), /* 256 */
- /* 1 */ V(4, 3, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(5, 0, 1), /* 258 */
- /* 1 */ V(2, 4, 1),
-
- /* 0001 1110 ... */
- /* 0 */ V(4, 2, 1), /* 260 */
- /* 1 */ V(3, 3, 1),
-
- /* 0000 0000 0000 ... */
- /* 0000 */ PTR(388, 3), /* 262 */
- /* 0001 */ V(15, 15, 4),
- /* 0010 */ V(14, 15, 4),
- /* 0011 */ V(13, 15, 4),
- /* 0100 */ V(14, 14, 4),
- /* 0101 */ V(12, 15, 4),
- /* 0110 */ V(13, 14, 4),
- /* 0111 */ V(11, 15, 4),
- /* 1000 */ V(15, 11, 4),
- /* 1001 */ V(12, 14, 4),
- /* 1010 */ V(13, 12, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 12, 3),
- /* 1101 */ V(14, 12, 3),
- /* 1110 */ V(13, 13, 3),
- /* 1111 */ V(13, 13, 3),
-
- /* 0000 0000 0001 ... */
- /* 0000 */ V(15, 10, 4), /* 278 */
- /* 0001 */ V(12, 13, 4),
- /* 0010 */ V(11, 14, 3),
- /* 0011 */ V(11, 14, 3),
- /* 0100 */ V(14, 11, 3),
- /* 0101 */ V(14, 11, 3),
- /* 0110 */ V(9, 15, 3),
- /* 0111 */ V(9, 15, 3),
- /* 1000 */ V(15, 9, 3),
- /* 1001 */ V(15, 9, 3),
- /* 1010 */ V(14, 10, 3),
- /* 1011 */ V(14, 10, 3),
- /* 1100 */ V(11, 13, 3),
- /* 1101 */ V(11, 13, 3),
- /* 1110 */ V(13, 11, 3),
- /* 1111 */ V(13, 11, 3),
-
- /* 0000 0000 0010 ... */
- /* 0000 */ V(8, 15, 3), /* 294 */
- /* 0001 */ V(8, 15, 3),
- /* 0010 */ V(15, 8, 3),
- /* 0011 */ V(15, 8, 3),
- /* 0100 */ V(12, 12, 3),
- /* 0101 */ V(12, 12, 3),
- /* 0110 */ V(10, 14, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(8, 14, 3),
- /* 1001 */ V(8, 14, 3),
- /* 1010 */ V(7, 15, 4),
- /* 1011 */ V(7, 14, 4),
- /* 1100 */ V(15, 7, 2),
- /* 1101 */ V(15, 7, 2),
- /* 1110 */ V(15, 7, 2),
- /* 1111 */ V(15, 7, 2),
-
- /* 0000 0000 0011 ... */
- /* 000 */ V(13, 10, 2), /* 310 */
- /* 001 */ V(13, 10, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(11, 12, 3),
- /* 100 */ V(12, 11, 3),
- /* 101 */ V(15, 6, 3),
- /* 110 */ V(6, 15, 2),
- /* 111 */ V(6, 15, 2),
-
- /* 0000 0000 0100 ... */
- /* 00 */ V(14, 8, 2), /* 318 */
- /* 01 */ V(5, 15, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(13, 9, 2),
-
- /* 0000 0000 0101 ... */
- /* 00 */ V(15, 5, 2), /* 322 */
- /* 01 */ V(14, 7, 2),
- /* 10 */ V(10, 12, 2),
- /* 11 */ V(11, 11, 2),
-
- /* 0000 0000 0110 ... */
- /* 000 */ V(4, 15, 2), /* 326 */
- /* 001 */ V(4, 15, 2),
- /* 010 */ V(15, 4, 2),
- /* 011 */ V(15, 4, 2),
- /* 100 */ V(12, 10, 3),
- /* 101 */ V(14, 6, 3),
- /* 110 */ V(15, 3, 2),
- /* 111 */ V(15, 3, 2),
-
- /* 0000 0000 0111 ... */
- /* 00 */ V(3, 15, 1), /* 334 */
- /* 01 */ V(3, 15, 1),
- /* 10 */ V(8, 13, 2),
- /* 11 */ V(13, 8, 2),
-
- /* 0000 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 338 */
- /* 1 */ V(15, 2, 1),
-
- /* 0000 0000 1001 ... */
- /* 00 */ V(6, 14, 2), /* 340 */
- /* 01 */ V(9, 12, 2),
- /* 10 */ V(0, 15, 1),
- /* 11 */ V(0, 15, 1),
-
- /* 0000 0000 1010 ... */
- /* 00 */ V(12, 9, 2), /* 344 */
- /* 01 */ V(5, 14, 2),
- /* 10 */ V(10, 11, 1),
- /* 11 */ V(10, 11, 1),
-
- /* 0000 0000 1011 ... */
- /* 00 */ V(7, 13, 2), /* 348 */
- /* 01 */ V(13, 7, 2),
- /* 10 */ V(4, 14, 1),
- /* 11 */ V(4, 14, 1),
-
- /* 0000 0000 1100 ... */
- /* 00 */ V(12, 8, 2), /* 352 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(3, 14, 1),
- /* 11 */ V(3, 14, 1),
-
- /* 0000 0000 1101 ... */
- /* 00 */ V(11, 9, 1), /* 356 */
- /* 01 */ V(11, 9, 1),
- /* 10 */ V(9, 11, 2),
- /* 11 */ V(10, 10, 2),
-
- /* 0000 0001 0001 ... */
- /* 0 */ V(11, 10, 1), /* 360 */
- /* 1 */ V(14, 5, 1),
-
- /* 0000 0001 0010 ... */
- /* 0 */ V(14, 4, 1), /* 362 */
- /* 1 */ V(8, 12, 1),
-
- /* 0000 0001 0011 ... */
- /* 0 */ V(6, 13, 1), /* 364 */
- /* 1 */ V(14, 3, 1),
-
- /* 0000 0001 0101 ... */
- /* 0 */ V(2, 14, 1), /* 366 */
- /* 1 */ V(0, 14, 1),
-
- /* 0000 0001 1000 ... */
- /* 0 */ V(14, 0, 1), /* 368 */
- /* 1 */ V(5, 13, 1),
-
- /* 0000 0001 1001 ... */
- /* 0 */ V(13, 5, 1), /* 370 */
- /* 1 */ V(7, 12, 1),
-
- /* 0000 0001 1010 ... */
- /* 0 */ V(12, 7, 1), /* 372 */
- /* 1 */ V(4, 13, 1),
-
- /* 0000 0001 1011 ... */
- /* 0 */ V(8, 11, 1), /* 374 */
- /* 1 */ V(11, 8, 1),
-
- /* 0000 0001 1100 ... */
- /* 0 */ V(13, 4, 1), /* 376 */
- /* 1 */ V(9, 10, 1),
-
- /* 0000 0001 1101 ... */
- /* 0 */ V(10, 9, 1), /* 378 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 0010 0000 ... */
- /* 0 */ V(13, 3, 1), /* 380 */
- /* 1 */ V(7, 11, 1),
-
- /* 0000 0010 0101 ... */
- /* 0 */ V(5, 12, 1), /* 382 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 0010 0110 ... */
- /* 0 */ V(9, 9, 1), /* 384 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 0010 1000 ... */
- /* 0 */ V(10, 7, 1), /* 386 */
- /* 1 */ V(9, 7, 1),
-
- /* 0000 0000 0000 0000 ... */
- /* 000 */ V(15, 14, 3), /* 388 */
- /* 001 */ V(15, 12, 3),
- /* 010 */ V(15, 13, 2),
- /* 011 */ V(15, 13, 2),
- /* 100 */ V(14, 13, 1),
- /* 101 */ V(14, 13, 1),
- /* 110 */ V(14, 13, 1),
- /* 111 */ V(14, 13, 1),
-
- /* 0000 0000 0000 1011 ... */
- /* 0 */ V(10, 15, 1), /* 396 */
- /* 1 */ V(14, 9, 1)
+union huffpair const hufftab13[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 4), /* 16 */
+ /* 0001 */ PTR(84, 4),
+ /* 0010 */ PTR(100, 4),
+ /* 0011 */ PTR(116, 4),
+ /* 0100 */ PTR(132, 4),
+ /* 0101 */ PTR(148, 4),
+ /* 0110 */ PTR(164, 3),
+ /* 0111 */ PTR(172, 3),
+ /* 1000 */ PTR(180, 3),
+ /* 1001 */ PTR(188, 3),
+ /* 1010 */ PTR(196, 3),
+ /* 1011 */ PTR(204, 3),
+ /* 1100 */ PTR(212, 1),
+ /* 1101 */ PTR(214, 2),
+ /* 1110 */ PTR(218, 3),
+ /* 1111 */ PTR(226, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(228, 2), /* 32 */
+ /* 0001 */ PTR(232, 2),
+ /* 0010 */ PTR(236, 2),
+ /* 0011 */ PTR(240, 2),
+ /* 0100 */ V(8, 1, 4),
+ /* 0101 */ PTR(244, 1),
+ /* 0110 */ PTR(246, 1),
+ /* 0111 */ PTR(248, 1),
+ /* 1000 */ PTR(250, 2),
+ /* 1001 */ PTR(254, 1),
+ /* 1010 */ V(1, 5, 4),
+ /* 1011 */ V(5, 1, 4),
+ /* 1100 */ PTR(256, 1),
+ /* 1101 */ PTR(258, 1),
+ /* 1110 */ PTR(260, 1),
+ /* 1111 */ V(1, 4, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(4, 1, 3), /* 48 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 4),
+ /* 0101 */ V(3, 2, 4),
+ /* 0110 */ V(1, 3, 3),
+ /* 0111 */ V(1, 3, 3),
+ /* 1000 */ V(3, 1, 3),
+ /* 1001 */ V(3, 1, 3),
+ /* 1010 */ V(0, 3, 3),
+ /* 1011 */ V(0, 3, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(262, 4), /* 68 */
+ /* 0001 */ PTR(278, 4),
+ /* 0010 */ PTR(294, 4),
+ /* 0011 */ PTR(310, 3),
+ /* 0100 */ PTR(318, 2),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 3),
+ /* 0111 */ PTR(334, 2),
+ /* 1000 */ PTR(338, 1),
+ /* 1001 */ PTR(340, 2),
+ /* 1010 */ PTR(344, 2),
+ /* 1011 */ PTR(348, 2),
+ /* 1100 */ PTR(352, 2),
+ /* 1101 */ PTR(356, 2),
+ /* 1110 */ V(1, 15, 4),
+ /* 1111 */ V(15, 1, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 0, 4), /* 84 */
+ /* 0001 */ PTR(360, 1),
+ /* 0010 */ PTR(362, 1),
+ /* 0011 */ PTR(364, 1),
+ /* 0100 */ V(14, 2, 4),
+ /* 0101 */ PTR(366, 1),
+ /* 0110 */ V(1, 14, 4),
+ /* 0111 */ V(14, 1, 4),
+ /* 1000 */ PTR(368, 1),
+ /* 1001 */ PTR(370, 1),
+ /* 1010 */ PTR(372, 1),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 1),
+ /* 1101 */ PTR(378, 1),
+ /* 1110 */ V(12, 6, 4),
+ /* 1111 */ V(3, 13, 4),
+
+ /* 0000 0010 ... */
+ /* 0000 */ PTR(380, 1), /* 100 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(1, 13, 4),
+ /* 0100 */ V(11, 7, 4),
+ /* 0101 */ PTR(382, 1),
+ /* 0110 */ PTR(384, 1),
+ /* 0111 */ V(12, 3, 4),
+ /* 1000 */ PTR(386, 1),
+ /* 1001 */ V(4, 11, 4),
+ /* 1010 */ V(13, 1, 3),
+ /* 1011 */ V(13, 1, 3),
+ /* 1100 */ V(0, 13, 4),
+ /* 1101 */ V(13, 0, 4),
+ /* 1110 */ V(8, 10, 4),
+ /* 1111 */ V(10, 8, 4),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(4, 12, 4), /* 116 */
+ /* 0001 */ V(12, 4, 4),
+ /* 0010 */ V(6, 11, 4),
+ /* 0011 */ V(11, 6, 4),
+ /* 0100 */ V(3, 12, 3),
+ /* 0101 */ V(3, 12, 3),
+ /* 0110 */ V(2, 12, 3),
+ /* 0111 */ V(2, 12, 3),
+ /* 1000 */ V(12, 2, 3),
+ /* 1001 */ V(12, 2, 3),
+ /* 1010 */ V(5, 11, 3),
+ /* 1011 */ V(5, 11, 3),
+ /* 1100 */ V(11, 5, 4),
+ /* 1101 */ V(8, 9, 4),
+ /* 1110 */ V(1, 12, 3),
+ /* 1111 */ V(1, 12, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(12, 1, 3), /* 132 */
+ /* 0001 */ V(12, 1, 3),
+ /* 0010 */ V(9, 8, 4),
+ /* 0011 */ V(0, 12, 4),
+ /* 0100 */ V(12, 0, 3),
+ /* 0101 */ V(12, 0, 3),
+ /* 0110 */ V(11, 4, 4),
+ /* 0111 */ V(6, 10, 4),
+ /* 1000 */ V(10, 6, 4),
+ /* 1001 */ V(7, 9, 4),
+ /* 1010 */ V(3, 11, 3),
+ /* 1011 */ V(3, 11, 3),
+ /* 1100 */ V(11, 3, 3),
+ /* 1101 */ V(11, 3, 3),
+ /* 1110 */ V(8, 8, 4),
+ /* 1111 */ V(5, 10, 4),
+
+ /* 0000 0101 ... */
+ /* 0000 */ V(2, 11, 3), /* 148 */
+ /* 0001 */ V(2, 11, 3),
+ /* 0010 */ V(10, 5, 4),
+ /* 0011 */ V(6, 9, 4),
+ /* 0100 */ V(10, 4, 3),
+ /* 0101 */ V(10, 4, 3),
+ /* 0110 */ V(7, 8, 4),
+ /* 0111 */ V(8, 7, 4),
+ /* 1000 */ V(9, 4, 3),
+ /* 1001 */ V(9, 4, 3),
+ /* 1010 */ V(7, 7, 4),
+ /* 1011 */ V(7, 6, 4),
+ /* 1100 */ V(11, 2, 2),
+ /* 1101 */ V(11, 2, 2),
+ /* 1110 */ V(11, 2, 2),
+ /* 1111 */ V(11, 2, 2),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(1, 11, 2), /* 164 */
+ /* 001 */ V(1, 11, 2),
+ /* 010 */ V(11, 1, 2),
+ /* 011 */ V(11, 1, 2),
+ /* 100 */ V(0, 11, 3),
+ /* 101 */ V(11, 0, 3),
+ /* 110 */ V(9, 6, 3),
+ /* 111 */ V(4, 10, 3),
+
+ /* 0000 0111 ... */
+ /* 000 */ V(3, 10, 3), /* 172 */
+ /* 001 */ V(10, 3, 3),
+ /* 010 */ V(5, 9, 3),
+ /* 011 */ V(9, 5, 3),
+ /* 100 */ V(2, 10, 2),
+ /* 101 */ V(2, 10, 2),
+ /* 110 */ V(10, 2, 2),
+ /* 111 */ V(10, 2, 2),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(1, 10, 2), /* 180 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(10, 1, 2),
+ /* 011 */ V(10, 1, 2),
+ /* 100 */ V(0, 10, 3),
+ /* 101 */ V(6, 8, 3),
+ /* 110 */ V(10, 0, 2),
+ /* 111 */ V(10, 0, 2),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(8, 6, 3), /* 188 */
+ /* 001 */ V(4, 9, 3),
+ /* 010 */ V(9, 3, 2),
+ /* 011 */ V(9, 3, 2),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(5, 8, 3),
+ /* 110 */ V(8, 5, 3),
+ /* 111 */ V(6, 7, 3),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 9, 2), /* 196 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(5, 7, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 2),
+ /* 111 */ V(3, 8, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(8, 3, 2), /* 204 */
+ /* 001 */ V(8, 3, 2),
+ /* 010 */ V(6, 6, 3),
+ /* 011 */ V(4, 7, 3),
+ /* 100 */ V(7, 4, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(6, 5, 3),
+ /* 111 */ V(7, 3, 3),
+
+ /* 0000 1100 ... */
+ /* 0 */ V(1, 9, 1), /* 212 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0000 1101 ... */
+ /* 00 */ V(0, 9, 2), /* 214 */
+ /* 01 */ V(9, 0, 2),
+ /* 10 */ V(4, 8, 2),
+ /* 11 */ V(8, 4, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 2, 2), /* 218 */
+ /* 001 */ V(7, 2, 2),
+ /* 010 */ V(4, 6, 3),
+ /* 011 */ V(6, 4, 3),
+ /* 100 */ V(2, 8, 1),
+ /* 101 */ V(2, 8, 1),
+ /* 110 */ V(2, 8, 1),
+ /* 111 */ V(2, 8, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(8, 2, 1), /* 226 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(3, 7, 2), /* 228 */
+ /* 01 */ V(2, 7, 2),
+ /* 10 */ V(1, 7, 1),
+ /* 11 */ V(1, 7, 1),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(7, 1, 1), /* 232 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(5, 5, 2),
+ /* 11 */ V(0, 7, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(7, 0, 2), /* 236 */
+ /* 01 */ V(3, 6, 2),
+ /* 10 */ V(6, 3, 2),
+ /* 11 */ V(4, 5, 2),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(5, 4, 2), /* 240 */
+ /* 01 */ V(2, 6, 2),
+ /* 10 */ V(6, 2, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0001 0101 ... */
+ /* 0 */ V(0, 8, 1), /* 244 */
+ /* 1 */ V(8, 0, 1),
+
+ /* 0001 0110 ... */
+ /* 0 */ V(1, 6, 1), /* 246 */
+ /* 1 */ V(6, 1, 1),
+
+ /* 0001 0111 ... */
+ /* 0 */ V(0, 6, 1), /* 248 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(5, 3, 2), /* 250 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(5, 2, 1), /* 254 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(3, 4, 1), /* 256 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(5, 0, 1), /* 258 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0001 1110 ... */
+ /* 0 */ V(4, 2, 1), /* 260 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0000 */ PTR(388, 3), /* 262 */
+ /* 0001 */ V(15, 15, 4),
+ /* 0010 */ V(14, 15, 4),
+ /* 0011 */ V(13, 15, 4),
+ /* 0100 */ V(14, 14, 4),
+ /* 0101 */ V(12, 15, 4),
+ /* 0110 */ V(13, 14, 4),
+ /* 0111 */ V(11, 15, 4),
+ /* 1000 */ V(15, 11, 4),
+ /* 1001 */ V(12, 14, 4),
+ /* 1010 */ V(13, 12, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 12, 3),
+ /* 1101 */ V(14, 12, 3),
+ /* 1110 */ V(13, 13, 3),
+ /* 1111 */ V(13, 13, 3),
+
+ /* 0000 0000 0001 ... */
+ /* 0000 */ V(15, 10, 4), /* 278 */
+ /* 0001 */ V(12, 13, 4),
+ /* 0010 */ V(11, 14, 3),
+ /* 0011 */ V(11, 14, 3),
+ /* 0100 */ V(14, 11, 3),
+ /* 0101 */ V(14, 11, 3),
+ /* 0110 */ V(9, 15, 3),
+ /* 0111 */ V(9, 15, 3),
+ /* 1000 */ V(15, 9, 3),
+ /* 1001 */ V(15, 9, 3),
+ /* 1010 */ V(14, 10, 3),
+ /* 1011 */ V(14, 10, 3),
+ /* 1100 */ V(11, 13, 3),
+ /* 1101 */ V(11, 13, 3),
+ /* 1110 */ V(13, 11, 3),
+ /* 1111 */ V(13, 11, 3),
+
+ /* 0000 0000 0010 ... */
+ /* 0000 */ V(8, 15, 3), /* 294 */
+ /* 0001 */ V(8, 15, 3),
+ /* 0010 */ V(15, 8, 3),
+ /* 0011 */ V(15, 8, 3),
+ /* 0100 */ V(12, 12, 3),
+ /* 0101 */ V(12, 12, 3),
+ /* 0110 */ V(10, 14, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(8, 14, 3),
+ /* 1001 */ V(8, 14, 3),
+ /* 1010 */ V(7, 15, 4),
+ /* 1011 */ V(7, 14, 4),
+ /* 1100 */ V(15, 7, 2),
+ /* 1101 */ V(15, 7, 2),
+ /* 1110 */ V(15, 7, 2),
+ /* 1111 */ V(15, 7, 2),
+
+ /* 0000 0000 0011 ... */
+ /* 000 */ V(13, 10, 2), /* 310 */
+ /* 001 */ V(13, 10, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(11, 12, 3),
+ /* 100 */ V(12, 11, 3),
+ /* 101 */ V(15, 6, 3),
+ /* 110 */ V(6, 15, 2),
+ /* 111 */ V(6, 15, 2),
+
+ /* 0000 0000 0100 ... */
+ /* 00 */ V(14, 8, 2), /* 318 */
+ /* 01 */ V(5, 15, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(13, 9, 2),
+
+ /* 0000 0000 0101 ... */
+ /* 00 */ V(15, 5, 2), /* 322 */
+ /* 01 */ V(14, 7, 2),
+ /* 10 */ V(10, 12, 2),
+ /* 11 */ V(11, 11, 2),
+
+ /* 0000 0000 0110 ... */
+ /* 000 */ V(4, 15, 2), /* 326 */
+ /* 001 */ V(4, 15, 2),
+ /* 010 */ V(15, 4, 2),
+ /* 011 */ V(15, 4, 2),
+ /* 100 */ V(12, 10, 3),
+ /* 101 */ V(14, 6, 3),
+ /* 110 */ V(15, 3, 2),
+ /* 111 */ V(15, 3, 2),
+
+ /* 0000 0000 0111 ... */
+ /* 00 */ V(3, 15, 1), /* 334 */
+ /* 01 */ V(3, 15, 1),
+ /* 10 */ V(8, 13, 2),
+ /* 11 */ V(13, 8, 2),
+
+ /* 0000 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 338 */
+ /* 1 */ V(15, 2, 1),
+
+ /* 0000 0000 1001 ... */
+ /* 00 */ V(6, 14, 2), /* 340 */
+ /* 01 */ V(9, 12, 2),
+ /* 10 */ V(0, 15, 1),
+ /* 11 */ V(0, 15, 1),
+
+ /* 0000 0000 1010 ... */
+ /* 00 */ V(12, 9, 2), /* 344 */
+ /* 01 */ V(5, 14, 2),
+ /* 10 */ V(10, 11, 1),
+ /* 11 */ V(10, 11, 1),
+
+ /* 0000 0000 1011 ... */
+ /* 00 */ V(7, 13, 2), /* 348 */
+ /* 01 */ V(13, 7, 2),
+ /* 10 */ V(4, 14, 1),
+ /* 11 */ V(4, 14, 1),
+
+ /* 0000 0000 1100 ... */
+ /* 00 */ V(12, 8, 2), /* 352 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(3, 14, 1),
+ /* 11 */ V(3, 14, 1),
+
+ /* 0000 0000 1101 ... */
+ /* 00 */ V(11, 9, 1), /* 356 */
+ /* 01 */ V(11, 9, 1),
+ /* 10 */ V(9, 11, 2),
+ /* 11 */ V(10, 10, 2),
+
+ /* 0000 0001 0001 ... */
+ /* 0 */ V(11, 10, 1), /* 360 */
+ /* 1 */ V(14, 5, 1),
+
+ /* 0000 0001 0010 ... */
+ /* 0 */ V(14, 4, 1), /* 362 */
+ /* 1 */ V(8, 12, 1),
+
+ /* 0000 0001 0011 ... */
+ /* 0 */ V(6, 13, 1), /* 364 */
+ /* 1 */ V(14, 3, 1),
+
+ /* 0000 0001 0101 ... */
+ /* 0 */ V(2, 14, 1), /* 366 */
+ /* 1 */ V(0, 14, 1),
+
+ /* 0000 0001 1000 ... */
+ /* 0 */ V(14, 0, 1), /* 368 */
+ /* 1 */ V(5, 13, 1),
+
+ /* 0000 0001 1001 ... */
+ /* 0 */ V(13, 5, 1), /* 370 */
+ /* 1 */ V(7, 12, 1),
+
+ /* 0000 0001 1010 ... */
+ /* 0 */ V(12, 7, 1), /* 372 */
+ /* 1 */ V(4, 13, 1),
+
+ /* 0000 0001 1011 ... */
+ /* 0 */ V(8, 11, 1), /* 374 */
+ /* 1 */ V(11, 8, 1),
+
+ /* 0000 0001 1100 ... */
+ /* 0 */ V(13, 4, 1), /* 376 */
+ /* 1 */ V(9, 10, 1),
+
+ /* 0000 0001 1101 ... */
+ /* 0 */ V(10, 9, 1), /* 378 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 0010 0000 ... */
+ /* 0 */ V(13, 3, 1), /* 380 */
+ /* 1 */ V(7, 11, 1),
+
+ /* 0000 0010 0101 ... */
+ /* 0 */ V(5, 12, 1), /* 382 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 0010 0110 ... */
+ /* 0 */ V(9, 9, 1), /* 384 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 0010 1000 ... */
+ /* 0 */ V(10, 7, 1), /* 386 */
+ /* 1 */ V(9, 7, 1),
+
+ /* 0000 0000 0000 0000 ... */
+ /* 000 */ V(15, 14, 3), /* 388 */
+ /* 001 */ V(15, 12, 3),
+ /* 010 */ V(15, 13, 2),
+ /* 011 */ V(15, 13, 2),
+ /* 100 */ V(14, 13, 1),
+ /* 101 */ V(14, 13, 1),
+ /* 110 */ V(14, 13, 1),
+ /* 111 */ V(14, 13, 1),
+
+ /* 0000 0000 0000 1011 ... */
+ /* 0 */ V(10, 15, 1), /* 396 */
+ /* 1 */ V(14, 9, 1)
};
static
-union huffpair const hufftab15[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 4),
- /* 0100 */ PTR(80, 4),
- /* 0101 */ PTR(96, 3),
- /* 0110 */ PTR(104, 3),
- /* 0111 */ PTR(112, 2),
- /* 1000 */ PTR(116, 1),
- /* 1001 */ PTR(118, 1),
- /* 1010 */ V(1, 1, 3),
- /* 1011 */ V(1, 1, 3),
- /* 1100 */ V(0, 1, 4),
- /* 1101 */ V(1, 0, 4),
- /* 1110 */ V(0, 0, 3),
- /* 1111 */ V(0, 0, 3),
-
- /* 0000 ... */
- /* 0000 */ PTR(120, 4), /* 16 */
- /* 0001 */ PTR(136, 4),
- /* 0010 */ PTR(152, 4),
- /* 0011 */ PTR(168, 4),
- /* 0100 */ PTR(184, 4),
- /* 0101 */ PTR(200, 3),
- /* 0110 */ PTR(208, 3),
- /* 0111 */ PTR(216, 4),
- /* 1000 */ PTR(232, 3),
- /* 1001 */ PTR(240, 3),
- /* 1010 */ PTR(248, 3),
- /* 1011 */ PTR(256, 3),
- /* 1100 */ PTR(264, 2),
- /* 1101 */ PTR(268, 3),
- /* 1110 */ PTR(276, 3),
- /* 1111 */ PTR(284, 2),
-
- /* 0001 ... */
- /* 0000 */ PTR(288, 2), /* 32 */
- /* 0001 */ PTR(292, 2),
- /* 0010 */ PTR(296, 2),
- /* 0011 */ PTR(300, 2),
- /* 0100 */ PTR(304, 2),
- /* 0101 */ PTR(308, 2),
- /* 0110 */ PTR(312, 2),
- /* 0111 */ PTR(316, 2),
- /* 1000 */ PTR(320, 1),
- /* 1001 */ PTR(322, 1),
- /* 1010 */ PTR(324, 1),
- /* 1011 */ PTR(326, 2),
- /* 1100 */ PTR(330, 1),
- /* 1101 */ PTR(332, 1),
- /* 1110 */ PTR(334, 2),
- /* 1111 */ PTR(338, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(340, 1), /* 48 */
- /* 0001 */ PTR(342, 1),
- /* 0010 */ V(9, 1, 4),
- /* 0011 */ PTR(344, 1),
- /* 0100 */ PTR(346, 1),
- /* 0101 */ PTR(348, 1),
- /* 0110 */ PTR(350, 1),
- /* 0111 */ PTR(352, 1),
- /* 1000 */ V(2, 8, 4),
- /* 1001 */ V(8, 2, 4),
- /* 1010 */ V(1, 8, 4),
- /* 1011 */ V(8, 1, 4),
- /* 1100 */ PTR(354, 1),
- /* 1101 */ PTR(356, 1),
- /* 1110 */ PTR(358, 1),
- /* 1111 */ PTR(360, 1),
-
- /* 0011 ... */
- /* 0000 */ V(2, 7, 4), /* 64 */
- /* 0001 */ V(7, 2, 4),
- /* 0010 */ V(6, 4, 4),
- /* 0011 */ V(1, 7, 4),
- /* 0100 */ V(5, 5, 4),
- /* 0101 */ V(7, 1, 4),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ V(3, 6, 4),
- /* 1000 */ V(6, 3, 4),
- /* 1001 */ V(4, 5, 4),
- /* 1010 */ V(5, 4, 4),
- /* 1011 */ V(2, 6, 4),
- /* 1100 */ V(6, 2, 4),
- /* 1101 */ V(1, 6, 4),
- /* 1110 */ PTR(364, 1),
- /* 1111 */ V(3, 5, 4),
-
- /* 0100 ... */
- /* 0000 */ V(6, 1, 3), /* 80 */
- /* 0001 */ V(6, 1, 3),
- /* 0010 */ V(5, 3, 4),
- /* 0011 */ V(4, 4, 4),
- /* 0100 */ V(2, 5, 3),
- /* 0101 */ V(2, 5, 3),
- /* 0110 */ V(5, 2, 3),
- /* 0111 */ V(5, 2, 3),
- /* 1000 */ V(1, 5, 3),
- /* 1001 */ V(1, 5, 3),
- /* 1010 */ V(5, 1, 3),
- /* 1011 */ V(5, 1, 3),
- /* 1100 */ V(0, 5, 4),
- /* 1101 */ V(5, 0, 4),
- /* 1110 */ V(3, 4, 3),
- /* 1111 */ V(3, 4, 3),
-
- /* 0101 ... */
- /* 000 */ V(4, 3, 3), /* 96 */
- /* 001 */ V(2, 4, 3),
- /* 010 */ V(4, 2, 3),
- /* 011 */ V(3, 3, 3),
- /* 100 */ V(4, 1, 2),
- /* 101 */ V(4, 1, 2),
- /* 110 */ V(1, 4, 3),
- /* 111 */ V(0, 4, 3),
-
- /* 0110 ... */
- /* 000 */ V(2, 3, 2), /* 104 */
- /* 001 */ V(2, 3, 2),
- /* 010 */ V(3, 2, 2),
- /* 011 */ V(3, 2, 2),
- /* 100 */ V(4, 0, 3),
- /* 101 */ V(0, 3, 3),
- /* 110 */ V(1, 3, 2),
- /* 111 */ V(1, 3, 2),
-
- /* 0111 ... */
- /* 00 */ V(3, 1, 2), /* 112 */
- /* 01 */ V(3, 0, 2),
- /* 10 */ V(2, 2, 1),
- /* 11 */ V(2, 2, 1),
-
- /* 1000 ... */
- /* 0 */ V(1, 2, 1), /* 116 */
- /* 1 */ V(2, 1, 1),
-
- /* 1001 ... */
- /* 0 */ V(0, 2, 1), /* 118 */
- /* 1 */ V(2, 0, 1),
-
- /* 0000 0000 ... */
- /* 0000 */ PTR(366, 1), /* 120 */
- /* 0001 */ PTR(368, 1),
- /* 0010 */ V(14, 14, 4),
- /* 0011 */ PTR(370, 1),
- /* 0100 */ PTR(372, 1),
- /* 0101 */ PTR(374, 1),
- /* 0110 */ V(15, 11, 4),
- /* 0111 */ PTR(376, 1),
- /* 1000 */ V(13, 13, 4),
- /* 1001 */ V(10, 15, 4),
- /* 1010 */ V(15, 10, 4),
- /* 1011 */ V(11, 14, 4),
- /* 1100 */ V(14, 11, 4),
- /* 1101 */ V(12, 13, 4),
- /* 1110 */ V(13, 12, 4),
- /* 1111 */ V(9, 15, 4),
-
- /* 0000 0001 ... */
- /* 0000 */ V(15, 9, 4), /* 136 */
- /* 0001 */ V(14, 10, 4),
- /* 0010 */ V(11, 13, 4),
- /* 0011 */ V(13, 11, 4),
- /* 0100 */ V(8, 15, 4),
- /* 0101 */ V(15, 8, 4),
- /* 0110 */ V(12, 12, 4),
- /* 0111 */ V(9, 14, 4),
- /* 1000 */ V(14, 9, 4),
- /* 1001 */ V(7, 15, 4),
- /* 1010 */ V(15, 7, 4),
- /* 1011 */ V(10, 13, 4),
- /* 1100 */ V(13, 10, 4),
- /* 1101 */ V(11, 12, 4),
- /* 1110 */ V(6, 15, 4),
- /* 1111 */ PTR(378, 1),
-
- /* 0000 0010 ... */
- /* 0000 */ V(12, 11, 3), /* 152 */
- /* 0001 */ V(12, 11, 3),
- /* 0010 */ V(15, 6, 3),
- /* 0011 */ V(15, 6, 3),
- /* 0100 */ V(8, 14, 4),
- /* 0101 */ V(14, 8, 4),
- /* 0110 */ V(5, 15, 4),
- /* 0111 */ V(9, 13, 4),
- /* 1000 */ V(15, 5, 3),
- /* 1001 */ V(15, 5, 3),
- /* 1010 */ V(7, 14, 3),
- /* 1011 */ V(7, 14, 3),
- /* 1100 */ V(14, 7, 3),
- /* 1101 */ V(14, 7, 3),
- /* 1110 */ V(10, 12, 3),
- /* 1111 */ V(10, 12, 3),
-
- /* 0000 0011 ... */
- /* 0000 */ V(12, 10, 3), /* 168 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(13, 9, 4),
- /* 0101 */ V(8, 13, 4),
- /* 0110 */ V(4, 15, 3),
- /* 0111 */ V(4, 15, 3),
- /* 1000 */ V(15, 4, 3),
- /* 1001 */ V(15, 4, 3),
- /* 1010 */ V(3, 15, 3),
- /* 1011 */ V(3, 15, 3),
- /* 1100 */ V(15, 3, 3),
- /* 1101 */ V(15, 3, 3),
- /* 1110 */ V(13, 8, 3),
- /* 1111 */ V(13, 8, 3),
-
- /* 0000 0100 ... */
- /* 0000 */ V(14, 6, 3), /* 184 */
- /* 0001 */ V(14, 6, 3),
- /* 0010 */ V(2, 15, 3),
- /* 0011 */ V(2, 15, 3),
- /* 0100 */ V(15, 2, 3),
- /* 0101 */ V(15, 2, 3),
- /* 0110 */ V(6, 14, 4),
- /* 0111 */ V(15, 0, 4),
- /* 1000 */ V(1, 15, 3),
- /* 1001 */ V(1, 15, 3),
- /* 1010 */ V(15, 1, 3),
- /* 1011 */ V(15, 1, 3),
- /* 1100 */ V(9, 12, 3),
- /* 1101 */ V(9, 12, 3),
- /* 1110 */ V(12, 9, 3),
- /* 1111 */ V(12, 9, 3),
-
- /* 0000 0101 ... */
- /* 000 */ V(5, 14, 3), /* 200 */
- /* 001 */ V(10, 11, 3),
- /* 010 */ V(11, 10, 3),
- /* 011 */ V(14, 5, 3),
- /* 100 */ V(7, 13, 3),
- /* 101 */ V(13, 7, 3),
- /* 110 */ V(4, 14, 3),
- /* 111 */ V(14, 4, 3),
-
- /* 0000 0110 ... */
- /* 000 */ V(8, 12, 3), /* 208 */
- /* 001 */ V(12, 8, 3),
- /* 010 */ V(3, 14, 3),
- /* 011 */ V(6, 13, 3),
- /* 100 */ V(13, 6, 3),
- /* 101 */ V(14, 3, 3),
- /* 110 */ V(9, 11, 3),
- /* 111 */ V(11, 9, 3),
-
- /* 0000 0111 ... */
- /* 0000 */ V(2, 14, 3), /* 216 */
- /* 0001 */ V(2, 14, 3),
- /* 0010 */ V(10, 10, 3),
- /* 0011 */ V(10, 10, 3),
- /* 0100 */ V(14, 2, 3),
- /* 0101 */ V(14, 2, 3),
- /* 0110 */ V(1, 14, 3),
- /* 0111 */ V(1, 14, 3),
- /* 1000 */ V(14, 1, 3),
- /* 1001 */ V(14, 1, 3),
- /* 1010 */ V(0, 14, 4),
- /* 1011 */ V(14, 0, 4),
- /* 1100 */ V(5, 13, 3),
- /* 1101 */ V(5, 13, 3),
- /* 1110 */ V(13, 5, 3),
- /* 1111 */ V(13, 5, 3),
-
- /* 0000 1000 ... */
- /* 000 */ V(7, 12, 3), /* 232 */
- /* 001 */ V(12, 7, 3),
- /* 010 */ V(4, 13, 3),
- /* 011 */ V(8, 11, 3),
- /* 100 */ V(13, 4, 2),
- /* 101 */ V(13, 4, 2),
- /* 110 */ V(11, 8, 3),
- /* 111 */ V(9, 10, 3),
-
- /* 0000 1001 ... */
- /* 000 */ V(10, 9, 3), /* 240 */
- /* 001 */ V(6, 12, 3),
- /* 010 */ V(12, 6, 3),
- /* 011 */ V(3, 13, 3),
- /* 100 */ V(13, 3, 2),
- /* 101 */ V(13, 3, 2),
- /* 110 */ V(13, 2, 2),
- /* 111 */ V(13, 2, 2),
-
- /* 0000 1010 ... */
- /* 000 */ V(2, 13, 3), /* 248 */
- /* 001 */ V(0, 13, 3),
- /* 010 */ V(1, 13, 2),
- /* 011 */ V(1, 13, 2),
- /* 100 */ V(7, 11, 2),
- /* 101 */ V(7, 11, 2),
- /* 110 */ V(11, 7, 2),
- /* 111 */ V(11, 7, 2),
-
- /* 0000 1011 ... */
- /* 000 */ V(13, 1, 2), /* 256 */
- /* 001 */ V(13, 1, 2),
- /* 010 */ V(5, 12, 3),
- /* 011 */ V(13, 0, 3),
- /* 100 */ V(12, 5, 2),
- /* 101 */ V(12, 5, 2),
- /* 110 */ V(8, 10, 2),
- /* 111 */ V(8, 10, 2),
-
- /* 0000 1100 ... */
- /* 00 */ V(10, 8, 2), /* 264 */
- /* 01 */ V(4, 12, 2),
- /* 10 */ V(12, 4, 2),
- /* 11 */ V(6, 11, 2),
-
- /* 0000 1101 ... */
- /* 000 */ V(11, 6, 2), /* 268 */
- /* 001 */ V(11, 6, 2),
- /* 010 */ V(9, 9, 3),
- /* 011 */ V(0, 12, 3),
- /* 100 */ V(3, 12, 2),
- /* 101 */ V(3, 12, 2),
- /* 110 */ V(12, 3, 2),
- /* 111 */ V(12, 3, 2),
-
- /* 0000 1110 ... */
- /* 000 */ V(7, 10, 2), /* 276 */
- /* 001 */ V(7, 10, 2),
- /* 010 */ V(10, 7, 2),
- /* 011 */ V(10, 7, 2),
- /* 100 */ V(10, 6, 2),
- /* 101 */ V(10, 6, 2),
- /* 110 */ V(12, 0, 3),
- /* 111 */ V(0, 11, 3),
-
- /* 0000 1111 ... */
- /* 00 */ V(12, 2, 1), /* 284 */
- /* 01 */ V(12, 2, 1),
- /* 10 */ V(2, 12, 2),
- /* 11 */ V(5, 11, 2),
-
- /* 0001 0000 ... */
- /* 00 */ V(11, 5, 2), /* 288 */
- /* 01 */ V(1, 12, 2),
- /* 10 */ V(8, 9, 2),
- /* 11 */ V(9, 8, 2),
-
- /* 0001 0001 ... */
- /* 00 */ V(12, 1, 2), /* 292 */
- /* 01 */ V(4, 11, 2),
- /* 10 */ V(11, 4, 2),
- /* 11 */ V(6, 10, 2),
-
- /* 0001 0010 ... */
- /* 00 */ V(3, 11, 2), /* 296 */
- /* 01 */ V(7, 9, 2),
- /* 10 */ V(11, 3, 1),
- /* 11 */ V(11, 3, 1),
-
- /* 0001 0011 ... */
- /* 00 */ V(9, 7, 2), /* 300 */
- /* 01 */ V(8, 8, 2),
- /* 10 */ V(2, 11, 2),
- /* 11 */ V(5, 10, 2),
-
- /* 0001 0100 ... */
- /* 00 */ V(11, 2, 1), /* 304 */
- /* 01 */ V(11, 2, 1),
- /* 10 */ V(10, 5, 2),
- /* 11 */ V(1, 11, 2),
-
- /* 0001 0101 ... */
- /* 00 */ V(11, 1, 1), /* 308 */
- /* 01 */ V(11, 1, 1),
- /* 10 */ V(11, 0, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0001 0110 ... */
- /* 00 */ V(9, 6, 2), /* 312 */
- /* 01 */ V(4, 10, 2),
- /* 10 */ V(10, 4, 2),
- /* 11 */ V(7, 8, 2),
-
- /* 0001 0111 ... */
- /* 00 */ V(8, 7, 2), /* 316 */
- /* 01 */ V(3, 10, 2),
- /* 10 */ V(10, 3, 1),
- /* 11 */ V(10, 3, 1),
-
- /* 0001 1000 ... */
- /* 0 */ V(5, 9, 1), /* 320 */
- /* 1 */ V(9, 5, 1),
-
- /* 0001 1001 ... */
- /* 0 */ V(2, 10, 1), /* 322 */
- /* 1 */ V(10, 2, 1),
-
- /* 0001 1010 ... */
- /* 0 */ V(1, 10, 1), /* 324 */
- /* 1 */ V(10, 1, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(0, 10, 2), /* 326 */
- /* 01 */ V(10, 0, 2),
- /* 10 */ V(6, 8, 1),
- /* 11 */ V(6, 8, 1),
-
- /* 0001 1100 ... */
- /* 0 */ V(8, 6, 1), /* 330 */
- /* 1 */ V(4, 9, 1),
-
- /* 0001 1101 ... */
- /* 0 */ V(9, 4, 1), /* 332 */
- /* 1 */ V(3, 9, 1),
-
- /* 0001 1110 ... */
- /* 00 */ V(9, 3, 1), /* 334 */
- /* 01 */ V(9, 3, 1),
- /* 10 */ V(7, 7, 2),
- /* 11 */ V(0, 9, 2),
-
- /* 0001 1111 ... */
- /* 0 */ V(5, 8, 1), /* 338 */
- /* 1 */ V(8, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(2, 9, 1), /* 340 */
- /* 1 */ V(6, 7, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(7, 6, 1), /* 342 */
- /* 1 */ V(9, 2, 1),
-
- /* 0010 0011 ... */
- /* 0 */ V(1, 9, 1), /* 344 */
- /* 1 */ V(9, 0, 1),
-
- /* 0010 0100 ... */
- /* 0 */ V(4, 8, 1), /* 346 */
- /* 1 */ V(8, 4, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(5, 7, 1), /* 348 */
- /* 1 */ V(7, 5, 1),
-
- /* 0010 0110 ... */
- /* 0 */ V(3, 8, 1), /* 350 */
- /* 1 */ V(8, 3, 1),
-
- /* 0010 0111 ... */
- /* 0 */ V(6, 6, 1), /* 352 */
- /* 1 */ V(4, 7, 1),
-
- /* 0010 1100 ... */
- /* 0 */ V(7, 4, 1), /* 354 */
- /* 1 */ V(0, 8, 1),
-
- /* 0010 1101 ... */
- /* 0 */ V(8, 0, 1), /* 356 */
- /* 1 */ V(5, 6, 1),
-
- /* 0010 1110 ... */
- /* 0 */ V(6, 5, 1), /* 358 */
- /* 1 */ V(3, 7, 1),
-
- /* 0010 1111 ... */
- /* 0 */ V(7, 3, 1), /* 360 */
- /* 1 */ V(4, 6, 1),
-
- /* 0011 0110 ... */
- /* 0 */ V(0, 7, 1), /* 362 */
- /* 1 */ V(7, 0, 1),
-
- /* 0011 1110 ... */
- /* 0 */ V(0, 6, 1), /* 364 */
- /* 1 */ V(6, 0, 1),
-
- /* 0000 0000 0000 ... */
- /* 0 */ V(15, 15, 1), /* 366 */
- /* 1 */ V(14, 15, 1),
-
- /* 0000 0000 0001 ... */
- /* 0 */ V(15, 14, 1), /* 368 */
- /* 1 */ V(13, 15, 1),
-
- /* 0000 0000 0011 ... */
- /* 0 */ V(15, 13, 1), /* 370 */
- /* 1 */ V(12, 15, 1),
-
- /* 0000 0000 0100 ... */
- /* 0 */ V(15, 12, 1), /* 372 */
- /* 1 */ V(13, 14, 1),
-
- /* 0000 0000 0101 ... */
- /* 0 */ V(14, 13, 1), /* 374 */
- /* 1 */ V(11, 15, 1),
-
- /* 0000 0000 0111 ... */
- /* 0 */ V(12, 14, 1), /* 376 */
- /* 1 */ V(14, 12, 1),
-
- /* 0000 0001 1111 ... */
- /* 0 */ V(10, 14, 1), /* 378 */
- /* 1 */ V(0, 15, 1)
+union huffpair const hufftab15[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 4),
+ /* 0100 */ PTR(80, 4),
+ /* 0101 */ PTR(96, 3),
+ /* 0110 */ PTR(104, 3),
+ /* 0111 */ PTR(112, 2),
+ /* 1000 */ PTR(116, 1),
+ /* 1001 */ PTR(118, 1),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 4),
+ /* 1101 */ V(1, 0, 4),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(120, 4), /* 16 */
+ /* 0001 */ PTR(136, 4),
+ /* 0010 */ PTR(152, 4),
+ /* 0011 */ PTR(168, 4),
+ /* 0100 */ PTR(184, 4),
+ /* 0101 */ PTR(200, 3),
+ /* 0110 */ PTR(208, 3),
+ /* 0111 */ PTR(216, 4),
+ /* 1000 */ PTR(232, 3),
+ /* 1001 */ PTR(240, 3),
+ /* 1010 */ PTR(248, 3),
+ /* 1011 */ PTR(256, 3),
+ /* 1100 */ PTR(264, 2),
+ /* 1101 */ PTR(268, 3),
+ /* 1110 */ PTR(276, 3),
+ /* 1111 */ PTR(284, 2),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(288, 2), /* 32 */
+ /* 0001 */ PTR(292, 2),
+ /* 0010 */ PTR(296, 2),
+ /* 0011 */ PTR(300, 2),
+ /* 0100 */ PTR(304, 2),
+ /* 0101 */ PTR(308, 2),
+ /* 0110 */ PTR(312, 2),
+ /* 0111 */ PTR(316, 2),
+ /* 1000 */ PTR(320, 1),
+ /* 1001 */ PTR(322, 1),
+ /* 1010 */ PTR(324, 1),
+ /* 1011 */ PTR(326, 2),
+ /* 1100 */ PTR(330, 1),
+ /* 1101 */ PTR(332, 1),
+ /* 1110 */ PTR(334, 2),
+ /* 1111 */ PTR(338, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(340, 1), /* 48 */
+ /* 0001 */ PTR(342, 1),
+ /* 0010 */ V(9, 1, 4),
+ /* 0011 */ PTR(344, 1),
+ /* 0100 */ PTR(346, 1),
+ /* 0101 */ PTR(348, 1),
+ /* 0110 */ PTR(350, 1),
+ /* 0111 */ PTR(352, 1),
+ /* 1000 */ V(2, 8, 4),
+ /* 1001 */ V(8, 2, 4),
+ /* 1010 */ V(1, 8, 4),
+ /* 1011 */ V(8, 1, 4),
+ /* 1100 */ PTR(354, 1),
+ /* 1101 */ PTR(356, 1),
+ /* 1110 */ PTR(358, 1),
+ /* 1111 */ PTR(360, 1),
+
+ /* 0011 ... */
+ /* 0000 */ V(2, 7, 4), /* 64 */
+ /* 0001 */ V(7, 2, 4),
+ /* 0010 */ V(6, 4, 4),
+ /* 0011 */ V(1, 7, 4),
+ /* 0100 */ V(5, 5, 4),
+ /* 0101 */ V(7, 1, 4),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ V(3, 6, 4),
+ /* 1000 */ V(6, 3, 4),
+ /* 1001 */ V(4, 5, 4),
+ /* 1010 */ V(5, 4, 4),
+ /* 1011 */ V(2, 6, 4),
+ /* 1100 */ V(6, 2, 4),
+ /* 1101 */ V(1, 6, 4),
+ /* 1110 */ PTR(364, 1),
+ /* 1111 */ V(3, 5, 4),
+
+ /* 0100 ... */
+ /* 0000 */ V(6, 1, 3), /* 80 */
+ /* 0001 */ V(6, 1, 3),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ V(4, 4, 4),
+ /* 0100 */ V(2, 5, 3),
+ /* 0101 */ V(2, 5, 3),
+ /* 0110 */ V(5, 2, 3),
+ /* 0111 */ V(5, 2, 3),
+ /* 1000 */ V(1, 5, 3),
+ /* 1001 */ V(1, 5, 3),
+ /* 1010 */ V(5, 1, 3),
+ /* 1011 */ V(5, 1, 3),
+ /* 1100 */ V(0, 5, 4),
+ /* 1101 */ V(5, 0, 4),
+ /* 1110 */ V(3, 4, 3),
+ /* 1111 */ V(3, 4, 3),
+
+ /* 0101 ... */
+ /* 000 */ V(4, 3, 3), /* 96 */
+ /* 001 */ V(2, 4, 3),
+ /* 010 */ V(4, 2, 3),
+ /* 011 */ V(3, 3, 3),
+ /* 100 */ V(4, 1, 2),
+ /* 101 */ V(4, 1, 2),
+ /* 110 */ V(1, 4, 3),
+ /* 111 */ V(0, 4, 3),
+
+ /* 0110 ... */
+ /* 000 */ V(2, 3, 2), /* 104 */
+ /* 001 */ V(2, 3, 2),
+ /* 010 */ V(3, 2, 2),
+ /* 011 */ V(3, 2, 2),
+ /* 100 */ V(4, 0, 3),
+ /* 101 */ V(0, 3, 3),
+ /* 110 */ V(1, 3, 2),
+ /* 111 */ V(1, 3, 2),
+
+ /* 0111 ... */
+ /* 00 */ V(3, 1, 2), /* 112 */
+ /* 01 */ V(3, 0, 2),
+ /* 10 */ V(2, 2, 1),
+ /* 11 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(1, 2, 1), /* 116 */
+ /* 1 */ V(2, 1, 1),
+
+ /* 1001 ... */
+ /* 0 */ V(0, 2, 1), /* 118 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(366, 1), /* 120 */
+ /* 0001 */ PTR(368, 1),
+ /* 0010 */ V(14, 14, 4),
+ /* 0011 */ PTR(370, 1),
+ /* 0100 */ PTR(372, 1),
+ /* 0101 */ PTR(374, 1),
+ /* 0110 */ V(15, 11, 4),
+ /* 0111 */ PTR(376, 1),
+ /* 1000 */ V(13, 13, 4),
+ /* 1001 */ V(10, 15, 4),
+ /* 1010 */ V(15, 10, 4),
+ /* 1011 */ V(11, 14, 4),
+ /* 1100 */ V(14, 11, 4),
+ /* 1101 */ V(12, 13, 4),
+ /* 1110 */ V(13, 12, 4),
+ /* 1111 */ V(9, 15, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 9, 4), /* 136 */
+ /* 0001 */ V(14, 10, 4),
+ /* 0010 */ V(11, 13, 4),
+ /* 0011 */ V(13, 11, 4),
+ /* 0100 */ V(8, 15, 4),
+ /* 0101 */ V(15, 8, 4),
+ /* 0110 */ V(12, 12, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(14, 9, 4),
+ /* 1001 */ V(7, 15, 4),
+ /* 1010 */ V(15, 7, 4),
+ /* 1011 */ V(10, 13, 4),
+ /* 1100 */ V(13, 10, 4),
+ /* 1101 */ V(11, 12, 4),
+ /* 1110 */ V(6, 15, 4),
+ /* 1111 */ PTR(378, 1),
+
+ /* 0000 0010 ... */
+ /* 0000 */ V(12, 11, 3), /* 152 */
+ /* 0001 */ V(12, 11, 3),
+ /* 0010 */ V(15, 6, 3),
+ /* 0011 */ V(15, 6, 3),
+ /* 0100 */ V(8, 14, 4),
+ /* 0101 */ V(14, 8, 4),
+ /* 0110 */ V(5, 15, 4),
+ /* 0111 */ V(9, 13, 4),
+ /* 1000 */ V(15, 5, 3),
+ /* 1001 */ V(15, 5, 3),
+ /* 1010 */ V(7, 14, 3),
+ /* 1011 */ V(7, 14, 3),
+ /* 1100 */ V(14, 7, 3),
+ /* 1101 */ V(14, 7, 3),
+ /* 1110 */ V(10, 12, 3),
+ /* 1111 */ V(10, 12, 3),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(12, 10, 3), /* 168 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(13, 9, 4),
+ /* 0101 */ V(8, 13, 4),
+ /* 0110 */ V(4, 15, 3),
+ /* 0111 */ V(4, 15, 3),
+ /* 1000 */ V(15, 4, 3),
+ /* 1001 */ V(15, 4, 3),
+ /* 1010 */ V(3, 15, 3),
+ /* 1011 */ V(3, 15, 3),
+ /* 1100 */ V(15, 3, 3),
+ /* 1101 */ V(15, 3, 3),
+ /* 1110 */ V(13, 8, 3),
+ /* 1111 */ V(13, 8, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(14, 6, 3), /* 184 */
+ /* 0001 */ V(14, 6, 3),
+ /* 0010 */ V(2, 15, 3),
+ /* 0011 */ V(2, 15, 3),
+ /* 0100 */ V(15, 2, 3),
+ /* 0101 */ V(15, 2, 3),
+ /* 0110 */ V(6, 14, 4),
+ /* 0111 */ V(15, 0, 4),
+ /* 1000 */ V(1, 15, 3),
+ /* 1001 */ V(1, 15, 3),
+ /* 1010 */ V(15, 1, 3),
+ /* 1011 */ V(15, 1, 3),
+ /* 1100 */ V(9, 12, 3),
+ /* 1101 */ V(9, 12, 3),
+ /* 1110 */ V(12, 9, 3),
+ /* 1111 */ V(12, 9, 3),
+
+ /* 0000 0101 ... */
+ /* 000 */ V(5, 14, 3), /* 200 */
+ /* 001 */ V(10, 11, 3),
+ /* 010 */ V(11, 10, 3),
+ /* 011 */ V(14, 5, 3),
+ /* 100 */ V(7, 13, 3),
+ /* 101 */ V(13, 7, 3),
+ /* 110 */ V(4, 14, 3),
+ /* 111 */ V(14, 4, 3),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(8, 12, 3), /* 208 */
+ /* 001 */ V(12, 8, 3),
+ /* 010 */ V(3, 14, 3),
+ /* 011 */ V(6, 13, 3),
+ /* 100 */ V(13, 6, 3),
+ /* 101 */ V(14, 3, 3),
+ /* 110 */ V(9, 11, 3),
+ /* 111 */ V(11, 9, 3),
+
+ /* 0000 0111 ... */
+ /* 0000 */ V(2, 14, 3), /* 216 */
+ /* 0001 */ V(2, 14, 3),
+ /* 0010 */ V(10, 10, 3),
+ /* 0011 */ V(10, 10, 3),
+ /* 0100 */ V(14, 2, 3),
+ /* 0101 */ V(14, 2, 3),
+ /* 0110 */ V(1, 14, 3),
+ /* 0111 */ V(1, 14, 3),
+ /* 1000 */ V(14, 1, 3),
+ /* 1001 */ V(14, 1, 3),
+ /* 1010 */ V(0, 14, 4),
+ /* 1011 */ V(14, 0, 4),
+ /* 1100 */ V(5, 13, 3),
+ /* 1101 */ V(5, 13, 3),
+ /* 1110 */ V(13, 5, 3),
+ /* 1111 */ V(13, 5, 3),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(7, 12, 3), /* 232 */
+ /* 001 */ V(12, 7, 3),
+ /* 010 */ V(4, 13, 3),
+ /* 011 */ V(8, 11, 3),
+ /* 100 */ V(13, 4, 2),
+ /* 101 */ V(13, 4, 2),
+ /* 110 */ V(11, 8, 3),
+ /* 111 */ V(9, 10, 3),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(10, 9, 3), /* 240 */
+ /* 001 */ V(6, 12, 3),
+ /* 010 */ V(12, 6, 3),
+ /* 011 */ V(3, 13, 3),
+ /* 100 */ V(13, 3, 2),
+ /* 101 */ V(13, 3, 2),
+ /* 110 */ V(13, 2, 2),
+ /* 111 */ V(13, 2, 2),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 13, 3), /* 248 */
+ /* 001 */ V(0, 13, 3),
+ /* 010 */ V(1, 13, 2),
+ /* 011 */ V(1, 13, 2),
+ /* 100 */ V(7, 11, 2),
+ /* 101 */ V(7, 11, 2),
+ /* 110 */ V(11, 7, 2),
+ /* 111 */ V(11, 7, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(13, 1, 2), /* 256 */
+ /* 001 */ V(13, 1, 2),
+ /* 010 */ V(5, 12, 3),
+ /* 011 */ V(13, 0, 3),
+ /* 100 */ V(12, 5, 2),
+ /* 101 */ V(12, 5, 2),
+ /* 110 */ V(8, 10, 2),
+ /* 111 */ V(8, 10, 2),
+
+ /* 0000 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 264 */
+ /* 01 */ V(4, 12, 2),
+ /* 10 */ V(12, 4, 2),
+ /* 11 */ V(6, 11, 2),
+
+ /* 0000 1101 ... */
+ /* 000 */ V(11, 6, 2), /* 268 */
+ /* 001 */ V(11, 6, 2),
+ /* 010 */ V(9, 9, 3),
+ /* 011 */ V(0, 12, 3),
+ /* 100 */ V(3, 12, 2),
+ /* 101 */ V(3, 12, 2),
+ /* 110 */ V(12, 3, 2),
+ /* 111 */ V(12, 3, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 10, 2), /* 276 */
+ /* 001 */ V(7, 10, 2),
+ /* 010 */ V(10, 7, 2),
+ /* 011 */ V(10, 7, 2),
+ /* 100 */ V(10, 6, 2),
+ /* 101 */ V(10, 6, 2),
+ /* 110 */ V(12, 0, 3),
+ /* 111 */ V(0, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 00 */ V(12, 2, 1), /* 284 */
+ /* 01 */ V(12, 2, 1),
+ /* 10 */ V(2, 12, 2),
+ /* 11 */ V(5, 11, 2),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(11, 5, 2), /* 288 */
+ /* 01 */ V(1, 12, 2),
+ /* 10 */ V(8, 9, 2),
+ /* 11 */ V(9, 8, 2),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(12, 1, 2), /* 292 */
+ /* 01 */ V(4, 11, 2),
+ /* 10 */ V(11, 4, 2),
+ /* 11 */ V(6, 10, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(3, 11, 2), /* 296 */
+ /* 01 */ V(7, 9, 2),
+ /* 10 */ V(11, 3, 1),
+ /* 11 */ V(11, 3, 1),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(9, 7, 2), /* 300 */
+ /* 01 */ V(8, 8, 2),
+ /* 10 */ V(2, 11, 2),
+ /* 11 */ V(5, 10, 2),
+
+ /* 0001 0100 ... */
+ /* 00 */ V(11, 2, 1), /* 304 */
+ /* 01 */ V(11, 2, 1),
+ /* 10 */ V(10, 5, 2),
+ /* 11 */ V(1, 11, 2),
+
+ /* 0001 0101 ... */
+ /* 00 */ V(11, 1, 1), /* 308 */
+ /* 01 */ V(11, 1, 1),
+ /* 10 */ V(11, 0, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0001 0110 ... */
+ /* 00 */ V(9, 6, 2), /* 312 */
+ /* 01 */ V(4, 10, 2),
+ /* 10 */ V(10, 4, 2),
+ /* 11 */ V(7, 8, 2),
+
+ /* 0001 0111 ... */
+ /* 00 */ V(8, 7, 2), /* 316 */
+ /* 01 */ V(3, 10, 2),
+ /* 10 */ V(10, 3, 1),
+ /* 11 */ V(10, 3, 1),
+
+ /* 0001 1000 ... */
+ /* 0 */ V(5, 9, 1), /* 320 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(2, 10, 1), /* 322 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(1, 10, 1), /* 324 */
+ /* 1 */ V(10, 1, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(0, 10, 2), /* 326 */
+ /* 01 */ V(10, 0, 2),
+ /* 10 */ V(6, 8, 1),
+ /* 11 */ V(6, 8, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(8, 6, 1), /* 330 */
+ /* 1 */ V(4, 9, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(9, 4, 1), /* 332 */
+ /* 1 */ V(3, 9, 1),
+
+ /* 0001 1110 ... */
+ /* 00 */ V(9, 3, 1), /* 334 */
+ /* 01 */ V(9, 3, 1),
+ /* 10 */ V(7, 7, 2),
+ /* 11 */ V(0, 9, 2),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(5, 8, 1), /* 338 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(2, 9, 1), /* 340 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(7, 6, 1), /* 342 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0010 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 344 */
+ /* 1 */ V(9, 0, 1),
+
+ /* 0010 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 346 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 348 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0010 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 350 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0010 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 352 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0010 1100 ... */
+ /* 0 */ V(7, 4, 1), /* 354 */
+ /* 1 */ V(0, 8, 1),
+
+ /* 0010 1101 ... */
+ /* 0 */ V(8, 0, 1), /* 356 */
+ /* 1 */ V(5, 6, 1),
+
+ /* 0010 1110 ... */
+ /* 0 */ V(6, 5, 1), /* 358 */
+ /* 1 */ V(3, 7, 1),
+
+ /* 0010 1111 ... */
+ /* 0 */ V(7, 3, 1), /* 360 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0011 0110 ... */
+ /* 0 */ V(0, 7, 1), /* 362 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0011 1110 ... */
+ /* 0 */ V(0, 6, 1), /* 364 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0 */ V(15, 15, 1), /* 366 */
+ /* 1 */ V(14, 15, 1),
+
+ /* 0000 0000 0001 ... */
+ /* 0 */ V(15, 14, 1), /* 368 */
+ /* 1 */ V(13, 15, 1),
+
+ /* 0000 0000 0011 ... */
+ /* 0 */ V(15, 13, 1), /* 370 */
+ /* 1 */ V(12, 15, 1),
+
+ /* 0000 0000 0100 ... */
+ /* 0 */ V(15, 12, 1), /* 372 */
+ /* 1 */ V(13, 14, 1),
+
+ /* 0000 0000 0101 ... */
+ /* 0 */ V(14, 13, 1), /* 374 */
+ /* 1 */ V(11, 15, 1),
+
+ /* 0000 0000 0111 ... */
+ /* 0 */ V(12, 14, 1), /* 376 */
+ /* 1 */ V(14, 12, 1),
+
+ /* 0000 0001 1111 ... */
+ /* 0 */ V(10, 14, 1), /* 378 */
+ /* 1 */ V(0, 15, 1)
};
static
-union huffpair const hufftab16[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ PTR(64, 2),
- /* 0100 */ V(1, 1, 4),
- /* 0101 */ V(0, 1, 4),
- /* 0110 */ V(1, 0, 3),
- /* 0111 */ V(1, 0, 3),
- /* 1000 */ V(0, 0, 1),
- /* 1001 */ V(0, 0, 1),
- /* 1010 */ V(0, 0, 1),
- /* 1011 */ V(0, 0, 1),
- /* 1100 */ V(0, 0, 1),
- /* 1101 */ V(0, 0, 1),
- /* 1110 */ V(0, 0, 1),
- /* 1111 */ V(0, 0, 1),
-
- /* 0000 ... */
- /* 0000 */ PTR(68, 3), /* 16 */
- /* 0001 */ PTR(76, 3),
- /* 0010 */ PTR(84, 2),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(88, 2),
- /* 0101 */ PTR(92, 1),
- /* 0110 */ PTR(94, 4),
- /* 0111 */ V(15, 2, 4),
- /* 1000 */ PTR(110, 1),
- /* 1001 */ V(1, 15, 4),
- /* 1010 */ V(15, 1, 4),
- /* 1011 */ PTR(112, 4),
- /* 1100 */ PTR(128, 4),
- /* 1101 */ PTR(144, 4),
- /* 1110 */ PTR(160, 4),
- /* 1111 */ PTR(176, 4),
-
- /* 0001 ... */
- /* 0000 */ PTR(192, 4), /* 32 */
- /* 0001 */ PTR(208, 3),
- /* 0010 */ PTR(216, 3),
- /* 0011 */ PTR(224, 3),
- /* 0100 */ PTR(232, 3),
- /* 0101 */ PTR(240, 3),
- /* 0110 */ PTR(248, 3),
- /* 0111 */ PTR(256, 3),
- /* 1000 */ PTR(264, 2),
- /* 1001 */ PTR(268, 2),
- /* 1010 */ PTR(272, 1),
- /* 1011 */ PTR(274, 2),
- /* 1100 */ PTR(278, 2),
- /* 1101 */ PTR(282, 1),
- /* 1110 */ V(5, 1, 4),
- /* 1111 */ PTR(284, 1),
-
- /* 0010 ... */
- /* 0000 */ PTR(286, 1), /* 48 */
- /* 0001 */ PTR(288, 1),
- /* 0010 */ PTR(290, 1),
- /* 0011 */ V(1, 4, 4),
- /* 0100 */ V(4, 1, 4),
- /* 0101 */ PTR(292, 1),
- /* 0110 */ V(2, 3, 4),
- /* 0111 */ V(3, 2, 4),
- /* 1000 */ V(1, 3, 3),
- /* 1001 */ V(1, 3, 3),
- /* 1010 */ V(3, 1, 3),
- /* 1011 */ V(3, 1, 3),
- /* 1100 */ V(0, 3, 4),
- /* 1101 */ V(3, 0, 4),
- /* 1110 */ V(2, 2, 3),
- /* 1111 */ V(2, 2, 3),
-
- /* 0011 ... */
- /* 00 */ V(1, 2, 2), /* 64 */
- /* 01 */ V(2, 1, 2),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0000 0000 ... */
- /* 000 */ V(14, 15, 3), /* 68 */
- /* 001 */ V(15, 14, 3),
- /* 010 */ V(13, 15, 3),
- /* 011 */ V(15, 13, 3),
- /* 100 */ V(12, 15, 3),
- /* 101 */ V(15, 12, 3),
- /* 110 */ V(11, 15, 3),
- /* 111 */ V(15, 11, 3),
-
- /* 0000 0001 ... */
- /* 000 */ V(10, 15, 2), /* 76 */
- /* 001 */ V(10, 15, 2),
- /* 010 */ V(15, 10, 3),
- /* 011 */ V(9, 15, 3),
- /* 100 */ V(15, 9, 3),
- /* 101 */ V(15, 8, 3),
- /* 110 */ V(8, 15, 2),
- /* 111 */ V(8, 15, 2),
-
- /* 0000 0010 ... */
- /* 00 */ V(7, 15, 2), /* 84 */
- /* 01 */ V(15, 7, 2),
- /* 10 */ V(6, 15, 2),
- /* 11 */ V(15, 6, 2),
-
- /* 0000 0100 ... */
- /* 00 */ V(5, 15, 2), /* 88 */
- /* 01 */ V(15, 5, 2),
- /* 10 */ V(4, 15, 1),
- /* 11 */ V(4, 15, 1),
-
- /* 0000 0101 ... */
- /* 0 */ V(15, 4, 1), /* 92 */
- /* 1 */ V(15, 3, 1),
-
- /* 0000 0110 ... */
- /* 0000 */ V(15, 0, 1), /* 94 */
- /* 0001 */ V(15, 0, 1),
- /* 0010 */ V(15, 0, 1),
- /* 0011 */ V(15, 0, 1),
- /* 0100 */ V(15, 0, 1),
- /* 0101 */ V(15, 0, 1),
- /* 0110 */ V(15, 0, 1),
- /* 0111 */ V(15, 0, 1),
- /* 1000 */ V(3, 15, 2),
- /* 1001 */ V(3, 15, 2),
- /* 1010 */ V(3, 15, 2),
- /* 1011 */ V(3, 15, 2),
- /* 1100 */ PTR(294, 4),
- /* 1101 */ PTR(310, 3),
- /* 1110 */ PTR(318, 3),
- /* 1111 */ PTR(326, 3),
-
- /* 0000 1000 ... */
- /* 0 */ V(2, 15, 1), /* 110 */
- /* 1 */ V(0, 15, 1),
-
- /* 0000 1011 ... */
- /* 0000 */ PTR(334, 2), /* 112 */
- /* 0001 */ PTR(338, 2),
- /* 0010 */ PTR(342, 2),
- /* 0011 */ PTR(346, 1),
- /* 0100 */ PTR(348, 2),
- /* 0101 */ PTR(352, 2),
- /* 0110 */ PTR(356, 1),
- /* 0111 */ PTR(358, 2),
- /* 1000 */ PTR(362, 2),
- /* 1001 */ PTR(366, 2),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ V(14, 3, 4),
- /* 1100 */ PTR(374, 1),
- /* 1101 */ PTR(376, 1),
- /* 1110 */ PTR(378, 1),
- /* 1111 */ PTR(380, 1),
-
- /* 0000 1100 ... */
- /* 0000 */ PTR(382, 1), /* 128 */
- /* 0001 */ PTR(384, 1),
- /* 0010 */ PTR(386, 1),
- /* 0011 */ V(0, 13, 4),
- /* 0100 */ PTR(388, 1),
- /* 0101 */ PTR(390, 1),
- /* 0110 */ PTR(392, 1),
- /* 0111 */ V(3, 12, 4),
- /* 1000 */ PTR(394, 1),
- /* 1001 */ V(1, 12, 4),
- /* 1010 */ V(12, 0, 4),
- /* 1011 */ PTR(396, 1),
- /* 1100 */ V(14, 2, 3),
- /* 1101 */ V(14, 2, 3),
- /* 1110 */ V(2, 14, 4),
- /* 1111 */ V(1, 14, 4),
-
- /* 0000 1101 ... */
- /* 0000 */ V(13, 3, 4), /* 144 */
- /* 0001 */ V(2, 13, 4),
- /* 0010 */ V(13, 2, 4),
- /* 0011 */ V(13, 1, 4),
- /* 0100 */ V(3, 11, 4),
- /* 0101 */ PTR(398, 1),
- /* 0110 */ V(1, 13, 3),
- /* 0111 */ V(1, 13, 3),
- /* 1000 */ V(12, 4, 4),
- /* 1001 */ V(6, 11, 4),
- /* 1010 */ V(12, 3, 4),
- /* 1011 */ V(10, 7, 4),
- /* 1100 */ V(2, 12, 3),
- /* 1101 */ V(2, 12, 3),
- /* 1110 */ V(12, 2, 4),
- /* 1111 */ V(11, 5, 4),
-
- /* 0000 1110 ... */
- /* 0000 */ V(12, 1, 4), /* 160 */
- /* 0001 */ V(0, 12, 4),
- /* 0010 */ V(4, 11, 4),
- /* 0011 */ V(11, 4, 4),
- /* 0100 */ V(6, 10, 4),
- /* 0101 */ V(10, 6, 4),
- /* 0110 */ V(11, 3, 3),
- /* 0111 */ V(11, 3, 3),
- /* 1000 */ V(5, 10, 4),
- /* 1001 */ V(10, 5, 4),
- /* 1010 */ V(2, 11, 3),
- /* 1011 */ V(2, 11, 3),
- /* 1100 */ V(11, 2, 3),
- /* 1101 */ V(11, 2, 3),
- /* 1110 */ V(1, 11, 3),
- /* 1111 */ V(1, 11, 3),
-
- /* 0000 1111 ... */
- /* 0000 */ V(11, 1, 3), /* 176 */
- /* 0001 */ V(11, 1, 3),
- /* 0010 */ V(0, 11, 4),
- /* 0011 */ V(11, 0, 4),
- /* 0100 */ V(6, 9, 4),
- /* 0101 */ V(9, 6, 4),
- /* 0110 */ V(4, 10, 4),
- /* 0111 */ V(10, 4, 4),
- /* 1000 */ V(7, 8, 4),
- /* 1001 */ V(8, 7, 4),
- /* 1010 */ V(10, 3, 3),
- /* 1011 */ V(10, 3, 3),
- /* 1100 */ V(3, 10, 4),
- /* 1101 */ V(5, 9, 4),
- /* 1110 */ V(2, 10, 3),
- /* 1111 */ V(2, 10, 3),
-
- /* 0001 0000 ... */
- /* 0000 */ V(9, 5, 4), /* 192 */
- /* 0001 */ V(6, 8, 4),
- /* 0010 */ V(10, 1, 3),
- /* 0011 */ V(10, 1, 3),
- /* 0100 */ V(8, 6, 4),
- /* 0101 */ V(7, 7, 4),
- /* 0110 */ V(9, 4, 3),
- /* 0111 */ V(9, 4, 3),
- /* 1000 */ V(4, 9, 4),
- /* 1001 */ V(5, 7, 4),
- /* 1010 */ V(6, 7, 3),
- /* 1011 */ V(6, 7, 3),
- /* 1100 */ V(10, 2, 2),
- /* 1101 */ V(10, 2, 2),
- /* 1110 */ V(10, 2, 2),
- /* 1111 */ V(10, 2, 2),
-
- /* 0001 0001 ... */
- /* 000 */ V(1, 10, 2), /* 208 */
- /* 001 */ V(1, 10, 2),
- /* 010 */ V(0, 10, 3),
- /* 011 */ V(10, 0, 3),
- /* 100 */ V(3, 9, 3),
- /* 101 */ V(9, 3, 3),
- /* 110 */ V(5, 8, 3),
- /* 111 */ V(8, 5, 3),
-
- /* 0001 0010 ... */
- /* 000 */ V(2, 9, 2), /* 216 */
- /* 001 */ V(2, 9, 2),
- /* 010 */ V(9, 2, 2),
- /* 011 */ V(9, 2, 2),
- /* 100 */ V(7, 6, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(1, 9, 2),
- /* 111 */ V(1, 9, 2),
-
- /* 0001 0011 ... */
- /* 000 */ V(9, 1, 2), /* 224 */
- /* 001 */ V(9, 1, 2),
- /* 010 */ V(9, 0, 3),
- /* 011 */ V(4, 8, 3),
- /* 100 */ V(8, 4, 3),
- /* 101 */ V(7, 5, 3),
- /* 110 */ V(3, 8, 3),
- /* 111 */ V(8, 3, 3),
-
- /* 0001 0100 ... */
- /* 000 */ V(6, 6, 3), /* 232 */
- /* 001 */ V(2, 8, 3),
- /* 010 */ V(8, 2, 2),
- /* 011 */ V(8, 2, 2),
- /* 100 */ V(4, 7, 3),
- /* 101 */ V(7, 4, 3),
- /* 110 */ V(1, 8, 2),
- /* 111 */ V(1, 8, 2),
-
- /* 0001 0101 ... */
- /* 000 */ V(8, 1, 2), /* 240 */
- /* 001 */ V(8, 1, 2),
- /* 010 */ V(8, 0, 2),
- /* 011 */ V(8, 0, 2),
- /* 100 */ V(0, 8, 3),
- /* 101 */ V(5, 6, 3),
- /* 110 */ V(3, 7, 2),
- /* 111 */ V(3, 7, 2),
-
- /* 0001 0110 ... */
- /* 000 */ V(7, 3, 2), /* 248 */
- /* 001 */ V(7, 3, 2),
- /* 010 */ V(6, 5, 3),
- /* 011 */ V(4, 6, 3),
- /* 100 */ V(2, 7, 2),
- /* 101 */ V(2, 7, 2),
- /* 110 */ V(7, 2, 2),
- /* 111 */ V(7, 2, 2),
-
- /* 0001 0111 ... */
- /* 000 */ V(6, 4, 3), /* 256 */
- /* 001 */ V(5, 5, 3),
- /* 010 */ V(0, 7, 2),
- /* 011 */ V(0, 7, 2),
- /* 100 */ V(1, 7, 1),
- /* 101 */ V(1, 7, 1),
- /* 110 */ V(1, 7, 1),
- /* 111 */ V(1, 7, 1),
-
- /* 0001 1000 ... */
- /* 00 */ V(7, 1, 1), /* 264 */
- /* 01 */ V(7, 1, 1),
- /* 10 */ V(7, 0, 2),
- /* 11 */ V(3, 6, 2),
-
- /* 0001 1001 ... */
- /* 00 */ V(6, 3, 2), /* 268 */
- /* 01 */ V(4, 5, 2),
- /* 10 */ V(5, 4, 2),
- /* 11 */ V(2, 6, 2),
-
- /* 0001 1010 ... */
- /* 0 */ V(6, 2, 1), /* 272 */
- /* 1 */ V(1, 6, 1),
-
- /* 0001 1011 ... */
- /* 00 */ V(6, 1, 1), /* 274 */
- /* 01 */ V(6, 1, 1),
- /* 10 */ V(0, 6, 2),
- /* 11 */ V(6, 0, 2),
-
- /* 0001 1100 ... */
- /* 00 */ V(5, 3, 1), /* 278 */
- /* 01 */ V(5, 3, 1),
- /* 10 */ V(3, 5, 2),
- /* 11 */ V(4, 4, 2),
-
- /* 0001 1101 ... */
- /* 0 */ V(2, 5, 1), /* 282 */
- /* 1 */ V(5, 2, 1),
-
- /* 0001 1111 ... */
- /* 0 */ V(1, 5, 1), /* 284 */
- /* 1 */ V(0, 5, 1),
-
- /* 0010 0000 ... */
- /* 0 */ V(3, 4, 1), /* 286 */
- /* 1 */ V(4, 3, 1),
-
- /* 0010 0001 ... */
- /* 0 */ V(5, 0, 1), /* 288 */
- /* 1 */ V(2, 4, 1),
-
- /* 0010 0010 ... */
- /* 0 */ V(4, 2, 1), /* 290 */
- /* 1 */ V(3, 3, 1),
-
- /* 0010 0101 ... */
- /* 0 */ V(0, 4, 1), /* 292 */
- /* 1 */ V(4, 0, 1),
-
- /* 0000 0110 1100 ... */
- /* 0000 */ V(12, 14, 4), /* 294 */
- /* 0001 */ PTR(400, 1),
- /* 0010 */ V(13, 14, 3),
- /* 0011 */ V(13, 14, 3),
- /* 0100 */ V(14, 9, 3),
- /* 0101 */ V(14, 9, 3),
- /* 0110 */ V(14, 10, 4),
- /* 0111 */ V(13, 9, 4),
- /* 1000 */ V(14, 14, 2),
- /* 1001 */ V(14, 14, 2),
- /* 1010 */ V(14, 14, 2),
- /* 1011 */ V(14, 14, 2),
- /* 1100 */ V(14, 13, 3),
- /* 1101 */ V(14, 13, 3),
- /* 1110 */ V(14, 11, 3),
- /* 1111 */ V(14, 11, 3),
-
- /* 0000 0110 1101 ... */
- /* 000 */ V(11, 14, 2), /* 310 */
- /* 001 */ V(11, 14, 2),
- /* 010 */ V(12, 13, 2),
- /* 011 */ V(12, 13, 2),
- /* 100 */ V(13, 12, 3),
- /* 101 */ V(13, 11, 3),
- /* 110 */ V(10, 14, 2),
- /* 111 */ V(10, 14, 2),
-
- /* 0000 0110 1110 ... */
- /* 000 */ V(12, 12, 2), /* 318 */
- /* 001 */ V(12, 12, 2),
- /* 010 */ V(10, 13, 3),
- /* 011 */ V(13, 10, 3),
- /* 100 */ V(7, 14, 3),
- /* 101 */ V(10, 12, 3),
- /* 110 */ V(12, 10, 2),
- /* 111 */ V(12, 10, 2),
-
- /* 0000 0110 1111 ... */
- /* 000 */ V(12, 9, 3), /* 326 */
- /* 001 */ V(7, 13, 3),
- /* 010 */ V(5, 14, 2),
- /* 011 */ V(5, 14, 2),
- /* 100 */ V(11, 13, 1),
- /* 101 */ V(11, 13, 1),
- /* 110 */ V(11, 13, 1),
- /* 111 */ V(11, 13, 1),
-
- /* 0000 1011 0000 ... */
- /* 00 */ V(9, 14, 1), /* 334 */
- /* 01 */ V(9, 14, 1),
- /* 10 */ V(11, 12, 2),
- /* 11 */ V(12, 11, 2),
-
- /* 0000 1011 0001 ... */
- /* 00 */ V(8, 14, 2), /* 338 */
- /* 01 */ V(14, 8, 2),
- /* 10 */ V(9, 13, 2),
- /* 11 */ V(14, 7, 2),
-
- /* 0000 1011 0010 ... */
- /* 00 */ V(11, 11, 2), /* 342 */
- /* 01 */ V(8, 13, 2),
- /* 10 */ V(13, 8, 2),
- /* 11 */ V(6, 14, 2),
-
- /* 0000 1011 0011 ... */
- /* 0 */ V(14, 6, 1), /* 346 */
- /* 1 */ V(9, 12, 1),
-
- /* 0000 1011 0100 ... */
- /* 00 */ V(10, 11, 2), /* 348 */
- /* 01 */ V(11, 10, 2),
- /* 10 */ V(14, 5, 2),
- /* 11 */ V(13, 7, 2),
-
- /* 0000 1011 0101 ... */
- /* 00 */ V(4, 14, 1), /* 352 */
- /* 01 */ V(4, 14, 1),
- /* 10 */ V(14, 4, 2),
- /* 11 */ V(8, 12, 2),
-
- /* 0000 1011 0110 ... */
- /* 0 */ V(12, 8, 1), /* 356 */
- /* 1 */ V(3, 14, 1),
-
- /* 0000 1011 0111 ... */
- /* 00 */ V(6, 13, 1), /* 358 */
- /* 01 */ V(6, 13, 1),
- /* 10 */ V(13, 6, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0000 1011 1000 ... */
- /* 00 */ V(11, 9, 2), /* 362 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 1, 1),
- /* 11 */ V(14, 1, 1),
-
- /* 0000 1011 1001 ... */
- /* 00 */ V(13, 4, 1), /* 366 */
- /* 01 */ V(13, 4, 1),
- /* 10 */ V(11, 8, 2),
- /* 11 */ V(10, 9, 2),
-
- /* 0000 1011 1010 ... */
- /* 00 */ V(7, 11, 1), /* 370 */
- /* 01 */ V(7, 11, 1),
- /* 10 */ V(11, 7, 2),
- /* 11 */ V(13, 0, 2),
-
- /* 0000 1011 1100 ... */
- /* 0 */ V(0, 14, 1), /* 374 */
- /* 1 */ V(14, 0, 1),
-
- /* 0000 1011 1101 ... */
- /* 0 */ V(5, 13, 1), /* 376 */
- /* 1 */ V(13, 5, 1),
-
- /* 0000 1011 1110 ... */
- /* 0 */ V(7, 12, 1), /* 378 */
- /* 1 */ V(12, 7, 1),
-
- /* 0000 1011 1111 ... */
- /* 0 */ V(4, 13, 1), /* 380 */
- /* 1 */ V(8, 11, 1),
-
- /* 0000 1100 0000 ... */
- /* 0 */ V(9, 10, 1), /* 382 */
- /* 1 */ V(6, 12, 1),
-
- /* 0000 1100 0001 ... */
- /* 0 */ V(12, 6, 1), /* 384 */
- /* 1 */ V(3, 13, 1),
-
- /* 0000 1100 0010 ... */
- /* 0 */ V(5, 12, 1), /* 386 */
- /* 1 */ V(12, 5, 1),
-
- /* 0000 1100 0100 ... */
- /* 0 */ V(8, 10, 1), /* 388 */
- /* 1 */ V(10, 8, 1),
-
- /* 0000 1100 0101 ... */
- /* 0 */ V(9, 9, 1), /* 390 */
- /* 1 */ V(4, 12, 1),
-
- /* 0000 1100 0110 ... */
- /* 0 */ V(11, 6, 1), /* 392 */
- /* 1 */ V(7, 10, 1),
-
- /* 0000 1100 1000 ... */
- /* 0 */ V(5, 11, 1), /* 394 */
- /* 1 */ V(8, 9, 1),
-
- /* 0000 1100 1011 ... */
- /* 0 */ V(9, 8, 1), /* 396 */
- /* 1 */ V(7, 9, 1),
-
- /* 0000 1101 0101 ... */
- /* 0 */ V(9, 7, 1), /* 398 */
- /* 1 */ V(8, 8, 1),
-
- /* 0000 0110 1100 0001 ... */
- /* 0 */ V(14, 12, 1), /* 400 */
- /* 1 */ V(13, 13, 1)
+union huffpair const hufftab16[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 3), /* 16 */
+ /* 0001 */ PTR(76, 3),
+ /* 0010 */ PTR(84, 2),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(88, 2),
+ /* 0101 */ PTR(92, 1),
+ /* 0110 */ PTR(94, 4),
+ /* 0111 */ V(15, 2, 4),
+ /* 1000 */ PTR(110, 1),
+ /* 1001 */ V(1, 15, 4),
+ /* 1010 */ V(15, 1, 4),
+ /* 1011 */ PTR(112, 4),
+ /* 1100 */ PTR(128, 4),
+ /* 1101 */ PTR(144, 4),
+ /* 1110 */ PTR(160, 4),
+ /* 1111 */ PTR(176, 4),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(192, 4), /* 32 */
+ /* 0001 */ PTR(208, 3),
+ /* 0010 */ PTR(216, 3),
+ /* 0011 */ PTR(224, 3),
+ /* 0100 */ PTR(232, 3),
+ /* 0101 */ PTR(240, 3),
+ /* 0110 */ PTR(248, 3),
+ /* 0111 */ PTR(256, 3),
+ /* 1000 */ PTR(264, 2),
+ /* 1001 */ PTR(268, 2),
+ /* 1010 */ PTR(272, 1),
+ /* 1011 */ PTR(274, 2),
+ /* 1100 */ PTR(278, 2),
+ /* 1101 */ PTR(282, 1),
+ /* 1110 */ V(5, 1, 4),
+ /* 1111 */ PTR(284, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(286, 1), /* 48 */
+ /* 0001 */ PTR(288, 1),
+ /* 0010 */ PTR(290, 1),
+ /* 0011 */ V(1, 4, 4),
+ /* 0100 */ V(4, 1, 4),
+ /* 0101 */ PTR(292, 1),
+ /* 0110 */ V(2, 3, 4),
+ /* 0111 */ V(3, 2, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(0, 3, 4),
+ /* 1101 */ V(3, 0, 4),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(14, 15, 3), /* 68 */
+ /* 001 */ V(15, 14, 3),
+ /* 010 */ V(13, 15, 3),
+ /* 011 */ V(15, 13, 3),
+ /* 100 */ V(12, 15, 3),
+ /* 101 */ V(15, 12, 3),
+ /* 110 */ V(11, 15, 3),
+ /* 111 */ V(15, 11, 3),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(10, 15, 2), /* 76 */
+ /* 001 */ V(10, 15, 2),
+ /* 010 */ V(15, 10, 3),
+ /* 011 */ V(9, 15, 3),
+ /* 100 */ V(15, 9, 3),
+ /* 101 */ V(15, 8, 3),
+ /* 110 */ V(8, 15, 2),
+ /* 111 */ V(8, 15, 2),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(7, 15, 2), /* 84 */
+ /* 01 */ V(15, 7, 2),
+ /* 10 */ V(6, 15, 2),
+ /* 11 */ V(15, 6, 2),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(5, 15, 2), /* 88 */
+ /* 01 */ V(15, 5, 2),
+ /* 10 */ V(4, 15, 1),
+ /* 11 */ V(4, 15, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(15, 4, 1), /* 92 */
+ /* 1 */ V(15, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0000 */ V(15, 0, 1), /* 94 */
+ /* 0001 */ V(15, 0, 1),
+ /* 0010 */ V(15, 0, 1),
+ /* 0011 */ V(15, 0, 1),
+ /* 0100 */ V(15, 0, 1),
+ /* 0101 */ V(15, 0, 1),
+ /* 0110 */ V(15, 0, 1),
+ /* 0111 */ V(15, 0, 1),
+ /* 1000 */ V(3, 15, 2),
+ /* 1001 */ V(3, 15, 2),
+ /* 1010 */ V(3, 15, 2),
+ /* 1011 */ V(3, 15, 2),
+ /* 1100 */ PTR(294, 4),
+ /* 1101 */ PTR(310, 3),
+ /* 1110 */ PTR(318, 3),
+ /* 1111 */ PTR(326, 3),
+
+ /* 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 110 */
+ /* 1 */ V(0, 15, 1),
+
+ /* 0000 1011 ... */
+ /* 0000 */ PTR(334, 2), /* 112 */
+ /* 0001 */ PTR(338, 2),
+ /* 0010 */ PTR(342, 2),
+ /* 0011 */ PTR(346, 1),
+ /* 0100 */ PTR(348, 2),
+ /* 0101 */ PTR(352, 2),
+ /* 0110 */ PTR(356, 1),
+ /* 0111 */ PTR(358, 2),
+ /* 1000 */ PTR(362, 2),
+ /* 1001 */ PTR(366, 2),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ V(14, 3, 4),
+ /* 1100 */ PTR(374, 1),
+ /* 1101 */ PTR(376, 1),
+ /* 1110 */ PTR(378, 1),
+ /* 1111 */ PTR(380, 1),
+
+ /* 0000 1100 ... */
+ /* 0000 */ PTR(382, 1), /* 128 */
+ /* 0001 */ PTR(384, 1),
+ /* 0010 */ PTR(386, 1),
+ /* 0011 */ V(0, 13, 4),
+ /* 0100 */ PTR(388, 1),
+ /* 0101 */ PTR(390, 1),
+ /* 0110 */ PTR(392, 1),
+ /* 0111 */ V(3, 12, 4),
+ /* 1000 */ PTR(394, 1),
+ /* 1001 */ V(1, 12, 4),
+ /* 1010 */ V(12, 0, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 2, 3),
+ /* 1101 */ V(14, 2, 3),
+ /* 1110 */ V(2, 14, 4),
+ /* 1111 */ V(1, 14, 4),
+
+ /* 0000 1101 ... */
+ /* 0000 */ V(13, 3, 4), /* 144 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(13, 1, 4),
+ /* 0100 */ V(3, 11, 4),
+ /* 0101 */ PTR(398, 1),
+ /* 0110 */ V(1, 13, 3),
+ /* 0111 */ V(1, 13, 3),
+ /* 1000 */ V(12, 4, 4),
+ /* 1001 */ V(6, 11, 4),
+ /* 1010 */ V(12, 3, 4),
+ /* 1011 */ V(10, 7, 4),
+ /* 1100 */ V(2, 12, 3),
+ /* 1101 */ V(2, 12, 3),
+ /* 1110 */ V(12, 2, 4),
+ /* 1111 */ V(11, 5, 4),
+
+ /* 0000 1110 ... */
+ /* 0000 */ V(12, 1, 4), /* 160 */
+ /* 0001 */ V(0, 12, 4),
+ /* 0010 */ V(4, 11, 4),
+ /* 0011 */ V(11, 4, 4),
+ /* 0100 */ V(6, 10, 4),
+ /* 0101 */ V(10, 6, 4),
+ /* 0110 */ V(11, 3, 3),
+ /* 0111 */ V(11, 3, 3),
+ /* 1000 */ V(5, 10, 4),
+ /* 1001 */ V(10, 5, 4),
+ /* 1010 */ V(2, 11, 3),
+ /* 1011 */ V(2, 11, 3),
+ /* 1100 */ V(11, 2, 3),
+ /* 1101 */ V(11, 2, 3),
+ /* 1110 */ V(1, 11, 3),
+ /* 1111 */ V(1, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 0000 */ V(11, 1, 3), /* 176 */
+ /* 0001 */ V(11, 1, 3),
+ /* 0010 */ V(0, 11, 4),
+ /* 0011 */ V(11, 0, 4),
+ /* 0100 */ V(6, 9, 4),
+ /* 0101 */ V(9, 6, 4),
+ /* 0110 */ V(4, 10, 4),
+ /* 0111 */ V(10, 4, 4),
+ /* 1000 */ V(7, 8, 4),
+ /* 1001 */ V(8, 7, 4),
+ /* 1010 */ V(10, 3, 3),
+ /* 1011 */ V(10, 3, 3),
+ /* 1100 */ V(3, 10, 4),
+ /* 1101 */ V(5, 9, 4),
+ /* 1110 */ V(2, 10, 3),
+ /* 1111 */ V(2, 10, 3),
+
+ /* 0001 0000 ... */
+ /* 0000 */ V(9, 5, 4), /* 192 */
+ /* 0001 */ V(6, 8, 4),
+ /* 0010 */ V(10, 1, 3),
+ /* 0011 */ V(10, 1, 3),
+ /* 0100 */ V(8, 6, 4),
+ /* 0101 */ V(7, 7, 4),
+ /* 0110 */ V(9, 4, 3),
+ /* 0111 */ V(9, 4, 3),
+ /* 1000 */ V(4, 9, 4),
+ /* 1001 */ V(5, 7, 4),
+ /* 1010 */ V(6, 7, 3),
+ /* 1011 */ V(6, 7, 3),
+ /* 1100 */ V(10, 2, 2),
+ /* 1101 */ V(10, 2, 2),
+ /* 1110 */ V(10, 2, 2),
+ /* 1111 */ V(10, 2, 2),
+
+ /* 0001 0001 ... */
+ /* 000 */ V(1, 10, 2), /* 208 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(0, 10, 3),
+ /* 011 */ V(10, 0, 3),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(9, 3, 3),
+ /* 110 */ V(5, 8, 3),
+ /* 111 */ V(8, 5, 3),
+
+ /* 0001 0010 ... */
+ /* 000 */ V(2, 9, 2), /* 216 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(7, 6, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(1, 9, 2),
+ /* 111 */ V(1, 9, 2),
+
+ /* 0001 0011 ... */
+ /* 000 */ V(9, 1, 2), /* 224 */
+ /* 001 */ V(9, 1, 2),
+ /* 010 */ V(9, 0, 3),
+ /* 011 */ V(4, 8, 3),
+ /* 100 */ V(8, 4, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 3),
+ /* 111 */ V(8, 3, 3),
+
+ /* 0001 0100 ... */
+ /* 000 */ V(6, 6, 3), /* 232 */
+ /* 001 */ V(2, 8, 3),
+ /* 010 */ V(8, 2, 2),
+ /* 011 */ V(8, 2, 2),
+ /* 100 */ V(4, 7, 3),
+ /* 101 */ V(7, 4, 3),
+ /* 110 */ V(1, 8, 2),
+ /* 111 */ V(1, 8, 2),
+
+ /* 0001 0101 ... */
+ /* 000 */ V(8, 1, 2), /* 240 */
+ /* 001 */ V(8, 1, 2),
+ /* 010 */ V(8, 0, 2),
+ /* 011 */ V(8, 0, 2),
+ /* 100 */ V(0, 8, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(3, 7, 2),
+ /* 111 */ V(3, 7, 2),
+
+ /* 0001 0110 ... */
+ /* 000 */ V(7, 3, 2), /* 248 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(6, 5, 3),
+ /* 011 */ V(4, 6, 3),
+ /* 100 */ V(2, 7, 2),
+ /* 101 */ V(2, 7, 2),
+ /* 110 */ V(7, 2, 2),
+ /* 111 */ V(7, 2, 2),
+
+ /* 0001 0111 ... */
+ /* 000 */ V(6, 4, 3), /* 256 */
+ /* 001 */ V(5, 5, 3),
+ /* 010 */ V(0, 7, 2),
+ /* 011 */ V(0, 7, 2),
+ /* 100 */ V(1, 7, 1),
+ /* 101 */ V(1, 7, 1),
+ /* 110 */ V(1, 7, 1),
+ /* 111 */ V(1, 7, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(7, 1, 1), /* 264 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(7, 0, 2),
+ /* 11 */ V(3, 6, 2),
+
+ /* 0001 1001 ... */
+ /* 00 */ V(6, 3, 2), /* 268 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(2, 6, 2),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(6, 2, 1), /* 272 */
+ /* 1 */ V(1, 6, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(6, 1, 1), /* 274 */
+ /* 01 */ V(6, 1, 1),
+ /* 10 */ V(0, 6, 2),
+ /* 11 */ V(6, 0, 2),
+
+ /* 0001 1100 ... */
+ /* 00 */ V(5, 3, 1), /* 278 */
+ /* 01 */ V(5, 3, 1),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(2, 5, 1), /* 282 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(1, 5, 1), /* 284 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(3, 4, 1), /* 286 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(5, 0, 1), /* 288 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0010 0010 ... */
+ /* 0 */ V(4, 2, 1), /* 290 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(0, 4, 1), /* 292 */
+ /* 1 */ V(4, 0, 1),
+
+ /* 0000 0110 1100 ... */
+ /* 0000 */ V(12, 14, 4), /* 294 */
+ /* 0001 */ PTR(400, 1),
+ /* 0010 */ V(13, 14, 3),
+ /* 0011 */ V(13, 14, 3),
+ /* 0100 */ V(14, 9, 3),
+ /* 0101 */ V(14, 9, 3),
+ /* 0110 */ V(14, 10, 4),
+ /* 0111 */ V(13, 9, 4),
+ /* 1000 */ V(14, 14, 2),
+ /* 1001 */ V(14, 14, 2),
+ /* 1010 */ V(14, 14, 2),
+ /* 1011 */ V(14, 14, 2),
+ /* 1100 */ V(14, 13, 3),
+ /* 1101 */ V(14, 13, 3),
+ /* 1110 */ V(14, 11, 3),
+ /* 1111 */ V(14, 11, 3),
+
+ /* 0000 0110 1101 ... */
+ /* 000 */ V(11, 14, 2), /* 310 */
+ /* 001 */ V(11, 14, 2),
+ /* 010 */ V(12, 13, 2),
+ /* 011 */ V(12, 13, 2),
+ /* 100 */ V(13, 12, 3),
+ /* 101 */ V(13, 11, 3),
+ /* 110 */ V(10, 14, 2),
+ /* 111 */ V(10, 14, 2),
+
+ /* 0000 0110 1110 ... */
+ /* 000 */ V(12, 12, 2), /* 318 */
+ /* 001 */ V(12, 12, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(13, 10, 3),
+ /* 100 */ V(7, 14, 3),
+ /* 101 */ V(10, 12, 3),
+ /* 110 */ V(12, 10, 2),
+ /* 111 */ V(12, 10, 2),
+
+ /* 0000 0110 1111 ... */
+ /* 000 */ V(12, 9, 3), /* 326 */
+ /* 001 */ V(7, 13, 3),
+ /* 010 */ V(5, 14, 2),
+ /* 011 */ V(5, 14, 2),
+ /* 100 */ V(11, 13, 1),
+ /* 101 */ V(11, 13, 1),
+ /* 110 */ V(11, 13, 1),
+ /* 111 */ V(11, 13, 1),
+
+ /* 0000 1011 0000 ... */
+ /* 00 */ V(9, 14, 1), /* 334 */
+ /* 01 */ V(9, 14, 1),
+ /* 10 */ V(11, 12, 2),
+ /* 11 */ V(12, 11, 2),
+
+ /* 0000 1011 0001 ... */
+ /* 00 */ V(8, 14, 2), /* 338 */
+ /* 01 */ V(14, 8, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(14, 7, 2),
+
+ /* 0000 1011 0010 ... */
+ /* 00 */ V(11, 11, 2), /* 342 */
+ /* 01 */ V(8, 13, 2),
+ /* 10 */ V(13, 8, 2),
+ /* 11 */ V(6, 14, 2),
+
+ /* 0000 1011 0011 ... */
+ /* 0 */ V(14, 6, 1), /* 346 */
+ /* 1 */ V(9, 12, 1),
+
+ /* 0000 1011 0100 ... */
+ /* 00 */ V(10, 11, 2), /* 348 */
+ /* 01 */ V(11, 10, 2),
+ /* 10 */ V(14, 5, 2),
+ /* 11 */ V(13, 7, 2),
+
+ /* 0000 1011 0101 ... */
+ /* 00 */ V(4, 14, 1), /* 352 */
+ /* 01 */ V(4, 14, 1),
+ /* 10 */ V(14, 4, 2),
+ /* 11 */ V(8, 12, 2),
+
+ /* 0000 1011 0110 ... */
+ /* 0 */ V(12, 8, 1), /* 356 */
+ /* 1 */ V(3, 14, 1),
+
+ /* 0000 1011 0111 ... */
+ /* 00 */ V(6, 13, 1), /* 358 */
+ /* 01 */ V(6, 13, 1),
+ /* 10 */ V(13, 6, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0000 1011 1000 ... */
+ /* 00 */ V(11, 9, 2), /* 362 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 1, 1),
+ /* 11 */ V(14, 1, 1),
+
+ /* 0000 1011 1001 ... */
+ /* 00 */ V(13, 4, 1), /* 366 */
+ /* 01 */ V(13, 4, 1),
+ /* 10 */ V(11, 8, 2),
+ /* 11 */ V(10, 9, 2),
+
+ /* 0000 1011 1010 ... */
+ /* 00 */ V(7, 11, 1), /* 370 */
+ /* 01 */ V(7, 11, 1),
+ /* 10 */ V(11, 7, 2),
+ /* 11 */ V(13, 0, 2),
+
+ /* 0000 1011 1100 ... */
+ /* 0 */ V(0, 14, 1), /* 374 */
+ /* 1 */ V(14, 0, 1),
+
+ /* 0000 1011 1101 ... */
+ /* 0 */ V(5, 13, 1), /* 376 */
+ /* 1 */ V(13, 5, 1),
+
+ /* 0000 1011 1110 ... */
+ /* 0 */ V(7, 12, 1), /* 378 */
+ /* 1 */ V(12, 7, 1),
+
+ /* 0000 1011 1111 ... */
+ /* 0 */ V(4, 13, 1), /* 380 */
+ /* 1 */ V(8, 11, 1),
+
+ /* 0000 1100 0000 ... */
+ /* 0 */ V(9, 10, 1), /* 382 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 1100 0001 ... */
+ /* 0 */ V(12, 6, 1), /* 384 */
+ /* 1 */ V(3, 13, 1),
+
+ /* 0000 1100 0010 ... */
+ /* 0 */ V(5, 12, 1), /* 386 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 1100 0100 ... */
+ /* 0 */ V(8, 10, 1), /* 388 */
+ /* 1 */ V(10, 8, 1),
+
+ /* 0000 1100 0101 ... */
+ /* 0 */ V(9, 9, 1), /* 390 */
+ /* 1 */ V(4, 12, 1),
+
+ /* 0000 1100 0110 ... */
+ /* 0 */ V(11, 6, 1), /* 392 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 1100 1000 ... */
+ /* 0 */ V(5, 11, 1), /* 394 */
+ /* 1 */ V(8, 9, 1),
+
+ /* 0000 1100 1011 ... */
+ /* 0 */ V(9, 8, 1), /* 396 */
+ /* 1 */ V(7, 9, 1),
+
+ /* 0000 1101 0101 ... */
+ /* 0 */ V(9, 7, 1), /* 398 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0000 0110 1100 0001 ... */
+ /* 0 */ V(14, 12, 1), /* 400 */
+ /* 1 */ V(13, 13, 1)
};
static
-union huffpair const hufftab24[] =
-{
- /* 0000 */ PTR(16, 4),
- /* 0001 */ PTR(32, 4),
- /* 0010 */ PTR(48, 4),
- /* 0011 */ V(15, 15, 4),
- /* 0100 */ PTR(64, 4),
- /* 0101 */ PTR(80, 4),
- /* 0110 */ PTR(96, 4),
- /* 0111 */ PTR(112, 4),
- /* 1000 */ PTR(128, 4),
- /* 1001 */ PTR(144, 4),
- /* 1010 */ PTR(160, 3),
- /* 1011 */ PTR(168, 2),
- /* 1100 */ V(1, 1, 4),
- /* 1101 */ V(0, 1, 4),
- /* 1110 */ V(1, 0, 4),
- /* 1111 */ V(0, 0, 4),
-
- /* 0000 ... */
- /* 0000 */ V(14, 15, 4), /* 16 */
- /* 0001 */ V(15, 14, 4),
- /* 0010 */ V(13, 15, 4),
- /* 0011 */ V(15, 13, 4),
- /* 0100 */ V(12, 15, 4),
- /* 0101 */ V(15, 12, 4),
- /* 0110 */ V(11, 15, 4),
- /* 0111 */ V(15, 11, 4),
- /* 1000 */ V(15, 10, 3),
- /* 1001 */ V(15, 10, 3),
- /* 1010 */ V(10, 15, 4),
- /* 1011 */ V(9, 15, 4),
- /* 1100 */ V(15, 9, 3),
- /* 1101 */ V(15, 9, 3),
- /* 1110 */ V(15, 8, 3),
- /* 1111 */ V(15, 8, 3),
-
- /* 0001 ... */
- /* 0000 */ V(8, 15, 4), /* 32 */
- /* 0001 */ V(7, 15, 4),
- /* 0010 */ V(15, 7, 3),
- /* 0011 */ V(15, 7, 3),
- /* 0100 */ V(6, 15, 3),
- /* 0101 */ V(6, 15, 3),
- /* 0110 */ V(15, 6, 3),
- /* 0111 */ V(15, 6, 3),
- /* 1000 */ V(5, 15, 3),
- /* 1001 */ V(5, 15, 3),
- /* 1010 */ V(15, 5, 3),
- /* 1011 */ V(15, 5, 3),
- /* 1100 */ V(4, 15, 3),
- /* 1101 */ V(4, 15, 3),
- /* 1110 */ V(15, 4, 3),
- /* 1111 */ V(15, 4, 3),
-
- /* 0010 ... */
- /* 0000 */ V(3, 15, 3), /* 48 */
- /* 0001 */ V(3, 15, 3),
- /* 0010 */ V(15, 3, 3),
- /* 0011 */ V(15, 3, 3),
- /* 0100 */ V(2, 15, 3),
- /* 0101 */ V(2, 15, 3),
- /* 0110 */ V(15, 2, 3),
- /* 0111 */ V(15, 2, 3),
- /* 1000 */ V(15, 1, 3),
- /* 1001 */ V(15, 1, 3),
- /* 1010 */ V(1, 15, 4),
- /* 1011 */ V(15, 0, 4),
- /* 1100 */ PTR(172, 3),
- /* 1101 */ PTR(180, 3),
- /* 1110 */ PTR(188, 3),
- /* 1111 */ PTR(196, 3),
-
- /* 0100 ... */
- /* 0000 */ PTR(204, 4), /* 64 */
- /* 0001 */ PTR(220, 3),
- /* 0010 */ PTR(228, 3),
- /* 0011 */ PTR(236, 3),
- /* 0100 */ PTR(244, 2),
- /* 0101 */ PTR(248, 2),
- /* 0110 */ PTR(252, 2),
- /* 0111 */ PTR(256, 2),
- /* 1000 */ PTR(260, 2),
- /* 1001 */ PTR(264, 2),
- /* 1010 */ PTR(268, 2),
- /* 1011 */ PTR(272, 2),
- /* 1100 */ PTR(276, 2),
- /* 1101 */ PTR(280, 3),
- /* 1110 */ PTR(288, 2),
- /* 1111 */ PTR(292, 2),
-
- /* 0101 ... */
- /* 0000 */ PTR(296, 2), /* 80 */
- /* 0001 */ PTR(300, 3),
- /* 0010 */ PTR(308, 2),
- /* 0011 */ PTR(312, 3),
- /* 0100 */ PTR(320, 1),
- /* 0101 */ PTR(322, 2),
- /* 0110 */ PTR(326, 2),
- /* 0111 */ PTR(330, 1),
- /* 1000 */ PTR(332, 2),
- /* 1001 */ PTR(336, 1),
- /* 1010 */ PTR(338, 1),
- /* 1011 */ PTR(340, 1),
- /* 1100 */ PTR(342, 1),
- /* 1101 */ PTR(344, 1),
- /* 1110 */ PTR(346, 1),
- /* 1111 */ PTR(348, 1),
-
- /* 0110 ... */
- /* 0000 */ PTR(350, 1), /* 96 */
- /* 0001 */ PTR(352, 1),
- /* 0010 */ PTR(354, 1),
- /* 0011 */ PTR(356, 1),
- /* 0100 */ PTR(358, 1),
- /* 0101 */ PTR(360, 1),
- /* 0110 */ PTR(362, 1),
- /* 0111 */ PTR(364, 1),
- /* 1000 */ PTR(366, 1),
- /* 1001 */ PTR(368, 1),
- /* 1010 */ PTR(370, 2),
- /* 1011 */ PTR(374, 1),
- /* 1100 */ PTR(376, 2),
- /* 1101 */ V(7, 3, 4),
- /* 1110 */ PTR(380, 1),
- /* 1111 */ V(7, 2, 4),
-
- /* 0111 ... */
- /* 0000 */ V(4, 6, 4), /* 112 */
- /* 0001 */ V(6, 4, 4),
- /* 0010 */ V(5, 5, 4),
- /* 0011 */ V(7, 1, 4),
- /* 0100 */ V(3, 6, 4),
- /* 0101 */ V(6, 3, 4),
- /* 0110 */ V(4, 5, 4),
- /* 0111 */ V(5, 4, 4),
- /* 1000 */ V(2, 6, 4),
- /* 1001 */ V(6, 2, 4),
- /* 1010 */ V(1, 6, 4),
- /* 1011 */ V(6, 1, 4),
- /* 1100 */ PTR(382, 1),
- /* 1101 */ V(3, 5, 4),
- /* 1110 */ V(5, 3, 4),
- /* 1111 */ V(4, 4, 4),
-
- /* 1000 ... */
- /* 0000 */ V(2, 5, 4), /* 128 */
- /* 0001 */ V(5, 2, 4),
- /* 0010 */ V(1, 5, 4),
- /* 0011 */ PTR(384, 1),
- /* 0100 */ V(5, 1, 3),
- /* 0101 */ V(5, 1, 3),
- /* 0110 */ V(3, 4, 4),
- /* 0111 */ V(4, 3, 4),
- /* 1000 */ V(2, 4, 3),
- /* 1001 */ V(2, 4, 3),
- /* 1010 */ V(4, 2, 3),
- /* 1011 */ V(4, 2, 3),
- /* 1100 */ V(3, 3, 3),
- /* 1101 */ V(3, 3, 3),
- /* 1110 */ V(1, 4, 3),
- /* 1111 */ V(1, 4, 3),
-
- /* 1001 ... */
- /* 0000 */ V(4, 1, 3), /* 144 */
- /* 0001 */ V(4, 1, 3),
- /* 0010 */ V(0, 4, 4),
- /* 0011 */ V(4, 0, 4),
- /* 0100 */ V(2, 3, 3),
- /* 0101 */ V(2, 3, 3),
- /* 0110 */ V(3, 2, 3),
- /* 0111 */ V(3, 2, 3),
- /* 1000 */ V(1, 3, 2),
- /* 1001 */ V(1, 3, 2),
- /* 1010 */ V(1, 3, 2),
- /* 1011 */ V(1, 3, 2),
- /* 1100 */ V(3, 1, 2),
- /* 1101 */ V(3, 1, 2),
- /* 1110 */ V(3, 1, 2),
- /* 1111 */ V(3, 1, 2),
-
- /* 1010 ... */
- /* 000 */ V(0, 3, 3), /* 160 */
- /* 001 */ V(3, 0, 3),
- /* 010 */ V(2, 2, 2),
- /* 011 */ V(2, 2, 2),
- /* 100 */ V(1, 2, 1),
- /* 101 */ V(1, 2, 1),
- /* 110 */ V(1, 2, 1),
- /* 111 */ V(1, 2, 1),
-
- /* 1011 ... */
- /* 00 */ V(2, 1, 1), /* 168 */
- /* 01 */ V(2, 1, 1),
- /* 10 */ V(0, 2, 2),
- /* 11 */ V(2, 0, 2),
-
- /* 0010 1100 ... */
- /* 000 */ V(0, 15, 1), /* 172 */
- /* 001 */ V(0, 15, 1),
- /* 010 */ V(0, 15, 1),
- /* 011 */ V(0, 15, 1),
- /* 100 */ V(14, 14, 3),
- /* 101 */ V(13, 14, 3),
- /* 110 */ V(14, 13, 3),
- /* 111 */ V(12, 14, 3),
-
- /* 0010 1101 ... */
- /* 000 */ V(14, 12, 3), /* 180 */
- /* 001 */ V(13, 13, 3),
- /* 010 */ V(11, 14, 3),
- /* 011 */ V(14, 11, 3),
- /* 100 */ V(12, 13, 3),
- /* 101 */ V(13, 12, 3),
- /* 110 */ V(10, 14, 3),
- /* 111 */ V(14, 10, 3),
-
- /* 0010 1110 ... */
- /* 000 */ V(11, 13, 3), /* 188 */
- /* 001 */ V(13, 11, 3),
- /* 010 */ V(12, 12, 3),
- /* 011 */ V(9, 14, 3),
- /* 100 */ V(14, 9, 3),
- /* 101 */ V(10, 13, 3),
- /* 110 */ V(13, 10, 3),
- /* 111 */ V(11, 12, 3),
-
- /* 0010 1111 ... */
- /* 000 */ V(12, 11, 3), /* 196 */
- /* 001 */ V(8, 14, 3),
- /* 010 */ V(14, 8, 3),
- /* 011 */ V(9, 13, 3),
- /* 100 */ V(13, 9, 3),
- /* 101 */ V(7, 14, 3),
- /* 110 */ V(14, 7, 3),
- /* 111 */ V(10, 12, 3),
-
- /* 0100 0000 ... */
- /* 0000 */ V(12, 10, 3), /* 204 */
- /* 0001 */ V(12, 10, 3),
- /* 0010 */ V(11, 11, 3),
- /* 0011 */ V(11, 11, 3),
- /* 0100 */ V(8, 13, 3),
- /* 0101 */ V(8, 13, 3),
- /* 0110 */ V(13, 8, 3),
- /* 0111 */ V(13, 8, 3),
- /* 1000 */ V(0, 14, 4),
- /* 1001 */ V(14, 0, 4),
- /* 1010 */ V(0, 13, 3),
- /* 1011 */ V(0, 13, 3),
- /* 1100 */ V(14, 6, 2),
- /* 1101 */ V(14, 6, 2),
- /* 1110 */ V(14, 6, 2),
- /* 1111 */ V(14, 6, 2),
-
- /* 0100 0001 ... */
- /* 000 */ V(6, 14, 3), /* 220 */
- /* 001 */ V(9, 12, 3),
- /* 010 */ V(12, 9, 2),
- /* 011 */ V(12, 9, 2),
- /* 100 */ V(5, 14, 2),
- /* 101 */ V(5, 14, 2),
- /* 110 */ V(11, 10, 2),
- /* 111 */ V(11, 10, 2),
-
- /* 0100 0010 ... */
- /* 000 */ V(14, 5, 2), /* 228 */
- /* 001 */ V(14, 5, 2),
- /* 010 */ V(10, 11, 3),
- /* 011 */ V(7, 13, 3),
- /* 100 */ V(13, 7, 2),
- /* 101 */ V(13, 7, 2),
- /* 110 */ V(14, 4, 2),
- /* 111 */ V(14, 4, 2),
-
- /* 0100 0011 ... */
- /* 000 */ V(8, 12, 2), /* 236 */
- /* 001 */ V(8, 12, 2),
- /* 010 */ V(12, 8, 2),
- /* 011 */ V(12, 8, 2),
- /* 100 */ V(4, 14, 3),
- /* 101 */ V(2, 14, 3),
- /* 110 */ V(3, 14, 2),
- /* 111 */ V(3, 14, 2),
-
- /* 0100 0100 ... */
- /* 00 */ V(6, 13, 2), /* 244 */
- /* 01 */ V(13, 6, 2),
- /* 10 */ V(14, 3, 2),
- /* 11 */ V(9, 11, 2),
-
- /* 0100 0101 ... */
- /* 00 */ V(11, 9, 2), /* 248 */
- /* 01 */ V(10, 10, 2),
- /* 10 */ V(14, 2, 2),
- /* 11 */ V(1, 14, 2),
-
- /* 0100 0110 ... */
- /* 00 */ V(14, 1, 2), /* 252 */
- /* 01 */ V(5, 13, 2),
- /* 10 */ V(13, 5, 2),
- /* 11 */ V(7, 12, 2),
-
- /* 0100 0111 ... */
- /* 00 */ V(12, 7, 2), /* 256 */
- /* 01 */ V(4, 13, 2),
- /* 10 */ V(8, 11, 2),
- /* 11 */ V(11, 8, 2),
-
- /* 0100 1000 ... */
- /* 00 */ V(13, 4, 2), /* 260 */
- /* 01 */ V(9, 10, 2),
- /* 10 */ V(10, 9, 2),
- /* 11 */ V(6, 12, 2),
-
- /* 0100 1001 ... */
- /* 00 */ V(12, 6, 2), /* 264 */
- /* 01 */ V(3, 13, 2),
- /* 10 */ V(13, 3, 2),
- /* 11 */ V(2, 13, 2),
-
- /* 0100 1010 ... */
- /* 00 */ V(13, 2, 2), /* 268 */
- /* 01 */ V(1, 13, 2),
- /* 10 */ V(7, 11, 2),
- /* 11 */ V(11, 7, 2),
-
- /* 0100 1011 ... */
- /* 00 */ V(13, 1, 2), /* 272 */
- /* 01 */ V(5, 12, 2),
- /* 10 */ V(12, 5, 2),
- /* 11 */ V(8, 10, 2),
-
- /* 0100 1100 ... */
- /* 00 */ V(10, 8, 2), /* 276 */
- /* 01 */ V(9, 9, 2),
- /* 10 */ V(4, 12, 2),
- /* 11 */ V(12, 4, 2),
-
- /* 0100 1101 ... */
- /* 000 */ V(6, 11, 2), /* 280 */
- /* 001 */ V(6, 11, 2),
- /* 010 */ V(11, 6, 2),
- /* 011 */ V(11, 6, 2),
- /* 100 */ V(13, 0, 3),
- /* 101 */ V(0, 12, 3),
- /* 110 */ V(3, 12, 2),
- /* 111 */ V(3, 12, 2),
-
- /* 0100 1110 ... */
- /* 00 */ V(12, 3, 2), /* 288 */
- /* 01 */ V(7, 10, 2),
- /* 10 */ V(10, 7, 2),
- /* 11 */ V(2, 12, 2),
-
- /* 0100 1111 ... */
- /* 00 */ V(12, 2, 2), /* 292 */
- /* 01 */ V(5, 11, 2),
- /* 10 */ V(11, 5, 2),
- /* 11 */ V(1, 12, 2),
-
- /* 0101 0000 ... */
- /* 00 */ V(8, 9, 2), /* 296 */
- /* 01 */ V(9, 8, 2),
- /* 10 */ V(12, 1, 2),
- /* 11 */ V(4, 11, 2),
-
- /* 0101 0001 ... */
- /* 000 */ V(12, 0, 3), /* 300 */
- /* 001 */ V(0, 11, 3),
- /* 010 */ V(3, 11, 2),
- /* 011 */ V(3, 11, 2),
- /* 100 */ V(11, 0, 3),
- /* 101 */ V(0, 10, 3),
- /* 110 */ V(1, 10, 2),
- /* 111 */ V(1, 10, 2),
-
- /* 0101 0010 ... */
- /* 00 */ V(11, 4, 1), /* 308 */
- /* 01 */ V(11, 4, 1),
- /* 10 */ V(6, 10, 2),
- /* 11 */ V(10, 6, 2),
-
- /* 0101 0011 ... */
- /* 000 */ V(7, 9, 2), /* 312 */
- /* 001 */ V(7, 9, 2),
- /* 010 */ V(9, 7, 2),
- /* 011 */ V(9, 7, 2),
- /* 100 */ V(10, 0, 3),
- /* 101 */ V(0, 9, 3),
- /* 110 */ V(9, 0, 2),
- /* 111 */ V(9, 0, 2),
-
- /* 0101 0100 ... */
- /* 0 */ V(11, 3, 1), /* 320 */
- /* 1 */ V(8, 8, 1),
-
- /* 0101 0101 ... */
- /* 00 */ V(2, 11, 2), /* 322 */
- /* 01 */ V(5, 10, 2),
- /* 10 */ V(11, 2, 1),
- /* 11 */ V(11, 2, 1),
-
- /* 0101 0110 ... */
- /* 00 */ V(10, 5, 2), /* 326 */
- /* 01 */ V(1, 11, 2),
- /* 10 */ V(11, 1, 2),
- /* 11 */ V(6, 9, 2),
-
- /* 0101 0111 ... */
- /* 0 */ V(9, 6, 1), /* 330 */
- /* 1 */ V(10, 4, 1),
-
- /* 0101 1000 ... */
- /* 00 */ V(4, 10, 2), /* 332 */
- /* 01 */ V(7, 8, 2),
- /* 10 */ V(8, 7, 1),
- /* 11 */ V(8, 7, 1),
-
- /* 0101 1001 ... */
- /* 0 */ V(3, 10, 1), /* 336 */
- /* 1 */ V(10, 3, 1),
-
- /* 0101 1010 ... */
- /* 0 */ V(5, 9, 1), /* 338 */
- /* 1 */ V(9, 5, 1),
-
- /* 0101 1011 ... */
- /* 0 */ V(2, 10, 1), /* 340 */
- /* 1 */ V(10, 2, 1),
-
- /* 0101 1100 ... */
- /* 0 */ V(10, 1, 1), /* 342 */
- /* 1 */ V(6, 8, 1),
-
- /* 0101 1101 ... */
- /* 0 */ V(8, 6, 1), /* 344 */
- /* 1 */ V(7, 7, 1),
-
- /* 0101 1110 ... */
- /* 0 */ V(4, 9, 1), /* 346 */
- /* 1 */ V(9, 4, 1),
-
- /* 0101 1111 ... */
- /* 0 */ V(3, 9, 1), /* 348 */
- /* 1 */ V(9, 3, 1),
-
- /* 0110 0000 ... */
- /* 0 */ V(5, 8, 1), /* 350 */
- /* 1 */ V(8, 5, 1),
-
- /* 0110 0001 ... */
- /* 0 */ V(2, 9, 1), /* 352 */
- /* 1 */ V(6, 7, 1),
-
- /* 0110 0010 ... */
- /* 0 */ V(7, 6, 1), /* 354 */
- /* 1 */ V(9, 2, 1),
-
- /* 0110 0011 ... */
- /* 0 */ V(1, 9, 1), /* 356 */
- /* 1 */ V(9, 1, 1),
-
- /* 0110 0100 ... */
- /* 0 */ V(4, 8, 1), /* 358 */
- /* 1 */ V(8, 4, 1),
-
- /* 0110 0101 ... */
- /* 0 */ V(5, 7, 1), /* 360 */
- /* 1 */ V(7, 5, 1),
-
- /* 0110 0110 ... */
- /* 0 */ V(3, 8, 1), /* 362 */
- /* 1 */ V(8, 3, 1),
-
- /* 0110 0111 ... */
- /* 0 */ V(6, 6, 1), /* 364 */
- /* 1 */ V(2, 8, 1),
-
- /* 0110 1000 ... */
- /* 0 */ V(8, 2, 1), /* 366 */
- /* 1 */ V(1, 8, 1),
-
- /* 0110 1001 ... */
- /* 0 */ V(4, 7, 1), /* 368 */
- /* 1 */ V(7, 4, 1),
-
- /* 0110 1010 ... */
- /* 00 */ V(8, 1, 1), /* 370 */
- /* 01 */ V(8, 1, 1),
- /* 10 */ V(0, 8, 2),
- /* 11 */ V(8, 0, 2),
-
- /* 0110 1011 ... */
- /* 0 */ V(5, 6, 1), /* 374 */
- /* 1 */ V(6, 5, 1),
-
- /* 0110 1100 ... */
- /* 00 */ V(1, 7, 1), /* 376 */
- /* 01 */ V(1, 7, 1),
- /* 10 */ V(0, 7, 2),
- /* 11 */ V(7, 0, 2),
-
- /* 0110 1110 ... */
- /* 0 */ V(3, 7, 1), /* 380 */
- /* 1 */ V(2, 7, 1),
-
- /* 0111 1100 ... */
- /* 0 */ V(0, 6, 1), /* 382 */
- /* 1 */ V(6, 0, 1),
-
- /* 1000 0011 ... */
- /* 0 */ V(0, 5, 1), /* 384 */
- /* 1 */ V(5, 0, 1)
+union huffpair const hufftab24[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(64, 4),
+ /* 0101 */ PTR(80, 4),
+ /* 0110 */ PTR(96, 4),
+ /* 0111 */ PTR(112, 4),
+ /* 1000 */ PTR(128, 4),
+ /* 1001 */ PTR(144, 4),
+ /* 1010 */ PTR(160, 3),
+ /* 1011 */ PTR(168, 2),
+ /* 1100 */ V(1, 1, 4),
+ /* 1101 */ V(0, 1, 4),
+ /* 1110 */ V(1, 0, 4),
+ /* 1111 */ V(0, 0, 4),
+
+ /* 0000 ... */
+ /* 0000 */ V(14, 15, 4), /* 16 */
+ /* 0001 */ V(15, 14, 4),
+ /* 0010 */ V(13, 15, 4),
+ /* 0011 */ V(15, 13, 4),
+ /* 0100 */ V(12, 15, 4),
+ /* 0101 */ V(15, 12, 4),
+ /* 0110 */ V(11, 15, 4),
+ /* 0111 */ V(15, 11, 4),
+ /* 1000 */ V(15, 10, 3),
+ /* 1001 */ V(15, 10, 3),
+ /* 1010 */ V(10, 15, 4),
+ /* 1011 */ V(9, 15, 4),
+ /* 1100 */ V(15, 9, 3),
+ /* 1101 */ V(15, 9, 3),
+ /* 1110 */ V(15, 8, 3),
+ /* 1111 */ V(15, 8, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(8, 15, 4), /* 32 */
+ /* 0001 */ V(7, 15, 4),
+ /* 0010 */ V(15, 7, 3),
+ /* 0011 */ V(15, 7, 3),
+ /* 0100 */ V(6, 15, 3),
+ /* 0101 */ V(6, 15, 3),
+ /* 0110 */ V(15, 6, 3),
+ /* 0111 */ V(15, 6, 3),
+ /* 1000 */ V(5, 15, 3),
+ /* 1001 */ V(5, 15, 3),
+ /* 1010 */ V(15, 5, 3),
+ /* 1011 */ V(15, 5, 3),
+ /* 1100 */ V(4, 15, 3),
+ /* 1101 */ V(4, 15, 3),
+ /* 1110 */ V(15, 4, 3),
+ /* 1111 */ V(15, 4, 3),
+
+ /* 0010 ... */
+ /* 0000 */ V(3, 15, 3), /* 48 */
+ /* 0001 */ V(3, 15, 3),
+ /* 0010 */ V(15, 3, 3),
+ /* 0011 */ V(15, 3, 3),
+ /* 0100 */ V(2, 15, 3),
+ /* 0101 */ V(2, 15, 3),
+ /* 0110 */ V(15, 2, 3),
+ /* 0111 */ V(15, 2, 3),
+ /* 1000 */ V(15, 1, 3),
+ /* 1001 */ V(15, 1, 3),
+ /* 1010 */ V(1, 15, 4),
+ /* 1011 */ V(15, 0, 4),
+ /* 1100 */ PTR(172, 3),
+ /* 1101 */ PTR(180, 3),
+ /* 1110 */ PTR(188, 3),
+ /* 1111 */ PTR(196, 3),
+
+ /* 0100 ... */
+ /* 0000 */ PTR(204, 4), /* 64 */
+ /* 0001 */ PTR(220, 3),
+ /* 0010 */ PTR(228, 3),
+ /* 0011 */ PTR(236, 3),
+ /* 0100 */ PTR(244, 2),
+ /* 0101 */ PTR(248, 2),
+ /* 0110 */ PTR(252, 2),
+ /* 0111 */ PTR(256, 2),
+ /* 1000 */ PTR(260, 2),
+ /* 1001 */ PTR(264, 2),
+ /* 1010 */ PTR(268, 2),
+ /* 1011 */ PTR(272, 2),
+ /* 1100 */ PTR(276, 2),
+ /* 1101 */ PTR(280, 3),
+ /* 1110 */ PTR(288, 2),
+ /* 1111 */ PTR(292, 2),
+
+ /* 0101 ... */
+ /* 0000 */ PTR(296, 2), /* 80 */
+ /* 0001 */ PTR(300, 3),
+ /* 0010 */ PTR(308, 2),
+ /* 0011 */ PTR(312, 3),
+ /* 0100 */ PTR(320, 1),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 2),
+ /* 0111 */ PTR(330, 1),
+ /* 1000 */ PTR(332, 2),
+ /* 1001 */ PTR(336, 1),
+ /* 1010 */ PTR(338, 1),
+ /* 1011 */ PTR(340, 1),
+ /* 1100 */ PTR(342, 1),
+ /* 1101 */ PTR(344, 1),
+ /* 1110 */ PTR(346, 1),
+ /* 1111 */ PTR(348, 1),
+
+ /* 0110 ... */
+ /* 0000 */ PTR(350, 1), /* 96 */
+ /* 0001 */ PTR(352, 1),
+ /* 0010 */ PTR(354, 1),
+ /* 0011 */ PTR(356, 1),
+ /* 0100 */ PTR(358, 1),
+ /* 0101 */ PTR(360, 1),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ PTR(364, 1),
+ /* 1000 */ PTR(366, 1),
+ /* 1001 */ PTR(368, 1),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 2),
+ /* 1101 */ V(7, 3, 4),
+ /* 1110 */ PTR(380, 1),
+ /* 1111 */ V(7, 2, 4),
+
+ /* 0111 ... */
+ /* 0000 */ V(4, 6, 4), /* 112 */
+ /* 0001 */ V(6, 4, 4),
+ /* 0010 */ V(5, 5, 4),
+ /* 0011 */ V(7, 1, 4),
+ /* 0100 */ V(3, 6, 4),
+ /* 0101 */ V(6, 3, 4),
+ /* 0110 */ V(4, 5, 4),
+ /* 0111 */ V(5, 4, 4),
+ /* 1000 */ V(2, 6, 4),
+ /* 1001 */ V(6, 2, 4),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 1, 4),
+ /* 1100 */ PTR(382, 1),
+ /* 1101 */ V(3, 5, 4),
+ /* 1110 */ V(5, 3, 4),
+ /* 1111 */ V(4, 4, 4),
+
+ /* 1000 ... */
+ /* 0000 */ V(2, 5, 4), /* 128 */
+ /* 0001 */ V(5, 2, 4),
+ /* 0010 */ V(1, 5, 4),
+ /* 0011 */ PTR(384, 1),
+ /* 0100 */ V(5, 1, 3),
+ /* 0101 */ V(5, 1, 3),
+ /* 0110 */ V(3, 4, 4),
+ /* 0111 */ V(4, 3, 4),
+ /* 1000 */ V(2, 4, 3),
+ /* 1001 */ V(2, 4, 3),
+ /* 1010 */ V(4, 2, 3),
+ /* 1011 */ V(4, 2, 3),
+ /* 1100 */ V(3, 3, 3),
+ /* 1101 */ V(3, 3, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 1001 ... */
+ /* 0000 */ V(4, 1, 3), /* 144 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 1010 ... */
+ /* 000 */ V(0, 3, 3), /* 160 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(1, 2, 1),
+ /* 101 */ V(1, 2, 1),
+ /* 110 */ V(1, 2, 1),
+ /* 111 */ V(1, 2, 1),
+
+ /* 1011 ... */
+ /* 00 */ V(2, 1, 1), /* 168 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0010 1100 ... */
+ /* 000 */ V(0, 15, 1), /* 172 */
+ /* 001 */ V(0, 15, 1),
+ /* 010 */ V(0, 15, 1),
+ /* 011 */ V(0, 15, 1),
+ /* 100 */ V(14, 14, 3),
+ /* 101 */ V(13, 14, 3),
+ /* 110 */ V(14, 13, 3),
+ /* 111 */ V(12, 14, 3),
+
+ /* 0010 1101 ... */
+ /* 000 */ V(14, 12, 3), /* 180 */
+ /* 001 */ V(13, 13, 3),
+ /* 010 */ V(11, 14, 3),
+ /* 011 */ V(14, 11, 3),
+ /* 100 */ V(12, 13, 3),
+ /* 101 */ V(13, 12, 3),
+ /* 110 */ V(10, 14, 3),
+ /* 111 */ V(14, 10, 3),
+
+ /* 0010 1110 ... */
+ /* 000 */ V(11, 13, 3), /* 188 */
+ /* 001 */ V(13, 11, 3),
+ /* 010 */ V(12, 12, 3),
+ /* 011 */ V(9, 14, 3),
+ /* 100 */ V(14, 9, 3),
+ /* 101 */ V(10, 13, 3),
+ /* 110 */ V(13, 10, 3),
+ /* 111 */ V(11, 12, 3),
+
+ /* 0010 1111 ... */
+ /* 000 */ V(12, 11, 3), /* 196 */
+ /* 001 */ V(8, 14, 3),
+ /* 010 */ V(14, 8, 3),
+ /* 011 */ V(9, 13, 3),
+ /* 100 */ V(13, 9, 3),
+ /* 101 */ V(7, 14, 3),
+ /* 110 */ V(14, 7, 3),
+ /* 111 */ V(10, 12, 3),
+
+ /* 0100 0000 ... */
+ /* 0000 */ V(12, 10, 3), /* 204 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(8, 13, 3),
+ /* 0101 */ V(8, 13, 3),
+ /* 0110 */ V(13, 8, 3),
+ /* 0111 */ V(13, 8, 3),
+ /* 1000 */ V(0, 14, 4),
+ /* 1001 */ V(14, 0, 4),
+ /* 1010 */ V(0, 13, 3),
+ /* 1011 */ V(0, 13, 3),
+ /* 1100 */ V(14, 6, 2),
+ /* 1101 */ V(14, 6, 2),
+ /* 1110 */ V(14, 6, 2),
+ /* 1111 */ V(14, 6, 2),
+
+ /* 0100 0001 ... */
+ /* 000 */ V(6, 14, 3), /* 220 */
+ /* 001 */ V(9, 12, 3),
+ /* 010 */ V(12, 9, 2),
+ /* 011 */ V(12, 9, 2),
+ /* 100 */ V(5, 14, 2),
+ /* 101 */ V(5, 14, 2),
+ /* 110 */ V(11, 10, 2),
+ /* 111 */ V(11, 10, 2),
+
+ /* 0100 0010 ... */
+ /* 000 */ V(14, 5, 2), /* 228 */
+ /* 001 */ V(14, 5, 2),
+ /* 010 */ V(10, 11, 3),
+ /* 011 */ V(7, 13, 3),
+ /* 100 */ V(13, 7, 2),
+ /* 101 */ V(13, 7, 2),
+ /* 110 */ V(14, 4, 2),
+ /* 111 */ V(14, 4, 2),
+
+ /* 0100 0011 ... */
+ /* 000 */ V(8, 12, 2), /* 236 */
+ /* 001 */ V(8, 12, 2),
+ /* 010 */ V(12, 8, 2),
+ /* 011 */ V(12, 8, 2),
+ /* 100 */ V(4, 14, 3),
+ /* 101 */ V(2, 14, 3),
+ /* 110 */ V(3, 14, 2),
+ /* 111 */ V(3, 14, 2),
+
+ /* 0100 0100 ... */
+ /* 00 */ V(6, 13, 2), /* 244 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(14, 3, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0100 0101 ... */
+ /* 00 */ V(11, 9, 2), /* 248 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 2, 2),
+ /* 11 */ V(1, 14, 2),
+
+ /* 0100 0110 ... */
+ /* 00 */ V(14, 1, 2), /* 252 */
+ /* 01 */ V(5, 13, 2),
+ /* 10 */ V(13, 5, 2),
+ /* 11 */ V(7, 12, 2),
+
+ /* 0100 0111 ... */
+ /* 00 */ V(12, 7, 2), /* 256 */
+ /* 01 */ V(4, 13, 2),
+ /* 10 */ V(8, 11, 2),
+ /* 11 */ V(11, 8, 2),
+
+ /* 0100 1000 ... */
+ /* 00 */ V(13, 4, 2), /* 260 */
+ /* 01 */ V(9, 10, 2),
+ /* 10 */ V(10, 9, 2),
+ /* 11 */ V(6, 12, 2),
+
+ /* 0100 1001 ... */
+ /* 00 */ V(12, 6, 2), /* 264 */
+ /* 01 */ V(3, 13, 2),
+ /* 10 */ V(13, 3, 2),
+ /* 11 */ V(2, 13, 2),
+
+ /* 0100 1010 ... */
+ /* 00 */ V(13, 2, 2), /* 268 */
+ /* 01 */ V(1, 13, 2),
+ /* 10 */ V(7, 11, 2),
+ /* 11 */ V(11, 7, 2),
+
+ /* 0100 1011 ... */
+ /* 00 */ V(13, 1, 2), /* 272 */
+ /* 01 */ V(5, 12, 2),
+ /* 10 */ V(12, 5, 2),
+ /* 11 */ V(8, 10, 2),
+
+ /* 0100 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 276 */
+ /* 01 */ V(9, 9, 2),
+ /* 10 */ V(4, 12, 2),
+ /* 11 */ V(12, 4, 2),
+
+ /* 0100 1101 ... */
+ /* 000 */ V(6, 11, 2), /* 280 */
+ /* 001 */ V(6, 11, 2),
+ /* 010 */ V(11, 6, 2),
+ /* 011 */ V(11, 6, 2),
+ /* 100 */ V(13, 0, 3),
+ /* 101 */ V(0, 12, 3),
+ /* 110 */ V(3, 12, 2),
+ /* 111 */ V(3, 12, 2),
+
+ /* 0100 1110 ... */
+ /* 00 */ V(12, 3, 2), /* 288 */
+ /* 01 */ V(7, 10, 2),
+ /* 10 */ V(10, 7, 2),
+ /* 11 */ V(2, 12, 2),
+
+ /* 0100 1111 ... */
+ /* 00 */ V(12, 2, 2), /* 292 */
+ /* 01 */ V(5, 11, 2),
+ /* 10 */ V(11, 5, 2),
+ /* 11 */ V(1, 12, 2),
+
+ /* 0101 0000 ... */
+ /* 00 */ V(8, 9, 2), /* 296 */
+ /* 01 */ V(9, 8, 2),
+ /* 10 */ V(12, 1, 2),
+ /* 11 */ V(4, 11, 2),
+
+ /* 0101 0001 ... */
+ /* 000 */ V(12, 0, 3), /* 300 */
+ /* 001 */ V(0, 11, 3),
+ /* 010 */ V(3, 11, 2),
+ /* 011 */ V(3, 11, 2),
+ /* 100 */ V(11, 0, 3),
+ /* 101 */ V(0, 10, 3),
+ /* 110 */ V(1, 10, 2),
+ /* 111 */ V(1, 10, 2),
+
+ /* 0101 0010 ... */
+ /* 00 */ V(11, 4, 1), /* 308 */
+ /* 01 */ V(11, 4, 1),
+ /* 10 */ V(6, 10, 2),
+ /* 11 */ V(10, 6, 2),
+
+ /* 0101 0011 ... */
+ /* 000 */ V(7, 9, 2), /* 312 */
+ /* 001 */ V(7, 9, 2),
+ /* 010 */ V(9, 7, 2),
+ /* 011 */ V(9, 7, 2),
+ /* 100 */ V(10, 0, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(9, 0, 2),
+ /* 111 */ V(9, 0, 2),
+
+ /* 0101 0100 ... */
+ /* 0 */ V(11, 3, 1), /* 320 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0101 0101 ... */
+ /* 00 */ V(2, 11, 2), /* 322 */
+ /* 01 */ V(5, 10, 2),
+ /* 10 */ V(11, 2, 1),
+ /* 11 */ V(11, 2, 1),
+
+ /* 0101 0110 ... */
+ /* 00 */ V(10, 5, 2), /* 326 */
+ /* 01 */ V(1, 11, 2),
+ /* 10 */ V(11, 1, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0101 0111 ... */
+ /* 0 */ V(9, 6, 1), /* 330 */
+ /* 1 */ V(10, 4, 1),
+
+ /* 0101 1000 ... */
+ /* 00 */ V(4, 10, 2), /* 332 */
+ /* 01 */ V(7, 8, 2),
+ /* 10 */ V(8, 7, 1),
+ /* 11 */ V(8, 7, 1),
+
+ /* 0101 1001 ... */
+ /* 0 */ V(3, 10, 1), /* 336 */
+ /* 1 */ V(10, 3, 1),
+
+ /* 0101 1010 ... */
+ /* 0 */ V(5, 9, 1), /* 338 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0101 1011 ... */
+ /* 0 */ V(2, 10, 1), /* 340 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0101 1100 ... */
+ /* 0 */ V(10, 1, 1), /* 342 */
+ /* 1 */ V(6, 8, 1),
+
+ /* 0101 1101 ... */
+ /* 0 */ V(8, 6, 1), /* 344 */
+ /* 1 */ V(7, 7, 1),
+
+ /* 0101 1110 ... */
+ /* 0 */ V(4, 9, 1), /* 346 */
+ /* 1 */ V(9, 4, 1),
+
+ /* 0101 1111 ... */
+ /* 0 */ V(3, 9, 1), /* 348 */
+ /* 1 */ V(9, 3, 1),
+
+ /* 0110 0000 ... */
+ /* 0 */ V(5, 8, 1), /* 350 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0110 0001 ... */
+ /* 0 */ V(2, 9, 1), /* 352 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0110 0010 ... */
+ /* 0 */ V(7, 6, 1), /* 354 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0110 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 356 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0110 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 358 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0110 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 360 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0110 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 362 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0110 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 364 */
+ /* 1 */ V(2, 8, 1),
+
+ /* 0110 1000 ... */
+ /* 0 */ V(8, 2, 1), /* 366 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0110 1001 ... */
+ /* 0 */ V(4, 7, 1), /* 368 */
+ /* 1 */ V(7, 4, 1),
+
+ /* 0110 1010 ... */
+ /* 00 */ V(8, 1, 1), /* 370 */
+ /* 01 */ V(8, 1, 1),
+ /* 10 */ V(0, 8, 2),
+ /* 11 */ V(8, 0, 2),
+
+ /* 0110 1011 ... */
+ /* 0 */ V(5, 6, 1), /* 374 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0110 1100 ... */
+ /* 00 */ V(1, 7, 1), /* 376 */
+ /* 01 */ V(1, 7, 1),
+ /* 10 */ V(0, 7, 2),
+ /* 11 */ V(7, 0, 2),
+
+ /* 0110 1110 ... */
+ /* 0 */ V(3, 7, 1), /* 380 */
+ /* 1 */ V(2, 7, 1),
+
+ /* 0111 1100 ... */
+ /* 0 */ V(0, 6, 1), /* 382 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 1000 0011 ... */
+ /* 0 */ V(0, 5, 1), /* 384 */
+ /* 1 */ V(5, 0, 1)
};
# undef V
@@ -3081,38 +3062,37 @@ union huffpair const hufftab24[] =
union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB };
-struct hufftable const mad_huff_pair_table[32] =
-{
- /* 0 */ { hufftab0, 0, 0 },
- /* 1 */ { hufftab1, 0, 3 },
- /* 2 */ { hufftab2, 0, 3 },
- /* 3 */ { hufftab3, 0, 3 },
- /* 4 */ { 0 /* not used */ },
- /* 5 */ { hufftab5, 0, 3 },
- /* 6 */ { hufftab6, 0, 4 },
- /* 7 */ { hufftab7, 0, 4 },
- /* 8 */ { hufftab8, 0, 4 },
- /* 9 */ { hufftab9, 0, 4 },
- /* 10 */ { hufftab10, 0, 4 },
- /* 11 */ { hufftab11, 0, 4 },
- /* 12 */ { hufftab12, 0, 4 },
- /* 13 */ { hufftab13, 0, 4 },
- /* 14 */ { 0 /* not used */ },
- /* 15 */ { hufftab15, 0, 4 },
- /* 16 */ { hufftab16, 1, 4 },
- /* 17 */ { hufftab16, 2, 4 },
- /* 18 */ { hufftab16, 3, 4 },
- /* 19 */ { hufftab16, 4, 4 },
- /* 20 */ { hufftab16, 6, 4 },
- /* 21 */ { hufftab16, 8, 4 },
- /* 22 */ { hufftab16, 10, 4 },
- /* 23 */ { hufftab16, 13, 4 },
- /* 24 */ { hufftab24, 4, 4 },
- /* 25 */ { hufftab24, 5, 4 },
- /* 26 */ { hufftab24, 6, 4 },
- /* 27 */ { hufftab24, 7, 4 },
- /* 28 */ { hufftab24, 8, 4 },
- /* 29 */ { hufftab24, 9, 4 },
- /* 30 */ { hufftab24, 11, 4 },
- /* 31 */ { hufftab24, 13, 4 }
+struct hufftable const mad_huff_pair_table[32] = {
+ /* 0 */ { hufftab0, 0, 0 },
+ /* 1 */ { hufftab1, 0, 3 },
+ /* 2 */ { hufftab2, 0, 3 },
+ /* 3 */ { hufftab3, 0, 3 },
+ /* 4 */ { 0 /* not used */ },
+ /* 5 */ { hufftab5, 0, 3 },
+ /* 6 */ { hufftab6, 0, 4 },
+ /* 7 */ { hufftab7, 0, 4 },
+ /* 8 */ { hufftab8, 0, 4 },
+ /* 9 */ { hufftab9, 0, 4 },
+ /* 10 */ { hufftab10, 0, 4 },
+ /* 11 */ { hufftab11, 0, 4 },
+ /* 12 */ { hufftab12, 0, 4 },
+ /* 13 */ { hufftab13, 0, 4 },
+ /* 14 */ { 0 /* not used */ },
+ /* 15 */ { hufftab15, 0, 4 },
+ /* 16 */ { hufftab16, 1, 4 },
+ /* 17 */ { hufftab16, 2, 4 },
+ /* 18 */ { hufftab16, 3, 4 },
+ /* 19 */ { hufftab16, 4, 4 },
+ /* 20 */ { hufftab16, 6, 4 },
+ /* 21 */ { hufftab16, 8, 4 },
+ /* 22 */ { hufftab16, 10, 4 },
+ /* 23 */ { hufftab16, 13, 4 },
+ /* 24 */ { hufftab24, 4, 4 },
+ /* 25 */ { hufftab24, 5, 4 },
+ /* 26 */ { hufftab24, 6, 4 },
+ /* 27 */ { hufftab24, 7, 4 },
+ /* 28 */ { hufftab24, 8, 4 },
+ /* 29 */ { hufftab24, 9, 4 },
+ /* 30 */ { hufftab24, 11, 4 },
+ /* 31 */ { hufftab24, 13, 4 }
};
diff --git a/src/filters/transform/MpaDecFilter/libmad/hufftab.h b/src/filters/transform/MpaDecFilter/libmad/hufftab.h
index 32af86a61..4848f1c27 100644
--- a/src/filters/transform/MpaDecFilter/libmad/hufftab.h
+++ b/src/filters/transform/MpaDecFilter/libmad/hufftab.h
@@ -22,49 +22,42 @@
# ifndef LIBMAD_HUFFMAN_H
# define LIBMAD_HUFFMAN_H
-union huffquad
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short v : 1;
- unsigned short w : 1;
- unsigned short x : 1;
- unsigned short y : 1;
- } value;
- unsigned short final : 1;
+union huffquad {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short v : 1;
+ unsigned short w : 1;
+ unsigned short x : 1;
+ unsigned short y : 1;
+ } value;
+ unsigned short final : 1;
};
-union huffpair
-{
- struct
- {
- unsigned short final : 1;
- unsigned short bits : 3;
- unsigned short offset : 12;
- } ptr;
- struct
- {
- unsigned short final : 1;
- unsigned short hlen : 3;
- unsigned short x : 4;
- unsigned short y : 4;
- } value;
- unsigned short final : 1;
+union huffpair {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short x : 4;
+ unsigned short y : 4;
+ } value;
+ unsigned short final : 1;
};
-struct hufftable
-{
- union huffpair const *table;
- unsigned short linbits;
- unsigned short startbits;
+struct hufftable {
+ union huffpair const *table;
+ unsigned short linbits;
+ unsigned short startbits;
};
extern union huffquad const *const mad_huff_quad_table[2];
diff --git a/src/filters/transform/MpaDecFilter/libmad/layer12.c b/src/filters/transform/MpaDecFilter/libmad/layer12.c
index ba26ecefb..8b315c7fe 100644
--- a/src/filters/transform/MpaDecFilter/libmad/layer12.c
+++ b/src/filters/transform/MpaDecFilter/libmad/layer12.c
@@ -41,8 +41,7 @@
* used in both Layer I and Layer II decoding
*/
static
-mad_fixed_t const sf_table[64] =
-{
+mad_fixed_t const sf_table[64] = {
# include "sf_table.dat"
};
@@ -50,22 +49,21 @@ mad_fixed_t const sf_table[64] =
/* linear scaling table */
static
-mad_fixed_t const linear_table[14] =
-{
- MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
- MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
- MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
- MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
- MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
- MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
- MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
- MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
- MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
- MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
- MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
- MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
- MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
- MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
+mad_fixed_t const linear_table[14] = {
+ MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
+ MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
+ MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
+ MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
+ MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
+ MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
+ MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
+ MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
+ MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
+ MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
+ MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
+ MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
+ MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
+ MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
};
/*
@@ -75,27 +73,27 @@ mad_fixed_t const linear_table[14] =
static
mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
{
- mad_fixed_t sample;
+ mad_fixed_t sample;
- sample = mad_bit_read(ptr, nb);
+ sample = mad_bit_read(ptr, nb);
- /* invert most significant bit, extend sign, then scale to fixed format */
+ /* invert most significant bit, extend sign, then scale to fixed format */
- sample ^= 1 << (nb - 1);
- sample |= -(sample & (1 << (nb - 1)));
+ sample ^= 1 << (nb - 1);
+ sample |= -(sample & (1 << (nb - 1)));
- sample <<= MAD_F_FRACBITS - (nb - 1);
+ sample <<= MAD_F_FRACBITS - (nb - 1);
- /* requantize the sample */
+ /* requantize the sample */
- /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
+ /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
- sample += MAD_F_ONE >> (nb - 1);
+ sample += MAD_F_ONE >> (nb - 1);
- return mad_f_mul(sample, linear_table[nb - 2]);
+ return mad_f_mul(sample, linear_table[nb - 2]);
- /* s' = factor * s'' */
- /* (to be performed by caller) */
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
}
/*
@@ -104,211 +102,173 @@ mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
*/
int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- unsigned int nch, bound, ch, s, sb, nb;
- unsigned char allocation[2][32], scalefactor[2][32];
+ struct mad_header *header = &frame->header;
+ unsigned int nch, bound, ch, s, sb, nb;
+ unsigned char allocation[2][32], scalefactor[2][32];
- nch = MAD_NCHANNELS(header);
+ nch = MAD_NCHANNELS(header);
- bound = 32;
- if(header->mode == MAD_MODE_JOINT_STEREO)
- {
- header->flags |= MAD_FLAG_I_STEREO;
- bound = 4 + header->mode_extension * 4;
- }
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
- header->crc_check);
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
+ header->crc_check);
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- return -1;
- }
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
}
+ }
- /* decode bit allocations */
+ /* decode bit allocations */
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- nb = mad_bit_read(&stream->ptr, 4);
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = mad_bit_read(&stream->ptr, 4);
- if(nb == 15)
- {
- stream->error = MAD_ERROR_BADBITALLOC;
- return -1;
- }
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
+ }
- allocation[ch][sb] = nb ? nb + 1 : 0;
- }
+ allocation[ch][sb] = nb ? nb + 1 : 0;
}
+ }
- for(sb = bound; sb < 32; ++sb)
- {
- nb = mad_bit_read(&stream->ptr, 4);
+ for (sb = bound; sb < 32; ++sb) {
+ nb = mad_bit_read(&stream->ptr, 4);
- if(nb == 15)
- {
- stream->error = MAD_ERROR_BADBITALLOC;
- return -1;
- }
-
- allocation[0][sb] =
- allocation[1][sb] = nb ? nb + 1 : 0;
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
}
- /* decode scalefactors */
+ allocation[0][sb] =
+ allocation[1][sb] = nb ? nb + 1 : 0;
+ }
+
+ /* decode scalefactors */
- for(sb = 0; sb < 32; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- {
- scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+ for (sb = 0; sb < 32; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
# if defined(OPT_STRICT)
- /*
- * Scalefactor index 63 does not appear in Table B.1 of
- * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
- * so we only reject it if OPT_STRICT is defined.
- */
- if(scalefactor[ch][sb] == 63)
- {
- stream->error = MAD_ERROR_BADSCALEFACTOR;
- return -1;
- }
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
# endif
- }
- }
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (s = 0; s < 12; ++s) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = allocation[ch][sb];
+ frame->sbsample[ch][s][sb] = nb ?
+ mad_f_mul(I_sample(&stream->ptr, nb),
+ sf_table[scalefactor[ch][sb]]) : 0;
+ }
}
- /* decode samples */
-
- for(s = 0; s < 12; ++s)
- {
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- nb = allocation[ch][sb];
- frame->sbsample[ch][s][sb] = nb ?
- mad_f_mul(I_sample(&stream->ptr, nb),
- sf_table[scalefactor[ch][sb]]) : 0;
- }
- }
-
- for(sb = bound; sb < 32; ++sb)
- {
- if((nb = allocation[0][sb]))
- {
- mad_fixed_t sample;
-
- sample = I_sample(&stream->ptr, nb);
-
- for(ch = 0; ch < nch; ++ch)
- {
- frame->sbsample[ch][s][sb] =
- mad_f_mul(sample, sf_table[scalefactor[ch][sb]]);
- }
- }
- else
- {
- for(ch = 0; ch < nch; ++ch)
- frame->sbsample[ch][s][sb] = 0;
- }
- }
+ for (sb = bound; sb < 32; ++sb) {
+ if ((nb = allocation[0][sb])) {
+ mad_fixed_t sample;
+
+ sample = I_sample(&stream->ptr, nb);
+
+ for (ch = 0; ch < nch; ++ch) {
+ frame->sbsample[ch][s][sb] =
+ mad_f_mul(sample, sf_table[scalefactor[ch][sb]]);
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch)
+ frame->sbsample[ch][s][sb] = 0;
+ }
}
+ }
- return 0;
+ return 0;
}
/* --- Layer II ------------------------------------------------------------ */
/* possible quantization per subband table */
static
-struct
-{
- unsigned int sblimit;
- unsigned char const offsets[30];
-} const sbquant_table[5] =
-{
- /* ISO/IEC 11172-3 Table B.2a */
- {
- 27, {
- 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */
- 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0
- }
- },
- /* ISO/IEC 11172-3 Table B.2b */
- {
- 30, {
- 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */
- 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0
- }
- },
- /* ISO/IEC 11172-3 Table B.2c */
- { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */
- /* ISO/IEC 11172-3 Table B.2d */
- { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */
- /* ISO/IEC 13818-3 Table B.1 */
- {
- 30, {
- 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
- }
- }
+struct {
+ unsigned int sblimit;
+ unsigned char const offsets[30];
+} const sbquant_table[5] = {
+ /* ISO/IEC 11172-3 Table B.2a */
+ { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2b */
+ { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2c */
+ { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */
+ /* ISO/IEC 11172-3 Table B.2d */
+ { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */
+ /* ISO/IEC 13818-3 Table B.1 */
+ { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }
};
/* bit allocation table */
static
-struct
-{
- unsigned short nbal;
- unsigned short offset;
-} const bitalloc_table[8] =
-{
- { 2, 0 }, /* 0 */
- { 2, 3 }, /* 1 */
- { 3, 3 }, /* 2 */
- { 3, 1 }, /* 3 */
- { 4, 2 }, /* 4 */
- { 4, 3 }, /* 5 */
- { 4, 4 }, /* 6 */
- { 4, 5 } /* 7 */
+struct {
+ unsigned short nbal;
+ unsigned short offset;
+} const bitalloc_table[8] = {
+ { 2, 0 }, /* 0 */
+ { 2, 3 }, /* 1 */
+ { 3, 3 }, /* 2 */
+ { 3, 1 }, /* 3 */
+ { 4, 2 }, /* 4 */
+ { 4, 3 }, /* 5 */
+ { 4, 4 }, /* 6 */
+ { 4, 5 } /* 7 */
};
/* offsets into quantization class table */
static
-unsigned char const offset_table[6][15] =
-{
- { 0, 1, 16 }, /* 0 */
- { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */
- { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */
- { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */
+unsigned char const offset_table[6][15] = {
+ { 0, 1, 16 }, /* 0 */
+ { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */
+ { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */
+ { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */
};
/* quantization class table */
static
-struct quantclass
-{
- unsigned short nlevels;
- unsigned char group;
- unsigned char bits;
- mad_fixed_t C;
- mad_fixed_t D;
-} const qc_table[17] =
-{
+struct quantclass {
+ unsigned short nlevels;
+ unsigned char group;
+ unsigned char bits;
+ mad_fixed_t C;
+ mad_fixed_t D;
+} const qc_table[17] = {
# include "qc_table.dat"
};
@@ -318,53 +278,49 @@ struct quantclass
*/
static
void II_samples(struct mad_bitptr *ptr,
- struct quantclass const *quantclass,
- mad_fixed_t output[3])
+ struct quantclass const *quantclass,
+ mad_fixed_t output[3])
{
- unsigned int nb, s, sample[3];
+ unsigned int nb, s, sample[3];
- if((nb = quantclass->group))
- {
- unsigned int c, nlevels;
+ if ((nb = quantclass->group)) {
+ unsigned int c, nlevels;
- /* degrouping */
- c = mad_bit_read(ptr, quantclass->bits);
- nlevels = quantclass->nlevels;
+ /* degrouping */
+ c = mad_bit_read(ptr, quantclass->bits);
+ nlevels = quantclass->nlevels;
- for(s = 0; s < 3; ++s)
- {
- sample[s] = c % nlevels;
- c /= nlevels;
- }
+ for (s = 0; s < 3; ++s) {
+ sample[s] = c % nlevels;
+ c /= nlevels;
}
- else
- {
- nb = quantclass->bits;
+ }
+ else {
+ nb = quantclass->bits;
- for(s = 0; s < 3; ++s)
- sample[s] = mad_bit_read(ptr, nb);
- }
+ for (s = 0; s < 3; ++s)
+ sample[s] = mad_bit_read(ptr, nb);
+ }
- for(s = 0; s < 3; ++s)
- {
- mad_fixed_t requantized;
+ for (s = 0; s < 3; ++s) {
+ mad_fixed_t requantized;
- /* invert most significant bit, extend sign, then scale to fixed format */
+ /* invert most significant bit, extend sign, then scale to fixed format */
- requantized = sample[s] ^(1 << (nb - 1));
- requantized |= -(requantized & (1 << (nb - 1)));
+ requantized = sample[s] ^ (1 << (nb - 1));
+ requantized |= -(requantized & (1 << (nb - 1)));
- requantized <<= MAD_F_FRACBITS - (nb - 1);
+ requantized <<= MAD_F_FRACBITS - (nb - 1);
- /* requantize the sample */
+ /* requantize the sample */
- /* s'' = C * (s''' + D) */
+ /* s'' = C * (s''' + D) */
- output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C);
+ output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C);
- /* s' = factor * s'' */
- /* (to be performed by caller) */
- }
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
+ }
}
/*
@@ -373,237 +329,205 @@ void II_samples(struct mad_bitptr *ptr,
*/
int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- struct mad_bitptr start;
- unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb;
- unsigned char const *offsets;
- unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
- mad_fixed_t samples[3];
-
- nch = MAD_NCHANNELS(header);
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- index = 4;
- else if(header->flags & MAD_FLAG_FREEFORMAT)
- goto freeformat;
- else
- {
- unsigned long bitrate_per_channel;
-
- bitrate_per_channel = header->bitrate;
- if(nch == 2)
- {
- bitrate_per_channel /= 2;
+ struct mad_header *header = &frame->header;
+ struct mad_bitptr start;
+ unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb;
+ unsigned char const *offsets;
+ unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
+ mad_fixed_t samples[3];
+
+ nch = MAD_NCHANNELS(header);
+
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ index = 4;
+ else if (header->flags & MAD_FLAG_FREEFORMAT)
+ goto freeformat;
+ else {
+ unsigned long bitrate_per_channel;
+
+ bitrate_per_channel = header->bitrate;
+ if (nch == 2) {
+ bitrate_per_channel /= 2;
# if defined(OPT_STRICT)
- /*
- * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and
- * 80 kbps bitrates in Layer II, but some encoders ignore this
- * restriction. We enforce it if OPT_STRICT is defined.
- */
- if(bitrate_per_channel <= 28000 || bitrate_per_channel == 40000)
- {
- stream->error = MAD_ERROR_BADMODE;
- return -1;
- }
+ /*
+ * ISO/IEC 11172-3 allows only single channel mode for 32, 48, 56, and
+ * 80 kbps bitrates in Layer II, but some encoders ignore this
+ * restriction. We enforce it if OPT_STRICT is defined.
+ */
+ if (bitrate_per_channel <= 28000 || bitrate_per_channel == 40000) {
+ stream->error = MAD_ERROR_BADMODE;
+ return -1;
+ }
# endif
- }
- else /* nch == 1 */
- {
- if(bitrate_per_channel > 192000)
- {
- /*
- * ISO/IEC 11172-3 does not allow single channel mode for 224, 256,
- * 320, or 384 kbps bitrates in Layer II.
- */
- stream->error = MAD_ERROR_BADMODE;
- return -1;
- }
- }
-
- if(bitrate_per_channel <= 48000)
- index = (header->samplerate == 32000) ? 3 : 2;
- else if(bitrate_per_channel <= 80000)
- index = 0;
- else
- {
-freeformat:
- index = (header->samplerate == 48000) ? 0 : 1;
- }
+ }
+ else { /* nch == 1 */
+ if (bitrate_per_channel > 192000) {
+ /*
+ * ISO/IEC 11172-3 does not allow single channel mode for 224, 256,
+ * 320, or 384 kbps bitrates in Layer II.
+ */
+ stream->error = MAD_ERROR_BADMODE;
+ return -1;
+ }
}
- sblimit = sbquant_table[index].sblimit;
- offsets = sbquant_table[index].offsets;
-
- bound = 32;
- if(header->mode == MAD_MODE_JOINT_STEREO)
- {
- header->flags |= MAD_FLAG_I_STEREO;
- bound = 4 + header->mode_extension * 4;
+ if (bitrate_per_channel <= 48000)
+ index = (header->samplerate == 32000) ? 3 : 2;
+ else if (bitrate_per_channel <= 80000)
+ index = 0;
+ else {
+ freeformat:
+ index = (header->samplerate == 48000) ? 0 : 1;
}
+ }
- if(bound > sblimit)
- bound = sblimit;
+ sblimit = sbquant_table[index].sblimit;
+ offsets = sbquant_table[index].offsets;
- start = stream->ptr;
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
- /* decode bit allocations */
+ if (bound > sblimit)
+ bound = sblimit;
- for(sb = 0; sb < bound; ++sb)
- {
- nbal = bitalloc_table[offsets[sb]].nbal;
+ start = stream->ptr;
- for(ch = 0; ch < nch; ++ch)
- allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
- }
+ /* decode bit allocations */
- for(sb = bound; sb < sblimit; ++sb)
- {
- nbal = bitalloc_table[offsets[sb]].nbal;
+ for (sb = 0; sb < bound; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
- allocation[0][sb] =
- allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
- }
+ for (ch = 0; ch < nch; ++ch)
+ allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
- /* decode scalefactor selection info */
+ allocation[0][sb] =
+ allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
- for(sb = 0; sb < sblimit; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
- }
+ /* decode scalefactor selection info */
+
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb])
+ scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
}
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(start, mad_bit_length(&start, &stream->ptr),
- header->crc_check);
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(start, mad_bit_length(&start, &stream->ptr),
+ header->crc_check);
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- return -1;
- }
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
}
+ }
- /* decode scalefactors */
+ /* decode scalefactors */
- for(sb = 0; sb < sblimit; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if(allocation[ch][sb])
- {
- scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
- switch(scfsi[ch][sb])
- {
- case 2:
- scalefactor[ch][sb][2] =
- scalefactor[ch][sb][1] =
- scalefactor[ch][sb][0];
- break;
+ switch (scfsi[ch][sb]) {
+ case 2:
+ scalefactor[ch][sb][2] =
+ scalefactor[ch][sb][1] =
+ scalefactor[ch][sb][0];
+ break;
- case 0:
- scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
- /* fall through */
+ case 0:
+ scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ /* fall through */
- case 1:
- case 3:
- scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
- }
+ case 1:
+ case 3:
+ scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ }
- if(scfsi[ch][sb] & 1)
- scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1];
+ if (scfsi[ch][sb] & 1)
+ scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1];
# if defined(OPT_STRICT)
- /*
- * Scalefactor index 63 does not appear in Table B.1 of
- * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
- * so we only reject it if OPT_STRICT is defined.
- */
- if(scalefactor[ch][sb][0] == 63 ||
- scalefactor[ch][sb][1] == 63 ||
- scalefactor[ch][sb][2] == 63)
- {
- stream->error = MAD_ERROR_BADSCALEFACTOR;
- return -1;
- }
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb][0] == 63 ||
+ scalefactor[ch][sb][1] == 63 ||
+ scalefactor[ch][sb][2] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
# endif
- }
- }
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (gr = 0; gr < 12; ++gr) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if ((index = allocation[ch][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ else {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ if ((index = allocation[0][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
}
- /* decode samples */
-
- for(gr = 0; gr < 12; ++gr)
- {
- for(sb = 0; sb < bound; ++sb)
- {
- for(ch = 0; ch < nch; ++ch)
- {
- if((index = allocation[ch][sb]))
- {
- index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
-
- II_samples(&stream->ptr, &qc_table[index], samples);
-
- for(s = 0; s < 3; ++s)
- {
- frame->sbsample[ch][3 * gr + s][sb] =
- mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
- }
- }
- else
- {
- for(s = 0; s < 3; ++s)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
- }
-
- for(sb = bound; sb < sblimit; ++sb)
- {
- if((index = allocation[0][sb]))
- {
- index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
-
- II_samples(&stream->ptr, &qc_table[index], samples);
-
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- {
- frame->sbsample[ch][3 * gr + s][sb] =
- mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
- }
- }
- }
- else
- {
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
- }
-
- for(ch = 0; ch < nch; ++ch)
- {
- for(s = 0; s < 3; ++s)
- {
- for(sb = sblimit; sb < 32; ++sb)
- frame->sbsample[ch][3 * gr + s][sb] = 0;
- }
- }
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ for (sb = sblimit; sb < 32; ++sb)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
}
+ }
- return 0;
+ return 0;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/layer3.c b/src/filters/transform/MpaDecFilter/libmad/layer3.c
index 70cd405fb..30caef7c0 100644
--- a/src/filters/transform/MpaDecFilter/libmad/layer3.c
+++ b/src/filters/transform/MpaDecFilter/libmad/layer3.c
@@ -46,48 +46,43 @@
/* --- Layer III ----------------------------------------------------------- */
-enum
-{
- count1table_select = 0x01,
- scalefac_scale = 0x02,
- preflag = 0x04,
- mixed_block_flag = 0x08
+enum {
+ count1table_select = 0x01,
+ scalefac_scale = 0x02,
+ preflag = 0x04,
+ mixed_block_flag = 0x08
};
-enum
-{
- I_STEREO = 0x1,
- MS_STEREO = 0x2
+enum {
+ I_STEREO = 0x1,
+ MS_STEREO = 0x2
};
-struct sideinfo
-{
- unsigned int main_data_begin;
- unsigned int private_bits;
-
- unsigned char scfsi[2];
-
- struct granule
- {
- struct channel
- {
- /* from side info */
- unsigned short part2_3_length;
- unsigned short big_values;
- unsigned short global_gain;
- unsigned short scalefac_compress;
-
- unsigned char flags;
- unsigned char block_type;
- unsigned char table_select[3];
- unsigned char subblock_gain[3];
- unsigned char region0_count;
- unsigned char region1_count;
-
- /* from main_data */
- unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */
- } ch[2];
- } gr[2];
+struct sideinfo {
+ unsigned int main_data_begin;
+ unsigned int private_bits;
+
+ unsigned char scfsi[2];
+
+ struct granule {
+ struct channel {
+ /* from side info */
+ unsigned short part2_3_length;
+ unsigned short big_values;
+ unsigned short global_gain;
+ unsigned short scalefac_compress;
+
+ unsigned char flags;
+ unsigned char block_type;
+ unsigned char table_select[3];
+ unsigned char subblock_gain[3];
+ unsigned char region0_count;
+ unsigned char region1_count;
+
+ /* from main_data */
+ unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */
+ } ch[2];
+ } gr[2];
};
/*
@@ -95,16 +90,14 @@ struct sideinfo
* derived from section 2.4.2.7 of ISO/IEC 11172-3
*/
static
-struct
-{
- unsigned char slen1;
- unsigned char slen2;
-} const sflen_table[16] =
-{
- { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
- { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 },
- { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 },
- { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 }
+struct {
+ unsigned char slen1;
+ unsigned char slen2;
+} const sflen_table[16] = {
+ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
+ { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 },
+ { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 },
+ { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 }
};
/*
@@ -112,37 +105,30 @@ struct
* derived from section 2.4.3.2 of ISO/IEC 13818-3
*/
static
-unsigned char const nsfb_table[6][3][4] =
-{
- { { 6, 5, 5, 5 },
- { 9, 9, 9, 9 },
- { 6, 9, 9, 9 }
- },
-
- { { 6, 5, 7, 3 },
- { 9, 9, 12, 6 },
- { 6, 9, 12, 6 }
- },
-
- { { 11, 10, 0, 0 },
- { 18, 18, 0, 0 },
- { 15, 18, 0, 0 }
- },
-
- { { 7, 7, 7, 0 },
- { 12, 12, 12, 0 },
- { 6, 15, 12, 0 }
- },
-
- { { 6, 6, 6, 3 },
- { 12, 9, 9, 6 },
- { 6, 12, 9, 6 }
- },
-
- { { 8, 8, 5, 0 },
- { 15, 12, 9, 0 },
- { 6, 18, 9, 0 }
- }
+unsigned char const nsfb_table[6][3][4] = {
+ { { 6, 5, 5, 5 },
+ { 9, 9, 9, 9 },
+ { 6, 9, 9, 9 } },
+
+ { { 6, 5, 7, 3 },
+ { 9, 9, 12, 6 },
+ { 6, 9, 12, 6 } },
+
+ { { 11, 10, 0, 0 },
+ { 18, 18, 0, 0 },
+ { 15, 18, 0, 0 } },
+
+ { { 7, 7, 7, 0 },
+ { 12, 12, 12, 0 },
+ { 6, 15, 12, 0 } },
+
+ { { 6, 6, 6, 3 },
+ { 12, 9, 9, 6 },
+ { 6, 12, 9, 6 } },
+
+ { { 8, 8, 5, 0 },
+ { 15, 12, 9, 0 },
+ { 6, 18, 9, 0 } }
};
/*
@@ -150,75 +136,66 @@ unsigned char const nsfb_table[6][3][4] =
* derived from Table B.8 of ISO/IEC 11172-3
*/
static
-unsigned char const sfb_48000_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
- 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192
+unsigned char const sfb_48000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
+ 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192
};
static
-unsigned char const sfb_44100_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
- 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158
+unsigned char const sfb_44100_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
+ 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158
};
static
-unsigned char const sfb_32000_long[] =
-{
- 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
- 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26
+unsigned char const sfb_32000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
+ 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26
};
static
-unsigned char const sfb_48000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14,
- 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+unsigned char const sfb_48000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
};
static
-unsigned char const sfb_44100_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14,
- 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+unsigned char const sfb_44100_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
};
static
-unsigned char const sfb_32000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
- 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20,
- 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+unsigned char const sfb_32000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20,
+ 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
};
static
-unsigned char const sfb_48000_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10,
- 10, 10, 12, 12, 12, 14, 14, 14, 16, 16,
- 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+unsigned char const sfb_48000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 16, 16,
+ 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
};
static
-unsigned char const sfb_44100_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10,
- 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+unsigned char const sfb_44100_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
};
static
-unsigned char const sfb_32000_mixed[] =
-{
- /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
- /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12,
- 12, 12, 16, 16, 16, 20, 20, 20, 26, 26,
- 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+unsigned char const sfb_32000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12,
+ 12, 12, 16, 16, 16, 20, 20, 20, 26, 26,
+ 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
};
/*
@@ -226,70 +203,62 @@ unsigned char const sfb_32000_mixed[] =
* derived from Table B.2 of ISO/IEC 13818-3
*/
static
-unsigned char const sfb_24000_long[] =
-{
- 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
- 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36
+unsigned char const sfb_24000_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36
};
static
-unsigned char const sfb_22050_long[] =
-{
- 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
- 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54
+unsigned char const sfb_22050_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54
};
# define sfb_16000_long sfb_22050_long
static
-unsigned char const sfb_24000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
- 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+unsigned char const sfb_24000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
};
static
-unsigned char const sfb_22050_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
- 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18,
- 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+unsigned char const sfb_22050_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18,
+ 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
};
static
-unsigned char const sfb_16000_short[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
- 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
- 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+unsigned char const sfb_16000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
};
static
-unsigned char const sfb_24000_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
- 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
- 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+unsigned char const sfb_24000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
};
static
-unsigned char const sfb_22050_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10,
- 10, 10, 14, 14, 14, 18, 18, 18, 26, 26,
- 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+unsigned char const sfb_22050_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 14, 14, 14, 18, 18, 18, 26, 26,
+ 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
};
static
-unsigned char const sfb_16000_mixed[] =
-{
- /* long */ 6, 6, 6, 6, 6, 6,
- /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
- 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
- 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+unsigned char const sfb_16000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
};
/*
@@ -300,21 +269,19 @@ unsigned char const sfb_16000_mixed[] =
# define sfb_11025_long sfb_12000_long
static
-unsigned char const sfb_8000_long[] =
-{
- 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
- 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2
+unsigned char const sfb_8000_long[] = {
+ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
+ 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2
};
# define sfb_12000_short sfb_16000_short
# define sfb_11025_short sfb_12000_short
static
-unsigned char const sfb_8000_short[] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16,
- 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36,
- 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+unsigned char const sfb_8000_short[] = {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16,
+ 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36,
+ 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
};
# define sfb_12000_mixed sfb_16000_mixed
@@ -323,31 +290,28 @@ unsigned char const sfb_8000_short[] =
/* the 8000 Hz short block scalefactor bands do not break after
the first 36 frequency lines, so this is probably wrong */
static
-unsigned char const sfb_8000_mixed[] =
-{
- /* long */ 12, 12, 12,
- /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16,
- 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+unsigned char const sfb_8000_mixed[] = {
+ /* long */ 12, 12, 12,
+ /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16,
+ 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
};
static
-struct
-{
- unsigned char const *l;
- unsigned char const *s;
- unsigned char const *m;
-} const sfbwidth_table[9] =
-{
- { sfb_48000_long, sfb_48000_short, sfb_48000_mixed },
- { sfb_44100_long, sfb_44100_short, sfb_44100_mixed },
- { sfb_32000_long, sfb_32000_short, sfb_32000_mixed },
- { sfb_24000_long, sfb_24000_short, sfb_24000_mixed },
- { sfb_22050_long, sfb_22050_short, sfb_22050_mixed },
- { sfb_16000_long, sfb_16000_short, sfb_16000_mixed },
- { sfb_12000_long, sfb_12000_short, sfb_12000_mixed },
- { sfb_11025_long, sfb_11025_short, sfb_11025_mixed },
- { sfb_8000_long, sfb_8000_short, sfb_8000_mixed }
+struct {
+ unsigned char const *l;
+ unsigned char const *s;
+ unsigned char const *m;
+} const sfbwidth_table[9] = {
+ { sfb_48000_long, sfb_48000_short, sfb_48000_mixed },
+ { sfb_44100_long, sfb_44100_short, sfb_44100_mixed },
+ { sfb_32000_long, sfb_32000_short, sfb_32000_mixed },
+ { sfb_24000_long, sfb_24000_short, sfb_24000_mixed },
+ { sfb_22050_long, sfb_22050_short, sfb_22050_mixed },
+ { sfb_16000_long, sfb_16000_short, sfb_16000_mixed },
+ { sfb_12000_long, sfb_12000_short, sfb_12000_mixed },
+ { sfb_11025_long, sfb_11025_short, sfb_11025_mixed },
+ { sfb_8000_long, sfb_8000_short, sfb_8000_mixed }
};
/*
@@ -355,9 +319,8 @@ struct
* derived from Table B.6 of ISO/IEC 11172-3
*/
static
-unsigned char const pretab[22] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
+unsigned char const pretab[22] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
};
/*
@@ -366,12 +329,10 @@ unsigned char const pretab[22] =
* rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3)
*/
static
-struct fixedfloat
-{
- unsigned long mantissa : 27;
- unsigned short exponent : 5;
-} const rq_table[8207] =
-{
+struct fixedfloat {
+ unsigned long mantissa : 27;
+ unsigned short exponent : 5;
+} const rq_table[8207] = {
# include "rq_table.dat"
};
@@ -382,15 +343,14 @@ struct fixedfloat
* root_table[3 + x] = 2^(x/4)
*/
static
-mad_fixed_t const root_table[7] =
-{
- MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
- MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
- MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
- MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
- MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
- MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
- MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
+mad_fixed_t const root_table[7] = {
+ MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
+ MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
+ MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
+ MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
+ MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
+ MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
+ MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
};
/*
@@ -402,21 +362,19 @@ mad_fixed_t const root_table[7] =
* ca[i] = c[i] / sqrt(1 + c[i]^2)
*/
static
-mad_fixed_t const cs[8] =
-{
- +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
- +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
- +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
- +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
+mad_fixed_t const cs[8] = {
+ +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
+ +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
+ +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
+ +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
};
static
-mad_fixed_t const ca[8] =
-{
- -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
- -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
- -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
- -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
+mad_fixed_t const ca[8] = {
+ -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
+ -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
+ -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
+ -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
};
/*
@@ -427,8 +385,7 @@ mad_fixed_t const ca[8] =
* imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1))
*/
static
-mad_fixed_t const imdct_s[6][6] =
-{
+mad_fixed_t const imdct_s[6][6] = {
# include "imdct_s.dat"
};
@@ -440,28 +397,27 @@ mad_fixed_t const imdct_s[6][6] =
* window_l[i] = sin((PI / 36) * (i + 1/2))
*/
static
-mad_fixed_t const window_l[36] =
-{
- MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
- MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
- MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
- MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
- MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
- MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
-
- MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
- MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
- MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
- MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
- MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
- MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
-
- MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
- MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
- MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
- MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
- MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
- MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
+mad_fixed_t const window_l[36] = {
+ MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+ MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
+ MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
+
+ MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
+ MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
+
+ MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
+ MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
};
# endif /* ASO_IMDCT */
@@ -472,14 +428,13 @@ mad_fixed_t const window_l[36] =
* window_s[i] = sin((PI / 12) * (i + 1/2))
*/
static
-mad_fixed_t const window_s[12] =
-{
- MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
- MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
- MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
- MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
- MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
- MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+mad_fixed_t const window_s[12] = {
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
};
/*
@@ -490,15 +445,14 @@ mad_fixed_t const window_s[12] =
* is_table[i] = is_ratio[i] / (1 + is_ratio[i])
*/
static
-mad_fixed_t const is_table[7] =
-{
- MAD_F(0x00000000) /* 0.000000000 */,
- MAD_F(0x0361962f) /* 0.211324865 */,
- MAD_F(0x05db3d74) /* 0.366025404 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x0a24c28c) /* 0.633974596 */,
- MAD_F(0x0c9e69d1) /* 0.788675135 */,
- MAD_F(0x10000000) /* 1.000000000 */
+mad_fixed_t const is_table[7] = {
+ MAD_F(0x00000000) /* 0.000000000 */,
+ MAD_F(0x0361962f) /* 0.211324865 */,
+ MAD_F(0x05db3d74) /* 0.366025404 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x0a24c28c) /* 0.633974596 */,
+ MAD_F(0x0c9e69d1) /* 0.788675135 */,
+ MAD_F(0x10000000) /* 1.000000000 */
};
/*
@@ -509,41 +463,40 @@ mad_fixed_t const is_table[7] =
* is_lsf_table[1][i] = (1 / sqrt(2))^(i + 1)
*/
static
-mad_fixed_t const is_lsf_table[2][15] =
-{
- {
- MAD_F(0x0d744fcd) /* 0.840896415 */,
- MAD_F(0x0b504f33) /* 0.707106781 */,
- MAD_F(0x09837f05) /* 0.594603558 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x06ba27e6) /* 0.420448208 */,
- MAD_F(0x05a8279a) /* 0.353553391 */,
- MAD_F(0x04c1bf83) /* 0.297301779 */,
- MAD_F(0x04000000) /* 0.250000000 */,
- MAD_F(0x035d13f3) /* 0.210224104 */,
- MAD_F(0x02d413cd) /* 0.176776695 */,
- MAD_F(0x0260dfc1) /* 0.148650889 */,
- MAD_F(0x02000000) /* 0.125000000 */,
- MAD_F(0x01ae89fa) /* 0.105112052 */,
- MAD_F(0x016a09e6) /* 0.088388348 */,
- MAD_F(0x01306fe1) /* 0.074325445 */
- }, {
- MAD_F(0x0b504f33) /* 0.707106781 */,
- MAD_F(0x08000000) /* 0.500000000 */,
- MAD_F(0x05a8279a) /* 0.353553391 */,
- MAD_F(0x04000000) /* 0.250000000 */,
- MAD_F(0x02d413cd) /* 0.176776695 */,
- MAD_F(0x02000000) /* 0.125000000 */,
- MAD_F(0x016a09e6) /* 0.088388348 */,
- MAD_F(0x01000000) /* 0.062500000 */,
- MAD_F(0x00b504f3) /* 0.044194174 */,
- MAD_F(0x00800000) /* 0.031250000 */,
- MAD_F(0x005a827a) /* 0.022097087 */,
- MAD_F(0x00400000) /* 0.015625000 */,
- MAD_F(0x002d413d) /* 0.011048543 */,
- MAD_F(0x00200000) /* 0.007812500 */,
- MAD_F(0x0016a09e) /* 0.005524272 */
- }
+mad_fixed_t const is_lsf_table[2][15] = {
+ {
+ MAD_F(0x0d744fcd) /* 0.840896415 */,
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x09837f05) /* 0.594603558 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x06ba27e6) /* 0.420448208 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04c1bf83) /* 0.297301779 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x035d13f3) /* 0.210224104 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x0260dfc1) /* 0.148650889 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x01ae89fa) /* 0.105112052 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01306fe1) /* 0.074325445 */
+ }, {
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01000000) /* 0.062500000 */,
+ MAD_F(0x00b504f3) /* 0.044194174 */,
+ MAD_F(0x00800000) /* 0.031250000 */,
+ MAD_F(0x005a827a) /* 0.022097087 */,
+ MAD_F(0x00400000) /* 0.015625000 */,
+ MAD_F(0x002d413d) /* 0.011048543 */,
+ MAD_F(0x00200000) /* 0.007812500 */,
+ MAD_F(0x0016a09e) /* 0.005524272 */
+ }
};
/*
@@ -552,94 +505,89 @@ mad_fixed_t const is_lsf_table[2][15] =
*/
static
enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
- int lsf, struct sideinfo *si,
- unsigned int *data_bitlen,
- unsigned int *priv_bitlen)
+ int lsf, struct sideinfo *si,
+ unsigned int *data_bitlen,
+ unsigned int *priv_bitlen)
{
- unsigned int ngr, gr, ch, i;
- enum mad_error result = MAD_ERROR_NONE;
+ unsigned int ngr, gr, ch, i;
+ enum mad_error result = MAD_ERROR_NONE;
- *data_bitlen = 0;
- *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3);
+ *data_bitlen = 0;
+ *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3);
- si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9);
- si->private_bits = mad_bit_read(ptr, *priv_bitlen);
+ si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9);
+ si->private_bits = mad_bit_read(ptr, *priv_bitlen);
- ngr = 1;
- if(!lsf)
- {
- ngr = 2;
+ ngr = 1;
+ if (!lsf) {
+ ngr = 2;
- for(ch = 0; ch < nch; ++ch)
- si->scfsi[ch] = mad_bit_read(ptr, 4);
- }
+ for (ch = 0; ch < nch; ++ch)
+ si->scfsi[ch] = mad_bit_read(ptr, 4);
+ }
- for(gr = 0; gr < ngr; ++gr)
- {
- struct granule *granule = &si->gr[gr];
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel *channel = &granule->ch[ch];
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
- channel->part2_3_length = mad_bit_read(ptr, 12);
- channel->big_values = mad_bit_read(ptr, 9);
- channel->global_gain = mad_bit_read(ptr, 8);
- channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4);
+ channel->part2_3_length = mad_bit_read(ptr, 12);
+ channel->big_values = mad_bit_read(ptr, 9);
+ channel->global_gain = mad_bit_read(ptr, 8);
+ channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4);
- *data_bitlen += channel->part2_3_length;
+ *data_bitlen += channel->part2_3_length;
- if(channel->big_values > 288 && result == 0)
- result = MAD_ERROR_BADBIGVALUES;
+ if (channel->big_values > 288 && result == 0)
+ result = MAD_ERROR_BADBIGVALUES;
- channel->flags = 0;
+ channel->flags = 0;
- /* window_switching_flag */
- if(mad_bit_read(ptr, 1))
- {
- channel->block_type = mad_bit_read(ptr, 2);
+ /* window_switching_flag */
+ if (mad_bit_read(ptr, 1)) {
+ channel->block_type = mad_bit_read(ptr, 2);
- if(channel->block_type == 0 && result == 0)
- result = MAD_ERROR_BADBLOCKTYPE;
+ if (channel->block_type == 0 && result == 0)
+ result = MAD_ERROR_BADBLOCKTYPE;
- if(!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0)
- result = MAD_ERROR_BADSCFSI;
+ if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0)
+ result = MAD_ERROR_BADSCFSI;
- channel->region0_count = 7;
- channel->region1_count = 36;
+ channel->region0_count = 7;
+ channel->region1_count = 36;
- if(mad_bit_read(ptr, 1))
- channel->flags |= mixed_block_flag;
- else if(channel->block_type == 2)
- channel->region0_count = 8;
+ if (mad_bit_read(ptr, 1))
+ channel->flags |= mixed_block_flag;
+ else if (channel->block_type == 2)
+ channel->region0_count = 8;
- for(i = 0; i < 2; ++i)
- channel->table_select[i] = mad_bit_read(ptr, 5);
+ for (i = 0; i < 2; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
# if defined(DEBUG)
- channel->table_select[2] = 4; /* not used */
+ channel->table_select[2] = 4; /* not used */
# endif
- for(i = 0; i < 3; ++i)
- channel->subblock_gain[i] = mad_bit_read(ptr, 3);
- }
- else
- {
- channel->block_type = 0;
+ for (i = 0; i < 3; ++i)
+ channel->subblock_gain[i] = mad_bit_read(ptr, 3);
+ }
+ else {
+ channel->block_type = 0;
- for(i = 0; i < 3; ++i)
- channel->table_select[i] = mad_bit_read(ptr, 5);
+ for (i = 0; i < 3; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
- channel->region0_count = mad_bit_read(ptr, 4);
- channel->region1_count = mad_bit_read(ptr, 3);
- }
+ channel->region0_count = mad_bit_read(ptr, 4);
+ channel->region1_count = mad_bit_read(ptr, 3);
+ }
- /* [preflag,] scalefac_scale, count1table_select */
- channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3);
- }
+ /* [preflag,] scalefac_scale, count1table_select */
+ channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3);
}
+ }
- return result;
+ return result;
}
/*
@@ -648,125 +596,113 @@ enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
*/
static
unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
- struct channel *channel,
- struct channel *gr1ch, int mode_extension)
+ struct channel *channel,
+ struct channel *gr1ch, int mode_extension)
{
- struct mad_bitptr start;
- unsigned int scalefac_compress, index, slen[4], part, n, i;
- unsigned char const *nsfb;
+ struct mad_bitptr start;
+ unsigned int scalefac_compress, index, slen[4], part, n, i;
+ unsigned char const *nsfb;
- start = *ptr;
+ start = *ptr;
- scalefac_compress = channel->scalefac_compress;
- index = (channel->block_type == 2) ?
- ((channel->flags & mixed_block_flag) ? 2 : 1) : 0;
+ scalefac_compress = channel->scalefac_compress;
+ index = (channel->block_type == 2) ?
+ ((channel->flags & mixed_block_flag) ? 2 : 1) : 0;
- if(!((mode_extension & I_STEREO) && gr1ch))
- {
- if(scalefac_compress < 400)
- {
- slen[0] = (scalefac_compress >> 4) / 5;
- slen[1] = (scalefac_compress >> 4) % 5;
- slen[2] = (scalefac_compress % 16) >> 2;
- slen[3] = scalefac_compress % 4;
-
- nsfb = nsfb_table[0][index];
- }
- else if(scalefac_compress < 500)
- {
- scalefac_compress -= 400;
-
- slen[0] = (scalefac_compress >> 2) / 5;
- slen[1] = (scalefac_compress >> 2) % 5;
- slen[2] = scalefac_compress % 4;
- slen[3] = 0;
-
- nsfb = nsfb_table[1][index];
- }
- else
- {
- scalefac_compress -= 500;
-
- slen[0] = scalefac_compress / 3;
- slen[1] = scalefac_compress % 3;
- slen[2] = 0;
- slen[3] = 0;
-
- channel->flags |= preflag;
-
- nsfb = nsfb_table[2][index];
- }
-
- n = 0;
- for(part = 0; part < 4; ++part)
- {
- for(i = 0; i < nsfb[part]; ++i)
- channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
- }
-
- while(n < 39)
- channel->scalefac[n++] = 0;
+ if (!((mode_extension & I_STEREO) && gr1ch)) {
+ if (scalefac_compress < 400) {
+ slen[0] = (scalefac_compress >> 4) / 5;
+ slen[1] = (scalefac_compress >> 4) % 5;
+ slen[2] = (scalefac_compress % 16) >> 2;
+ slen[3] = scalefac_compress % 4;
+
+ nsfb = nsfb_table[0][index];
}
- else /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
- {
- scalefac_compress >>= 1;
-
- if(scalefac_compress < 180)
- {
- slen[0] = scalefac_compress / 36;
- slen[1] = (scalefac_compress % 36) / 6;
- slen[2] = (scalefac_compress % 36) % 6;
- slen[3] = 0;
-
- nsfb = nsfb_table[3][index];
- }
- else if(scalefac_compress < 244)
- {
- scalefac_compress -= 180;
-
- slen[0] = (scalefac_compress % 64) >> 4;
- slen[1] = (scalefac_compress % 16) >> 2;
- slen[2] = scalefac_compress % 4;
- slen[3] = 0;
-
- nsfb = nsfb_table[4][index];
- }
- else
- {
- scalefac_compress -= 244;
-
- slen[0] = scalefac_compress / 3;
- slen[1] = scalefac_compress % 3;
- slen[2] = 0;
- slen[3] = 0;
-
- nsfb = nsfb_table[5][index];
- }
-
- n = 0;
- for(part = 0; part < 4; ++part)
- {
- unsigned int max, is_pos;
-
- max = (1 << slen[part]) - 1;
-
- for(i = 0; i < nsfb[part]; ++i)
- {
- is_pos = mad_bit_read(ptr, slen[part]);
-
- channel->scalefac[n] = is_pos;
- gr1ch->scalefac[n++] = (is_pos == max);
- }
- }
-
- while(n < 39)
- {
- channel->scalefac[n] = 0;
- gr1ch->scalefac[n++] = 0; /* apparently not illegal */
- }
+ else if (scalefac_compress < 500) {
+ scalefac_compress -= 400;
+
+ slen[0] = (scalefac_compress >> 2) / 5;
+ slen[1] = (scalefac_compress >> 2) % 5;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[1][index];
}
+ else {
+ scalefac_compress -= 500;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ channel->flags |= preflag;
+
+ nsfb = nsfb_table[2][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ for (i = 0; i < nsfb[part]; ++i)
+ channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
+ }
+
+ while (n < 39)
+ channel->scalefac[n++] = 0;
+ }
+ else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
+ scalefac_compress >>= 1;
- return mad_bit_length(&start, ptr);
+ if (scalefac_compress < 180) {
+ slen[0] = scalefac_compress / 36;
+ slen[1] = (scalefac_compress % 36) / 6;
+ slen[2] = (scalefac_compress % 36) % 6;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[3][index];
+ }
+ else if (scalefac_compress < 244) {
+ scalefac_compress -= 180;
+
+ slen[0] = (scalefac_compress % 64) >> 4;
+ slen[1] = (scalefac_compress % 16) >> 2;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[4][index];
+ }
+ else {
+ scalefac_compress -= 244;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[5][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ unsigned int max, is_pos;
+
+ max = (1 << slen[part]) - 1;
+
+ for (i = 0; i < nsfb[part]; ++i) {
+ is_pos = mad_bit_read(ptr, slen[part]);
+
+ channel->scalefac[n] = is_pos;
+ gr1ch->scalefac[n++] = (is_pos == max);
+ }
+ }
+
+ while (n < 39) {
+ channel->scalefac[n] = 0;
+ gr1ch->scalefac[n++] = 0; /* apparently not illegal */
+ }
+ }
+
+ return mad_bit_length(&start, ptr);
}
/*
@@ -775,84 +711,74 @@ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
*/
static
unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
- struct channel const *gr0ch, unsigned int scfsi)
+ struct channel const *gr0ch, unsigned int scfsi)
{
- struct mad_bitptr start;
- unsigned int slen1, slen2, sfbi;
+ struct mad_bitptr start;
+ unsigned int slen1, slen2, sfbi;
- start = *ptr;
+ start = *ptr;
- slen1 = sflen_table[channel->scalefac_compress].slen1;
- slen2 = sflen_table[channel->scalefac_compress].slen2;
+ slen1 = sflen_table[channel->scalefac_compress].slen1;
+ slen2 = sflen_table[channel->scalefac_compress].slen2;
- if(channel->block_type == 2)
- {
- unsigned int nsfb;
+ if (channel->block_type == 2) {
+ unsigned int nsfb;
- sfbi = 0;
+ sfbi = 0;
- nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
+ nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
- nsfb = 6 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
+ nsfb = 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
- nsfb = 1 * 3;
- while(nsfb--)
- channel->scalefac[sfbi++] = 0;
+ nsfb = 1 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = 0;
+ }
+ else { /* channel->block_type != 2 */
+ if (scfsi & 0x8) {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
}
- else /* channel->block_type != 2 */
- {
- if(scfsi & 0x8)
- {
- for(sfbi = 0; sfbi < 6; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 0; sfbi < 6; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
- }
-
- if(scfsi & 0x4)
- {
- for(sfbi = 6; sfbi < 11; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 6; sfbi < 11; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
- }
-
- if(scfsi & 0x2)
- {
- for(sfbi = 11; sfbi < 16; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 11; sfbi < 16; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
- }
-
- if(scfsi & 0x1)
- {
- for(sfbi = 16; sfbi < 21; ++sfbi)
- channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
- }
- else
- {
- for(sfbi = 16; sfbi < 21; ++sfbi)
- channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
- }
-
- channel->scalefac[21] = 0;
+ else {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
}
- return mad_bit_length(&start, ptr);
+ if (scfsi & 0x4) {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
+ }
+
+ if (scfsi & 0x2) {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ if (scfsi & 0x1) {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ channel->scalefac[21] = 0;
+ }
+
+ return mad_bit_length(&start, ptr);
}
/*
@@ -883,78 +809,69 @@ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
*/
static
void III_exponents(struct channel const *channel,
- unsigned char const *sfbwidth, signed int exponents[39])
+ unsigned char const *sfbwidth, signed int exponents[39])
{
- signed int gain;
- unsigned int scalefac_multiplier, sfbi;
+ signed int gain;
+ unsigned int scalefac_multiplier, sfbi;
- gain = (signed int) channel->global_gain - 210;
- scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1;
+ gain = (signed int) channel->global_gain - 210;
+ scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1;
- if(channel->block_type == 2)
- {
- unsigned int l;
- signed int gain0, gain1, gain2;
+ if (channel->block_type == 2) {
+ unsigned int l;
+ signed int gain0, gain1, gain2;
- sfbi = l = 0;
+ sfbi = l = 0;
- if(channel->flags & mixed_block_flag)
- {
- unsigned int premask;
+ if (channel->flags & mixed_block_flag) {
+ unsigned int premask;
- premask = (channel->flags & preflag) ? ~0 : 0;
+ premask = (channel->flags & preflag) ? ~0 : 0;
- /* long block subbands 0-1 */
+ /* long block subbands 0-1 */
- while(l < 36)
- {
- exponents[sfbi] = gain -
- (signed int)((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) <<
- scalefac_multiplier);
+ while (l < 36) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) <<
+ scalefac_multiplier);
- l += sfbwidth[sfbi++];
- }
- }
+ l += sfbwidth[sfbi++];
+ }
+ }
- /* this is probably wrong for 8000 Hz short/mixed blocks */
+ /* this is probably wrong for 8000 Hz short/mixed blocks */
- gain0 = gain - 8 * (signed int) channel->subblock_gain[0];
- gain1 = gain - 8 * (signed int) channel->subblock_gain[1];
- gain2 = gain - 8 * (signed int) channel->subblock_gain[2];
+ gain0 = gain - 8 * (signed int) channel->subblock_gain[0];
+ gain1 = gain - 8 * (signed int) channel->subblock_gain[1];
+ gain2 = gain - 8 * (signed int) channel->subblock_gain[2];
- while(l < 576)
- {
- exponents[sfbi + 0] = gain0 -
- (signed int)(channel->scalefac[sfbi + 0] << scalefac_multiplier);
- exponents[sfbi + 1] = gain1 -
- (signed int)(channel->scalefac[sfbi + 1] << scalefac_multiplier);
- exponents[sfbi + 2] = gain2 -
- (signed int)(channel->scalefac[sfbi + 2] << scalefac_multiplier);
+ while (l < 576) {
+ exponents[sfbi + 0] = gain0 -
+ (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier);
+ exponents[sfbi + 1] = gain1 -
+ (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier);
+ exponents[sfbi + 2] = gain2 -
+ (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier);
- l += 3 * sfbwidth[sfbi];
- sfbi += 3;
- }
+ l += 3 * sfbwidth[sfbi];
+ sfbi += 3;
}
- else /* channel->block_type != 2 */
- {
- if(channel->flags & preflag)
- {
- for(sfbi = 0; sfbi < 22; ++sfbi)
- {
- exponents[sfbi] = gain -
- (signed int)((channel->scalefac[sfbi] + pretab[sfbi]) <<
- scalefac_multiplier);
- }
- }
- else
- {
- for(sfbi = 0; sfbi < 22; ++sfbi)
- {
- exponents[sfbi] = gain -
- (signed int)(channel->scalefac[sfbi] << scalefac_multiplier);
- }
- }
+ }
+ else { /* channel->block_type != 2 */
+ if (channel->flags & preflag) {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) <<
+ scalefac_multiplier);
+ }
}
+ else {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) (channel->scalefac[sfbi] << scalefac_multiplier);
+ }
+ }
+ }
}
/*
@@ -964,46 +881,41 @@ void III_exponents(struct channel const *channel,
static
mad_fixed_t III_requantize(unsigned int value, signed int exp)
{
- mad_fixed_t requantized;
- signed int frac;
- struct fixedfloat const *power;
+ mad_fixed_t requantized;
+ signed int frac;
+ struct fixedfloat const *power;
- frac = exp % 4; /* assumes sign(frac) == sign(exp) */
- exp /= 4;
+ frac = exp % 4; /* assumes sign(frac) == sign(exp) */
+ exp /= 4;
- power = &rq_table[value];
- requantized = power->mantissa;
- exp += power->exponent;
+ power = &rq_table[value];
+ requantized = power->mantissa;
+ exp += power->exponent;
- if(exp < 0)
- {
- if(-exp >= sizeof(mad_fixed_t) * CHAR_BIT)
- {
- /* underflow */
- requantized = 0;
- }
- else
- {
- requantized += 1L << (-exp - 1);
- requantized >>= -exp;
- }
+ if (exp < 0) {
+ if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) {
+ /* underflow */
+ requantized = 0;
}
- else
- {
- if(exp >= 5)
- {
- /* overflow */
+ else {
+ requantized += 1L << (-exp - 1);
+ requantized >>= -exp;
+ }
+ }
+ else {
+ if (exp >= 5) {
+ /* overflow */
# if defined(DEBUG)
- fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
- mad_f_todouble(requantized), exp);
+ fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
+ mad_f_todouble(requantized), exp);
# endif
- requantized = MAD_F_MAX;
- }
- else
- requantized <<= exp;
+ requantized = MAD_F_MAX;
}
+ else
+ requantized <<= exp;
+ }
- return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
+ return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
}
/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */
@@ -1018,370 +930,343 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp)
*/
static
enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
- struct channel *channel,
- unsigned char const *sfbwidth,
- unsigned int part2_length)
+ struct channel *channel,
+ unsigned char const *sfbwidth,
+ unsigned int part2_length)
{
- signed int exponents[39], exp;
- signed int const *expptr;
- struct mad_bitptr peek;
- signed int bits_left, cachesz;
- register mad_fixed_t *xrptr;
- mad_fixed_t const *sfbound;
- register unsigned long bitcache;
+ signed int exponents[39], exp;
+ signed int const *expptr;
+ struct mad_bitptr peek;
+ signed int bits_left, cachesz;
+ register mad_fixed_t *xrptr;
+ mad_fixed_t const *sfbound;
+ register unsigned long bitcache;
- bits_left = (signed) channel->part2_3_length - (signed) part2_length;
- if(bits_left < 0)
- return MAD_ERROR_BADPART3LEN;
+ bits_left = (signed) channel->part2_3_length - (signed) part2_length;
+ if (bits_left < 0)
+ return MAD_ERROR_BADPART3LEN;
- III_exponents(channel, sfbwidth, exponents);
+ III_exponents(channel, sfbwidth, exponents);
- peek = *ptr;
- mad_bit_skip(ptr, bits_left);
+ peek = *ptr;
+ mad_bit_skip(ptr, bits_left);
- /* align bit reads to byte boundaries */
- cachesz = mad_bit_bitsleft(&peek);
- cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
+ /* align bit reads to byte boundaries */
+ cachesz = mad_bit_bitsleft(&peek);
+ cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
- bitcache = mad_bit_read(&peek, cachesz);
- bits_left -= cachesz;
+ bitcache = mad_bit_read(&peek, cachesz);
+ bits_left -= cachesz;
- xrptr = &xr[0];
+ xrptr = &xr[0];
- /* big_values */
- {
- unsigned int region, rcount;
- struct hufftable const *entry;
- union huffpair const *table;
- unsigned int linbits, startbits, big_values, reqhits;
- mad_fixed_t reqcache[16];
-
- sfbound = xrptr + *sfbwidth++;
- rcount = channel->region0_count + 1;
-
- entry = &mad_huff_pair_table[channel->table_select[region = 0]];
- table = entry->table;
- linbits = entry->linbits;
- startbits = entry->startbits;
-
- if(table == 0)
- return MAD_ERROR_BADHUFFTABLE;
-
- expptr = &exponents[0];
- exp = *expptr++;
- reqhits = 0;
-
- big_values = channel->big_values;
-
- while(big_values-- && cachesz + bits_left > 0)
- {
- union huffpair const *pair;
- unsigned int clumpsz, value;
- register mad_fixed_t requantized;
-
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
-
- /* change table if region boundary */
-
- if(--rcount == 0)
- {
- if(region == 0)
- rcount = channel->region1_count + 1;
- else
- rcount = 0; /* all remaining */
-
- entry = &mad_huff_pair_table[channel->table_select[++region]];
- table = entry->table;
- linbits = entry->linbits;
- startbits = entry->startbits;
-
- if(table == 0)
- return MAD_ERROR_BADHUFFTABLE;
- }
-
- if(exp != *expptr)
- {
- exp = *expptr;
- reqhits = 0;
- }
-
- ++expptr;
- }
-
- if(cachesz < 21)
- {
- unsigned int bits;
-
- bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
- bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
- cachesz += bits;
- bits_left -= bits;
- }
-
- /* hcod (0..19) */
-
- clumpsz = startbits;
- pair = &table[MASK(bitcache, cachesz, clumpsz)];
-
- while(!pair->final)
- {
- cachesz -= clumpsz;
-
- clumpsz = pair->ptr.bits;
- pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)];
- }
-
- cachesz -= pair->value.hlen;
-
- if(linbits)
- {
- /* x (0..14) */
-
- value = pair->value.x;
-
- switch(value)
- {
- case 0:
- xrptr[0] = 0;
- break;
-
- case 15:
- if(cachesz < linbits + 2)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
-
- value += MASK(bitcache, cachesz, linbits);
- cachesz -= linbits;
-
- requantized = III_requantize(value, exp);
- goto x_final;
-
- default:
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
-x_final:
- xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
-
- /* y (0..14) */
-
- value = pair->value.y;
-
- switch(value)
- {
- case 0:
- xrptr[1] = 0;
- break;
-
- case 15:
- if(cachesz < linbits + 1)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
-
- value += MASK(bitcache, cachesz, linbits);
- cachesz -= linbits;
-
- requantized = III_requantize(value, exp);
- goto y_final;
-
- default:
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
-y_final:
- xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
- }
- else
- {
- /* x (0..1) */
-
- value = pair->value.x;
-
- if(value == 0)
- xrptr[0] = 0;
- else
- {
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
- xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
-
- /* y (0..1) */
-
- value = pair->value.y;
-
- if(value == 0)
- xrptr[1] = 0;
- else
- {
- if(reqhits & (1 << value))
- requantized = reqcache[value];
- else
- {
- reqhits |= (1 << value);
- requantized = reqcache[value] = III_requantize(value, exp);
- }
-
- xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
- -requantized : requantized;
- }
- }
-
- xrptr += 2;
- }
+ /* big_values */
+ {
+ unsigned int region, rcount;
+ struct hufftable const *entry;
+ union huffpair const *table;
+ unsigned int linbits, startbits, big_values, reqhits;
+ mad_fixed_t reqcache[16];
+
+ sfbound = xrptr + *sfbwidth++;
+ rcount = channel->region0_count + 1;
+
+ entry = &mad_huff_pair_table[channel->table_select[region = 0]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+
+ expptr = &exponents[0];
+ exp = *expptr++;
+ reqhits = 0;
+
+ big_values = channel->big_values;
+
+ while (big_values-- && cachesz + bits_left > 0) {
+ union huffpair const *pair;
+ unsigned int clumpsz, value;
+ register mad_fixed_t requantized;
+
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
+
+ /* change table if region boundary */
+
+ if (--rcount == 0) {
+ if (region == 0)
+ rcount = channel->region1_count + 1;
+ else
+ rcount = 0; /* all remaining */
+
+ entry = &mad_huff_pair_table[channel->table_select[++region]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+ }
+
+ if (exp != *expptr) {
+ exp = *expptr;
+ reqhits = 0;
+ }
+
+ ++expptr;
+ }
+
+ if (cachesz < 21) {
+ unsigned int bits;
+
+ bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
+ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
+ cachesz += bits;
+ bits_left -= bits;
+ }
+
+ /* hcod (0..19) */
+
+ clumpsz = startbits;
+ pair = &table[MASK(bitcache, cachesz, clumpsz)];
+
+ while (!pair->final) {
+ cachesz -= clumpsz;
+
+ clumpsz = pair->ptr.bits;
+ pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)];
+ }
+
+ cachesz -= pair->value.hlen;
+
+ if (linbits) {
+ /* x (0..14) */
+
+ value = pair->value.x;
+
+ switch (value) {
+ case 0:
+ xrptr[0] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 2) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto x_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ x_final:
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..14) */
+
+ value = pair->value.y;
+
+ switch (value) {
+ case 0:
+ xrptr[1] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 1) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto y_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ y_final:
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+ else {
+ /* x (0..1) */
+
+ value = pair->value.x;
+
+ if (value == 0)
+ xrptr[0] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..1) */
+
+ value = pair->value.y;
+
+ if (value == 0)
+ xrptr[1] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+
+ xrptr += 2;
}
+ }
- if(cachesz + bits_left < 0)
- return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
+ if (cachesz + bits_left < 0)
+ return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
- /* count1 */
- {
- union huffquad const *table;
- register mad_fixed_t requantized;
+ /* count1 */
+ {
+ union huffquad const *table;
+ register mad_fixed_t requantized;
- table = mad_huff_quad_table[channel->flags & count1table_select];
+ table = mad_huff_quad_table[channel->flags & count1table_select];
- requantized = III_requantize(1, exp);
+ requantized = III_requantize(1, exp);
- while(cachesz + bits_left > 0 && xrptr <= &xr[572])
- {
- union huffquad const *quad;
+ while (cachesz + bits_left > 0 && xrptr <= &xr[572]) {
+ union huffquad const *quad;
- /* hcod (1..6) */
+ /* hcod (1..6) */
- if(cachesz < 10)
- {
- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
- cachesz += 16;
- bits_left -= 16;
- }
+ if (cachesz < 10) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
- quad = &table[MASK(bitcache, cachesz, 4)];
+ quad = &table[MASK(bitcache, cachesz, 4)];
- /* quad tables guaranteed to have at most one extra lookup */
- if(!quad->final)
- {
- cachesz -= 4;
+ /* quad tables guaranteed to have at most one extra lookup */
+ if (!quad->final) {
+ cachesz -= 4;
- quad = &table[quad->ptr.offset +
- MASK(bitcache, cachesz, quad->ptr.bits)];
- }
+ quad = &table[quad->ptr.offset +
+ MASK(bitcache, cachesz, quad->ptr.bits)];
+ }
- cachesz -= quad->value.hlen;
+ cachesz -= quad->value.hlen;
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
- if(exp != *expptr)
- {
- exp = *expptr;
- requantized = III_requantize(1, exp);
- }
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
- ++expptr;
- }
+ ++expptr;
+ }
- /* v (0..1) */
+ /* v (0..1) */
- xrptr[0] = quad->value.v ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[0] = quad->value.v ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- /* w (0..1) */
+ /* w (0..1) */
- xrptr[1] = quad->value.w ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[1] = quad->value.w ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- xrptr += 2;
+ xrptr += 2;
- if(xrptr == sfbound)
- {
- sfbound += *sfbwidth++;
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
- if(exp != *expptr)
- {
- exp = *expptr;
- requantized = III_requantize(1, exp);
- }
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
- ++expptr;
- }
+ ++expptr;
+ }
- /* x (0..1) */
+ /* x (0..1) */
- xrptr[0] = quad->value.x ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[0] = quad->value.x ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- /* y (0..1) */
+ /* y (0..1) */
- xrptr[1] = quad->value.y ?
- (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+ xrptr[1] = quad->value.y ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
- xrptr += 2;
- }
+ xrptr += 2;
+ }
- if(cachesz + bits_left < 0)
- {
+ if (cachesz + bits_left < 0) {
# if 0 && defined(DEBUG)
- fprintf(stderr, "huffman count1 overrun (%d bits)\n",
- -(cachesz + bits_left));
+ fprintf(stderr, "huffman count1 overrun (%d bits)\n",
+ -(cachesz + bits_left));
# endif
- /* technically the bitstream is misformatted, but apparently
- some encoders are just a bit sloppy with stuffing bits */
+ /* technically the bitstream is misformatted, but apparently
+ some encoders are just a bit sloppy with stuffing bits */
- xrptr -= 4;
- }
+ xrptr -= 4;
}
+ }
- assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
+ assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
# if 0 && defined(DEBUG)
- if(bits_left < 0)
- fprintf(stderr, "read %d bits too many\n", -bits_left);
- else if(cachesz + bits_left > 0)
- fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left);
+ if (bits_left < 0)
+ fprintf(stderr, "read %d bits too many\n", -bits_left);
+ else if (cachesz + bits_left > 0)
+ fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left);
# endif
- /* rzero */
- while(xrptr < &xr[576])
- {
- xrptr[0] = 0;
- xrptr[1] = 0;
+ /* rzero */
+ while (xrptr < &xr[576]) {
+ xrptr[0] = 0;
+ xrptr[1] = 0;
- xrptr += 2;
- }
+ xrptr += 2;
+ }
- return MAD_ERROR_NONE;
+ return MAD_ERROR_NONE;
}
# undef MASK
@@ -1393,50 +1278,45 @@ y_final:
*/
static
void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
- unsigned char const sfbwidth[39])
+ unsigned char const sfbwidth[39])
{
- mad_fixed_t tmp[32][3][6];
- unsigned int sb, l, f, w, sbw[3], sw[3];
+ mad_fixed_t tmp[32][3][6];
+ unsigned int sb, l, f, w, sbw[3], sw[3];
- /* this is probably wrong for 8000 Hz mixed blocks */
+ /* this is probably wrong for 8000 Hz mixed blocks */
- sb = 0;
- if(channel->flags & mixed_block_flag)
- {
- sb = 2;
+ sb = 0;
+ if (channel->flags & mixed_block_flag) {
+ sb = 2;
- l = 0;
- while(l < 36)
- l += *sfbwidth++;
- }
+ l = 0;
+ while (l < 36)
+ l += *sfbwidth++;
+ }
- for(w = 0; w < 3; ++w)
- {
- sbw[w] = sb;
- sw[w] = 0;
+ for (w = 0; w < 3; ++w) {
+ sbw[w] = sb;
+ sw[w] = 0;
+ }
+
+ f = *sfbwidth++;
+ w = 0;
+
+ for (l = 18 * sb; l < 576; ++l) {
+ if (f-- == 0) {
+ f = *sfbwidth++ - 1;
+ w = (w + 1) % 3;
}
- f = *sfbwidth++;
- w = 0;
+ tmp[sbw[w]][w][sw[w]++] = xr[l];
- for(l = 18 * sb; l < 576; ++l)
- {
- if(f-- == 0)
- {
- f = *sfbwidth++ - 1;
- w = (w + 1) % 3;
- }
-
- tmp[sbw[w]][w][sw[w]++] = xr[l];
-
- if(sw[w] == 6)
- {
- sw[w] = 0;
- ++sbw[w];
- }
+ if (sw[w] == 6) {
+ sw[w] = 0;
+ ++sbw[w];
}
+ }
- memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t));
+ memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t));
}
/*
@@ -1445,238 +1325,211 @@ void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
*/
static
enum mad_error III_stereo(mad_fixed_t xr[2][576],
- struct granule const *granule,
- struct mad_header *header,
- unsigned char const *sfbwidth)
+ struct granule const *granule,
+ struct mad_header *header,
+ unsigned char const *sfbwidth)
{
- short modes[39];
- unsigned int sfbi, l, n, i;
+ short modes[39];
+ unsigned int sfbi, l, n, i;
- if(granule->ch[0].block_type !=
- granule->ch[1].block_type ||
- (granule->ch[0].flags & mixed_block_flag) !=
- (granule->ch[1].flags & mixed_block_flag))
- return MAD_ERROR_BADSTEREO;
+ if (granule->ch[0].block_type !=
+ granule->ch[1].block_type ||
+ (granule->ch[0].flags & mixed_block_flag) !=
+ (granule->ch[1].flags & mixed_block_flag))
+ return MAD_ERROR_BADSTEREO;
- for(i = 0; i < 39; ++i)
- modes[i] = header->mode_extension;
+ for (i = 0; i < 39; ++i)
+ modes[i] = header->mode_extension;
- /* intensity stereo */
+ /* intensity stereo */
- if(header->mode_extension & I_STEREO)
- {
- struct channel const *right_ch = &granule->ch[1];
- mad_fixed_t const *right_xr = xr[1];
- unsigned int is_pos;
-
- header->flags |= MAD_FLAG_I_STEREO;
-
- /* first determine which scalefactor bands are to be processed */
-
- if(right_ch->block_type == 2)
- {
- unsigned int lower, start, max, bound[3], w;
-
- lower = start = max = bound[0] = bound[1] = bound[2] = 0;
-
- sfbi = l = 0;
-
- if(right_ch->flags & mixed_block_flag)
- {
- while(l < 36)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- lower = sfbi;
- break;
- }
- }
-
- right_xr += n;
- l += n;
- }
-
- start = sfbi;
- }
-
- w = 0;
- while(l < 576)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- max = bound[w] = sfbi;
- break;
- }
- }
-
- right_xr += n;
- l += n;
- w = (w + 1) % 3;
- }
-
- if(max)
- lower = start;
-
- /* long blocks */
-
- for(i = 0; i < lower; ++i)
- modes[i] = header->mode_extension & ~I_STEREO;
-
- /* short blocks */
-
- w = 0;
- for(i = start; i < max; ++i)
- {
- if(i < bound[w])
- modes[i] = header->mode_extension & ~I_STEREO;
-
- w = (w + 1) % 3;
- }
- }
- else /* right_ch->block_type != 2 */
- {
- unsigned int bound;
-
- bound = 0;
- for(sfbi = l = 0; l < 576; l += n)
- {
- n = sfbwidth[sfbi++];
-
- for(i = 0; i < n; ++i)
- {
- if(right_xr[i])
- {
- bound = sfbi;
- break;
- }
- }
-
- right_xr += n;
- }
-
- for(i = 0; i < bound; ++i)
- modes[i] = header->mode_extension & ~I_STEREO;
- }
-
- /* now do the actual processing */
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- unsigned char const *illegal_pos = granule[1].ch[1].scalefac;
- mad_fixed_t const *lsf_scale;
-
- /* intensity_scale */
- lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1];
-
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
-
- if(!(modes[sfbi] & I_STEREO))
- continue;
-
- if(illegal_pos[sfbi])
- {
- modes[sfbi] &= ~I_STEREO;
- continue;
- }
-
- is_pos = right_ch->scalefac[sfbi];
-
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t left;
-
- left = xr[0][l + i];
-
- if(is_pos == 0)
- xr[1][l + i] = left;
- else
- {
- register mad_fixed_t opposite;
-
- opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]);
-
- if(is_pos & 1)
- {
- xr[0][l + i] = opposite;
- xr[1][l + i] = left;
- }
- else
- xr[1][l + i] = opposite;
- }
- }
- }
- }
- else /* !(header->flags & MAD_FLAG_LSF_EXT) */
- {
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
-
- if(!(modes[sfbi] & I_STEREO))
- continue;
-
- is_pos = right_ch->scalefac[sfbi];
-
- if(is_pos >= 7) /* illegal intensity position */
- {
- modes[sfbi] &= ~I_STEREO;
- continue;
- }
-
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t left;
-
- left = xr[0][l + i];
-
- xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]);
- xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]);
- }
- }
- }
+ if (header->mode_extension & I_STEREO) {
+ struct channel const *right_ch = &granule->ch[1];
+ mad_fixed_t const *right_xr = xr[1];
+ unsigned int is_pos;
+
+ header->flags |= MAD_FLAG_I_STEREO;
+
+ /* first determine which scalefactor bands are to be processed */
+
+ if (right_ch->block_type == 2) {
+ unsigned int lower, start, max, bound[3], w;
+
+ lower = start = max = bound[0] = bound[1] = bound[2] = 0;
+
+ sfbi = l = 0;
+
+ if (right_ch->flags & mixed_block_flag) {
+ while (l < 36) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ lower = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ }
+
+ start = sfbi;
+ }
+
+ w = 0;
+ while (l < 576) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ max = bound[w] = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ w = (w + 1) % 3;
+ }
+
+ if (max)
+ lower = start;
+
+ /* long blocks */
+
+ for (i = 0; i < lower; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ /* short blocks */
+
+ w = 0;
+ for (i = start; i < max; ++i) {
+ if (i < bound[w])
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ w = (w + 1) % 3;
+ }
}
+ else { /* right_ch->block_type != 2 */
+ unsigned int bound;
- /* middle/side stereo */
+ bound = 0;
+ for (sfbi = l = 0; l < 576; l += n) {
+ n = sfbwidth[sfbi++];
- if(header->mode_extension & MS_STEREO)
- {
- register mad_fixed_t invsqrt2;
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ bound = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ }
+
+ for (i = 0; i < bound; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+ }
+
+ /* now do the actual processing */
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ unsigned char const *illegal_pos = granule[1].ch[1].scalefac;
+ mad_fixed_t const *lsf_scale;
+
+ /* intensity_scale */
+ lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
- header->flags |= MAD_FLAG_MS_STEREO;
+ if (illegal_pos[sfbi]) {
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
- invsqrt2 = root_table[3 + -2];
+ is_pos = right_ch->scalefac[sfbi];
- for(sfbi = l = 0; l < 576; ++sfbi, l += n)
- {
- n = sfbwidth[sfbi];
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
- if(modes[sfbi] != MS_STEREO)
- continue;
+ left = xr[0][l + i];
- for(i = 0; i < n; ++i)
- {
- register mad_fixed_t m, s;
+ if (is_pos == 0)
+ xr[1][l + i] = left;
+ else {
+ register mad_fixed_t opposite;
- m = xr[0][l + i];
- s = xr[1][l + i];
+ opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]);
- xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */
- xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */
- }
- }
+ if (is_pos & 1) {
+ xr[0][l + i] = opposite;
+ xr[1][l + i] = left;
+ }
+ else
+ xr[1][l + i] = opposite;
+ }
+ }
+ }
}
+ else { /* !(header->flags & MAD_FLAG_LSF_EXT) */
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
+
+ is_pos = right_ch->scalefac[sfbi];
+
+ if (is_pos >= 7) { /* illegal intensity position */
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
+
+ left = xr[0][l + i];
+
+ xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]);
+ xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]);
+ }
+ }
+ }
+ }
+
+ /* middle/side stereo */
+
+ if (header->mode_extension & MS_STEREO) {
+ register mad_fixed_t invsqrt2;
- return MAD_ERROR_NONE;
+ header->flags |= MAD_FLAG_MS_STEREO;
+
+ invsqrt2 = root_table[3 + -2];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (modes[sfbi] != MS_STEREO)
+ continue;
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t m, s;
+
+ m = xr[0][l + i];
+ s = xr[1][l + i];
+
+ xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */
+ xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */
+ }
+ }
+ }
+
+ return MAD_ERROR_NONE;
}
/*
@@ -1686,39 +1539,36 @@ enum mad_error III_stereo(mad_fixed_t xr[2][576],
static
void III_aliasreduce(mad_fixed_t xr[576], int lines)
{
- mad_fixed_t const *bound;
- int i;
+ mad_fixed_t const *bound;
+ int i;
- bound = &xr[lines];
- for(xr += 18; xr < bound; xr += 18)
- {
- for(i = 0; i < 8; ++i)
- {
- register mad_fixed_t a, b;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
+ bound = &xr[lines];
+ for (xr += 18; xr < bound; xr += 18) {
+ for (i = 0; i < 8; ++i) {
+ register mad_fixed_t a, b;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
- a = xr[-1 - i];
- b = xr[ i];
+ a = xr[-1 - i];
+ b = xr[ i];
# if defined(ASO_ZEROCHECK)
- if(a | b)
- {
+ if (a | b) {
# endif
- MAD_F_ML0(hi, lo, a, cs[i]);
- MAD_F_MLA(hi, lo, -b, ca[i]);
+ MAD_F_ML0(hi, lo, a, cs[i]);
+ MAD_F_MLA(hi, lo, -b, ca[i]);
- xr[-1 - i] = MAD_F_MLZ(hi, lo);
+ xr[-1 - i] = MAD_F_MLZ(hi, lo);
- MAD_F_ML0(hi, lo, b, cs[i]);
- MAD_F_MLA(hi, lo, a, ca[i]);
+ MAD_F_ML0(hi, lo, b, cs[i]);
+ MAD_F_MLA(hi, lo, a, ca[i]);
- xr[ i] = MAD_F_MLZ(hi, lo);
+ xr[ i] = MAD_F_MLZ(hi, lo);
# if defined(ASO_ZEROCHECK)
- }
+ }
# endif
- }
}
+ }
}
# if defined(ASO_IMDCT)
@@ -1728,162 +1578,154 @@ void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int);
static
void fastsdct(mad_fixed_t const x[9], mad_fixed_t y[18])
{
- mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
- mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
- mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7;
-
- enum
- {
- c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */
- c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */
- c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */
- c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */
- c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */
- c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */
- c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */
- };
-
- a0 = x[3] + x[5];
- a1 = x[3] - x[5];
- a2 = x[6] + x[2];
- a3 = x[6] - x[2];
- a4 = x[1] + x[7];
- a5 = x[1] - x[7];
- a6 = x[8] + x[0];
- a7 = x[8] - x[0];
-
- a8 = a0 + a2;
- a9 = a0 - a2;
- a10 = a0 - a6;
- a11 = a2 - a6;
- a12 = a8 + a6;
- a13 = a1 - a3;
- a14 = a13 + a7;
- a15 = a3 + a7;
- a16 = a1 - a7;
- a17 = a1 + a3;
-
- m0 = mad_f_mul(a17, -c3);
- m1 = mad_f_mul(a16, -c0);
- m2 = mad_f_mul(a15, -c4);
- m3 = mad_f_mul(a14, -c1);
- m4 = mad_f_mul(a5, -c1);
- m5 = mad_f_mul(a11, -c6);
- m6 = mad_f_mul(a10, -c5);
- m7 = mad_f_mul(a9, -c2);
-
- a18 = x[4] + a4;
- a19 = 2 * x[4] - a4;
- a20 = a19 + m5;
- a21 = a19 - m5;
- a22 = a19 + m6;
- a23 = m4 + m2;
- a24 = m4 - m2;
- a25 = m4 + m1;
-
- /* output to every other slot for convenience */
-
- y[ 0] = a18 + a12;
- y[ 2] = m0 - a25;
- y[ 4] = m7 - a20;
- y[ 6] = m3;
- y[ 8] = a21 - m6;
- y[10] = a24 - m1;
- y[12] = a12 - 2 * a18;
- y[14] = a23 + m0;
- y[16] = a22 + m7;
+ mad_fixed_t a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12;
+ mad_fixed_t a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25;
+ mad_fixed_t m0, m1, m2, m3, m4, m5, m6, m7;
+
+ enum {
+ c0 = MAD_F(0x1f838b8d), /* 2 * cos( 1 * PI / 18) */
+ c1 = MAD_F(0x1bb67ae8), /* 2 * cos( 3 * PI / 18) */
+ c2 = MAD_F(0x18836fa3), /* 2 * cos( 4 * PI / 18) */
+ c3 = MAD_F(0x1491b752), /* 2 * cos( 5 * PI / 18) */
+ c4 = MAD_F(0x0af1d43a), /* 2 * cos( 7 * PI / 18) */
+ c5 = MAD_F(0x058e86a0), /* 2 * cos( 8 * PI / 18) */
+ c6 = -MAD_F(0x1e11f642) /* 2 * cos(16 * PI / 18) */
+ };
+
+ a0 = x[3] + x[5];
+ a1 = x[3] - x[5];
+ a2 = x[6] + x[2];
+ a3 = x[6] - x[2];
+ a4 = x[1] + x[7];
+ a5 = x[1] - x[7];
+ a6 = x[8] + x[0];
+ a7 = x[8] - x[0];
+
+ a8 = a0 + a2;
+ a9 = a0 - a2;
+ a10 = a0 - a6;
+ a11 = a2 - a6;
+ a12 = a8 + a6;
+ a13 = a1 - a3;
+ a14 = a13 + a7;
+ a15 = a3 + a7;
+ a16 = a1 - a7;
+ a17 = a1 + a3;
+
+ m0 = mad_f_mul(a17, -c3);
+ m1 = mad_f_mul(a16, -c0);
+ m2 = mad_f_mul(a15, -c4);
+ m3 = mad_f_mul(a14, -c1);
+ m4 = mad_f_mul(a5, -c1);
+ m5 = mad_f_mul(a11, -c6);
+ m6 = mad_f_mul(a10, -c5);
+ m7 = mad_f_mul(a9, -c2);
+
+ a18 = x[4] + a4;
+ a19 = 2 * x[4] - a4;
+ a20 = a19 + m5;
+ a21 = a19 - m5;
+ a22 = a19 + m6;
+ a23 = m4 + m2;
+ a24 = m4 - m2;
+ a25 = m4 + m1;
+
+ /* output to every other slot for convenience */
+
+ y[ 0] = a18 + a12;
+ y[ 2] = m0 - a25;
+ y[ 4] = m7 - a20;
+ y[ 6] = m3;
+ y[ 8] = a21 - m6;
+ y[10] = a24 - m1;
+ y[12] = a12 - 2 * a18;
+ y[14] = a23 + m0;
+ y[16] = a22 + m7;
}
static inline
void sdctII(mad_fixed_t const x[18], mad_fixed_t X[18])
{
- mad_fixed_t tmp[9];
- int i;
+ mad_fixed_t tmp[9];
+ int i;
- /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */
- static mad_fixed_t const scale[9] =
- {
- MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930),
- MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8),
- MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7)
- };
+ /* scale[i] = 2 * cos(PI * (2 * i + 1) / (2 * 18)) */
+ static mad_fixed_t const scale[9] = {
+ MAD_F(0x1fe0d3b4), MAD_F(0x1ee8dd47), MAD_F(0x1d007930),
+ MAD_F(0x1a367e59), MAD_F(0x16a09e66), MAD_F(0x125abcf8),
+ MAD_F(0x0d8616bc), MAD_F(0x08483ee1), MAD_F(0x02c9fad7)
+ };
- /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */
+ /* divide the 18-point SDCT-II into two 9-point SDCT-IIs */
- /* even input butterfly */
+ /* even input butterfly */
- for(i = 0; i < 9; i += 3)
- {
- tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1];
- tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1];
- tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1];
- }
+ for (i = 0; i < 9; i += 3) {
+ tmp[i + 0] = x[i + 0] + x[18 - (i + 0) - 1];
+ tmp[i + 1] = x[i + 1] + x[18 - (i + 1) - 1];
+ tmp[i + 2] = x[i + 2] + x[18 - (i + 2) - 1];
+ }
- fastsdct(tmp, &X[0]);
+ fastsdct(tmp, &X[0]);
- /* odd input butterfly and scaling */
+ /* odd input butterfly and scaling */
- for(i = 0; i < 9; i += 3)
- {
- tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]);
- tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]);
- tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]);
- }
+ for (i = 0; i < 9; i += 3) {
+ tmp[i + 0] = mad_f_mul(x[i + 0] - x[18 - (i + 0) - 1], scale[i + 0]);
+ tmp[i + 1] = mad_f_mul(x[i + 1] - x[18 - (i + 1) - 1], scale[i + 1]);
+ tmp[i + 2] = mad_f_mul(x[i + 2] - x[18 - (i + 2) - 1], scale[i + 2]);
+ }
- fastsdct(tmp, &X[1]);
+ fastsdct(tmp, &X[1]);
- /* output accumulation */
+ /* output accumulation */
- for(i = 3; i < 18; i += 8)
- {
- X[i + 0] -= X[(i + 0) - 2];
- X[i + 2] -= X[(i + 2) - 2];
- X[i + 4] -= X[(i + 4) - 2];
- X[i + 6] -= X[(i + 6) - 2];
- }
+ for (i = 3; i < 18; i += 8) {
+ X[i + 0] -= X[(i + 0) - 2];
+ X[i + 2] -= X[(i + 2) - 2];
+ X[i + 4] -= X[(i + 4) - 2];
+ X[i + 6] -= X[(i + 6) - 2];
+ }
}
static inline
void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18])
{
- mad_fixed_t tmp[18];
- int i;
-
- /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */
- static mad_fixed_t const scale[18] =
- {
- MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120),
- MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b),
- MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4),
- MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3),
- MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5),
- MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c)
- };
-
- /* scaling */
-
- for(i = 0; i < 18; i += 3)
- {
- tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]);
- tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]);
- tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]);
- }
-
- /* SDCT-II */
-
- sdctII(tmp, X);
-
- /* scale reduction and output accumulation */
-
- X[0] /= 2;
- for(i = 1; i < 17; i += 4)
- {
- X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1];
- X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1];
- X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1];
- X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1];
- }
- X[17] = X[17] / 2 - X[16];
+ mad_fixed_t tmp[18];
+ int i;
+
+ /* scale[i] = 2 * cos(PI * (2 * i + 1) / (4 * 18)) */
+ static mad_fixed_t const scale[18] = {
+ MAD_F(0x1ff833fa), MAD_F(0x1fb9ea93), MAD_F(0x1f3dd120),
+ MAD_F(0x1e84d969), MAD_F(0x1d906bcf), MAD_F(0x1c62648b),
+ MAD_F(0x1afd100f), MAD_F(0x1963268b), MAD_F(0x1797c6a4),
+ MAD_F(0x159e6f5b), MAD_F(0x137af940), MAD_F(0x11318ef3),
+ MAD_F(0x0ec6a507), MAD_F(0x0c3ef153), MAD_F(0x099f61c5),
+ MAD_F(0x06ed12c5), MAD_F(0x042d4544), MAD_F(0x0165547c)
+ };
+
+ /* scaling */
+
+ for (i = 0; i < 18; i += 3) {
+ tmp[i + 0] = mad_f_mul(y[i + 0], scale[i + 0]);
+ tmp[i + 1] = mad_f_mul(y[i + 1], scale[i + 1]);
+ tmp[i + 2] = mad_f_mul(y[i + 2], scale[i + 2]);
+ }
+
+ /* SDCT-II */
+
+ sdctII(tmp, X);
+
+ /* scale reduction and output accumulation */
+
+ X[0] /= 2;
+ for (i = 1; i < 17; i += 4) {
+ X[i + 0] = X[i + 0] / 2 - X[(i + 0) - 1];
+ X[i + 1] = X[i + 1] / 2 - X[(i + 1) - 1];
+ X[i + 2] = X[i + 2] / 2 - X[(i + 2) - 1];
+ X[i + 3] = X[i + 3] / 2 - X[(i + 3) - 1];
+ }
+ X[17] = X[17] / 2 - X[16];
}
/*
@@ -1893,33 +1735,30 @@ void dctIV(mad_fixed_t const y[18], mad_fixed_t X[18])
static inline
void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36])
{
- mad_fixed_t tmp[18];
- int i;
-
- /* DCT-IV */
-
- dctIV(x, tmp);
-
- /* convert 18-point DCT-IV to 36-point IMDCT */
-
- for(i = 0; i < 9; i += 3)
- {
- y[i + 0] = tmp[9 + (i + 0)];
- y[i + 1] = tmp[9 + (i + 1)];
- y[i + 2] = tmp[9 + (i + 2)];
- }
- for(i = 9; i < 27; i += 3)
- {
- y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1];
- y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1];
- y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1];
- }
- for(i = 27; i < 36; i += 3)
- {
- y[i + 0] = -tmp[(i + 0) - 27];
- y[i + 1] = -tmp[(i + 1) - 27];
- y[i + 2] = -tmp[(i + 2) - 27];
- }
+ mad_fixed_t tmp[18];
+ int i;
+
+ /* DCT-IV */
+
+ dctIV(x, tmp);
+
+ /* convert 18-point DCT-IV to 36-point IMDCT */
+
+ for (i = 0; i < 9; i += 3) {
+ y[i + 0] = tmp[9 + (i + 0)];
+ y[i + 1] = tmp[9 + (i + 1)];
+ y[i + 2] = tmp[9 + (i + 2)];
+ }
+ for (i = 9; i < 27; i += 3) {
+ y[i + 0] = -tmp[36 - (9 + (i + 0)) - 1];
+ y[i + 1] = -tmp[36 - (9 + (i + 1)) - 1];
+ y[i + 2] = -tmp[36 - (9 + (i + 2)) - 1];
+ }
+ for (i = 27; i < 36; i += 3) {
+ y[i + 0] = -tmp[(i + 0) - 27];
+ y[i + 1] = -tmp[(i + 1) - 27];
+ y[i + 2] = -tmp[(i + 2) - 27];
+ }
}
# else
/*
@@ -1929,288 +1768,288 @@ void imdct36(mad_fixed_t const x[18], mad_fixed_t y[36])
static inline
void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
{
- mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
- mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa));
-
- t6 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8));
-
- t0 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549));
-
- x[7] = MAD_F_MLZ(hi, lo);
- x[10] = -x[7];
-
- MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0));
-
- x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0;
-
- t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15];
- t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17];
-
- MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa));
-
- x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346));
-
- t1 = MAD_F_MLZ(hi, lo) + t6;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890));
-
- x[6] = MAD_F_MLZ(hi, lo) + t1;
- x[11] = -x[6];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2));
-
- x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1;
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad));
-
- x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1;
-
- MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8));
-
- t7 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0));
-
- t2 = MAD_F_MLZ(hi, lo);
-
- MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5));
-
- x[5] = MAD_F_MLZ(hi, lo);
- x[12] = -x[5];
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352));
-
- x[0] = MAD_F_MLZ(hi, lo) + t2;
- x[17] = -x[0];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962));
-
- x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549));
-
- t3 = MAD_F_MLZ(hi, lo) + t7;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd));
-
- x[8] = MAD_F_MLZ(hi, lo) + t3;
- x[9] = -x[8];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284));
-
- x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3;
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779));
-
- x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3;
-
- MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8));
- MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa));
-
- t4 = MAD_F_MLZ(hi, lo) - t7;
-
- MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa));
- MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8));
-
- x[4] = MAD_F_MLZ(hi, lo) + t4;
- x[13] = -x[4];
-
- MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2));
- MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346));
-
- x[1] = MAD_F_MLZ(hi, lo) + t4;
- x[16] = -x[1];
-
- MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2));
-
- x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4;
-
- MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549));
- MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346));
- MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0));
- MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2));
-
- t5 = MAD_F_MLZ(hi, lo) - t6;
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807));
-
- x[2] = MAD_F_MLZ(hi, lo) + t5;
- x[15] = -x[2];
-
- MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e));
- MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245));
-
- x[3] = MAD_F_MLZ(hi, lo) + t5;
- x[14] = -x[3];
-
- MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd));
- MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890));
- MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5));
- MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245));
- MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807));
- MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352));
- MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad));
- MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779));
- MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284));
- MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2));
- MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962));
- MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e));
-
- x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5;
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa));
+
+ t6 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8));
+
+ t0 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549));
+
+ x[7] = MAD_F_MLZ(hi, lo);
+ x[10] = -x[7];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0));
+
+ x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0;
+
+ t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15];
+ t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17];
+
+ MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa));
+
+ x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346));
+
+ t1 = MAD_F_MLZ(hi, lo) + t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890));
+
+ x[6] = MAD_F_MLZ(hi, lo) + t1;
+ x[11] = -x[6];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2));
+
+ x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad));
+
+ x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8));
+
+ t7 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0));
+
+ t2 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5));
+
+ x[5] = MAD_F_MLZ(hi, lo);
+ x[12] = -x[5];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352));
+
+ x[0] = MAD_F_MLZ(hi, lo) + t2;
+ x[17] = -x[0];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962));
+
+ x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549));
+
+ t3 = MAD_F_MLZ(hi, lo) + t7;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd));
+
+ x[8] = MAD_F_MLZ(hi, lo) + t3;
+ x[9] = -x[8];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284));
+
+ x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779));
+
+ x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3;
+
+ MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa));
+
+ t4 = MAD_F_MLZ(hi, lo) - t7;
+
+ MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8));
+
+ x[4] = MAD_F_MLZ(hi, lo) + t4;
+ x[13] = -x[4];
+
+ MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346));
+
+ x[1] = MAD_F_MLZ(hi, lo) + t4;
+ x[16] = -x[1];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2));
+
+ x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2));
+
+ t5 = MAD_F_MLZ(hi, lo) - t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807));
+
+ x[2] = MAD_F_MLZ(hi, lo) + t5;
+ x[15] = -x[2];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245));
+
+ x[3] = MAD_F_MLZ(hi, lo) + t5;
+ x[14] = -x[3];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e));
+
+ x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5;
}
# endif
@@ -2220,90 +2059,84 @@ void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
*/
static
void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36],
- unsigned int block_type)
+ unsigned int block_type)
{
- unsigned int i;
+ unsigned int i;
- /* IMDCT */
+ /* IMDCT */
- imdct36(X, z);
+ imdct36(X, z);
- /* windowing */
+ /* windowing */
- switch(block_type)
- {
- case 0: /* normal window */
+ switch (block_type) {
+ case 0: /* normal window */
# if defined(ASO_INTERLEAVE1)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = window_l[0];
- tmp2 = window_l[1];
-
- for(i = 0; i < 34; i += 2)
- {
- z[i + 0] = mad_f_mul(z[i + 0], tmp1);
- tmp1 = window_l[i + 2];
- z[i + 1] = mad_f_mul(z[i + 1], tmp2);
- tmp2 = window_l[i + 3];
- }
-
- z[34] = mad_f_mul(z[34], tmp1);
- z[35] = mad_f_mul(z[35], tmp2);
- }
-# elif defined(ASO_INTERLEAVE2)
-{
- register mad_fixed_t tmp1, tmp2;
+ {
+ register mad_fixed_t tmp1, tmp2;
- tmp1 = z[0];
- tmp2 = window_l[0];
+ tmp1 = window_l[0];
+ tmp2 = window_l[1];
- for(i = 0; i < 35; ++i)
- {
- z[i] = mad_f_mul(tmp1, tmp2);
- tmp1 = z[i + 1];
- tmp2 = window_l[i + 1];
+ for (i = 0; i < 34; i += 2) {
+ z[i + 0] = mad_f_mul(z[i + 0], tmp1);
+ tmp1 = window_l[i + 2];
+ z[i + 1] = mad_f_mul(z[i + 1], tmp2);
+ tmp2 = window_l[i + 3];
+ }
+
+ z[34] = mad_f_mul(z[34], tmp1);
+ z[35] = mad_f_mul(z[35], tmp2);
}
+# elif defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
- z[35] = mad_f_mul(tmp1, tmp2);
-}
+ tmp1 = z[0];
+ tmp2 = window_l[0];
+
+ for (i = 0; i < 35; ++i) {
+ z[i] = mad_f_mul(tmp1, tmp2);
+ tmp1 = z[i + 1];
+ tmp2 = window_l[i + 1];
+ }
+
+ z[35] = mad_f_mul(tmp1, tmp2);
+ }
# elif 1
-for(i = 0; i < 36; i += 4)
-{
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]);
-}
+ for (i = 0; i < 36; i += 4) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
+ z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]);
+ }
# else
-for(i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
+ for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
# endif
- break;
-
- case 1: /* start block */
- for(i = 0; i < 18; i += 3)
- {
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- }
- /* (i = 18; i < 24; ++i) z[i] unchanged */
- for(i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]);
- for(i = 30; i < 36; ++i) z[i] = 0;
- break;
-
- case 3: /* stop block */
- for(i = 0; i < 6; ++i) z[i] = 0;
- for(i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]);
- /* (i = 12; i < 18; ++i) z[i] unchanged */
- for(i = 18; i < 36; i += 3)
- {
- z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
- z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
- z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
- }
- break;
+ break;
+
+ case 1: /* start block */
+ for (i = 0; i < 18; i += 3) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
}
+ /* (i = 18; i < 24; ++i) z[i] unchanged */
+ for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]);
+ for (i = 30; i < 36; ++i) z[i] = 0;
+ break;
+
+ case 3: /* stop block */
+ for (i = 0; i < 6; ++i) z[i] = 0;
+ for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]);
+ /* (i = 12; i < 18; ++i) z[i] unchanged */
+ for (i = 18; i < 36; i += 3) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
+ }
+ break;
+ }
}
# endif /* ASO_IMDCT */
@@ -2314,79 +2147,76 @@ for(i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
static
void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
{
- mad_fixed_t y[36], *yptr;
- mad_fixed_t const *wptr;
- int w, i;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- /* IMDCT */
+ mad_fixed_t y[36], *yptr;
+ mad_fixed_t const *wptr;
+ int w, i;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
- yptr = &y[0];
+ /* IMDCT */
- for(w = 0; w < 3; ++w)
- {
- register mad_fixed_t const(*s)[6];
+ yptr = &y[0];
- s = imdct_s;
+ for (w = 0; w < 3; ++w) {
+ register mad_fixed_t const (*s)[6];
- for(i = 0; i < 3; ++i)
- {
- MAD_F_ML0(hi, lo, X[0], (*s)[0]);
- MAD_F_MLA(hi, lo, X[1], (*s)[1]);
- MAD_F_MLA(hi, lo, X[2], (*s)[2]);
- MAD_F_MLA(hi, lo, X[3], (*s)[3]);
- MAD_F_MLA(hi, lo, X[4], (*s)[4]);
- MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+ s = imdct_s;
- yptr[i + 0] = MAD_F_MLZ(hi, lo);
- yptr[5 - i] = -yptr[i + 0];
+ for (i = 0; i < 3; ++i) {
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
- ++s;
+ yptr[i + 0] = MAD_F_MLZ(hi, lo);
+ yptr[5 - i] = -yptr[i + 0];
- MAD_F_ML0(hi, lo, X[0], (*s)[0]);
- MAD_F_MLA(hi, lo, X[1], (*s)[1]);
- MAD_F_MLA(hi, lo, X[2], (*s)[2]);
- MAD_F_MLA(hi, lo, X[3], (*s)[3]);
- MAD_F_MLA(hi, lo, X[4], (*s)[4]);
- MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+ ++s;
- yptr[ i + 6] = MAD_F_MLZ(hi, lo);
- yptr[11 - i] = yptr[i + 6];
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
- ++s;
- }
+ yptr[ i + 6] = MAD_F_MLZ(hi, lo);
+ yptr[11 - i] = yptr[i + 6];
- yptr += 12;
- X += 6;
+ ++s;
}
- /* windowing, overlapping and concatenation */
+ yptr += 12;
+ X += 6;
+ }
- yptr = &y[0];
- wptr = &window_s[0];
+ /* windowing, overlapping and concatenation */
- for(i = 0; i < 6; ++i)
- {
- z[i + 0] = 0;
- z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]);
+ yptr = &y[0];
+ wptr = &window_s[0];
- MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]);
- MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]);
+ for (i = 0; i < 6; ++i) {
+ z[i + 0] = 0;
+ z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]);
- z[i + 12] = MAD_F_MLZ(hi, lo);
+ MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]);
- MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]);
- MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]);
+ z[i + 12] = MAD_F_MLZ(hi, lo);
- z[i + 18] = MAD_F_MLZ(hi, lo);
+ MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]);
- z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]);
- z[i + 30] = 0;
+ z[i + 18] = MAD_F_MLZ(hi, lo);
- ++yptr;
- ++wptr;
- }
+ z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]);
+ z[i + 30] = 0;
+
+ ++yptr;
+ ++wptr;
+ }
}
/*
@@ -2395,48 +2225,45 @@ void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
*/
static
void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
- mad_fixed_t sample[18][32], unsigned int sb)
+ mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = overlap[0];
- tmp2 = overlap[1];
-
- for(i = 0; i < 16; i += 2)
- {
- sample[i + 0][sb] = output[i + 0 + 0] + tmp1;
- overlap[i + 0] = output[i + 0 + 18];
- tmp1 = overlap[i + 2];
-
- sample[i + 1][sb] = output[i + 1 + 0] + tmp2;
- overlap[i + 1] = output[i + 1 + 18];
- tmp2 = overlap[i + 3];
- }
-
- sample[16][sb] = output[16 + 0] + tmp1;
- overlap[16] = output[16 + 18];
- sample[17][sb] = output[17 + 0] + tmp2;
- overlap[17] = output[17 + 18];
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + tmp1;
+ overlap[i + 0] = output[i + 0 + 18];
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = output[i + 1 + 0] + tmp2;
+ overlap[i + 1] = output[i + 1 + 18];
+ tmp2 = overlap[i + 3];
}
+
+ sample[16][sb] = output[16 + 0] + tmp1;
+ overlap[16] = output[16 + 18];
+ sample[17][sb] = output[17 + 0] + tmp2;
+ overlap[17] = output[17 + 18];
+ }
# elif 0
- for(i = 0; i < 18; i += 2)
- {
- sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0];
- overlap[i + 0] = output[i + 0 + 18];
+ for (i = 0; i < 18; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0];
+ overlap[i + 0] = output[i + 0 + 18];
- sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1];
- overlap[i + 1] = output[i + 1 + 18];
- }
+ sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1];
+ overlap[i + 1] = output[i + 1 + 18];
+ }
# else
- for(i = 0; i < 18; ++i)
- {
- sample[i][sb] = output[i + 0] + overlap[i];
- overlap[i] = output[i + 18];
- }
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = output[i + 0] + overlap[i];
+ overlap[i] = output[i + 18];
+ }
# endif
}
@@ -2446,39 +2273,37 @@ void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
*/
static inline
void III_overlap_z(mad_fixed_t overlap[18],
- mad_fixed_t sample[18][32], unsigned int sb)
+ mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = overlap[0];
- tmp2 = overlap[1];
-
- for(i = 0; i < 16; i += 2)
- {
- sample[i + 0][sb] = tmp1;
- overlap[i + 0] = 0;
- tmp1 = overlap[i + 2];
-
- sample[i + 1][sb] = tmp2;
- overlap[i + 1] = 0;
- tmp2 = overlap[i + 3];
- }
-
- sample[16][sb] = tmp1;
- overlap[16] = 0;
- sample[17][sb] = tmp2;
- overlap[17] = 0;
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = tmp1;
+ overlap[i + 0] = 0;
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = tmp2;
+ overlap[i + 1] = 0;
+ tmp2 = overlap[i + 3];
}
+
+ sample[16][sb] = tmp1;
+ overlap[16] = 0;
+ sample[17][sb] = tmp2;
+ overlap[17] = 0;
+ }
# else
- for(i = 0; i < 18; ++i)
- {
- sample[i][sb] = overlap[i];
- overlap[i] = 0;
- }
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = overlap[i];
+ overlap[i] = 0;
+ }
# endif
}
@@ -2489,31 +2314,30 @@ void III_overlap_z(mad_fixed_t overlap[18],
static
void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
{
- unsigned int i;
+ unsigned int i;
# if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2)
- {
- register mad_fixed_t tmp1, tmp2;
-
- tmp1 = sample[1][sb];
- tmp2 = sample[3][sb];
-
- for(i = 1; i < 13; i += 4)
- {
- sample[i + 0][sb] = -tmp1;
- tmp1 = sample[i + 4][sb];
- sample[i + 2][sb] = -tmp2;
- tmp2 = sample[i + 6][sb];
- }
-
- sample[13][sb] = -tmp1;
- tmp1 = sample[17][sb];
- sample[15][sb] = -tmp2;
- sample[17][sb] = -tmp1;
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = sample[1][sb];
+ tmp2 = sample[3][sb];
+
+ for (i = 1; i < 13; i += 4) {
+ sample[i + 0][sb] = -tmp1;
+ tmp1 = sample[i + 4][sb];
+ sample[i + 2][sb] = -tmp2;
+ tmp2 = sample[i + 6][sb];
}
+
+ sample[13][sb] = -tmp1;
+ tmp1 = sample[17][sb];
+ sample[15][sb] = -tmp2;
+ sample[17][sb] = -tmp1;
+ }
# else
- for(i = 1; i < 18; i += 2)
- sample[i][sb] = -sample[i][sb];
+ for (i = 1; i < 18; i += 2)
+ sample[i][sb] = -sample[i][sb];
# endif
}
@@ -2523,182 +2347,165 @@ void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
*/
static
enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
- struct sideinfo *si, unsigned int nch)
+ struct sideinfo *si, unsigned int nch)
{
- struct mad_header *header = &frame->header;
- unsigned int sfreqi, ngr, gr;
+ struct mad_header *header = &frame->header;
+ unsigned int sfreqi, ngr, gr;
- {
- unsigned int sfreq;
+ {
+ unsigned int sfreq;
- sfreq = header->samplerate;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- sfreq *= 2;
+ sfreq = header->samplerate;
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreq *= 2;
- /* 48000 => 0, 44100 => 1, 32000 => 2,
- 24000 => 3, 22050 => 4, 16000 => 5 */
- sfreqi = ((sfreq >> 7) & 0x000f) +
- ((sfreq >> 15) & 0x0001) - 8;
+ /* 48000 => 0, 44100 => 1, 32000 => 2,
+ 24000 => 3, 22050 => 4, 16000 => 5 */
+ sfreqi = ((sfreq >> 7) & 0x000f) +
+ ((sfreq >> 15) & 0x0001) - 8;
- if(header->flags & MAD_FLAG_MPEG_2_5_EXT)
- sfreqi += 3;
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreqi += 3;
+ }
+
+ /* scalefactors, Huffman decoding, requantization */
+
+ ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2;
+
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
+ unsigned char const *sfbwidth[2];
+ mad_fixed_t xr[2][576];
+ unsigned int ch;
+ enum mad_error error;
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
+ unsigned int part2_length;
+
+ sfbwidth[ch] = sfbwidth_table[sfreqi].l;
+ if (channel->block_type == 2) {
+ sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
+ sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
+ }
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ part2_length = III_scalefactors_lsf(ptr, channel,
+ ch == 0 ? 0 : &si->gr[1].ch[1],
+ header->mode_extension);
+ }
+ else {
+ part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
+ gr == 0 ? 0 : si->scfsi[ch]);
+ }
+
+ error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
+ if (error)
+ return error;
}
- /* scalefactors, Huffman decoding, requantization */
+ /* joint stereo processing */
- ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2;
+ if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) {
+ error = III_stereo(xr, granule, header, sfbwidth[0]);
+ if (error)
+ return error;
+ }
- for(gr = 0; gr < ngr; ++gr)
- {
- struct granule *granule = &si->gr[gr];
- unsigned char const *sfbwidth[2];
- mad_fixed_t xr[2][576];
- unsigned int ch;
- enum mad_error error;
-
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel *channel = &granule->ch[ch];
- unsigned int part2_length;
-
- sfbwidth[ch] = sfbwidth_table[sfreqi].l;
- if(channel->block_type == 2)
- {
- sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
- sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
- }
-
- if(header->flags & MAD_FLAG_LSF_EXT)
- {
- part2_length = III_scalefactors_lsf(ptr, channel,
- ch == 0 ? 0 : &si->gr[1].ch[1],
- header->mode_extension);
- }
- else
- {
- part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
- gr == 0 ? 0 : si->scfsi[ch]);
- }
-
- error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
- if(error)
- return error;
- }
-
- /* joint stereo processing */
-
- if(header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension)
- {
- error = III_stereo(xr, granule, header, sfbwidth[0]);
- if(error)
- return error;
- }
-
- /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */
-
- for(ch = 0; ch < nch; ++ch)
- {
- struct channel const *channel = &granule->ch[ch];
- mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr];
- unsigned int sb, l, i, sblimit;
- mad_fixed_t output[36];
-
- if(channel->block_type == 2)
- {
- III_reorder(xr[ch], channel, sfbwidth[ch]);
+ /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel const *channel = &granule->ch[ch];
+ mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr];
+ unsigned int sb, l, i, sblimit;
+ mad_fixed_t output[36];
+
+ if (channel->block_type == 2) {
+ III_reorder(xr[ch], channel, sfbwidth[ch]);
# if !defined(OPT_STRICT)
- /*
- * According to ISO/IEC 11172-3, "Alias reduction is not applied for
- * granules with block_type == 2 (short block)." However, other
- * sources suggest alias reduction should indeed be performed on the
- * lower two subbands of mixed blocks. Most other implementations do
- * this, so by default we will too.
- */
- if(channel->flags & mixed_block_flag)
- III_aliasreduce(xr[ch], 36);
+ /*
+ * According to ISO/IEC 11172-3, "Alias reduction is not applied for
+ * granules with block_type == 2 (short block)." However, other
+ * sources suggest alias reduction should indeed be performed on the
+ * lower two subbands of mixed blocks. Most other implementations do
+ * this, so by default we will too.
+ */
+ if (channel->flags & mixed_block_flag)
+ III_aliasreduce(xr[ch], 36);
# endif
- }
- else
- III_aliasreduce(xr[ch], 576);
-
- l = 0;
-
- /* subbands 0-1 */
-
- if(channel->block_type != 2 || (channel->flags & mixed_block_flag))
- {
- unsigned int block_type;
-
- block_type = channel->block_type;
- if(channel->flags & mixed_block_flag)
- block_type = 0;
-
- /* long blocks */
- for(sb = 0; sb < 2; ++sb, l += 18)
- {
- III_imdct_l(&xr[ch][l], output, block_type);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
- }
- }
- else
- {
- /* short blocks */
- for(sb = 0; sb < 2; ++sb, l += 18)
- {
- III_imdct_s(&xr[ch][l], output);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
- }
- }
-
- III_freqinver(sample, 1);
-
- /* (nonzero) subbands 2-31 */
-
- i = 576;
- while(i > 36 && xr[ch][i - 1] == 0)
- --i;
-
- sblimit = 32 - (576 - i) / 18;
-
- if(channel->block_type != 2)
- {
- /* long blocks */
- for(sb = 2; sb < sblimit; ++sb, l += 18)
- {
- III_imdct_l(&xr[ch][l], output, channel->block_type);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
- else
- {
- /* short blocks */
- for(sb = 2; sb < sblimit; ++sb, l += 18)
- {
- III_imdct_s(&xr[ch][l], output);
- III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
-
- /* remaining (zero) subbands */
-
- for(sb = sblimit; sb < 32; ++sb)
- {
- III_overlap_z((*frame->overlap)[ch][sb], sample, sb);
-
- if(sb & 1)
- III_freqinver(sample, sb);
- }
- }
+ }
+ else
+ III_aliasreduce(xr[ch], 576);
+
+ l = 0;
+
+ /* subbands 0-1 */
+
+ if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) {
+ unsigned int block_type;
+
+ block_type = channel->block_type;
+ if (channel->flags & mixed_block_flag)
+ block_type = 0;
+
+ /* long blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+
+ III_freqinver(sample, 1);
+
+ /* (nonzero) subbands 2-31 */
+
+ i = 576;
+ while (i > 36 && xr[ch][i - 1] == 0)
+ --i;
+
+ sblimit = 32 - (576 - i) / 18;
+
+ if (channel->block_type != 2) {
+ /* long blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, channel->block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+
+ /* remaining (zero) subbands */
+
+ for (sb = sblimit; sb < 32; ++sb) {
+ III_overlap_z((*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
}
+ }
- return MAD_ERROR_NONE;
+ return MAD_ERROR_NONE;
}
/*
@@ -2707,205 +2514,184 @@ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
*/
int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame)
{
- struct mad_header *header = &frame->header;
- unsigned int nch, priv_bitlen, next_md_begin = 0;
- unsigned int si_len, data_bitlen, md_len;
- unsigned int frame_space, frame_used, frame_free;
- struct mad_bitptr ptr;
- struct sideinfo si;
- enum mad_error error;
- int result = 0;
-
- /* allocate Layer III dynamic structures */
-
- if(stream->main_data == 0)
- {
- stream->main_data = malloc(MAD_BUFFER_MDLEN);
- if(stream->main_data == 0)
- {
- stream->error = MAD_ERROR_NOMEM;
- return -1;
- }
+ struct mad_header *header = &frame->header;
+ unsigned int nch, priv_bitlen, next_md_begin = 0;
+ unsigned int si_len, data_bitlen, md_len;
+ unsigned int frame_space, frame_used, frame_free;
+ struct mad_bitptr ptr;
+ struct sideinfo si;
+ enum mad_error error;
+ int result = 0;
+
+ /* allocate Layer III dynamic structures */
+
+ if (stream->main_data == 0) {
+ stream->main_data = malloc(MAD_BUFFER_MDLEN);
+ if (stream->main_data == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
}
+ }
- if(frame->overlap == 0)
- {
- frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t));
- if(frame->overlap == 0)
- {
- stream->error = MAD_ERROR_NOMEM;
- return -1;
- }
+ if (frame->overlap == 0) {
+ frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t));
+ if (frame->overlap == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
}
+ }
- nch = MAD_NCHANNELS(header);
- si_len = (header->flags & MAD_FLAG_LSF_EXT) ?
- (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32);
+ nch = MAD_NCHANNELS(header);
+ si_len = (header->flags & MAD_FLAG_LSF_EXT) ?
+ (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32);
- /* check frame sanity */
+ /* check frame sanity */
- if(stream->next_frame - mad_bit_nextbyte(&stream->ptr) <
- (signed int) si_len)
- {
- stream->error = MAD_ERROR_BADFRAMELEN;
- stream->md_len = 0;
- return -1;
- }
+ if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) <
+ (signed int) si_len) {
+ stream->error = MAD_ERROR_BADFRAMELEN;
+ stream->md_len = 0;
+ return -1;
+ }
- /* check CRC word */
+ /* check CRC word */
- if(header->flags & MAD_FLAG_PROTECTION)
- {
- header->crc_check =
- mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check);
-
- if(header->crc_check != header->crc_target &&
- !(frame->options & MAD_OPTION_IGNORECRC))
- {
- stream->error = MAD_ERROR_BADCRC;
- result = -1;
- }
- }
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check);
- /* decode frame side information */
-
- error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT,
- &si, &data_bitlen, &priv_bitlen);
- if(error && result == 0)
- {
- stream->error = error;
- result = -1;
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ result = -1;
}
+ }
- header->flags |= priv_bitlen;
- header->private_bits |= si.private_bits;
+ /* decode frame side information */
- /* find main_data of next frame */
+ error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT,
+ &si, &data_bitlen, &priv_bitlen);
+ if (error && result == 0) {
+ stream->error = error;
+ result = -1;
+ }
- {
- struct mad_bitptr peek;
- unsigned long header;
+ header->flags |= priv_bitlen;
+ header->private_bits |= si.private_bits;
- mad_bit_init(&peek, stream->next_frame);
+ /* find main_data of next frame */
+
+ {
+ struct mad_bitptr peek;
+ unsigned long header;
- header = mad_bit_read(&peek, 32);
- if((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L)
- {
- if(!(header & 0x00010000L)) /* protection_bit */
- mad_bit_skip(&peek, 16); /* crc_check */
+ mad_bit_init(&peek, stream->next_frame);
- next_md_begin =
- mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
- }
+ header = mad_bit_read(&peek, 32);
+ if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
+ if (!(header & 0x00010000L)) /* protection_bit */
+ mad_bit_skip(&peek, 16); /* crc_check */
- mad_bit_finish(&peek);
+ next_md_begin =
+ mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
}
- /* find main_data of this frame */
+ mad_bit_finish(&peek);
+ }
- frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr);
+ /* find main_data of this frame */
- if(next_md_begin > si.main_data_begin + frame_space)
- next_md_begin = 0;
+ frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr);
- md_len = si.main_data_begin + frame_space - next_md_begin;
+ if (next_md_begin > si.main_data_begin + frame_space)
+ next_md_begin = 0;
- frame_used = 0;
+ md_len = si.main_data_begin + frame_space - next_md_begin;
- if(si.main_data_begin == 0)
- {
- ptr = stream->ptr;
- stream->md_len = 0;
+ frame_used = 0;
+
+ if (si.main_data_begin == 0) {
+ ptr = stream->ptr;
+ stream->md_len = 0;
- frame_used = md_len;
+ frame_used = md_len;
+ }
+ else {
+ if (si.main_data_begin > stream->md_len) {
+ if (result == 0) {
+ stream->error = MAD_ERROR_BADDATAPTR;
+ result = -1;
+ }
}
- else
- {
- if(si.main_data_begin > stream->md_len)
- {
- if(result == 0)
- {
- stream->error = MAD_ERROR_BADDATAPTR;
- result = -1;
- }
- }
- else
- {
- mad_bit_init(&ptr,
- *stream->main_data + stream->md_len - si.main_data_begin);
-
- if(md_len > si.main_data_begin)
- {
- assert(stream->md_len + md_len -
- si.main_data_begin <= MAD_BUFFER_MDLEN);
-
- memcpy(*stream->main_data + stream->md_len,
- mad_bit_nextbyte(&stream->ptr),
- frame_used = md_len - si.main_data_begin);
- stream->md_len += frame_used;
- }
- }
+ else {
+ mad_bit_init(&ptr,
+ *stream->main_data + stream->md_len - si.main_data_begin);
+
+ if (md_len > si.main_data_begin) {
+ assert(stream->md_len + md_len -
+ si.main_data_begin <= MAD_BUFFER_MDLEN);
+
+ memcpy(*stream->main_data + stream->md_len,
+ mad_bit_nextbyte(&stream->ptr),
+ frame_used = md_len - si.main_data_begin);
+ stream->md_len += frame_used;
+ }
}
+ }
- frame_free = frame_space - frame_used;
+ frame_free = frame_space - frame_used;
- /* decode main_data */
+ /* decode main_data */
- if(result == 0)
- {
- error = III_decode(&ptr, frame, &si, nch);
- if(error)
- {
- stream->error = error;
- result = -1;
- }
+ if (result == 0) {
+ error = III_decode(&ptr, frame, &si, nch);
+ if (error) {
+ stream->error = error;
+ result = -1;
+ }
- /* designate ancillary bits */
+ /* designate ancillary bits */
- stream->anc_ptr = ptr;
- stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
- }
+ stream->anc_ptr = ptr;
+ stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
+ }
# if 0 && defined(DEBUG)
- fprintf(stderr,
- "main_data_begin:%u, md_len:%u, frame_free:%u, "
- "data_bitlen:%u, anc_bitlen: %u\n",
- si.main_data_begin, md_len, frame_free,
- data_bitlen, stream->anc_bitlen);
+ fprintf(stderr,
+ "main_data_begin:%u, md_len:%u, frame_free:%u, "
+ "data_bitlen:%u, anc_bitlen: %u\n",
+ si.main_data_begin, md_len, frame_free,
+ data_bitlen, stream->anc_bitlen);
# endif
- /* preload main_data buffer with up to 511 bytes for next frame(s) */
-
- if(frame_free >= next_md_begin)
- {
- memcpy(*stream->main_data,
- stream->next_frame - next_md_begin, next_md_begin);
- stream->md_len = next_md_begin;
+ /* preload main_data buffer with up to 511 bytes for next frame(s) */
+
+ if (frame_free >= next_md_begin) {
+ memcpy(*stream->main_data,
+ stream->next_frame - next_md_begin, next_md_begin);
+ stream->md_len = next_md_begin;
+ }
+ else {
+ if (md_len < si.main_data_begin) {
+ unsigned int extra;
+
+ extra = si.main_data_begin - md_len;
+ if (extra + frame_free > next_md_begin)
+ extra = next_md_begin - frame_free;
+
+ if (extra < stream->md_len) {
+ memmove(*stream->main_data,
+ *stream->main_data + stream->md_len - extra, extra);
+ stream->md_len = extra;
+ }
}
else
- {
- if(md_len < si.main_data_begin)
- {
- unsigned int extra;
-
- extra = si.main_data_begin - md_len;
- if(extra + frame_free > next_md_begin)
- extra = next_md_begin - frame_free;
-
- if(extra < stream->md_len)
- {
- memmove(*stream->main_data,
- *stream->main_data + stream->md_len - extra, extra);
- stream->md_len = extra;
- }
- }
- else
- stream->md_len = 0;
-
- memcpy(*stream->main_data + stream->md_len,
- stream->next_frame - frame_free, frame_free);
- stream->md_len += frame_free;
- }
+ stream->md_len = 0;
+
+ memcpy(*stream->main_data + stream->md_len,
+ stream->next_frame - frame_free, frame_free);
+ stream->md_len += frame_free;
+ }
- return result;
+ return result;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/mad.h b/src/filters/transform/MpaDecFilter/libmad/mad.h
index 381e0b01a..f52f3a692 100644
--- a/src/filters/transform/MpaDecFilter/libmad/mad.h
+++ b/src/filters/transform/MpaDecFilter/libmad/mad.h
@@ -33,7 +33,7 @@ extern "C" {
# define SIZEOF_LONG_LONG 8
- /* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
# ifndef LIBMAD_VERSION_H
# define LIBMAD_VERSION_H
@@ -55,28 +55,28 @@ extern "C" {
# define MAD_AUTHOR "Underbit Technologies, Inc."
# define MAD_EMAIL "info@underbit.com"
- extern char const mad_version[];
- extern char const mad_copyright[];
- extern char const mad_author[];
- extern char const mad_build[];
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
# endif
- /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
+/* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
# ifndef LIBMAD_FIXED_H
# define LIBMAD_FIXED_H
# if SIZEOF_INT >= 4
- typedef signed int mad_fixed_t;
+typedef signed int mad_fixed_t;
- typedef signed int mad_fixed64hi_t;
- typedef unsigned int mad_fixed64lo_t;
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
# else
- typedef signed long mad_fixed_t;
+typedef signed long mad_fixed_t;
- typedef signed long mad_fixed64hi_t;
- typedef unsigned long mad_fixed64lo_t;
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
# endif
# if defined(_MSC_VER)
@@ -86,33 +86,33 @@ extern "C" {
# endif
# if defined(FPM_FLOAT)
- typedef double mad_sample_t;
+typedef double mad_sample_t;
# else
- typedef mad_fixed_t mad_sample_t;
+typedef mad_fixed_t mad_sample_t;
# endif
- /*
- * Fixed-point format: 0xABBBBBBB
- * A == whole part (sign + 3 bits)
- * B == fractional part (28 bits)
- *
- * Values are signed two's complement, so the effective range is:
- * 0x80000000 to 0x7fffffff
- * -8.0 to +7.9999999962747097015380859375
- *
- * The smallest representable value is:
- * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
- *
- * 28 bits of fractional accuracy represent about
- * 8.6 digits of decimal accuracy.
- *
- * Fixed-point numbers can be added or subtracted as normal
- * integers, but multiplication requires shifting the 64-bit result
- * from 56 fractional bits back to 28 (and rounding.)
- *
- * Changing the definition of MAD_F_FRACBITS is only partially
- * supported, and must be done with care.
- */
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
# define MAD_F_FRACBITS 28
@@ -144,7 +144,7 @@ extern "C" {
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
- /* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -164,10 +164,10 @@ extern "C" {
# elif defined(FPM_64BIT)
- /*
- * This version should be the most accurate if 64-bit types are supported by
- * the compiler, although it may not be the most efficient.
- */
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
# if defined(OPT_ACCURACY)
# define mad_f_mul(x, y) \
((mad_fixed_t) \
@@ -180,7 +180,7 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Intel --------------------------------------------------------------- */
+/* --- Intel --------------------------------------------------------------- */
# elif defined(FPM_INTEL)
@@ -192,10 +192,10 @@ extern "C" {
# define mad_f_mul mad_f_mul_inline
# define mad_f_scale64
# else
- /*
- * This Intel version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("imull %3" \
: "=a" (lo), "=d" (hi) \
@@ -203,9 +203,9 @@ extern "C" {
: "cc")
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -219,9 +219,9 @@ extern "C" {
# endif /* OPT_ACCURACY */
# if defined(OPT_ACCURACY)
- /*
- * Surprisingly, this is faster than SHRD followed by ADC.
- */
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed64hi_t __hi_; \
mad_fixed64lo_t __lo_; \
@@ -239,9 +239,9 @@ extern "C" {
__result; \
})
# elif defined(OPT_INTEL)
- /*
- * Alternate Intel scaling that may or may not perform better.
- */
+/*
+ * Alternate Intel scaling that may or may not perform better.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result; \
asm ("shrl %3,%1\n\t" \
@@ -267,19 +267,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- ARM ----------------------------------------------------------------- */
+/* --- ARM ----------------------------------------------------------------- */
# elif defined(FPM_ARM)
- /*
- * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
- * least significant bit is properly rounded at no CPU cycle cost!
- */
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
# if 1
- /*
- * This is faster than the default implementation via MAD_F_MLX() and
- * mad_f_scale64().
- */
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
# define mad_f_mul(x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -325,14 +325,14 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- MIPS ---------------------------------------------------------------- */
+/* --- MIPS ---------------------------------------------------------------- */
# elif defined(FPM_MIPS)
- /*
- * This MIPS version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -344,10 +344,10 @@ extern "C" {
: "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y))
# elif defined(HAVE_MADD16_ASM)
- /*
- * This loses significant accuracy due to the 16-bit integer limit in the
- * multiply/accumulate instruction.
- */
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
# define MAD_F_ML0(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -365,28 +365,28 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- SPARC --------------------------------------------------------------- */
+/* --- SPARC --------------------------------------------------------------- */
# elif defined(FPM_SPARC)
- /*
- * This SPARC V8 version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("smul %2, %3, %0\n\t" \
"rd %%y, %1" \
: "=r" (lo), "=r" (hi) \
: "%r" (x), "rI" (y))
- /* --- PowerPC ------------------------------------------------------------- */
+/* --- PowerPC ------------------------------------------------------------- */
# elif defined(FPM_PPC)
- /*
- * This PowerPC version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
do { \
asm ("mullw %0,%1,%2" \
@@ -399,9 +399,9 @@ extern "C" {
while (0)
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -416,9 +416,9 @@ extern "C" {
# endif
# if defined(OPT_ACCURACY)
- /*
- * This is slower than the truncating version below it.
- */
+/*
+ * This is slower than the truncating version below it.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result, __round; \
asm ("rotrwi %0,%1,%2" \
@@ -450,19 +450,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Default ------------------------------------------------------------- */
+/* --- Default ------------------------------------------------------------- */
# elif defined(FPM_DEFAULT)
- /*
- * This version is the most portable but it loses significant accuracy.
- * Furthermore, accuracy is biased against the second argument, so care
- * should be taken when ordering operands.
- *
- * The scale factors are constant as this is not used with SSO.
- *
- * Pre-rounding is required to stay within the limits of compliance.
- */
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
# if defined(OPT_SPEED)
# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
# else
@@ -470,13 +470,13 @@ extern "C" {
(((y) + (1L << 15)) >> 16))
# endif
- /* ------------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
# else
# error "no FPM selected"
# endif
- /* default implementations */
+/* default implementations */
# if !defined(mad_f_mul)
# define mad_f_mul(x, y) \
@@ -521,128 +521,125 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* C routines */
+/* C routines */
- mad_fixed_t mad_f_abs(mad_fixed_t);
- mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
# endif
- /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
+/* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
- struct mad_bitptr
- {
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
- };
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
- void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
- unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
- unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
- void mad_bit_skip(struct mad_bitptr *, unsigned int);
- unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
- void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
- unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
# endif
- /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
+/* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
- typedef struct
- {
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
- } mad_timer_t;
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
- extern mad_timer_t const mad_timer_zero;
+extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
- enum mad_units
- {
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
- };
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
- int mad_timer_compare(mad_timer_t, mad_timer_t);
+int mad_timer_compare(mad_timer_t, mad_timer_t);
# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
- void mad_timer_negate(mad_timer_t *);
- mad_timer_t mad_timer_abs(mad_timer_t);
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
- void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
- void mad_timer_add(mad_timer_t *, mad_timer_t);
- void mad_timer_multiply(mad_timer_t *, signed long);
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
- signed long mad_timer_count(mad_timer_t, enum mad_units);
- unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
- void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
# endif
- /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
+/* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
# ifndef LIBMAD_STREAM_H
# define LIBMAD_STREAM_H
@@ -651,146 +648,138 @@ extern "C" {
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
- enum mad_error
- {
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
- };
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
- struct mad_stream
- {
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
- };
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
- enum
- {
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
- };
+};
- void mad_stream_init(struct mad_stream *);
- void mad_stream_finish(struct mad_stream *);
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
# define mad_stream_options(stream, opts) \
((void) ((stream)->options = (opts)))
- void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
- void mad_stream_skip(struct mad_stream *, unsigned long);
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
- int mad_stream_sync(struct mad_stream *);
+int mad_stream_sync(struct mad_stream *);
- char const *mad_stream_errorstr(struct mad_stream const *);
+char const *mad_stream_errorstr(struct mad_stream const *);
# endif
- /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
+/* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_FRAME_H
# define LIBMAD_FRAME_H
- enum mad_layer
- {
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
- };
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
- enum mad_mode
- {
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
- };
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
- enum mad_emphasis
- {
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
- };
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
- struct mad_header
- {
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
- };
+ mad_timer_t duration; /* audio playing time of frame */
+};
- struct mad_frame
- {
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
- };
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
@@ -798,172 +787,160 @@ extern "C" {
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
- enum
- {
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
- };
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
- enum
- {
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
- };
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
- void mad_header_init(struct mad_header *);
+void mad_header_init(struct mad_header *);
# define mad_header_finish(header) /* nothing */
- int mad_header_decode(struct mad_header *, struct mad_stream *);
+int mad_header_decode(struct mad_header *, struct mad_stream *);
- void mad_frame_init(struct mad_frame *);
- void mad_frame_finish(struct mad_frame *);
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
- int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
- void mad_frame_mute(struct mad_frame *);
+void mad_frame_mute(struct mad_frame *);
# endif
- /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
+/* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_SYNTH_H
# define LIBMAD_SYNTH_H
- struct mad_pcm
- {
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
- };
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
- struct mad_synth
- {
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
- };
+ struct mad_pcm pcm; /* PCM output */
+};
- /* single channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_SINGLE = 0
- };
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
- /* dual channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
- };
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
- /* stereo PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
- };
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
- void mad_synth_init(struct mad_synth *);
+void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */
- void mad_synth_mute(struct mad_synth *);
+void mad_synth_mute(struct mad_synth *);
- void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif
- /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
+/* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_DECODER_H
# define LIBMAD_DECODER_H
- enum mad_decoder_mode
- {
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
- };
-
- enum mad_flow
- {
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
- };
-
- struct mad_decoder
- {
- enum mad_decoder_mode mode;
-
- int options;
-
- struct
- {
- long pid;
- int in;
- int out;
- } async;
-
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
-
- void *cb_data;
-
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
- };
-
- void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
- int mad_decoder_finish(struct mad_decoder *);
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
((void) ((decoder)->options = (opts)))
- int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
- int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/minimad.c b/src/filters/transform/MpaDecFilter/libmad/minimad.c
index 3909a520f..79ca1ad4f 100644
--- a/src/filters/transform/MpaDecFilter/libmad/minimad.c
+++ b/src/filters/transform/MpaDecFilter/libmad/minimad.c
@@ -39,26 +39,26 @@ static int decode(unsigned char const *, unsigned long);
int main(int argc, char *argv[])
{
- struct stat stat;
- void *fdm;
+ struct stat stat;
+ void *fdm;
- if(argc != 1)
- return 1;
+ if (argc != 1)
+ return 1;
- if(fstat(STDIN_FILENO, &stat) == -1 ||
- stat.st_size == 0)
- return 2;
+ if (fstat(STDIN_FILENO, &stat) == -1 ||
+ stat.st_size == 0)
+ return 2;
- fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, STDIN_FILENO, 0);
- if(fdm == MAP_FAILED)
- return 3;
+ fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, STDIN_FILENO, 0);
+ if (fdm == MAP_FAILED)
+ return 3;
- decode(fdm, stat.st_size);
+ decode(fdm, stat.st_size);
- if(munmap(fdm, stat.st_size) == -1)
- return 4;
+ if (munmap(fdm, stat.st_size) == -1)
+ return 4;
- return 0;
+ return 0;
}
/*
@@ -67,10 +67,9 @@ int main(int argc, char *argv[])
* to access from within the callbacks.
*/
-struct buffer
-{
- unsigned char const *start;
- unsigned long length;
+struct buffer {
+ unsigned char const *start;
+ unsigned long length;
};
/*
@@ -83,18 +82,18 @@ struct buffer
static
enum mad_flow input(void *data,
- struct mad_stream *stream)
+ struct mad_stream *stream)
{
- struct buffer *buffer = data;
+ struct buffer *buffer = data;
- if(!buffer->length)
- return MAD_FLOW_STOP;
+ if (!buffer->length)
+ return MAD_FLOW_STOP;
- mad_stream_buffer(stream, buffer->start, buffer->length);
+ mad_stream_buffer(stream, buffer->start, buffer->length);
- buffer->length = 0;
+ buffer->length = 0;
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -108,17 +107,17 @@ enum mad_flow input(void *data,
static inline
signed int scale(mad_fixed_t sample)
{
- /* round */
- sample += (1L << (MAD_F_FRACBITS - 16));
+ /* round */
+ sample += (1L << (MAD_F_FRACBITS - 16));
- /* clip */
- if(sample >= MAD_F_ONE)
- sample = MAD_F_ONE - 1;
- else if(sample < -MAD_F_ONE)
- sample = -MAD_F_ONE;
+ /* clip */
+ if (sample >= MAD_F_ONE)
+ sample = MAD_F_ONE - 1;
+ else if (sample < -MAD_F_ONE)
+ sample = -MAD_F_ONE;
- /* quantize */
- return sample >> (MAD_F_FRACBITS + 1 - 16);
+ /* quantize */
+ return sample >> (MAD_F_FRACBITS + 1 - 16);
}
/*
@@ -129,38 +128,36 @@ signed int scale(mad_fixed_t sample)
static
enum mad_flow output(void *data,
- struct mad_header const *header,
- struct mad_pcm *pcm)
+ struct mad_header const *header,
+ struct mad_pcm *pcm)
{
- unsigned int nchannels, nsamples;
- mad_fixed_t const *left_ch, *right_ch;
+ unsigned int nchannels, nsamples;
+ mad_fixed_t const *left_ch, *right_ch;
- /* pcm->samplerate contains the sampling frequency */
+ /* pcm->samplerate contains the sampling frequency */
- nchannels = pcm->channels;
- nsamples = pcm->length;
- left_ch = pcm->samples[0];
- right_ch = pcm->samples[1];
+ nchannels = pcm->channels;
+ nsamples = pcm->length;
+ left_ch = pcm->samples[0];
+ right_ch = pcm->samples[1];
- while(nsamples--)
- {
- signed int sample;
+ while (nsamples--) {
+ signed int sample;
- /* output sample(s) in 16-bit signed little-endian PCM */
+ /* output sample(s) in 16-bit signed little-endian PCM */
- sample = scale(*left_ch++);
- putchar((sample >> 0) & 0xff);
- putchar((sample >> 8) & 0xff);
+ sample = scale(*left_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
- if(nchannels == 2)
- {
- sample = scale(*right_ch++);
- putchar((sample >> 0) & 0xff);
- putchar((sample >> 8) & 0xff);
- }
+ if (nchannels == 2) {
+ sample = scale(*right_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
}
+ }
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -172,18 +169,18 @@ enum mad_flow output(void *data,
static
enum mad_flow error(void *data,
- struct mad_stream *stream,
- struct mad_frame *frame)
+ struct mad_stream *stream,
+ struct mad_frame *frame)
{
- struct buffer *buffer = data;
+ struct buffer *buffer = data;
- fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n",
- stream->error, mad_stream_errorstr(stream),
- stream->this_frame - buffer->start);
+ fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n",
+ stream->error, mad_stream_errorstr(stream),
+ stream->this_frame - buffer->start);
- /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */
+ /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */
- return MAD_FLOW_CONTINUE;
+ return MAD_FLOW_CONTINUE;
}
/*
@@ -198,28 +195,28 @@ enum mad_flow error(void *data,
static
int decode(unsigned char const *start, unsigned long length)
{
- struct buffer buffer;
- struct mad_decoder decoder;
- int result;
+ struct buffer buffer;
+ struct mad_decoder decoder;
+ int result;
- /* initialize our private message structure */
+ /* initialize our private message structure */
- buffer.start = start;
- buffer.length = length;
+ buffer.start = start;
+ buffer.length = length;
- /* configure input, output, and error functions */
+ /* configure input, output, and error functions */
- mad_decoder_init(&decoder, &buffer,
- input, 0 /* header */, 0 /* filter */, output,
- error, 0 /* message */);
+ mad_decoder_init(&decoder, &buffer,
+ input, 0 /* header */, 0 /* filter */, output,
+ error, 0 /* message */);
- /* start decoding */
+ /* start decoding */
- result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
+ result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
- /* release the decoder */
+ /* release the decoder */
- mad_decoder_finish(&decoder);
+ mad_decoder_finish(&decoder);
- return result;
+ return result;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h b/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
index 381e0b01a..f52f3a692 100644
--- a/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
+++ b/src/filters/transform/MpaDecFilter/libmad/msvc++/mad.h
@@ -33,7 +33,7 @@ extern "C" {
# define SIZEOF_LONG_LONG 8
- /* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
# ifndef LIBMAD_VERSION_H
# define LIBMAD_VERSION_H
@@ -55,28 +55,28 @@ extern "C" {
# define MAD_AUTHOR "Underbit Technologies, Inc."
# define MAD_EMAIL "info@underbit.com"
- extern char const mad_version[];
- extern char const mad_copyright[];
- extern char const mad_author[];
- extern char const mad_build[];
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
# endif
- /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
+/* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */
# ifndef LIBMAD_FIXED_H
# define LIBMAD_FIXED_H
# if SIZEOF_INT >= 4
- typedef signed int mad_fixed_t;
+typedef signed int mad_fixed_t;
- typedef signed int mad_fixed64hi_t;
- typedef unsigned int mad_fixed64lo_t;
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
# else
- typedef signed long mad_fixed_t;
+typedef signed long mad_fixed_t;
- typedef signed long mad_fixed64hi_t;
- typedef unsigned long mad_fixed64lo_t;
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
# endif
# if defined(_MSC_VER)
@@ -86,33 +86,33 @@ extern "C" {
# endif
# if defined(FPM_FLOAT)
- typedef double mad_sample_t;
+typedef double mad_sample_t;
# else
- typedef mad_fixed_t mad_sample_t;
+typedef mad_fixed_t mad_sample_t;
# endif
- /*
- * Fixed-point format: 0xABBBBBBB
- * A == whole part (sign + 3 bits)
- * B == fractional part (28 bits)
- *
- * Values are signed two's complement, so the effective range is:
- * 0x80000000 to 0x7fffffff
- * -8.0 to +7.9999999962747097015380859375
- *
- * The smallest representable value is:
- * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
- *
- * 28 bits of fractional accuracy represent about
- * 8.6 digits of decimal accuracy.
- *
- * Fixed-point numbers can be added or subtracted as normal
- * integers, but multiplication requires shifting the 64-bit result
- * from 56 fractional bits back to 28 (and rounding.)
- *
- * Changing the definition of MAD_F_FRACBITS is only partially
- * supported, and must be done with care.
- */
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
# define MAD_F_FRACBITS 28
@@ -144,7 +144,7 @@ extern "C" {
# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
- /* (x should be positive) */
+ /* (x should be positive) */
# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
@@ -164,10 +164,10 @@ extern "C" {
# elif defined(FPM_64BIT)
- /*
- * This version should be the most accurate if 64-bit types are supported by
- * the compiler, although it may not be the most efficient.
- */
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
# if defined(OPT_ACCURACY)
# define mad_f_mul(x, y) \
((mad_fixed_t) \
@@ -180,7 +180,7 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Intel --------------------------------------------------------------- */
+/* --- Intel --------------------------------------------------------------- */
# elif defined(FPM_INTEL)
@@ -192,10 +192,10 @@ extern "C" {
# define mad_f_mul mad_f_mul_inline
# define mad_f_scale64
# else
- /*
- * This Intel version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("imull %3" \
: "=a" (lo), "=d" (hi) \
@@ -203,9 +203,9 @@ extern "C" {
: "cc")
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -219,9 +219,9 @@ extern "C" {
# endif /* OPT_ACCURACY */
# if defined(OPT_ACCURACY)
- /*
- * Surprisingly, this is faster than SHRD followed by ADC.
- */
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed64hi_t __hi_; \
mad_fixed64lo_t __lo_; \
@@ -239,9 +239,9 @@ extern "C" {
__result; \
})
# elif defined(OPT_INTEL)
- /*
- * Alternate Intel scaling that may or may not perform better.
- */
+/*
+ * Alternate Intel scaling that may or may not perform better.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result; \
asm ("shrl %3,%1\n\t" \
@@ -267,19 +267,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- ARM ----------------------------------------------------------------- */
+/* --- ARM ----------------------------------------------------------------- */
# elif defined(FPM_ARM)
- /*
- * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
- * least significant bit is properly rounded at no CPU cycle cost!
- */
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
# if 1
- /*
- * This is faster than the default implementation via MAD_F_MLX() and
- * mad_f_scale64().
- */
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
# define mad_f_mul(x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -325,14 +325,14 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- MIPS ---------------------------------------------------------------- */
+/* --- MIPS ---------------------------------------------------------------- */
# elif defined(FPM_MIPS)
- /*
- * This MIPS version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -344,10 +344,10 @@ extern "C" {
: "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y))
# elif defined(HAVE_MADD16_ASM)
- /*
- * This loses significant accuracy due to the 16-bit integer limit in the
- * multiply/accumulate instruction.
- */
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
# define MAD_F_ML0(hi, lo, x, y) \
asm ("mult %2,%3" \
: "=l" (lo), "=h" (hi) \
@@ -365,28 +365,28 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* --- SPARC --------------------------------------------------------------- */
+/* --- SPARC --------------------------------------------------------------- */
# elif defined(FPM_SPARC)
- /*
- * This SPARC V8 version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
asm ("smul %2, %3, %0\n\t" \
"rd %%y, %1" \
: "=r" (lo), "=r" (hi) \
: "%r" (x), "rI" (y))
- /* --- PowerPC ------------------------------------------------------------- */
+/* --- PowerPC ------------------------------------------------------------- */
# elif defined(FPM_PPC)
- /*
- * This PowerPC version is fast and accurate; the disposition of the least
- * significant bit depends on OPT_ACCURACY via mad_f_scale64().
- */
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
# define MAD_F_MLX(hi, lo, x, y) \
do { \
asm ("mullw %0,%1,%2" \
@@ -399,9 +399,9 @@ extern "C" {
while (0)
# if defined(OPT_ACCURACY)
- /*
- * This gives best accuracy but is not very fast.
- */
+/*
+ * This gives best accuracy but is not very fast.
+ */
# define MAD_F_MLA(hi, lo, x, y) \
({ mad_fixed64hi_t __hi; \
mad_fixed64lo_t __lo; \
@@ -416,9 +416,9 @@ extern "C" {
# endif
# if defined(OPT_ACCURACY)
- /*
- * This is slower than the truncating version below it.
- */
+/*
+ * This is slower than the truncating version below it.
+ */
# define mad_f_scale64(hi, lo) \
({ mad_fixed_t __result, __round; \
asm ("rotrwi %0,%1,%2" \
@@ -450,19 +450,19 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
- /* --- Default ------------------------------------------------------------- */
+/* --- Default ------------------------------------------------------------- */
# elif defined(FPM_DEFAULT)
- /*
- * This version is the most portable but it loses significant accuracy.
- * Furthermore, accuracy is biased against the second argument, so care
- * should be taken when ordering operands.
- *
- * The scale factors are constant as this is not used with SSO.
- *
- * Pre-rounding is required to stay within the limits of compliance.
- */
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
# if defined(OPT_SPEED)
# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
# else
@@ -470,13 +470,13 @@ extern "C" {
(((y) + (1L << 15)) >> 16))
# endif
- /* ------------------------------------------------------------------------- */
+/* ------------------------------------------------------------------------- */
# else
# error "no FPM selected"
# endif
- /* default implementations */
+/* default implementations */
# if !defined(mad_f_mul)
# define mad_f_mul(x, y) \
@@ -521,128 +521,125 @@ extern "C" {
# define MAD_F_SCALEBITS MAD_F_FRACBITS
# endif
- /* C routines */
+/* C routines */
- mad_fixed_t mad_f_abs(mad_fixed_t);
- mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
# endif
- /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
+/* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
- struct mad_bitptr
- {
- unsigned char const *byte;
- unsigned short cache;
- unsigned short left;
- };
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
- void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
- unsigned int mad_bit_length(struct mad_bitptr const *,
- struct mad_bitptr const *);
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
- unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
- void mad_bit_skip(struct mad_bitptr *, unsigned int);
- unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
- void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
- unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
# endif
- /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
+/* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
- typedef struct
- {
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
- } mad_timer_t;
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
- extern mad_timer_t const mad_timer_zero;
+extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
- enum mad_units
- {
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
- };
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
- int mad_timer_compare(mad_timer_t, mad_timer_t);
+int mad_timer_compare(mad_timer_t, mad_timer_t);
# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
- void mad_timer_negate(mad_timer_t *);
- mad_timer_t mad_timer_abs(mad_timer_t);
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
- void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
- void mad_timer_add(mad_timer_t *, mad_timer_t);
- void mad_timer_multiply(mad_timer_t *, signed long);
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
- signed long mad_timer_count(mad_timer_t, enum mad_units);
- unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
- void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
# endif
- /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
+/* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */
# ifndef LIBMAD_STREAM_H
# define LIBMAD_STREAM_H
@@ -651,146 +648,138 @@ extern "C" {
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
- enum mad_error
- {
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
- };
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
- struct mad_stream
- {
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
- };
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
- enum
- {
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
- };
+};
- void mad_stream_init(struct mad_stream *);
- void mad_stream_finish(struct mad_stream *);
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
# define mad_stream_options(stream, opts) \
((void) ((stream)->options = (opts)))
- void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
- void mad_stream_skip(struct mad_stream *, unsigned long);
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
- int mad_stream_sync(struct mad_stream *);
+int mad_stream_sync(struct mad_stream *);
- char const *mad_stream_errorstr(struct mad_stream const *);
+char const *mad_stream_errorstr(struct mad_stream const *);
# endif
- /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
+/* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_FRAME_H
# define LIBMAD_FRAME_H
- enum mad_layer
- {
- MAD_LAYER_I = 1, /* Layer I */
- MAD_LAYER_II = 2, /* Layer II */
- MAD_LAYER_III = 3 /* Layer III */
- };
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
- enum mad_mode
- {
- MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
- MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
- MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
- MAD_MODE_STEREO = 3 /* normal LR stereo */
- };
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
- enum mad_emphasis
- {
- MAD_EMPHASIS_NONE = 0, /* no emphasis */
- MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
- MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
- MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
- };
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
- struct mad_header
- {
- enum mad_layer layer; /* audio layer (1, 2, or 3) */
- enum mad_mode mode; /* channel mode (see above) */
- int mode_extension; /* additional mode info */
- enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
- unsigned long bitrate; /* stream bitrate (bps) */
- unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short crc_check; /* frame CRC accumulator */
- unsigned short crc_target; /* final target CRC checksum */
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
- int flags; /* flags (see below) */
- int private_bits; /* private bits (see below) */
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
- mad_timer_t duration; /* audio playing time of frame */
- };
+ mad_timer_t duration; /* audio playing time of frame */
+};
- struct mad_frame
- {
- struct mad_header header; /* MPEG audio header */
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
- int options; /* decoding options (from stream) */
+ int options; /* decoding options (from stream) */
- mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
- mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
- };
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
@@ -798,172 +787,160 @@ extern "C" {
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
- enum
- {
- MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
- MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
- MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
- MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
- MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
- MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
- MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
- MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
- MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
- MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
- MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
- MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
- };
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
- enum
- {
- MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
- MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
- };
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
- void mad_header_init(struct mad_header *);
+void mad_header_init(struct mad_header *);
# define mad_header_finish(header) /* nothing */
- int mad_header_decode(struct mad_header *, struct mad_stream *);
+int mad_header_decode(struct mad_header *, struct mad_stream *);
- void mad_frame_init(struct mad_frame *);
- void mad_frame_finish(struct mad_frame *);
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
- int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
- void mad_frame_mute(struct mad_frame *);
+void mad_frame_mute(struct mad_frame *);
# endif
- /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
+/* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */
# ifndef LIBMAD_SYNTH_H
# define LIBMAD_SYNTH_H
- struct mad_pcm
- {
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
- };
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
- struct mad_synth
- {
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
- };
+ struct mad_pcm pcm; /* PCM output */
+};
- /* single channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_SINGLE = 0
- };
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
- /* dual channel PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
- };
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
- /* stereo PCM selector */
- enum
- {
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
- };
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
- void mad_synth_init(struct mad_synth *);
+void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */
- void mad_synth_mute(struct mad_synth *);
+void mad_synth_mute(struct mad_synth *);
- void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif
- /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
+/* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */
# ifndef LIBMAD_DECODER_H
# define LIBMAD_DECODER_H
- enum mad_decoder_mode
- {
- MAD_DECODER_MODE_SYNC = 0,
- MAD_DECODER_MODE_ASYNC
- };
-
- enum mad_flow
- {
- MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
- MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
- MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
- MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
- };
-
- struct mad_decoder
- {
- enum mad_decoder_mode mode;
-
- int options;
-
- struct
- {
- long pid;
- int in;
- int out;
- } async;
-
- struct
- {
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- } *sync;
-
- void *cb_data;
-
- enum mad_flow(*input_func)(void *, struct mad_stream *);
- enum mad_flow(*header_func)(void *, struct mad_header const *);
- enum mad_flow(*filter_func)(void *,
- struct mad_stream const *, struct mad_frame *);
- enum mad_flow(*output_func)(void *,
- struct mad_header const *, struct mad_pcm *);
- enum mad_flow(*error_func)(void *, struct mad_stream *, struct mad_frame *);
- enum mad_flow(*message_func)(void *, void *, unsigned int *);
- };
-
- void mad_decoder_init(struct mad_decoder *, void *,
- enum mad_flow(*)(void *, struct mad_stream *),
- enum mad_flow(*)(void *, struct mad_header const *),
- enum mad_flow(*)(void *,
- struct mad_stream const *,
- struct mad_frame *),
- enum mad_flow(*)(void *,
- struct mad_header const *,
- struct mad_pcm *),
- enum mad_flow(*)(void *,
- struct mad_stream *,
- struct mad_frame *),
- enum mad_flow(*)(void *, void *, unsigned int *));
- int mad_decoder_finish(struct mad_decoder *);
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
((void) ((decoder)->options = (opts)))
- int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
- int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/stream.c b/src/filters/transform/MpaDecFilter/libmad/stream.c
index 605f5210b..b14b6de4d 100644
--- a/src/filters/transform/MpaDecFilter/libmad/stream.c
+++ b/src/filters/transform/MpaDecFilter/libmad/stream.c
@@ -35,25 +35,25 @@
*/
void mad_stream_init(struct mad_stream *stream)
{
- stream->buffer = 0;
- stream->bufend = 0;
- stream->skiplen = 0;
+ stream->buffer = 0;
+ stream->bufend = 0;
+ stream->skiplen = 0;
- stream->sync = 0;
- stream->freerate = 0;
+ stream->sync = 0;
+ stream->freerate = 0;
- stream->this_frame = 0;
- stream->next_frame = 0;
- mad_bit_init(&stream->ptr, 0);
+ stream->this_frame = 0;
+ stream->next_frame = 0;
+ mad_bit_init(&stream->ptr, 0);
- mad_bit_init(&stream->anc_ptr, 0);
- stream->anc_bitlen = 0;
+ mad_bit_init(&stream->anc_ptr, 0);
+ stream->anc_bitlen = 0;
- stream->main_data = 0;
- stream->md_len = 0;
+ stream->main_data = 0;
+ stream->md_len = 0;
- stream->options = 0;
- stream->error = MAD_ERROR_NONE;
+ stream->options = 0;
+ stream->error = MAD_ERROR_NONE;
}
/*
@@ -62,14 +62,13 @@ void mad_stream_init(struct mad_stream *stream)
*/
void mad_stream_finish(struct mad_stream *stream)
{
- if(stream->main_data)
- {
- free(stream->main_data);
- stream->main_data = 0;
- }
-
- mad_bit_finish(&stream->anc_ptr);
- mad_bit_finish(&stream->ptr);
+ if (stream->main_data) {
+ free(stream->main_data);
+ stream->main_data = 0;
+ }
+
+ mad_bit_finish(&stream->anc_ptr);
+ mad_bit_finish(&stream->ptr);
}
/*
@@ -77,17 +76,17 @@ void mad_stream_finish(struct mad_stream *stream)
* DESCRIPTION: set stream buffer pointers
*/
void mad_stream_buffer(struct mad_stream *stream,
- unsigned char const *buffer, unsigned long length)
+ unsigned char const *buffer, unsigned long length)
{
- stream->buffer = buffer;
- stream->bufend = buffer + length;
+ stream->buffer = buffer;
+ stream->bufend = buffer + length;
- stream->this_frame = buffer;
- stream->next_frame = buffer;
+ stream->this_frame = buffer;
+ stream->next_frame = buffer;
- stream->sync = 1;
+ stream->sync = 1;
- mad_bit_init(&stream->ptr, buffer);
+ mad_bit_init(&stream->ptr, buffer);
}
/*
@@ -96,7 +95,7 @@ void mad_stream_buffer(struct mad_stream *stream,
*/
void mad_stream_skip(struct mad_stream *stream, unsigned long length)
{
- stream->skiplen += length;
+ stream->skiplen += length;
}
/*
@@ -105,21 +104,21 @@ void mad_stream_skip(struct mad_stream *stream, unsigned long length)
*/
int mad_stream_sync(struct mad_stream *stream)
{
- register unsigned char const *ptr, *end;
+ register unsigned char const *ptr, *end;
- ptr = mad_bit_nextbyte(&stream->ptr);
- end = stream->bufend;
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ end = stream->bufend;
- while(ptr < end - 1 &&
- !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
- ++ptr;
+ while (ptr < end - 1 &&
+ !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
+ ++ptr;
- if(end - ptr < MAD_BUFFER_GUARD)
- return -1;
+ if (end - ptr < MAD_BUFFER_GUARD)
+ return -1;
- mad_bit_init(&stream->ptr, ptr);
+ mad_bit_init(&stream->ptr, ptr);
- return 0;
+ return 0;
}
/*
@@ -128,57 +127,34 @@ int mad_stream_sync(struct mad_stream *stream)
*/
char const *mad_stream_errorstr(struct mad_stream const *stream)
{
- switch(stream->error)
- {
- case MAD_ERROR_NONE:
- return "no error";
-
- case MAD_ERROR_BUFLEN:
- return "input buffer too small (or EOF)";
- case MAD_ERROR_BUFPTR:
- return "invalid (null) buffer pointer";
-
- case MAD_ERROR_NOMEM:
- return "not enough memory";
-
- case MAD_ERROR_LOSTSYNC:
- return "lost synchronization";
- case MAD_ERROR_BADLAYER:
- return "reserved header layer value";
- case MAD_ERROR_BADBITRATE:
- return "forbidden bitrate value";
- case MAD_ERROR_BADSAMPLERATE:
- return "reserved sample frequency value";
- case MAD_ERROR_BADEMPHASIS:
- return "reserved emphasis value";
-
- case MAD_ERROR_BADCRC:
- return "CRC check failed";
- case MAD_ERROR_BADBITALLOC:
- return "forbidden bit allocation value";
- case MAD_ERROR_BADSCALEFACTOR:
- return "bad scalefactor index";
- case MAD_ERROR_BADMODE:
- return "bad bitrate/mode combination";
- case MAD_ERROR_BADFRAMELEN:
- return "bad frame length";
- case MAD_ERROR_BADBIGVALUES:
- return "bad big_values count";
- case MAD_ERROR_BADBLOCKTYPE:
- return "reserved block_type";
- case MAD_ERROR_BADSCFSI:
- return "bad scalefactor selection info";
- case MAD_ERROR_BADDATAPTR:
- return "bad main_data_begin pointer";
- case MAD_ERROR_BADPART3LEN:
- return "bad audio data length";
- case MAD_ERROR_BADHUFFTABLE:
- return "bad Huffman table select";
- case MAD_ERROR_BADHUFFDATA:
- return "Huffman data overrun";
- case MAD_ERROR_BADSTEREO:
- return "incompatible block_type for JS";
- }
-
- return 0;
+ switch (stream->error) {
+ case MAD_ERROR_NONE: return "no error";
+
+ case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
+ case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
+
+ case MAD_ERROR_NOMEM: return "not enough memory";
+
+ case MAD_ERROR_LOSTSYNC: return "lost synchronization";
+ case MAD_ERROR_BADLAYER: return "reserved header layer value";
+ case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
+ case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
+ case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
+
+ case MAD_ERROR_BADCRC: return "CRC check failed";
+ case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
+ case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
+ case MAD_ERROR_BADMODE: return "bad bitrate/mode combination";
+ case MAD_ERROR_BADFRAMELEN: return "bad frame length";
+ case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
+ case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
+ case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
+ case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
+ case MAD_ERROR_BADPART3LEN: return "bad audio data length";
+ case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
+ case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
+ case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
+ }
+
+ return 0;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/stream.h b/src/filters/transform/MpaDecFilter/libmad/stream.h
index df59ee3f4..364a337b6 100644
--- a/src/filters/transform/MpaDecFilter/libmad/stream.h
+++ b/src/filters/transform/MpaDecFilter/libmad/stream.h
@@ -26,70 +26,67 @@
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
-enum mad_error
-{
- MAD_ERROR_NONE = 0x0000, /* no error */
-
- MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
- MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
-
- MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
-
- MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
- MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
- MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
- MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
- MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
-
- MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
- MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
- MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
- MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
- MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
- MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
- MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
- MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
- MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
- MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
- MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
- MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
- MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
-struct mad_stream
-{
- unsigned char const *buffer; /* input bitstream buffer */
- unsigned char const *bufend; /* end of buffer */
- unsigned long skiplen; /* bytes to skip before next frame */
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
- int sync; /* stream sync found */
- unsigned long freerate; /* free bitrate (fixed) */
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
- unsigned char const *this_frame; /* start of current frame */
- unsigned char const *next_frame; /* start of next frame */
- struct mad_bitptr ptr; /* current processing bit pointer */
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
- struct mad_bitptr anc_ptr; /* ancillary bits pointer */
- unsigned int anc_bitlen; /* number of ancillary bits */
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
- unsigned char(*main_data)[MAD_BUFFER_MDLEN];
- /* Layer III main_data() */
- unsigned int md_len; /* bytes in main_data */
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
- int options; /* decoding options (see below) */
- enum mad_error error; /* error code (see above) */
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
};
-enum
-{
- MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
- MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
- MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
- MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
- MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
};
@@ -100,7 +97,7 @@ void mad_stream_finish(struct mad_stream *);
((void) ((stream)->options = (opts)))
void mad_stream_buffer(struct mad_stream *,
- unsigned char const *, unsigned long);
+ unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long);
int mad_stream_sync(struct mad_stream *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/synth.c b/src/filters/transform/MpaDecFilter/libmad/synth.c
index 32a7de2dc..61dec1ba4 100644
--- a/src/filters/transform/MpaDecFilter/libmad/synth.c
+++ b/src/filters/transform/MpaDecFilter/libmad/synth.c
@@ -34,13 +34,13 @@
*/
void mad_synth_init(struct mad_synth *synth)
{
- mad_synth_mute(synth);
+ mad_synth_mute(synth);
- synth->phase = 0;
+ synth->phase = 0;
- synth->pcm.samplerate = 0;
- synth->pcm.channels = 0;
- synth->pcm.length = 0;
+ synth->pcm.samplerate = 0;
+ synth->pcm.channels = 0;
+ synth->pcm.length = 0;
}
/*
@@ -49,19 +49,16 @@ void mad_synth_init(struct mad_synth *synth)
*/
void mad_synth_mute(struct mad_synth *synth)
{
- unsigned int ch, s, v;
-
- for(ch = 0; ch < 2; ++ch)
- {
- for(s = 0; s < 16; ++s)
- {
- for(v = 0; v < 8; ++v)
- {
- synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
- synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
- }
- }
+ unsigned int ch, s, v;
+
+ for (ch = 0; ch < 2; ++ch) {
+ for (s = 0; s < 16; ++s) {
+ for (v = 0; v < 8; ++v) {
+ synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
+ synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
+ }
}
+ }
}
/*
@@ -123,33 +120,33 @@ void mad_synth_mute(struct mad_synth *synth)
*/
static
void dct32(mad_fixed_t const in[32], unsigned int slot,
- mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
+ mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
{
- mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
- mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
- mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
- mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
- mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
- mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
- mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
- mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
- mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
- mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
- mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
- mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
- mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
- mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
- mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
- mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
- mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
- mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
- mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
- mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
- mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
- mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
- mad_fixed_t t176;
-
- /* costab[i] = cos(PI / (2 * 32) * i) */
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
+ mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
+ mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
+ mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
+ mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
+ mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
+ mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
+ mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
+ mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
+ mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
+ mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
+ mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
+ mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
+ mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
+ mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
+ mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
+ mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
+ mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
+ mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
+ mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
+ mad_fixed_t t176;
+
+ /* costab[i] = cos(PI / (2 * 32) * i) */
# if defined(OPT_DCTO)
# define costab1 MAD_F(0x7fd8878e)
@@ -217,364 +214,300 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */
# endif
- t0 = in[0] + in[31];
- t16 = MUL(in[0] - in[31], costab1);
- t1 = in[15] + in[16];
- t17 = MUL(in[15] - in[16], costab31);
-
- t41 = t16 + t17;
- t59 = MUL(t16 - t17, costab2);
- t33 = t0 + t1;
- t50 = MUL(t0 - t1, costab2);
-
- t2 = in[7] + in[24];
- t18 = MUL(in[7] - in[24], costab15);
- t3 = in[8] + in[23];
- t19 = MUL(in[8] - in[23], costab17);
-
- t42 = t18 + t19;
- t60 = MUL(t18 - t19, costab30);
- t34 = t2 + t3;
- t51 = MUL(t2 - t3, costab30);
-
- t4 = in[3] + in[28];
- t20 = MUL(in[3] - in[28], costab7);
- t5 = in[12] + in[19];
- t21 = MUL(in[12] - in[19], costab25);
-
- t43 = t20 + t21;
- t61 = MUL(t20 - t21, costab14);
- t35 = t4 + t5;
- t52 = MUL(t4 - t5, costab14);
-
- t6 = in[4] + in[27];
- t22 = MUL(in[4] - in[27], costab9);
- t7 = in[11] + in[20];
- t23 = MUL(in[11] - in[20], costab23);
-
- t44 = t22 + t23;
- t62 = MUL(t22 - t23, costab18);
- t36 = t6 + t7;
- t53 = MUL(t6 - t7, costab18);
-
- t8 = in[1] + in[30];
- t24 = MUL(in[1] - in[30], costab3);
- t9 = in[14] + in[17];
- t25 = MUL(in[14] - in[17], costab29);
-
- t45 = t24 + t25;
- t63 = MUL(t24 - t25, costab6);
- t37 = t8 + t9;
- t54 = MUL(t8 - t9, costab6);
-
- t10 = in[6] + in[25];
- t26 = MUL(in[6] - in[25], costab13);
- t11 = in[9] + in[22];
- t27 = MUL(in[9] - in[22], costab19);
-
- t46 = t26 + t27;
- t64 = MUL(t26 - t27, costab26);
- t38 = t10 + t11;
- t55 = MUL(t10 - t11, costab26);
-
- t12 = in[2] + in[29];
- t28 = MUL(in[2] - in[29], costab5);
- t13 = in[13] + in[18];
- t29 = MUL(in[13] - in[18], costab27);
-
- t47 = t28 + t29;
- t65 = MUL(t28 - t29, costab10);
- t39 = t12 + t13;
- t56 = MUL(t12 - t13, costab10);
-
- t14 = in[5] + in[26];
- t30 = MUL(in[5] - in[26], costab11);
- t15 = in[10] + in[21];
- t31 = MUL(in[10] - in[21], costab21);
-
- t48 = t30 + t31;
- t66 = MUL(t30 - t31, costab22);
- t40 = t14 + t15;
- t57 = MUL(t14 - t15, costab22);
-
- t69 = t33 + t34;
- t89 = MUL(t33 - t34, costab4);
- t70 = t35 + t36;
- t90 = MUL(t35 - t36, costab28);
- t71 = t37 + t38;
- t91 = MUL(t37 - t38, costab12);
- t72 = t39 + t40;
- t92 = MUL(t39 - t40, costab20);
- t73 = t41 + t42;
- t94 = MUL(t41 - t42, costab4);
- t74 = t43 + t44;
- t95 = MUL(t43 - t44, costab28);
- t75 = t45 + t46;
- t96 = MUL(t45 - t46, costab12);
- t76 = t47 + t48;
- t97 = MUL(t47 - t48, costab20);
+ t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1);
+ t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31);
- t78 = t50 + t51;
- t100 = MUL(t50 - t51, costab4);
- t79 = t52 + t53;
- t101 = MUL(t52 - t53, costab28);
- t80 = t54 + t55;
- t102 = MUL(t54 - t55, costab12);
- t81 = t56 + t57;
- t103 = MUL(t56 - t57, costab20);
+ t41 = t16 + t17;
+ t59 = MUL(t16 - t17, costab2);
+ t33 = t0 + t1;
+ t50 = MUL(t0 - t1, costab2);
- t83 = t59 + t60;
- t106 = MUL(t59 - t60, costab4);
- t84 = t61 + t62;
- t107 = MUL(t61 - t62, costab28);
- t85 = t63 + t64;
- t108 = MUL(t63 - t64, costab12);
- t86 = t65 + t66;
- t109 = MUL(t65 - t66, costab20);
+ t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15);
+ t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17);
- t113 = t69 + t70;
- t114 = t71 + t72;
+ t42 = t18 + t19;
+ t60 = MUL(t18 - t19, costab30);
+ t34 = t2 + t3;
+ t51 = MUL(t2 - t3, costab30);
- /* 0 */
- hi[15][slot] = SHIFT(t113 + t114);
- /* 16 */
- lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
+ t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7);
+ t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25);
- t115 = t73 + t74;
- t116 = t75 + t76;
+ t43 = t20 + t21;
+ t61 = MUL(t20 - t21, costab14);
+ t35 = t4 + t5;
+ t52 = MUL(t4 - t5, costab14);
- t32 = t115 + t116;
+ t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9);
+ t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23);
- /* 1 */
- hi[14][slot] = SHIFT(t32);
+ t44 = t22 + t23;
+ t62 = MUL(t22 - t23, costab18);
+ t36 = t6 + t7;
+ t53 = MUL(t6 - t7, costab18);
- t118 = t78 + t79;
- t119 = t80 + t81;
+ t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3);
+ t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29);
- t58 = t118 + t119;
+ t45 = t24 + t25;
+ t63 = MUL(t24 - t25, costab6);
+ t37 = t8 + t9;
+ t54 = MUL(t8 - t9, costab6);
- /* 2 */
- hi[13][slot] = SHIFT(t58);
+ t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13);
+ t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19);
- t121 = t83 + t84;
- t122 = t85 + t86;
+ t46 = t26 + t27;
+ t64 = MUL(t26 - t27, costab26);
+ t38 = t10 + t11;
+ t55 = MUL(t10 - t11, costab26);
- t67 = t121 + t122;
+ t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5);
+ t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27);
- t49 = (t67 * 2) - t32;
+ t47 = t28 + t29;
+ t65 = MUL(t28 - t29, costab10);
+ t39 = t12 + t13;
+ t56 = MUL(t12 - t13, costab10);
- /* 3 */
- hi[12][slot] = SHIFT(t49);
+ t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11);
+ t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21);
- t125 = t89 + t90;
- t126 = t91 + t92;
+ t48 = t30 + t31;
+ t66 = MUL(t30 - t31, costab22);
+ t40 = t14 + t15;
+ t57 = MUL(t14 - t15, costab22);
- t93 = t125 + t126;
+ t69 = t33 + t34; t89 = MUL(t33 - t34, costab4);
+ t70 = t35 + t36; t90 = MUL(t35 - t36, costab28);
+ t71 = t37 + t38; t91 = MUL(t37 - t38, costab12);
+ t72 = t39 + t40; t92 = MUL(t39 - t40, costab20);
+ t73 = t41 + t42; t94 = MUL(t41 - t42, costab4);
+ t74 = t43 + t44; t95 = MUL(t43 - t44, costab28);
+ t75 = t45 + t46; t96 = MUL(t45 - t46, costab12);
+ t76 = t47 + t48; t97 = MUL(t47 - t48, costab20);
- /* 4 */
- hi[11][slot] = SHIFT(t93);
+ t78 = t50 + t51; t100 = MUL(t50 - t51, costab4);
+ t79 = t52 + t53; t101 = MUL(t52 - t53, costab28);
+ t80 = t54 + t55; t102 = MUL(t54 - t55, costab12);
+ t81 = t56 + t57; t103 = MUL(t56 - t57, costab20);
- t128 = t94 + t95;
- t129 = t96 + t97;
+ t83 = t59 + t60; t106 = MUL(t59 - t60, costab4);
+ t84 = t61 + t62; t107 = MUL(t61 - t62, costab28);
+ t85 = t63 + t64; t108 = MUL(t63 - t64, costab12);
+ t86 = t65 + t66; t109 = MUL(t65 - t66, costab20);
- t98 = t128 + t129;
+ t113 = t69 + t70;
+ t114 = t71 + t72;
- t68 = (t98 * 2) - t49;
+ /* 0 */ hi[15][slot] = SHIFT(t113 + t114);
+ /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
- /* 5 */
- hi[10][slot] = SHIFT(t68);
+ t115 = t73 + t74;
+ t116 = t75 + t76;
- t132 = t100 + t101;
- t133 = t102 + t103;
+ t32 = t115 + t116;
- t104 = t132 + t133;
+ /* 1 */ hi[14][slot] = SHIFT(t32);
- t82 = (t104 * 2) - t58;
+ t118 = t78 + t79;
+ t119 = t80 + t81;
- /* 6 */
- hi[ 9][slot] = SHIFT(t82);
+ t58 = t118 + t119;
- t136 = t106 + t107;
- t137 = t108 + t109;
+ /* 2 */ hi[13][slot] = SHIFT(t58);
- t110 = t136 + t137;
+ t121 = t83 + t84;
+ t122 = t85 + t86;
- t87 = (t110 * 2) - t67;
+ t67 = t121 + t122;
- t77 = (t87 * 2) - t68;
+ t49 = (t67 * 2) - t32;
- /* 7 */
- hi[ 8][slot] = SHIFT(t77);
+ /* 3 */ hi[12][slot] = SHIFT(t49);
- t141 = MUL(t69 - t70, costab8);
- t142 = MUL(t71 - t72, costab24);
- t143 = t141 + t142;
+ t125 = t89 + t90;
+ t126 = t91 + t92;
- /* 8 */
- hi[ 7][slot] = SHIFT(t143);
- /* 24 */
- lo[ 8][slot] =
- SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
+ t93 = t125 + t126;
- t144 = MUL(t73 - t74, costab8);
- t145 = MUL(t75 - t76, costab24);
- t146 = t144 + t145;
+ /* 4 */ hi[11][slot] = SHIFT(t93);
- t88 = (t146 * 2) - t77;
+ t128 = t94 + t95;
+ t129 = t96 + t97;
- /* 9 */
- hi[ 6][slot] = SHIFT(t88);
+ t98 = t128 + t129;
- t148 = MUL(t78 - t79, costab8);
- t149 = MUL(t80 - t81, costab24);
- t150 = t148 + t149;
+ t68 = (t98 * 2) - t49;
- t105 = (t150 * 2) - t82;
+ /* 5 */ hi[10][slot] = SHIFT(t68);
- /* 10 */
- hi[ 5][slot] = SHIFT(t105);
+ t132 = t100 + t101;
+ t133 = t102 + t103;
- t152 = MUL(t83 - t84, costab8);
- t153 = MUL(t85 - t86, costab24);
- t154 = t152 + t153;
+ t104 = t132 + t133;
- t111 = (t154 * 2) - t87;
+ t82 = (t104 * 2) - t58;
- t99 = (t111 * 2) - t88;
+ /* 6 */ hi[ 9][slot] = SHIFT(t82);
- /* 11 */
- hi[ 4][slot] = SHIFT(t99);
+ t136 = t106 + t107;
+ t137 = t108 + t109;
- t157 = MUL(t89 - t90, costab8);
- t158 = MUL(t91 - t92, costab24);
- t159 = t157 + t158;
+ t110 = t136 + t137;
- t127 = (t159 * 2) - t93;
+ t87 = (t110 * 2) - t67;
- /* 12 */
- hi[ 3][slot] = SHIFT(t127);
+ t77 = (t87 * 2) - t68;
- t160 = (MUL(t125 - t126, costab16) * 2) - t127;
+ /* 7 */ hi[ 8][slot] = SHIFT(t77);
- /* 20 */
- lo[ 4][slot] = SHIFT(t160);
- /* 28 */
- lo[12][slot] =
- SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
+ t141 = MUL(t69 - t70, costab8);
+ t142 = MUL(t71 - t72, costab24);
+ t143 = t141 + t142;
- t161 = MUL(t94 - t95, costab8);
- t162 = MUL(t96 - t97, costab24);
- t163 = t161 + t162;
+ /* 8 */ hi[ 7][slot] = SHIFT(t143);
+ /* 24 */ lo[ 8][slot] =
+ SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
- t130 = (t163 * 2) - t98;
+ t144 = MUL(t73 - t74, costab8);
+ t145 = MUL(t75 - t76, costab24);
+ t146 = t144 + t145;
- t112 = (t130 * 2) - t99;
+ t88 = (t146 * 2) - t77;
- /* 13 */
- hi[ 2][slot] = SHIFT(t112);
+ /* 9 */ hi[ 6][slot] = SHIFT(t88);
- t164 = (MUL(t128 - t129, costab16) * 2) - t130;
+ t148 = MUL(t78 - t79, costab8);
+ t149 = MUL(t80 - t81, costab24);
+ t150 = t148 + t149;
- t166 = MUL(t100 - t101, costab8);
- t167 = MUL(t102 - t103, costab24);
- t168 = t166 + t167;
+ t105 = (t150 * 2) - t82;
- t134 = (t168 * 2) - t104;
+ /* 10 */ hi[ 5][slot] = SHIFT(t105);
- t120 = (t134 * 2) - t105;
+ t152 = MUL(t83 - t84, costab8);
+ t153 = MUL(t85 - t86, costab24);
+ t154 = t152 + t153;
- /* 14 */
- hi[ 1][slot] = SHIFT(t120);
+ t111 = (t154 * 2) - t87;
- t135 = (MUL(t118 - t119, costab16) * 2) - t120;
+ t99 = (t111 * 2) - t88;
- /* 18 */
- lo[ 2][slot] = SHIFT(t135);
+ /* 11 */ hi[ 4][slot] = SHIFT(t99);
- t169 = (MUL(t132 - t133, costab16) * 2) - t134;
+ t157 = MUL(t89 - t90, costab8);
+ t158 = MUL(t91 - t92, costab24);
+ t159 = t157 + t158;
- t151 = (t169 * 2) - t135;
+ t127 = (t159 * 2) - t93;
- /* 22 */
- lo[ 6][slot] = SHIFT(t151);
+ /* 12 */ hi[ 3][slot] = SHIFT(t127);
- t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
+ t160 = (MUL(t125 - t126, costab16) * 2) - t127;
- /* 26 */
- lo[10][slot] = SHIFT(t170);
- /* 30 */
- lo[14][slot] =
- SHIFT((((((MUL(t166 - t167, costab16) * 2) -
- t168) * 2) - t169) * 2) - t170);
+ /* 20 */ lo[ 4][slot] = SHIFT(t160);
+ /* 28 */ lo[12][slot] =
+ SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
- t171 = MUL(t106 - t107, costab8);
- t172 = MUL(t108 - t109, costab24);
- t173 = t171 + t172;
+ t161 = MUL(t94 - t95, costab8);
+ t162 = MUL(t96 - t97, costab24);
+ t163 = t161 + t162;
- t138 = (t173 * 2) - t110;
+ t130 = (t163 * 2) - t98;
- t123 = (t138 * 2) - t111;
+ t112 = (t130 * 2) - t99;
- t139 = (MUL(t121 - t122, costab16) * 2) - t123;
+ /* 13 */ hi[ 2][slot] = SHIFT(t112);
- t117 = (t123 * 2) - t112;
+ t164 = (MUL(t128 - t129, costab16) * 2) - t130;
- /* 15 */
- hi[ 0][slot] = SHIFT(t117);
+ t166 = MUL(t100 - t101, costab8);
+ t167 = MUL(t102 - t103, costab24);
+ t168 = t166 + t167;
- t124 = (MUL(t115 - t116, costab16) * 2) - t117;
+ t134 = (t168 * 2) - t104;
- /* 17 */
- lo[ 1][slot] = SHIFT(t124);
+ t120 = (t134 * 2) - t105;
- t131 = (t139 * 2) - t124;
+ /* 14 */ hi[ 1][slot] = SHIFT(t120);
- /* 19 */
- lo[ 3][slot] = SHIFT(t131);
+ t135 = (MUL(t118 - t119, costab16) * 2) - t120;
- t140 = (t164 * 2) - t131;
+ /* 18 */ lo[ 2][slot] = SHIFT(t135);
- /* 21 */
- lo[ 5][slot] = SHIFT(t140);
+ t169 = (MUL(t132 - t133, costab16) * 2) - t134;
- t174 = (MUL(t136 - t137, costab16) * 2) - t138;
+ t151 = (t169 * 2) - t135;
- t155 = (t174 * 2) - t139;
+ /* 22 */ lo[ 6][slot] = SHIFT(t151);
- t147 = (t155 * 2) - t140;
+ t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
- /* 23 */
- lo[ 7][slot] = SHIFT(t147);
+ /* 26 */ lo[10][slot] = SHIFT(t170);
+ /* 30 */ lo[14][slot] =
+ SHIFT((((((MUL(t166 - t167, costab16) * 2) -
+ t168) * 2) - t169) * 2) - t170);
- t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
+ t171 = MUL(t106 - t107, costab8);
+ t172 = MUL(t108 - t109, costab24);
+ t173 = t171 + t172;
- /* 25 */
- lo[ 9][slot] = SHIFT(t156);
+ t138 = (t173 * 2) - t110;
- t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
+ t123 = (t138 * 2) - t111;
- t165 = (t175 * 2) - t156;
+ t139 = (MUL(t121 - t122, costab16) * 2) - t123;
- /* 27 */
- lo[11][slot] = SHIFT(t165);
+ t117 = (t123 * 2) - t112;
- t176 = (((((MUL(t161 - t162, costab16) * 2) -
- t163) * 2) - t164) * 2) - t165;
+ /* 15 */ hi[ 0][slot] = SHIFT(t117);
- /* 29 */
- lo[13][slot] = SHIFT(t176);
- /* 31 */
- lo[15][slot] =
- SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
- t173) * 2) - t174) * 2) - t175) * 2) - t176);
+ t124 = (MUL(t115 - t116, costab16) * 2) - t117;
- /*
- * Totals:
- * 80 multiplies
- * 80 additions
- * 119 subtractions
- * 49 shifts (not counting SSO)
- */
+ /* 17 */ lo[ 1][slot] = SHIFT(t124);
+
+ t131 = (t139 * 2) - t124;
+
+ /* 19 */ lo[ 3][slot] = SHIFT(t131);
+
+ t140 = (t164 * 2) - t131;
+
+ /* 21 */ lo[ 5][slot] = SHIFT(t140);
+
+ t174 = (MUL(t136 - t137, costab16) * 2) - t138;
+
+ t155 = (t174 * 2) - t139;
+
+ t147 = (t155 * 2) - t140;
+
+ /* 23 */ lo[ 7][slot] = SHIFT(t147);
+
+ t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
+
+ /* 25 */ lo[ 9][slot] = SHIFT(t156);
+
+ t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
+
+ t165 = (t175 * 2) - t156;
+
+ /* 27 */ lo[11][slot] = SHIFT(t165);
+
+ t176 = (((((MUL(t161 - t162, costab16) * 2) -
+ t163) * 2) - t164) * 2) - t165;
+
+ /* 29 */ lo[13][slot] = SHIFT(t176);
+ /* 31 */ lo[15][slot] =
+ SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
+ t173) * 2) - t174) * 2) - t175) * 2) - t176);
+
+ /*
+ * Totals:
+ * 80 multiplies
+ * 80 additions
+ * 119 subtractions
+ * 49 shifts (not counting SSO)
+ */
}
# undef MUL
@@ -608,14 +541,13 @@ void dct32(mad_fixed_t const in[32], unsigned int slot,
# endif
static
-mad_fixed_t const D[17][32] =
-{
+mad_fixed_t const D[17][32] = {
# include "D.dat"
};
# if defined(ASO_SYNTH)
void synth_full(struct mad_synth *, struct mad_frame const *,
- unsigned int, unsigned int);
+ unsigned int, unsigned int);
# else
/*
* NAME: synth->full()
@@ -623,137 +555,134 @@ void synth_full(struct mad_synth *, struct mad_frame const *,
*/
static
void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
- unsigned int nch, unsigned int ns)
+ unsigned int nch, unsigned int ns)
{
- unsigned int phase, ch, s, sb, pe, po;
- mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
- mad_fixed_t const(*sbsample)[36][32];
- register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
- register mad_fixed_t const(*Dptr)[32], *ptr;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- for(ch = 0; ch < nch; ++ch)
- {
- sbsample = &frame->sbsample[ch];
- filter = &synth->filter[ch];
- phase = synth->phase;
- pcm1 = synth->pcm.samples[ch];
-
- for(s = 0; s < ns; ++s)
- {
- dct32((*sbsample)[s], phase >> 1,
- (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
-
- pe = phase & ~1;
- po = ((phase - 1) & 0xf) | 1;
-
- /* calculate 32 samples */
-
- fe = &(*filter)[0][ phase & 1][0];
- fx = &(*filter)[0][~phase & 1][0];
- fo = &(*filter)[1][~phase & 1][0];
-
- Dptr = &D[0];
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fx)[0], ptr[ 0]);
- MLA(hi, lo, (*fx)[1], ptr[14]);
- MLA(hi, lo, (*fx)[2], ptr[12]);
- MLA(hi, lo, (*fx)[3], ptr[10]);
- MLA(hi, lo, (*fx)[4], ptr[ 8]);
- MLA(hi, lo, (*fx)[5], ptr[ 6]);
- MLA(hi, lo, (*fx)[6], ptr[ 4]);
- MLA(hi, lo, (*fx)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- pcm2 = pcm1 + 30;
-
- for(sb = 1; sb < 16; ++sb)
- {
- ++fe;
- ++Dptr;
-
- /* D[32 - sb][i] == -D[sb][31 - i] */
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- ptr = *Dptr - pe;
- ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
- MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
-
- ptr = *Dptr - po;
- MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
- MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
-
- *pcm2-- = SHIFT(MLZ(hi, lo));
-
- ++fo;
- }
-
- ++Dptr;
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
-
- *pcm1 = SHIFT(-MLZ(hi, lo));
- pcm1 += 16;
-
- phase = (phase + 1) % 16;
- }
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 32 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 30;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - pe;
+ ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ ptr = *Dptr - po;
+ MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 16;
+
+ phase = (phase + 1) % 16;
}
+ }
}
# endif
@@ -763,140 +692,136 @@ void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
*/
static
void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
- unsigned int nch, unsigned int ns)
+ unsigned int nch, unsigned int ns)
{
- unsigned int phase, ch, s, sb, pe, po;
- mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
- mad_fixed_t const(*sbsample)[36][32];
- register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
- register mad_fixed_t const(*Dptr)[32], *ptr;
- register mad_fixed64hi_t hi;
- register mad_fixed64lo_t lo;
-
- for(ch = 0; ch < nch; ++ch)
- {
- sbsample = &frame->sbsample[ch];
- filter = &synth->filter[ch];
- phase = synth->phase;
- pcm1 = synth->pcm.samples[ch];
-
- for(s = 0; s < ns; ++s)
- {
- dct32((*sbsample)[s], phase >> 1,
- (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
-
- pe = phase & ~1;
- po = ((phase - 1) & 0xf) | 1;
-
- /* calculate 16 samples */
-
- fe = &(*filter)[0][ phase & 1][0];
- fx = &(*filter)[0][~phase & 1][0];
- fo = &(*filter)[1][~phase & 1][0];
-
- Dptr = &D[0];
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fx)[0], ptr[ 0]);
- MLA(hi, lo, (*fx)[1], ptr[14]);
- MLA(hi, lo, (*fx)[2], ptr[12]);
- MLA(hi, lo, (*fx)[3], ptr[10]);
- MLA(hi, lo, (*fx)[4], ptr[ 8]);
- MLA(hi, lo, (*fx)[5], ptr[ 6]);
- MLA(hi, lo, (*fx)[6], ptr[ 4]);
- MLA(hi, lo, (*fx)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- pcm2 = pcm1 + 14;
-
- for(sb = 1; sb < 16; ++sb)
- {
- ++fe;
- ++Dptr;
-
- /* D[32 - sb][i] == -D[sb][31 - i] */
-
- if(!(sb & 1))
- {
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
- MLN(hi, lo);
-
- ptr = *Dptr + pe;
- MLA(hi, lo, (*fe)[7], ptr[ 2]);
- MLA(hi, lo, (*fe)[6], ptr[ 4]);
- MLA(hi, lo, (*fe)[5], ptr[ 6]);
- MLA(hi, lo, (*fe)[4], ptr[ 8]);
- MLA(hi, lo, (*fe)[3], ptr[10]);
- MLA(hi, lo, (*fe)[2], ptr[12]);
- MLA(hi, lo, (*fe)[1], ptr[14]);
- MLA(hi, lo, (*fe)[0], ptr[ 0]);
-
- *pcm1++ = SHIFT(MLZ(hi, lo));
-
- ptr = *Dptr - po;
- ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
- MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
-
- ptr = *Dptr - pe;
- MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
- MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
- MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
- MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
- MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
- MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
- MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
- MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
-
- *pcm2-- = SHIFT(MLZ(hi, lo));
- }
-
- ++fo;
- }
-
- ++Dptr;
-
- ptr = *Dptr + po;
- ML0(hi, lo, (*fo)[0], ptr[ 0]);
- MLA(hi, lo, (*fo)[1], ptr[14]);
- MLA(hi, lo, (*fo)[2], ptr[12]);
- MLA(hi, lo, (*fo)[3], ptr[10]);
- MLA(hi, lo, (*fo)[4], ptr[ 8]);
- MLA(hi, lo, (*fo)[5], ptr[ 6]);
- MLA(hi, lo, (*fo)[6], ptr[ 4]);
- MLA(hi, lo, (*fo)[7], ptr[ 2]);
-
- *pcm1 = SHIFT(-MLZ(hi, lo));
- pcm1 += 8;
-
- phase = (phase + 1) % 16;
- }
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 16 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 14;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ if (!(sb & 1)) {
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - po;
+ ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ ptr = *Dptr - pe;
+ MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+ }
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 8;
+
+ phase = (phase + 1) % 16;
}
+ }
}
/*
@@ -905,28 +830,27 @@ void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
*/
void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame)
{
- unsigned int nch, ns;
- void (*synth_frame)(struct mad_synth *, struct mad_frame const *,
- unsigned int, unsigned int);
+ unsigned int nch, ns;
+ void (*synth_frame)(struct mad_synth *, struct mad_frame const *,
+ unsigned int, unsigned int);
- nch = MAD_NCHANNELS(&frame->header);
- ns = MAD_NSBSAMPLES(&frame->header);
+ nch = MAD_NCHANNELS(&frame->header);
+ ns = MAD_NSBSAMPLES(&frame->header);
- synth->pcm.samplerate = frame->header.samplerate;
- synth->pcm.channels = nch;
- synth->pcm.length = 32 * ns;
+ synth->pcm.samplerate = frame->header.samplerate;
+ synth->pcm.channels = nch;
+ synth->pcm.length = 32 * ns;
- synth_frame = synth_full;
+ synth_frame = synth_full;
- if(frame->options & MAD_OPTION_HALFSAMPLERATE)
- {
- synth->pcm.samplerate /= 2;
- synth->pcm.length /= 2;
+ if (frame->options & MAD_OPTION_HALFSAMPLERATE) {
+ synth->pcm.samplerate /= 2;
+ synth->pcm.length /= 2;
- synth_frame = synth_half;
- }
+ synth_frame = synth_half;
+ }
- synth_frame(synth, frame, nch, ns);
+ synth_frame(synth, frame, nch, ns);
- synth->phase = (synth->phase + ns) % 16;
+ synth->phase = (synth->phase + ns) % 16;
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/synth.h b/src/filters/transform/MpaDecFilter/libmad/synth.h
index 375faa406..50532638c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/synth.h
+++ b/src/filters/transform/MpaDecFilter/libmad/synth.h
@@ -24,42 +24,37 @@
# include "fixed.h"
# include "frame.h"
-struct mad_pcm
-{
- unsigned int samplerate; /* sampling frequency (Hz) */
- unsigned short channels; /* number of channels */
- unsigned short length; /* number of samples per channel */
- mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
};
-struct mad_synth
-{
- mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
- /* [ch][eo][peo][s][v] */
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
- unsigned int phase; /* current processing phase */
+ unsigned int phase; /* current processing phase */
- struct mad_pcm pcm; /* PCM output */
+ struct mad_pcm pcm; /* PCM output */
};
/* single channel PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_SINGLE = 0
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
};
/* dual channel PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_DUAL_1 = 0,
- MAD_PCM_CHANNEL_DUAL_2 = 1
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
};
/* stereo PCM selector */
-enum
-{
- MAD_PCM_CHANNEL_STEREO_LEFT = 0,
- MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
};
void mad_synth_init(struct mad_synth *);
diff --git a/src/filters/transform/MpaDecFilter/libmad/timer.c b/src/filters/transform/MpaDecFilter/libmad/timer.c
index a5f5d8c95..7ce9f7998 100644
--- a/src/filters/transform/MpaDecFilter/libmad/timer.c
+++ b/src/filters/transform/MpaDecFilter/libmad/timer.c
@@ -40,21 +40,21 @@ mad_timer_t const mad_timer_zero = { 0, 0 };
*/
int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2)
{
- signed long diff;
+ signed long diff;
- diff = timer1.seconds - timer2.seconds;
- if(diff < 0)
- return -1;
- else if(diff > 0)
- return +1;
+ diff = timer1.seconds - timer2.seconds;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
- diff = timer1.fraction - timer2.fraction;
- if(diff < 0)
- return -1;
- else if(diff > 0)
- return +1;
+ diff = timer1.fraction - timer2.fraction;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
- return 0;
+ return 0;
}
/*
@@ -63,13 +63,12 @@ int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2)
*/
void mad_timer_negate(mad_timer_t *timer)
{
- timer->seconds = -timer->seconds;
+ timer->seconds = -timer->seconds;
- if(timer->fraction)
- {
- timer->seconds -= 1;
- timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
- }
+ if (timer->fraction) {
+ timer->seconds -= 1;
+ timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
+ }
}
/*
@@ -78,10 +77,10 @@ void mad_timer_negate(mad_timer_t *timer)
*/
mad_timer_t mad_timer_abs(mad_timer_t timer)
{
- if(timer.seconds < 0)
- mad_timer_negate(&timer);
+ if (timer.seconds < 0)
+ mad_timer_negate(&timer);
- return timer;
+ return timer;
}
/*
@@ -91,8 +90,8 @@ mad_timer_t mad_timer_abs(mad_timer_t timer)
static
void reduce_timer(mad_timer_t *timer)
{
- timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION;
- timer->fraction %= MAD_TIMER_RESOLUTION;
+ timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION;
+ timer->fraction %= MAD_TIMER_RESOLUTION;
}
/*
@@ -102,16 +101,15 @@ void reduce_timer(mad_timer_t *timer)
static
unsigned long gcd(unsigned long num1, unsigned long num2)
{
- unsigned long tmp;
+ unsigned long tmp;
- while(num2)
- {
- tmp = num2;
- num2 = num1 % num2;
- num1 = tmp;
- }
+ while (num2) {
+ tmp = num2;
+ num2 = num1 % num2;
+ num1 = tmp;
+ }
- return num1;
+ return num1;
}
/*
@@ -121,14 +119,14 @@ unsigned long gcd(unsigned long num1, unsigned long num2)
static
void reduce_rational(unsigned long *numer, unsigned long *denom)
{
- unsigned long factor;
+ unsigned long factor;
- factor = gcd(*numer, *denom);
+ factor = gcd(*numer, *denom);
- assert(factor != 0);
+ assert(factor != 0);
- *numer /= factor;
- *denom /= factor;
+ *numer /= factor;
+ *denom /= factor;
}
/*
@@ -137,19 +135,19 @@ void reduce_rational(unsigned long *numer, unsigned long *denom)
*/
static
unsigned long scale_rational(unsigned long numer, unsigned long denom,
- unsigned long scale)
+ unsigned long scale)
{
- reduce_rational(&numer, &denom);
- reduce_rational(&scale, &denom);
+ reduce_rational(&numer, &denom);
+ reduce_rational(&scale, &denom);
- assert(denom != 0);
+ assert(denom != 0);
- if(denom < scale)
- return numer * (scale / denom) + numer * (scale % denom) / denom;
- if(denom < numer)
- return scale * (numer / denom) + scale * (numer % denom) / denom;
+ if (denom < scale)
+ return numer * (scale / denom) + numer * (scale % denom) / denom;
+ if (denom < numer)
+ return scale * (numer / denom) + scale * (numer % denom) / denom;
- return numer * scale / denom;
+ return numer * scale / denom;
}
/*
@@ -157,73 +155,71 @@ unsigned long scale_rational(unsigned long numer, unsigned long denom,
* DESCRIPTION: set timer to specific (positive) value
*/
void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
- unsigned long numer, unsigned long denom)
+ unsigned long numer, unsigned long denom)
{
- timer->seconds = seconds;
- if(numer >= denom && denom > 0)
- {
- timer->seconds += numer / denom;
- numer %= denom;
- }
+ timer->seconds = seconds;
+ if (numer >= denom && denom > 0) {
+ timer->seconds += numer / denom;
+ numer %= denom;
+ }
+
+ switch (denom) {
+ case 0:
+ case 1:
+ timer->fraction = 0;
+ break;
- switch(denom)
- {
- case 0:
- case 1:
- timer->fraction = 0;
- break;
-
- case MAD_TIMER_RESOLUTION:
- timer->fraction = numer;
- break;
-
- case 1000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
- break;
-
- case 8000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
- break;
-
- case 11025:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
- break;
-
- case 12000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
- break;
-
- case 16000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
- break;
-
- case 22050:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
- break;
-
- case 24000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
- break;
-
- case 32000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
- break;
-
- case 44100:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
- break;
-
- case 48000:
- timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
- break;
-
- default:
- timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
- break;
- }
+ case MAD_TIMER_RESOLUTION:
+ timer->fraction = numer;
+ break;
+
+ case 1000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
+ break;
+
+ case 8000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
+ break;
+
+ case 11025:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
+ break;
+
+ case 12000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
+ break;
+
+ case 16000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
+ break;
+
+ case 22050:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
+ break;
+
+ case 24000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
+ break;
+
+ case 32000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
+ break;
+
+ case 44100:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
+ break;
+
+ case 48000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
+ break;
- if(timer->fraction >= MAD_TIMER_RESOLUTION)
- reduce_timer(timer);
+ default:
+ timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
+ break;
+ }
+
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
}
/*
@@ -232,11 +228,11 @@ void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
*/
void mad_timer_add(mad_timer_t *timer, mad_timer_t incr)
{
- timer->seconds += incr.seconds;
- timer->fraction += incr.fraction;
+ timer->seconds += incr.seconds;
+ timer->fraction += incr.fraction;
- if(timer->fraction >= MAD_TIMER_RESOLUTION)
- reduce_timer(timer);
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
}
/*
@@ -245,27 +241,25 @@ void mad_timer_add(mad_timer_t *timer, mad_timer_t incr)
*/
void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
{
- mad_timer_t addend;
- unsigned long factor;
+ mad_timer_t addend;
+ unsigned long factor;
- factor = scalar;
- if(scalar < 0)
- {
- factor = -scalar;
- mad_timer_negate(timer);
- }
+ factor = scalar;
+ if (scalar < 0) {
+ factor = -scalar;
+ mad_timer_negate(timer);
+ }
- addend = *timer;
- *timer = mad_timer_zero;
+ addend = *timer;
+ *timer = mad_timer_zero;
- while(factor)
- {
- if(factor & 1)
- mad_timer_add(timer, addend);
+ while (factor) {
+ if (factor & 1)
+ mad_timer_add(timer, addend);
- mad_timer_add(&addend, addend);
- factor >>= 1;
- }
+ mad_timer_add(&addend, addend);
+ factor >>= 1;
+ }
}
/*
@@ -274,53 +268,52 @@ void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
*/
signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
{
- switch(units)
- {
- case MAD_UNITS_HOURS:
- return timer.seconds / 60 / 60;
-
- case MAD_UNITS_MINUTES:
- return timer.seconds / 60;
-
- case MAD_UNITS_SECONDS:
- return timer.seconds;
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
- return timer.seconds * (signed long) units +
- (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION,
- units);
-
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- return (mad_timer_count(timer, -units) + 1) * 1000 / 1001;
- }
-
- /* unsupported units */
- return 0;
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ return timer.seconds / 60 / 60;
+
+ case MAD_UNITS_MINUTES:
+ return timer.seconds / 60;
+
+ case MAD_UNITS_SECONDS:
+ return timer.seconds;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ return timer.seconds * (signed long) units +
+ (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION,
+ units);
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ return (mad_timer_count(timer, -units) + 1) * 1000 / 1001;
+ }
+
+ /* unsupported units */
+ return 0;
}
/*
@@ -329,20 +322,19 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
*/
unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
{
- timer = mad_timer_abs(timer);
+ timer = mad_timer_abs(timer);
- switch(denom)
- {
- case 0:
- return timer.fraction ?
- MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
+ switch (denom) {
+ case 0:
+ return timer.fraction ?
+ MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
- case MAD_TIMER_RESOLUTION:
- return timer.fraction;
+ case MAD_TIMER_RESOLUTION:
+ return timer.fraction;
- default:
- return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
- }
+ default:
+ return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
+ }
}
/*
@@ -350,146 +342,143 @@ unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
* DESCRIPTION: write a string representation of a timer using a template
*/
void mad_timer_string(mad_timer_t timer,
- char *dest, char const *format, enum mad_units units,
- enum mad_units fracunits, unsigned long subparts)
+ char *dest, char const *format, enum mad_units units,
+ enum mad_units fracunits, unsigned long subparts)
{
- unsigned long hours, minutes, seconds, sub;
- unsigned int frac;
+ unsigned long hours, minutes, seconds, sub;
+ unsigned int frac;
- timer = mad_timer_abs(timer);
+ timer = mad_timer_abs(timer);
- seconds = timer.seconds;
- frac = sub = 0;
+ seconds = timer.seconds;
+ frac = sub = 0;
- switch(fracunits)
- {
- case MAD_UNITS_HOURS:
- case MAD_UNITS_MINUTES:
- case MAD_UNITS_SECONDS:
- break;
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
+ switch (fracunits) {
+ case MAD_UNITS_HOURS:
+ case MAD_UNITS_MINUTES:
+ case MAD_UNITS_SECONDS:
+ break;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
{
- unsigned long denom;
+ unsigned long denom;
- denom = MAD_TIMER_RESOLUTION / fracunits;
+ denom = MAD_TIMER_RESOLUTION / fracunits;
- frac = timer.fraction / denom;
- sub = scale_rational(timer.fraction % denom, denom, subparts);
+ frac = timer.fraction / denom;
+ sub = scale_rational(timer.fraction % denom, denom, subparts);
}
break;
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- /* drop-frame encoding */
- /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ /* drop-frame encoding */
+ /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */
{
- unsigned long frame, cycle, d, m;
+ unsigned long frame, cycle, d, m;
- frame = mad_timer_count(timer, fracunits);
+ frame = mad_timer_count(timer, fracunits);
- cycle = -fracunits * 60 * 10 - (10 - 1) * 2;
+ cycle = -fracunits * 60 * 10 - (10 - 1) * 2;
- d = frame / cycle;
- m = frame % cycle;
- frame += (10 - 1) * 2 * d;
- if(m > 2)
- frame += 2 * ((m - 2) / (cycle / 10));
+ d = frame / cycle;
+ m = frame % cycle;
+ frame += (10 - 1) * 2 * d;
+ if (m > 2)
+ frame += 2 * ((m - 2) / (cycle / 10));
- frac = frame % -fracunits;
- seconds = frame / -fracunits;
+ frac = frame % -fracunits;
+ seconds = frame / -fracunits;
}
break;
- }
+ }
+
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ minutes = seconds / 60;
+ hours = minutes / 60;
+
+ sprintf(dest, format,
+ hours,
+ (unsigned int) (minutes % 60),
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
- switch(units)
- {
- case MAD_UNITS_HOURS:
- minutes = seconds / 60;
- hours = minutes / 60;
-
- sprintf(dest, format,
- hours,
- (unsigned int)(minutes % 60),
- (unsigned int)(seconds % 60),
- frac, sub);
- break;
-
- case MAD_UNITS_MINUTES:
- minutes = seconds / 60;
-
- sprintf(dest, format,
- minutes,
- (unsigned int)(seconds % 60),
- frac, sub);
- break;
-
- case MAD_UNITS_SECONDS:
- sprintf(dest, format,
- seconds,
- frac, sub);
- break;
-
- case MAD_UNITS_23_976_FPS:
- case MAD_UNITS_24_975_FPS:
- case MAD_UNITS_29_97_FPS:
- case MAD_UNITS_47_952_FPS:
- case MAD_UNITS_49_95_FPS:
- case MAD_UNITS_59_94_FPS:
- if(fracunits < 0)
- {
- /* not yet implemented */
- sub = 0;
- }
-
- /* fall through */
-
- case MAD_UNITS_DECISECONDS:
- case MAD_UNITS_CENTISECONDS:
- case MAD_UNITS_MILLISECONDS:
-
- case MAD_UNITS_8000_HZ:
- case MAD_UNITS_11025_HZ:
- case MAD_UNITS_12000_HZ:
- case MAD_UNITS_16000_HZ:
- case MAD_UNITS_22050_HZ:
- case MAD_UNITS_24000_HZ:
- case MAD_UNITS_32000_HZ:
- case MAD_UNITS_44100_HZ:
- case MAD_UNITS_48000_HZ:
-
- case MAD_UNITS_24_FPS:
- case MAD_UNITS_25_FPS:
- case MAD_UNITS_30_FPS:
- case MAD_UNITS_48_FPS:
- case MAD_UNITS_50_FPS:
- case MAD_UNITS_60_FPS:
- case MAD_UNITS_75_FPS:
- sprintf(dest, format, mad_timer_count(timer, units), sub);
- break;
+ case MAD_UNITS_MINUTES:
+ minutes = seconds / 60;
+
+ sprintf(dest, format,
+ minutes,
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
+
+ case MAD_UNITS_SECONDS:
+ sprintf(dest, format,
+ seconds,
+ frac, sub);
+ break;
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ if (fracunits < 0) {
+ /* not yet implemented */
+ sub = 0;
}
+
+ /* fall through */
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ sprintf(dest, format, mad_timer_count(timer, units), sub);
+ break;
+ }
}
diff --git a/src/filters/transform/MpaDecFilter/libmad/timer.h b/src/filters/transform/MpaDecFilter/libmad/timer.h
index b07ea8a90..9b0cdd19c 100644
--- a/src/filters/transform/MpaDecFilter/libmad/timer.h
+++ b/src/filters/transform/MpaDecFilter/libmad/timer.h
@@ -21,63 +21,61 @@
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
-typedef struct
-{
- signed long seconds; /* whole seconds */
- unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
} mad_timer_t;
extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
-enum mad_units
-{
- MAD_UNITS_HOURS = -2,
- MAD_UNITS_MINUTES = -1,
- MAD_UNITS_SECONDS = 0,
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
- /* metric units */
+ /* metric units */
- MAD_UNITS_DECISECONDS = 10,
- MAD_UNITS_CENTISECONDS = 100,
- MAD_UNITS_MILLISECONDS = 1000,
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
- /* audio sample units */
+ /* audio sample units */
- MAD_UNITS_8000_HZ = 8000,
- MAD_UNITS_11025_HZ = 11025,
- MAD_UNITS_12000_HZ = 12000,
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
- MAD_UNITS_16000_HZ = 16000,
- MAD_UNITS_22050_HZ = 22050,
- MAD_UNITS_24000_HZ = 24000,
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
- MAD_UNITS_32000_HZ = 32000,
- MAD_UNITS_44100_HZ = 44100,
- MAD_UNITS_48000_HZ = 48000,
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
- /* video frame/field units */
+ /* video frame/field units */
- MAD_UNITS_24_FPS = 24,
- MAD_UNITS_25_FPS = 25,
- MAD_UNITS_30_FPS = 30,
- MAD_UNITS_48_FPS = 48,
- MAD_UNITS_50_FPS = 50,
- MAD_UNITS_60_FPS = 60,
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
- /* CD audio frames */
+ /* CD audio frames */
- MAD_UNITS_75_FPS = 75,
+ MAD_UNITS_75_FPS = 75,
- /* video drop-frame units */
+ /* video drop-frame units */
- MAD_UNITS_23_976_FPS = -24,
- MAD_UNITS_24_975_FPS = -25,
- MAD_UNITS_29_97_FPS = -30,
- MAD_UNITS_47_952_FPS = -48,
- MAD_UNITS_49_95_FPS = -50,
- MAD_UNITS_59_94_FPS = -60
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
@@ -96,6 +94,6 @@ void mad_timer_multiply(mad_timer_t *, signed long);
signed long mad_timer_count(mad_timer_t, enum mad_units);
unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
void mad_timer_string(mad_timer_t, char *, char const *,
- enum mad_units, enum mad_units, unsigned long);
+ enum mad_units, enum mad_units, unsigned long);
# endif
diff --git a/src/filters/transform/MpaDecFilter/libmad/version.c b/src/filters/transform/MpaDecFilter/libmad/version.c
index eb44c4e62..b421d8753 100644
--- a/src/filters/transform/MpaDecFilter/libmad/version.c
+++ b/src/filters/transform/MpaDecFilter/libmad/version.c
@@ -31,60 +31,60 @@ char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">";
char const mad_build[] = ""
# if defined(DEBUG)
- "DEBUG "
+ "DEBUG "
# elif defined(NDEBUG)
- "NDEBUG "
+ "NDEBUG "
# endif
# if defined(EXPERIMENTAL)
- "EXPERIMENTAL "
+ "EXPERIMENTAL "
# endif
# if defined(FPM_64BIT)
- "FPM_64BIT "
+ "FPM_64BIT "
# elif defined(FPM_INTEL)
- "FPM_INTEL "
+ "FPM_INTEL "
# elif defined(FPM_ARM)
- "FPM_ARM "
+ "FPM_ARM "
# elif defined(FPM_MIPS)
- "FPM_MIPS "
+ "FPM_MIPS "
# elif defined(FPM_SPARC)
- "FPM_SPARC "
+ "FPM_SPARC "
# elif defined(FPM_PPC)
- "FPM_PPC "
+ "FPM_PPC "
# elif defined(FPM_DEFAULT)
- "FPM_DEFAULT "
+ "FPM_DEFAULT "
# endif
# if defined(ASO_IMDCT)
- "ASO_IMDCT "
+ "ASO_IMDCT "
# endif
# if defined(ASO_INTERLEAVE1)
- "ASO_INTERLEAVE1 "
+ "ASO_INTERLEAVE1 "
# endif
# if defined(ASO_INTERLEAVE2)
- "ASO_INTERLEAVE2 "
+ "ASO_INTERLEAVE2 "
# endif
# if defined(ASO_ZEROCHECK)
- "ASO_ZEROCHECK "
+ "ASO_ZEROCHECK "
# endif
# if defined(OPT_SPEED)
- "OPT_SPEED "
+ "OPT_SPEED "
# elif defined(OPT_ACCURACY)
- "OPT_ACCURACY "
+ "OPT_ACCURACY "
# endif
# if defined(OPT_SSO)
- "OPT_SSO "
+ "OPT_SSO "
# endif
# if defined(OPT_DCTO) /* never defined here */
- "OPT_DCTO "
+ "OPT_DCTO "
# endif
# if defined(OPT_STRICT)
- "OPT_STRICT "
+ "OPT_STRICT "
# endif
- ;
+;