Mercurial > libavcodec.hg
annotate sbr.h @ 11633:d47bd24cb380 libavcodec
H.264: move avctx->{profile,level} init before AVCodecContext.get_format().
author | gb |
---|---|
date | Thu, 15 Apr 2010 08:30:48 +0000 |
parents | 806dc446061d |
children | 7dd2a45249a9 |
rev | line source |
---|---|
11401 | 1 /* |
2 * Spectral Band Replication definitions and structures | |
3 * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) | |
4 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> | |
5 * | |
6 * This file is part of FFmpeg. | |
7 * | |
8 * FFmpeg is free software; you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public | |
10 * License as published by the Free Software Foundation; either | |
11 * version 2.1 of the License, or (at your option) any later version. | |
12 * | |
13 * FFmpeg is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with FFmpeg; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 */ | |
22 | |
23 /** | |
24 * @file libavcodec/sbr.h | |
25 * Spectral Band Replication definitions and structures | |
26 * @author Robert Swain ( rob opendot cl ) | |
27 */ | |
28 | |
29 #ifndef AVCODEC_SBR_H | |
30 #define AVCODEC_SBR_H | |
31 | |
32 #include <stdint.h> | |
33 #include "fft.h" | |
34 | |
35 /** | |
36 * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header. | |
37 */ | |
38 typedef struct { | |
39 uint8_t bs_start_freq; | |
40 uint8_t bs_stop_freq; | |
41 uint8_t bs_xover_band; | |
42 | |
43 /** | |
44 * @defgroup bs_header_extra_1 Variables associated with bs_header_extra_1 | |
45 * @{ | |
46 */ | |
47 uint8_t bs_freq_scale; | |
48 uint8_t bs_alter_scale; | |
49 uint8_t bs_noise_bands; | |
50 /** @} */ | |
51 } SpectrumParameters; | |
52 | |
53 #define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2) | |
54 | |
55 /** | |
56 * Spectral Band Replication per channel data | |
57 */ | |
58 typedef struct { | |
59 /** | |
60 * @defgroup bitstream Main bitstream data variables | |
61 * @{ | |
62 */ | |
63 unsigned bs_frame_class; | |
64 unsigned bs_add_harmonic_flag; | |
11446
806dc446061d
aacsbr: Make the previous value of bs_num_env local to read_sbr_data().
alexc
parents:
11437
diff
changeset
|
65 unsigned bs_num_env; |
11401 | 66 uint8_t bs_freq_res[7]; |
67 unsigned bs_num_noise; | |
68 uint8_t bs_df_env[5]; | |
69 uint8_t bs_df_noise[2]; | |
70 uint8_t bs_invf_mode[2][5]; | |
71 uint8_t bs_add_harmonic[48]; | |
72 unsigned bs_amp_res; | |
73 /** @} */ | |
74 | |
75 /** | |
76 * @defgroup state State variables | |
77 * @{ | |
78 */ | |
79 DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE]; | |
80 DECLARE_ALIGNED(16, float, analysis_filterbank_samples) [1312]; | |
81 int synthesis_filterbank_samples_offset; | |
82 ///l_APrev and l_A | |
83 int e_a[2]; | |
84 ///Chirp factors | |
85 float bw_array[5]; | |
86 ///QMF values of the original signal | |
87 float W[2][32][32][2]; | |
88 ///QMF output of the HF adjustor | |
89 float Y[2][38][64][2]; | |
90 float g_temp[42][48]; | |
91 float q_temp[42][48]; | |
92 uint8_t s_indexmapped[8][48]; | |
93 ///Envelope scalefactors | |
94 float env_facs[6][48]; | |
95 ///Noise scalefactors | |
96 float noise_facs[3][5]; | |
97 ///Envelope time borders | |
98 uint8_t t_env[8]; | |
99 ///Envelope time border of the last envelope of the previous frame | |
100 uint8_t t_env_num_env_old; | |
101 ///Noise time borders | |
102 uint8_t t_q[3]; | |
103 unsigned f_indexnoise; | |
104 unsigned f_indexsine; | |
105 /** @} */ | |
106 } SBRData; | |
107 | |
108 /** | |
109 * Spectral Band Replication | |
110 */ | |
111 typedef struct { | |
112 int sample_rate; | |
113 int start; | |
114 int reset; | |
115 SpectrumParameters spectrum_params; | |
116 int bs_amp_res_header; | |
117 /** | |
118 * @defgroup bs_header_extra_2 variables associated with bs_header_extra_2 | |
119 * @{ | |
120 */ | |
121 unsigned bs_limiter_bands; | |
122 unsigned bs_limiter_gains; | |
123 unsigned bs_interpol_freq; | |
124 unsigned bs_smoothing_mode; | |
125 /** @} */ | |
126 unsigned bs_coupling; | |
127 unsigned k[5]; ///< k0, k1, k2 | |
128 ///kx', and kx respectively, kx is the first QMF subband where SBR is used. | |
129 ///kx' is its value from the previous frame | |
130 unsigned kx[2]; | |
131 ///M' and M respectively, M is the number of QMF subbands that use SBR. | |
132 unsigned m[2]; | |
133 ///The number of frequency bands in f_master | |
134 unsigned n_master; | |
135 SBRData data[2]; | |
136 ///N_Low and N_High respectively, the number of frequency bands for low and high resolution | |
137 unsigned n[2]; | |
138 ///Number of noise floor bands | |
139 unsigned n_q; | |
140 ///Number of limiter bands | |
141 unsigned n_lim; | |
142 ///The master QMF frequency grouping | |
143 uint16_t f_master[49]; | |
144 ///Frequency borders for low resolution SBR | |
145 uint16_t f_tablelow[25]; | |
146 ///Frequency borders for high resolution SBR | |
147 uint16_t f_tablehigh[49]; | |
148 ///Frequency borders for noise floors | |
149 uint16_t f_tablenoise[6]; | |
150 ///Frequency borders for the limiter | |
151 uint16_t f_tablelim[29]; | |
152 unsigned num_patches; | |
153 uint8_t patch_num_subbands[6]; | |
154 uint8_t patch_start_subband[6]; | |
155 ///QMF low frequency input to the HF generator | |
156 float X_low[32][40][2]; | |
157 ///QMF output of the HF generator | |
158 float X_high[64][40][2]; | |
159 ///QMF values of the reconstructed signal | |
160 DECLARE_ALIGNED(16, float, X)[2][32][64]; | |
161 ///Zeroth coefficient used to filter the subband signals | |
162 float alpha0[64][2]; | |
163 ///First coefficient used to filter the subband signals | |
164 float alpha1[64][2]; | |
165 ///Dequantized envelope scalefactors, remapped | |
166 float e_origmapped[7][48]; | |
167 ///Dequantized noise scalefactors, remapped | |
168 float q_mapped[7][48]; | |
169 ///Sinusoidal presence, remapped | |
170 uint8_t s_mapped[7][48]; | |
171 ///Estimated envelope | |
172 float e_curr[7][48]; | |
173 ///Amplitude adjusted noise scalefactors | |
174 float q_m[7][48]; | |
175 ///Sinusoidal levels | |
176 float s_m[7][48]; | |
177 float gain[7][48]; | |
178 DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64]; | |
179 RDFTContext rdft; | |
180 FFTContext mdct; | |
181 } SpectralBandReplication; | |
182 | |
183 #endif /* AVCODEC_SBR_H */ |