Libav
sbr.h
Go to the documentation of this file.
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 Libav.
7  *
8  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
29 #ifndef AVCODEC_SBR_H
30 #define AVCODEC_SBR_H
31 
32 #include <stdint.h>
33 #include "fft.h"
34 #include "aacps.h"
35 #include "sbrdsp.h"
36 
40 typedef struct SpectrumParameters {
44 
54 
55 #define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2)
56 
60 typedef struct SBRData {
65  unsigned bs_frame_class;
67  unsigned bs_num_env;
69  unsigned bs_num_noise;
74  unsigned bs_amp_res;
85  int e_a[2];
87  float bw_array[5];
89  float W[2][32][32][2];
91  int Ypos;
92  DECLARE_ALIGNED(16, float, Y)[2][38][64][2];
93  DECLARE_ALIGNED(16, float, g_temp)[42][48];
94  float q_temp[42][48];
97  float env_facs[6][48];
99  float noise_facs[3][5];
106  unsigned f_indexnoise;
107  unsigned f_indexsine;
109 } SBRData;
110 
114 typedef struct SpectralBandReplication {
116  int start;
117  int reset;
129  unsigned bs_coupling;
130  unsigned k[5];
131  unsigned kx[2];
135  unsigned m[2];
136  unsigned kx_and_m_pushed;
138  unsigned n_master;
142  unsigned n[2];
144  unsigned n_q;
146  unsigned n_lim;
148  uint16_t f_master[49];
150  uint16_t f_tablelow[25];
152  uint16_t f_tablehigh[49];
154  uint16_t f_tablenoise[6];
156  uint16_t f_tablelim[29];
157  unsigned num_patches;
161  DECLARE_ALIGNED(16, float, X_low)[32][40][2];
163  DECLARE_ALIGNED(16, float, X_high)[64][40][2];
165  DECLARE_ALIGNED(16, float, X)[2][2][38][64];
167  DECLARE_ALIGNED(16, float, alpha0)[64][2];
169  DECLARE_ALIGNED(16, float, alpha1)[64][2];
171  float e_origmapped[7][48];
173  float q_mapped[7][48];
177  float e_curr[7][48];
179  float q_m[7][48];
181  float s_m[7][48];
182  float gain[7][48];
188 
189 #endif /* AVCODEC_SBR_H */
uint8_t s_indexmapped[8][48]
Definition: sbr.h:95
unsigned bs_add_harmonic_flag
Definition: sbr.h:66
float alpha1[64][2]
First coefficient used to filter the subband signals.
Definition: sbr.h:169
float e_curr[7][48]
Estimated envelope.
Definition: sbr.h:177
unsigned bs_smoothing_mode
Definition: sbr.h:127
float Y[2][38][64][2]
Definition: sbr.h:92
float X[2][2][38][64]
QMF values of the reconstructed signal.
Definition: sbr.h:165
int e_a[2]
l_APrev and l_A
Definition: sbr.h:85
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:58
unsigned kx[2]
kx', and kx respectively, kx is the first QMF subband where SBR is used.
Definition: sbr.h:133
float q_m[7][48]
Amplitude adjusted noise scalefactors.
Definition: sbr.h:179
float q_mapped[7][48]
Dequantized noise scalefactors, remapped.
Definition: sbr.h:173
unsigned n_lim
Number of limiter bands.
Definition: sbr.h:146
float e_origmapped[7][48]
Dequantized envelope scalefactors, remapped.
Definition: sbr.h:171
FFTContext mdct
Definition: sbr.h:185
uint8_t bs_xover_band
Definition: sbr.h:43
SpectrumParameters spectrum_params
Definition: sbr.h:118
float bw_array[5]
Chirp factors.
Definition: sbr.h:87
float qmf_filter_scratch[5][64]
Definition: sbr.h:183
unsigned kx_and_m_pushed
Definition: sbr.h:136
unsigned n[2]
N_Low and N_High respectively, the number of frequency bands for low and high resolution.
Definition: sbr.h:142
uint8_t
uint16_t f_tablehigh[49]
Frequency borders for high resolution SBR.
Definition: sbr.h:152
float env_facs[6][48]
Envelope scalefactors.
Definition: sbr.h:97
SBRData data[2]
Definition: sbr.h:139
uint8_t bs_df_noise[2]
Definition: sbr.h:71
uint8_t patch_num_subbands[6]
Definition: sbr.h:158
uint16_t f_tablenoise[6]
Frequency borders for noise floors.
Definition: sbr.h:154
float gain[7][48]
Definition: sbr.h:182
uint8_t t_q[3]
Noise time borders.
Definition: sbr.h:105
uint16_t f_tablelow[25]
Frequency borders for low resolution SBR.
Definition: sbr.h:150
Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the pr...
Definition: sbr.h:40
unsigned num_patches
Definition: sbr.h:157
float alpha0[64][2]
Zeroth coefficient used to filter the subband signals.
Definition: sbr.h:167
unsigned n_master
The number of frequency bands in f_master.
Definition: sbr.h:138
float q_temp[42][48]
Definition: sbr.h:94
unsigned bs_interpol_freq
Definition: sbr.h:126
FFTContext mdct_ana
Definition: sbr.h:184
float synthesis_filterbank_samples[SBR_SYNTHESIS_BUF_SIZE]
Definition: sbr.h:81
unsigned f_indexnoise
Definition: sbr.h:106
uint8_t t_env_num_env_old
Envelope time border of the last envelope of the previous frame.
Definition: sbr.h:103
Definition: fft.h:62
unsigned bs_amp_res
Definition: sbr.h:74
uint8_t bs_freq_scale
Definition: sbr.h:49
unsigned bs_limiter_gains
Definition: sbr.h:125
float W[2][32][32][2]
QMF values of the original signal.
Definition: sbr.h:89
uint8_t s_mapped[7][48]
Sinusoidal presence, remapped.
Definition: sbr.h:175
float X_low[32][40][2]
QMF low frequency input to the HF generator.
Definition: sbr.h:161
uint8_t bs_freq_res[7]
Definition: sbr.h:68
#define SBR_SYNTHESIS_BUF_SIZE
Definition: sbr.h:55
float s_m[7][48]
Sinusoidal levels.
Definition: sbr.h:181
float X_high[64][40][2]
QMF output of the HF generator.
Definition: sbr.h:163
unsigned m[2]
M' and M respectively, M is the number of QMF subbands that use SBR.
Definition: sbr.h:135
int synthesis_filterbank_samples_offset
Definition: sbr.h:83
unsigned k[5]
k0, k1, k2
Definition: sbr.h:130
uint8_t bs_noise_bands
Definition: sbr.h:51
uint8_t bs_stop_freq
Definition: sbr.h:42
uint16_t f_master[49]
The master QMF frequency grouping.
Definition: sbr.h:148
uint8_t bs_invf_mode[2][5]
Definition: sbr.h:72
float noise_facs[3][5]
Noise scalefactors.
Definition: sbr.h:99
float analysis_filterbank_samples[1312]
Definition: sbr.h:82
unsigned f_indexsine
Definition: sbr.h:107
uint8_t patch_start_subband[6]
Definition: sbr.h:159
uint8_t t_env[8]
Envelope time borders.
Definition: sbr.h:101
Spectral Band Replication per channel data.
Definition: sbr.h:60
unsigned bs_limiter_bands
Definition: sbr.h:124
int Ypos
QMF output of the HF adjustor.
Definition: sbr.h:91
uint8_t bs_alter_scale
Definition: sbr.h:50
uint16_t f_tablelim[29]
Frequency borders for the limiter.
Definition: sbr.h:156
unsigned bs_frame_class
Definition: sbr.h:65
uint8_t bs_df_env[5]
Definition: sbr.h:70
unsigned bs_num_noise
Definition: sbr.h:69
unsigned n_q
Number of noise floor bands.
Definition: sbr.h:144
SBRDSPContext dsp
Definition: sbr.h:186
float g_temp[42][48]
Definition: sbr.h:93
unsigned bs_coupling
Definition: sbr.h:129
Spectral Band Replication.
Definition: sbr.h:114
unsigned bs_num_env
Definition: sbr.h:67
uint8_t bs_add_harmonic[48]
Definition: sbr.h:73
PSContext ps
Definition: sbr.h:140
uint8_t bs_start_freq
Definition: sbr.h:41