diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libfaad/ps_dec.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libfaad/ps_dec.h')
-rw-r--r-- | lib/rbcodec/codecs/libfaad/ps_dec.h | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libfaad/ps_dec.h b/lib/rbcodec/codecs/libfaad/ps_dec.h new file mode 100644 index 0000000000..14e4bd54e6 --- /dev/null +++ b/lib/rbcodec/codecs/libfaad/ps_dec.h | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding | ||
3 | ** Copyright (C) 2003-2004 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. | ||
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 | ** Commercial non-GPL licensing of this software is possible. | ||
23 | ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | ||
24 | ** | ||
25 | ** $Id$ | ||
26 | **/ | ||
27 | |||
28 | #ifndef __PS_DEC_H__ | ||
29 | #define __PS_DEC_H__ | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | #include "bits.h" | ||
36 | |||
37 | #define EXTENSION_ID_PS 2 | ||
38 | |||
39 | #define MAX_PS_ENVELOPES 5 | ||
40 | #define NO_ALLPASS_LINKS 3 | ||
41 | |||
42 | #define MAX_NTSRPS 38 /* max number_time_slots * rate + 6 (delay) */ | ||
43 | |||
44 | typedef struct | ||
45 | { | ||
46 | uint8_t frame_len; | ||
47 | uint8_t resolution20[3]; | ||
48 | uint8_t resolution34[5]; | ||
49 | |||
50 | qmf_t work[32+12]; | ||
51 | qmf_t buffer[5][32]; | ||
52 | qmf_t temp[32][12]; | ||
53 | } hyb_info; | ||
54 | |||
55 | typedef struct | ||
56 | { | ||
57 | /* bitstream parameters */ | ||
58 | uint8_t enable_iid; | ||
59 | uint8_t enable_icc; | ||
60 | uint8_t enable_ext; | ||
61 | |||
62 | uint8_t iid_mode; | ||
63 | uint8_t icc_mode; | ||
64 | uint8_t nr_iid_par; | ||
65 | uint8_t nr_ipdopd_par; | ||
66 | uint8_t nr_icc_par; | ||
67 | |||
68 | uint8_t frame_class; | ||
69 | uint8_t num_env; | ||
70 | |||
71 | uint8_t border_position[MAX_PS_ENVELOPES+1]; | ||
72 | |||
73 | uint8_t iid_dt[MAX_PS_ENVELOPES]; | ||
74 | uint8_t icc_dt[MAX_PS_ENVELOPES]; | ||
75 | |||
76 | uint8_t enable_ipdopd; | ||
77 | uint8_t ipd_mode; | ||
78 | uint8_t ipd_dt[MAX_PS_ENVELOPES]; | ||
79 | uint8_t opd_dt[MAX_PS_ENVELOPES]; | ||
80 | |||
81 | /* indices */ | ||
82 | int8_t iid_index_prev[34]; | ||
83 | int8_t icc_index_prev[34]; | ||
84 | int8_t ipd_index_prev[17]; | ||
85 | int8_t opd_index_prev[17]; | ||
86 | int8_t iid_index[MAX_PS_ENVELOPES][34]; | ||
87 | int8_t icc_index[MAX_PS_ENVELOPES][34]; | ||
88 | int8_t ipd_index[MAX_PS_ENVELOPES][17]; | ||
89 | int8_t opd_index[MAX_PS_ENVELOPES][17]; | ||
90 | |||
91 | int8_t ipd_index_1[17]; | ||
92 | int8_t opd_index_1[17]; | ||
93 | int8_t ipd_index_2[17]; | ||
94 | int8_t opd_index_2[17]; | ||
95 | |||
96 | /* ps data was correctly read */ | ||
97 | uint8_t ps_data_available; | ||
98 | |||
99 | /* a header has been read */ | ||
100 | uint8_t header_read; | ||
101 | |||
102 | /* hybrid filterbank parameters */ | ||
103 | hyb_info hyb; | ||
104 | uint8_t use34hybrid_bands; | ||
105 | |||
106 | /**/ | ||
107 | uint8_t num_groups; | ||
108 | uint8_t num_hybrid_groups; | ||
109 | uint8_t nr_par_bands; | ||
110 | uint8_t nr_allpass_bands; | ||
111 | uint8_t decay_cutoff; | ||
112 | |||
113 | uint8_t *group_border; | ||
114 | uint16_t *map_group2bk; | ||
115 | |||
116 | /* filter delay handling */ | ||
117 | uint8_t saved_delay; | ||
118 | uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS]; | ||
119 | uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS]; | ||
120 | uint8_t delay_D[64]; | ||
121 | uint8_t delay_buf_index_delay[64]; | ||
122 | |||
123 | complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */ | ||
124 | complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */ | ||
125 | complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */ | ||
126 | complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */ | ||
127 | |||
128 | /* transients */ | ||
129 | real_t alpha_decay; | ||
130 | real_t alpha_smooth; | ||
131 | |||
132 | real_t P_PeakDecayNrg[34]; | ||
133 | real_t P_prev[34]; | ||
134 | real_t P_SmoothPeakDecayDiffNrg_prev[34]; | ||
135 | |||
136 | /* mixing and phase */ | ||
137 | complex_t h11_prev[50]; | ||
138 | complex_t h12_prev[50]; | ||
139 | complex_t h21_prev[50]; | ||
140 | complex_t h22_prev[50]; | ||
141 | uint8_t phase_hist; | ||
142 | complex_t ipd_prev[20][2]; | ||
143 | complex_t opd_prev[20][2]; | ||
144 | |||
145 | } ps_info; | ||
146 | |||
147 | /* ps_syntax.c */ | ||
148 | uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header); | ||
149 | |||
150 | /* ps_dec.c */ | ||
151 | void ps_init(ps_info *ps); | ||
152 | |||
153 | uint8_t ps_decode(ps_info *ps, | ||
154 | qmf_t X_left[MAX_NTSRPS][64], | ||
155 | qmf_t X_right[MAX_NTSRPS][64]); | ||
156 | |||
157 | |||
158 | #ifdef __cplusplus | ||
159 | } | ||
160 | #endif | ||
161 | #endif | ||
162 | |||