www.pudn.com > iMagic_2006_0428_v098r23.rar > AACEncoder.h
#ifndef _AACENCODER_H
#define _AACENCODER_H
#include "constant.h"
#include "aacenccommon.h"
#include "ChannelInfo.h"
// Basic Type Define
//typedef float FLOAT;
//typedef int BOOL;
//typedef unsigned short WORD;
//typedef unsigned long DWORD;
//typedef int bool;
typedef enum {
BINSEARCH_NONE,
BINSEARCH_UP,
BINSEARCH_DOWN
} DIRECTION;
//////////////////////////////////////////////////////////////////////////
// Structure Define
//////////////////////////////////////////////////////////////////////////
typedef struct
{
unsigned short wFormatTag; // format type
unsigned short nChannels; // number of channels (i.e. mono, stereo, etc.)
unsigned long nSamplesPerSec; // sample rate
unsigned long nAvgBytesPerSec; // for buffer estimation
unsigned short nBlockAlign; // block size of data
unsigned short wBitsPerSample;
}WAVFORMAT;
typedef struct
{
WAVFORMAT wavformat;
unsigned long data_sample;
unsigned long data_byte;
unsigned long totalbyte;
} WavInfo;
typedef struct
{
int i_pe[MAX_SCFAC_BANDS];
int i_en[MAX_SCFAC_BANDS];
int i_thr[MAX_SCFAC_BANDS];
int min_freq_clz[MAX_SCFAC_BANDS];
} MaskInfo;
typedef struct
{
int sampling_rate;
int num_band_long;
int width_long[NSFB_LONG];
int sum_width_long[NSFB_LONG];
} BandInfo;
typedef struct
{
// input parameter
int bitrate;
int vbr_quality;
int allowMidside;
int lowpassfreq;
int lowpasswidth;
int container;
//char* InFileName;
//char* OutFileName;
// FILE* pInFile;
unsigned long* pInFile;
// FILE* pOutFile;
unsigned long* pOutFile;
/*int* host_pcmL_addr;
int* host_pcmR_addr;
int* overlap_pcmL_addr;
int* overlap_pcmR_addr;*/
//int* mdct_xr_ptr;
//int* mdct_xi_ptr;
// wav info
long num_samples;
int sample_rate;
int sample_rate_idx;
int in_channels;
int out_channels;
// low pass starting cut line
int xlowpass;
// frame info
int frameNum;
int framePE;
// configuration (not sure needs or not)
int mpegVersion;
int aacObjectType;
int max_output_bits;
// Filter Bank
int *filter_buf1;
int *filter_buf2;
// M/S
int ms_used[MAX_SCFAC_BANDS];
int is_present;
int common_window;
// bit reservoir
int resv_history[RESV_HISTORY_NUM];
int pe_history[RESV_HISTORY_NUM];
int resv_max;
int resv_size;
int resv_index;
int resv_sum;
int pe_sum;
int pe_avg;
int bit_diff;
int mean_bits;
int inv_mean_bits;
int inv_sample_rate;
int i_rate_control;
int noise_band;
int valid_bits[MAX_CHANNELS];
// quantize buffer
int i_xr_sqrt_sum[MAX_SCFAC_BANDS];
int i_xmin[MAX_SCFAC_BANDS];
int *i_xr_pow34;
//int ix_abs[FRAME_LEN];
int amplify_band;
// bitstream
//unsigned char bsbuff[2*768]; // (6144/8)*2
unsigned char *bsbuff;
unsigned char* pbsbuff;
int bs_byte_idx;
int bs_cache_left;
unsigned int bs_cache;
int max_quant_sfb;
// ATH
//float ATH[MAX_SCFAC_BANDS];
// scale factor
int i_fscale[MAX_SCFAC_BANDS];
//int i_fupper[MAX_SCFAC_BANDS];
//int iupper[MAX_SCFAC_BANDS];
//int iscale[MAX_SCFAC_BANDS];
int shift_bw[NSFB_LONG];
///////////////////////////////
// structure define
///////////////////////////////
BandInfo bandinfo;
WavInfo wavinfo;
//////////////////////////////////////////////////////////////////////////
// Testing and Analyzing Parameters
//////////////////////////////////////////////////////////////////////////
//#ifdef _DUMP_FIND_MAX
// float f_max;
// int i_max;
//#endif
int ms_count;
int tmp_count;
} AAC_Config;
//Tony: modify
extern int *tmpr;
//extern int *tmpr2;
extern AAC_Config *aac_config;
extern ChannelInfo *channelinfo;
extern int ch_now;
//extern int g_buf1[FRAME_LEN];
extern int g_buf2[FRAME_LEN];
extern int *g_buf1;
//extern int *g_buf2;
//extern int g_buf3[FRAME_LEN];
//extern int g_buf4[FRAME_LEN];
extern int *g_buf3;
extern int *g_buf4;
//extern int g_buf5[FRAME_LEN];
//extern int g_buf6[FRAME_LEN];
extern int *g_buf5;
extern int *g_buf6;
extern int g_tmp[FRAME_LEN];
extern short *i_sin_window;
extern short *i_cos18_tab;
extern short *i_sin18_tab;
extern unsigned short *cfftf_table;
extern short c_i_cos18_tab[512];
extern short c_i_sin18_tab[512];
extern unsigned short c_cfftf_table[1024];
extern int* host_pcmL_addr;
extern int* host_pcmR_addr;
extern int* overlap_pcmL_addr;
extern int* overlap_pcmR_addr;
extern unsigned short *tab_huffman_book3;
extern short *tab_huffman_book4;
extern short *tab_huffman_book7;
extern short *tab_huffman_book8;
extern short *tab_huffman_book9;
extern short *tab_huffman_book10;
extern short *tab_huffman_book11;
extern int *i_POW2_X16_table;
extern int *i_INVPOW2_X16_table;
extern short *amplify_table;
extern int c_i_POW2_X16_table[16];
extern int c_i_INVPOW2_X16_table[16];
extern short c_amplify_table[MAX_SCFAC_BANDS];
#endif