annotate libfaad2/codebook/hcb.h @ 25440:ae7399c268fe

Remove internal unrarlib copy, the new unrarexec code is a strict superset.
author diego
date Thu, 20 Dec 2007 10:10:26 +0000
parents 1d5a49e6d9db
children e83eef58b30a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
1 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
4 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
8 ** (at your option) any later version.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
9 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
13 ** GNU General Public License for more details.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
14 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
18 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
20 ** forbidden.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
21 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
24 **
14726
1d5a49e6d9db Remove modification notice from files that have not been locally modified.
diego
parents: 12625
diff changeset
25 ** $Id: hcb.h,v 1.6 2003/09/09 18:12:01 menno Exp $
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
26 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
27
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 #ifndef __HCB_H__
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29 #define __HCB_H__
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #ifdef __cplusplus
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32 extern "C" {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36 * Optimal huffman decoding for AAC taken from:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 * AES paper 5436
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41 * 2 methods are used for huffman decoding:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
42 * - binary search
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
43 * - 2-step table lookup
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
45 * The choice of the "optimal" method is based on the fact that if the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 * memory size for the Two-step is exorbitantly high then the decision
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47 * is Binary search for that codebook. However, for marginally more memory
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
48 * size, if Twostep outperforms even the best case of Binary then the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 * decision is Two-step for that codebook.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51 * The following methods are used for the different tables.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 * codebook "optimal" method
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 * HCB_1 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 * HCB_2 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55 * HCB_3 Binary
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 * HCB_4 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 * HCB_5 Binary
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58 * HCB_6 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59 * HCB_7 Binary
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 * HCB_8 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 * HCB_9 Binary
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 * HCB_10 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 * HCB_11 2-Step
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 * HCB_SF Binary
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
67
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
69 #define ZERO_HCB 0
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
70 #define FIRST_PAIR_HCB 5
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
71 #define ESC_HCB 11
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 #define QUAD_LEN 4
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73 #define PAIR_LEN 2
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
74 #define NOISE_HCB 13
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 #define INTENSITY_HCB2 14
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 #define INTENSITY_HCB 15
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 /* 1st step table */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79 typedef struct
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 uint8_t offset;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 uint8_t extra_bits;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 } hcb;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 /* 2nd step table with quadruple data */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 typedef struct
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 uint8_t bits;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 int8_t x;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
90 int8_t y;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 } hcb_2_pair;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 typedef struct
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 uint8_t bits;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 int8_t x;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 int8_t y;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 int8_t v;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 int8_t w;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 } hcb_2_quad;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 /* binary search table */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 typedef struct
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 uint8_t is_leaf;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106 int8_t data[4];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
107 } hcb_bin_quad;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
108
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
109 typedef struct
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
110 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
111 uint8_t is_leaf;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 int8_t data[2];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 } hcb_bin_pair;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 hcb *hcb_table[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 hcb_2_quad *hcb_2_quad_table[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 hcb_2_pair *hcb_2_pair_table[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118 hcb_bin_pair *hcb_bin_table[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 uint8_t hcbN[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 uint8_t unsigned_cb[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 int hcb_2_quad_table_size[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122 int hcb_2_pair_table_size[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 int hcb_bin_table_size[];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125 #include "codebook/hcb_1.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126 #include "codebook/hcb_2.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 #include "codebook/hcb_3.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 #include "codebook/hcb_4.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 #include "codebook/hcb_5.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 #include "codebook/hcb_6.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 #include "codebook/hcb_7.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 #include "codebook/hcb_8.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 #include "codebook/hcb_9.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 #include "codebook/hcb_10.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 #include "codebook/hcb_11.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 #include "codebook/hcb_sf.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 #ifdef __cplusplus
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
141 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 #endif