2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
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.
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
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"
25 ** Commercial non-GPL licensing of this software is possible.
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
28 ** $Id: ps_dec.h,v 1.13 2009/01/26 22:32:31 menno Exp $
40 #define EXTENSION_ID_PS 2
42 #define MAX_PS_ENVELOPES 5
43 #define NO_ALLPASS_LINKS 3
47 /* bitstream parameters */
55 uint8_t nr_ipdopd_par;
61 uint8_t border_position[MAX_PS_ENVELOPES+1];
63 uint8_t iid_dt[MAX_PS_ENVELOPES];
64 uint8_t icc_dt[MAX_PS_ENVELOPES];
66 uint8_t enable_ipdopd;
68 uint8_t ipd_dt[MAX_PS_ENVELOPES];
69 uint8_t opd_dt[MAX_PS_ENVELOPES];
72 int8_t iid_index_prev[34];
73 int8_t icc_index_prev[34];
74 int8_t ipd_index_prev[17];
75 int8_t opd_index_prev[17];
76 int8_t iid_index[MAX_PS_ENVELOPES][34];
77 int8_t icc_index[MAX_PS_ENVELOPES][34];
78 int8_t ipd_index[MAX_PS_ENVELOPES][17];
79 int8_t opd_index[MAX_PS_ENVELOPES][17];
81 int8_t ipd_index_1[17];
82 int8_t opd_index_1[17];
83 int8_t ipd_index_2[17];
84 int8_t opd_index_2[17];
86 /* ps data was correctly read */
87 uint8_t ps_data_available;
89 /* a header has been read */
92 /* hybrid filterbank parameters */
94 uint8_t use34hybrid_bands;
95 uint8_t numTimeSlotsRate;
99 uint8_t num_hybrid_groups;
100 uint8_t nr_par_bands;
101 uint8_t nr_allpass_bands;
102 uint8_t decay_cutoff;
104 uint8_t *group_border;
105 uint16_t *map_group2bk;
107 /* filter delay handling */
109 uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
110 uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
112 uint8_t delay_buf_index_delay[64];
114 complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
115 complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
116 complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
117 complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
123 real_t P_PeakDecayNrg[34];
125 real_t P_SmoothPeakDecayDiffNrg_prev[34];
127 /* mixing and phase */
128 complex_t h11_prev[50];
129 complex_t h12_prev[50];
130 complex_t h21_prev[50];
131 complex_t h22_prev[50];
133 complex_t ipd_prev[20][2];
134 complex_t opd_prev[20][2];
139 uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
142 ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate);
143 void ps_free(ps_info *ps);
145 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);