• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavcodec/ac3dec.h

Go to the documentation of this file.
00001 /*
00002  * Common code between the AC-3 and E-AC-3 decoders
00003  * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com>
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00050 #ifndef AVCODEC_AC3DEC_H
00051 #define AVCODEC_AC3DEC_H
00052 
00053 #include "libavutil/lfg.h"
00054 #include "ac3.h"
00055 #include "ac3dsp.h"
00056 #include "get_bits.h"
00057 #include "dsputil.h"
00058 #include "fft.h"
00059 #include "fmtconvert.h"
00060 
00061 #define AC3_OUTPUT_LFEON  8
00062 
00063 #define SPX_MAX_BANDS    17
00064 
00066 #define AC3_FRAME_BUFFER_SIZE 32768
00067 
00068 typedef struct {
00069     AVClass        *class;                  
00070     AVCodecContext *avctx;                  
00071     AVFrame frame;                          
00072     GetBitContext gbc;                      
00073 
00076     int frame_type;                         
00077     int substreamid;                        
00078     int frame_size;                         
00079     int bit_rate;                           
00080     int sample_rate;                        
00081     int num_blocks;                         
00082     int bitstream_mode;                     
00083     int channel_mode;                       
00084     int channel_layout;                     
00085     int lfe_on;                             
00086     int channel_map;                        
00087     int center_mix_level;                   
00088     int surround_mix_level;                 
00089     int eac3;                               
00090 
00091 
00093     int snr_offset_strategy;                
00094     int block_switch_syntax;                
00095     int dither_flag_syntax;                 
00096     int bit_allocation_syntax;              
00097     int fast_gain_syntax;                   
00098     int dba_syntax;                         
00099     int skip_syntax;                        
00100 
00101 
00103     int cpl_in_use[AC3_MAX_BLOCKS];         
00104     int cpl_strategy_exists[AC3_MAX_BLOCKS];
00105     int channel_in_cpl[AC3_MAX_CHANNELS];   
00106     int phase_flags_in_use;                 
00107     int phase_flags[AC3_MAX_CPL_BANDS];     
00108     int num_cpl_bands;                      
00109     uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; 
00110     int firstchincpl;                       
00111     int first_cpl_coords[AC3_MAX_CHANNELS]; 
00112     int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; 
00113 
00114 
00117     int spx_in_use;                             
00118     uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; 
00119     int8_t spx_atten_code[AC3_MAX_CHANNELS];    
00120     int spx_src_start_freq;                     
00121     int spx_dst_end_freq;                       
00122     int spx_dst_start_freq;                     
00123 
00124     int num_spx_bands;                          
00125     uint8_t spx_band_sizes[SPX_MAX_BANDS];      
00126     uint8_t first_spx_coords[AC3_MAX_CHANNELS]; 
00127     float spx_noise_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; 
00128     float spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS];
00129 
00130 
00132     int channel_uses_aht[AC3_MAX_CHANNELS];                         
00133     int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][AC3_MAX_BLOCKS];  
00134 
00135 
00137     int fbw_channels;                           
00138     int channels;                               
00139     int lfe_ch;                                 
00140     float downmix_coeffs[AC3_MAX_CHANNELS][2];  
00141     int downmixed;                              
00142     int output_mode;                            
00143     int out_channels;                           
00144 
00145 
00147     float dynamic_range[2];                 
00148     float drc_scale;                        
00149 
00150 
00152     int start_freq[AC3_MAX_CHANNELS];       
00153     int end_freq[AC3_MAX_CHANNELS];         
00154 
00155 
00157     int num_rematrixing_bands;              
00158     int rematrixing_flags[4];               
00159 
00160 
00162     int num_exp_groups[AC3_MAX_CHANNELS];           
00163     int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS];  
00164     int exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS]; 
00165 
00166 
00168     AC3BitAllocParameters bit_alloc_params;         
00169     int first_cpl_leak;                             
00170     int snr_offset[AC3_MAX_CHANNELS];               
00171     int fast_gain[AC3_MAX_CHANNELS];                
00172     uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   
00173     int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   
00174     int16_t band_psd[AC3_MAX_CHANNELS][AC3_CRITICAL_BANDS]; 
00175     int16_t mask[AC3_MAX_CHANNELS][AC3_CRITICAL_BANDS];     
00176     int dba_mode[AC3_MAX_CHANNELS];                 
00177     int dba_nsegs[AC3_MAX_CHANNELS];                
00178     uint8_t dba_offsets[AC3_MAX_CHANNELS][8];       
00179     uint8_t dba_lengths[AC3_MAX_CHANNELS][8];       
00180     uint8_t dba_values[AC3_MAX_CHANNELS][8];        
00181 
00182 
00184     int dither_flag[AC3_MAX_CHANNELS];      
00185     AVLFG dith_state;                       
00186 
00187 
00189     int block_switch[AC3_MAX_CHANNELS];     
00190     FFTContext imdct_512;                   
00191     FFTContext imdct_256;                   
00192 
00193 
00195     DSPContext dsp;                         
00196     AC3DSPContext ac3dsp;
00197     FmtConvertContext fmt_conv;             
00198     float mul_bias;                         
00199 
00200 
00202     DECLARE_ALIGNED(16, int,   fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];       
00203     DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   
00204     DECLARE_ALIGNED(32, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];             
00205     DECLARE_ALIGNED(32, float, window)[AC3_BLOCK_SIZE];                              
00206     DECLARE_ALIGNED(32, float, tmp_output)[AC3_BLOCK_SIZE];                          
00207     DECLARE_ALIGNED(32, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            
00208     DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; 
00209 
00210 } AC3DecodeContext;
00211 
00216 int ff_eac3_parse_header(AC3DecodeContext *s);
00217 
00222 void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
00223 
00224 void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2],
00225                       int out_ch, int in_ch, int len);
00226 
00232 void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
00233 
00234 #endif /* AVCODEC_AC3DEC_H */
Generated on Sun Apr 22 2012 21:53:59 for Libav by doxygen 1.7.1