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