00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef AVCODEC_SBR_H
00030 #define AVCODEC_SBR_H
00031
00032 #include <stdint.h>
00033 #include "fft.h"
00034 #include "aacps.h"
00035 #include "sbrdsp.h"
00036
00040 typedef struct {
00041 uint8_t bs_start_freq;
00042 uint8_t bs_stop_freq;
00043 uint8_t bs_xover_band;
00044
00049 uint8_t bs_freq_scale;
00050 uint8_t bs_alter_scale;
00051 uint8_t bs_noise_bands;
00053 } SpectrumParameters;
00054
00055 #define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2)
00056
00060 typedef struct {
00065 unsigned bs_frame_class;
00066 unsigned bs_add_harmonic_flag;
00067 unsigned bs_num_env;
00068 uint8_t bs_freq_res[7];
00069 unsigned bs_num_noise;
00070 uint8_t bs_df_env[5];
00071 uint8_t bs_df_noise[2];
00072 uint8_t bs_invf_mode[2][5];
00073 uint8_t bs_add_harmonic[48];
00074 unsigned bs_amp_res;
00081 DECLARE_ALIGNED(32, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
00082 DECLARE_ALIGNED(32, float, analysis_filterbank_samples) [1312];
00083 int synthesis_filterbank_samples_offset;
00085 int e_a[2];
00087 float bw_array[5];
00089 float W[2][32][32][2];
00091 int Ypos;
00092 DECLARE_ALIGNED(16, float, Y)[2][38][64][2];
00093 DECLARE_ALIGNED(16, float, g_temp)[42][48];
00094 float q_temp[42][48];
00095 uint8_t s_indexmapped[8][48];
00097 float env_facs[6][48];
00099 float noise_facs[3][5];
00101 uint8_t t_env[8];
00103 uint8_t t_env_num_env_old;
00105 uint8_t t_q[3];
00106 unsigned f_indexnoise;
00107 unsigned f_indexsine;
00109 } SBRData;
00110
00114 typedef struct {
00115 int sample_rate;
00116 int start;
00117 int reset;
00118 SpectrumParameters spectrum_params;
00119 int bs_amp_res_header;
00124 unsigned bs_limiter_bands;
00125 unsigned bs_limiter_gains;
00126 unsigned bs_interpol_freq;
00127 unsigned bs_smoothing_mode;
00129 unsigned bs_coupling;
00130 unsigned k[5];
00131
00132
00133 unsigned kx[2];
00135 unsigned m[2];
00136 unsigned kx_and_m_pushed;
00138 unsigned n_master;
00139 SBRData data[2];
00140 PSContext ps;
00142 unsigned n[2];
00144 unsigned n_q;
00146 unsigned n_lim;
00148 uint16_t f_master[49];
00150 uint16_t f_tablelow[25];
00152 uint16_t f_tablehigh[49];
00154 uint16_t f_tablenoise[6];
00156 uint16_t f_tablelim[29];
00157 unsigned num_patches;
00158 uint8_t patch_num_subbands[6];
00159 uint8_t patch_start_subband[6];
00161 DECLARE_ALIGNED(16, float, X_low)[32][40][2];
00163 DECLARE_ALIGNED(16, float, X_high)[64][40][2];
00165 DECLARE_ALIGNED(16, float, X)[2][2][38][64];
00167 DECLARE_ALIGNED(16, float, alpha0)[64][2];
00169 DECLARE_ALIGNED(16, float, alpha1)[64][2];
00171 float e_origmapped[7][48];
00173 float q_mapped[7][48];
00175 uint8_t s_mapped[7][48];
00177 float e_curr[7][48];
00179 float q_m[7][48];
00181 float s_m[7][48];
00182 float gain[7][48];
00183 DECLARE_ALIGNED(32, float, qmf_filter_scratch)[5][64];
00184 FFTContext mdct_ana;
00185 FFTContext mdct;
00186 SBRDSPContext dsp;
00187 } SpectralBandReplication;
00188
00189 #endif