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>
6 * This file is part of FFmpeg.
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.
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.
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
25 * Spectral Band Replication definitions and structures
26 * @author Robert Swain ( rob opendot cl )
37 * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
40 uint8_t bs_start_freq;
42 uint8_t bs_xover_band;
45 * @name Variables associated with bs_header_extra_1
48 uint8_t bs_freq_scale;
49 uint8_t bs_alter_scale;
50 uint8_t bs_noise_bands;
54 #define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2)
57 * Spectral Band Replication per channel data
61 * @name Main bitstream data variables
64 unsigned bs_frame_class;
65 unsigned bs_add_harmonic_flag;
67 uint8_t bs_freq_res[7];
68 unsigned bs_num_noise;
70 uint8_t bs_df_noise[2];
71 uint8_t bs_invf_mode[2][5];
72 uint8_t bs_add_harmonic[48];
77 * @name State variables
80 DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
81 DECLARE_ALIGNED(16, float, analysis_filterbank_samples) [1312];
82 int synthesis_filterbank_samples_offset;
87 ///QMF values of the original signal
88 float W[2][32][32][2];
89 ///QMF output of the HF adjustor
90 float Y[2][38][64][2];
93 uint8_t s_indexmapped[8][48];
94 ///Envelope scalefactors
95 float env_facs[6][48];
97 float noise_facs[3][5];
98 ///Envelope time borders
100 ///Envelope time border of the last envelope of the previous frame
101 uint8_t t_env_num_env_old;
102 ///Noise time borders
104 unsigned f_indexnoise;
105 unsigned f_indexsine;
110 * Spectral Band Replication
116 SpectrumParameters spectrum_params;
117 int bs_amp_res_header;
119 * @name Variables associated with bs_header_extra_2
122 unsigned bs_limiter_bands;
123 unsigned bs_limiter_gains;
124 unsigned bs_interpol_freq;
125 unsigned bs_smoothing_mode;
127 unsigned bs_coupling;
128 unsigned k[5]; ///< k0, k1, k2
129 ///kx', and kx respectively, kx is the first QMF subband where SBR is used.
130 ///kx' is its value from the previous frame
132 ///M' and M respectively, M is the number of QMF subbands that use SBR.
134 ///The number of frequency bands in f_master
138 ///N_Low and N_High respectively, the number of frequency bands for low and high resolution
140 ///Number of noise floor bands
142 ///Number of limiter bands
144 ///The master QMF frequency grouping
145 uint16_t f_master[49];
146 ///Frequency borders for low resolution SBR
147 uint16_t f_tablelow[25];
148 ///Frequency borders for high resolution SBR
149 uint16_t f_tablehigh[49];
150 ///Frequency borders for noise floors
151 uint16_t f_tablenoise[6];
152 ///Frequency borders for the limiter
153 uint16_t f_tablelim[29];
154 unsigned num_patches;
155 uint8_t patch_num_subbands[6];
156 uint8_t patch_start_subband[6];
157 ///QMF low frequency input to the HF generator
158 float X_low[32][40][2];
159 ///QMF output of the HF generator
160 float X_high[64][40][2];
161 ///QMF values of the reconstructed signal
162 DECLARE_ALIGNED(16, float, X)[2][2][38][64];
163 ///Zeroth coefficient used to filter the subband signals
165 ///First coefficient used to filter the subband signals
167 ///Dequantized envelope scalefactors, remapped
168 float e_origmapped[7][48];
169 ///Dequantized noise scalefactors, remapped
170 float q_mapped[7][48];
171 ///Sinusoidal presence, remapped
172 uint8_t s_mapped[7][48];
173 ///Estimated envelope
175 ///Amplitude adjusted noise scalefactors
180 DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64];
183 } SpectralBandReplication;
185 #endif /* AVCODEC_SBR_H */