]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/ext/faad/codebook/hcb.h
wwww
[16.git] / src / lib / doslib / ext / faad / codebook / hcb.h
1 /*
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2005 M. Bakker, Nero 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.
14 ** 
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.
18 **
19 ** Any non-GPL usage of this software or parts of this software is strictly
20 ** forbidden.
21 **
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
24 **
25 ** Commercial non-GPL licensing of this software is possible.
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
27 **
28 ** $Id: hcb.h,v 1.8 2007/11/01 12:34:10 menno Exp $
29 **/
30
31 #ifndef __HCB_H__
32 #define __HCB_H__
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39  *  Optimal huffman decoding for AAC taken from:
40  *  "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
41  *  VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
42  *  AES paper 5436
43  *
44  *   2 methods are used for huffman decoding:
45  *   - binary search
46  *   - 2-step table lookup
47  *
48  *   The choice of the "optimal" method is based on the fact that if the
49  *   memory size for the Two-step is exorbitantly high then the decision
50  *   is Binary search for that codebook. However, for marginally more memory
51  *   size, if Twostep outperforms even the best case of Binary then the
52  *   decision is Two-step for that codebook.
53  *
54  *   The following methods are used for the different tables.
55  *   codebook   "optimal" method
56  *    HCB_1      2-Step
57  *    HCB_2      2-Step
58  *    HCB_3      Binary
59  *    HCB_4      2-Step
60  *    HCB_5      Binary
61  *    HCB_6      2-Step
62  *    HCB_7      Binary
63  *    HCB_8      2-Step
64  *    HCB_9      Binary
65  *    HCB_10     2-Step
66  *    HCB_11     2-Step
67  *    HCB_SF     Binary
68  *
69  */
70
71
72 #define ZERO_HCB       0
73 #define FIRST_PAIR_HCB 5
74 #define ESC_HCB        11
75 #define QUAD_LEN       4
76 #define PAIR_LEN       2
77 #define NOISE_HCB      13
78 #define INTENSITY_HCB2 14
79 #define INTENSITY_HCB  15
80
81 /* 1st step table */
82 typedef struct
83 {
84     uint8_t offset;
85     uint8_t extra_bits;
86 } hcb;
87
88 /* 2nd step table with quadruple data */
89 typedef struct
90 {
91     uint8_t bits;
92     int8_t x;
93     int8_t y;
94 } hcb_2_pair;
95
96 typedef struct
97 {
98     uint8_t bits;
99     int8_t x;
100     int8_t y;
101     int8_t v;
102     int8_t w;
103 } hcb_2_quad;
104
105 /* binary search table */
106 typedef struct
107 {
108     uint8_t is_leaf;
109     int8_t data[4];
110 } hcb_bin_quad;
111
112 typedef struct
113 {
114     uint8_t is_leaf;
115     int8_t data[2];
116 } hcb_bin_pair;
117
118 hcb *hcb_table[];
119 hcb_2_quad *hcb_2_quad_table[];
120 hcb_2_pair *hcb_2_pair_table[];
121 hcb_bin_pair *hcb_bin_table[];
122 uint8_t hcbN[];
123 uint8_t unsigned_cb[];
124 int hcb_2_quad_table_size[];
125 int hcb_2_pair_table_size[];
126 int hcb_bin_table_size[];
127
128 #include "codebook/hcb_1.h"
129 #include "codebook/hcb_2.h"
130 #include "codebook/hcb_3.h"
131 #include "codebook/hcb_4.h"
132 #include "codebook/hcb_5.h"
133 #include "codebook/hcb_6.h"
134 #include "codebook/hcb_7.h"
135 #include "codebook/hcb_8.h"
136 #include "codebook/hcb_9.h"
137 #include "codebook/hcb_10.h"
138 #include "codebook/hcb_11.h"
139 #include "codebook/hcb_sf.h"
140
141
142 #ifdef __cplusplus
143 }
144 #endif
145 #endif