msaud.h
来自「ESS3890+SL原代码(1*16内存)」· C头文件 代码 · 共 595 行 · 第 1/2 页
H
595 行
/* Copyright 1997, ESS Technology, Inc. *//* SCCSID @(#)msaud.h 1.1 01/23/02 *//* Based on DVD code version 1.17 10/13/01 */ #ifndef __MSAUDIO_H_#define __MSAUDIO_H_#include "macros.h"#if 0 /* GMGM */#include "DecTables.h"#endif#define ENABLE_ALL_ENCOPT/* Encoder-only/decoder-only defines are no longer allowed. All audio components must be built with same defines so that encoder and decoder may both be linked into one EXE. *//* The INTEGER_ENCODER #define was, where possible, replaced with BUILD_INTEGER. The remaining INTEGER_ENCODER's have remained as "tombstones" and should be replaced with a run-time decision of which codepath to take. As described above, encoder- and decoder-specific defines are no longer allowed. */#define MAX_SUBFRAMES 16#define PREV 0#define CURR 1#define NEXT 2/* ************************************************************************** *//* Encoding Options *//* ************************************************************************** */#define ENCOPT_BARK 0x0001#define ENCOPT_V5LPC 0x0020#define ENCOPT_SUPERFRAME 0x0002#define ENCOPT_SUBFRAME 0x0004#define ENCOPT_SUBFRAMEDIVMASK 0x0018#define ENCOPT_SUBFRAMEDIVSHR 3#define ENCOPT_TRANSCODE 0x0040#define ENCOPT_TRANSCODEMODE2 0x0080/* ************************************************************************** *//* Player Options *//* ************************************************************************** */#define PLAYOPT_DOWNSAMPLE32TO22 0x0001#define PLAYOPT_HALFTRANSFORM 0x0002#define PLAYOPT_UPSAMPLE 0x0004#define PLAYOPT_PAD2XTRANSFORM 0x0008#if defined(HEAP_DEBUG_TEST) && defined(_DEBUG)void HeapDebugCheck();#define HEAP_DEBUG_CHECK HeapDebugCheck()#else#define HEAP_DEBUG_CHECK#endif/* Forward data type decl */typedef struct _CoefStream CoefStream;typedef struct PerChannelInfoENC PerChannelInfoENC;typedef enum {TT_NONE = 0, TT_SIMPLE} TRANSCODETYPE;typedef enum {STEREO_INVALID = -1, STEREO_LEFTRIGHT = 0, STEREO_SUMDIFF} StereoMode;typedef enum {CODEC_NULL, CODEC_STEADY, CODEC_DONE, CODEC_BEGIN, CODEC_LAST, CODEC_ONHOLD} Status;typedef enum {FMU_DONE = 0, FMU_QUANTIZE, FMU_PROCESS} FMU_STATUS;typedef enum {FFT_FORWARD = 0, FFT_INVERSE} FftDirection;typedef struct PerChannelInfo { /* whenever the memory gest moved to buckets, update is needed */ /* Decoder and Global Members */ Int* m_rgiCoefQ; /* quantized coef */ Int* m_rgiMaskQ; /* quantized maskq ((could be I16)) */ Int* m_rgbBandNotCoded; /* band not coded */ FastFloat* m_rgffltSqrtBWRatio;/*MidRate/LowRate for Bands not coded */ Int* m_rgiNoisePower; const U16* m_rgiHuffDecTbl; /* decoder only */ const U16* m_rgiRunEntry; /* decoder only */ const U16* m_rgiLevelEntry; /* decoder only */ Int m_cSubbandActual; Int m_iPower; /* channel power */ Int m_iActualPower; /* Power as suggested by CoefQ/CoefRecon */ UInt* m_rguiWeightFactor; /* weighting factor */ Int* m_rgiCoefRecon; /* reconstructed coef */ Int m_iMaxMaskQ; #define CURRGETPCM_INVALID 0x7FFF I16 m_iCurrGetPCM_SubFrame; /* reconstruction index */ Int* m_rgiCoefReconCurr; /* current position in m_rgiCoefRecon */ WeightType m_wtMaxWeight;} PerChannelInfo;typedef struct SubFrameConfigInfo{ Int m_cSubFrame; Int m_rgiSubFrameSize [MAX_SUBFRAMES]; Int m_rgiSubFrameStart [MAX_SUBFRAMES]; Int m_rgfMaskUpdate [MAX_SUBFRAMES];} SubFrameConfigInfo;typedef enum {LPC_MODE=0,BARK_MODE} WeightMode;typedef struct CAudioObject{ /* Step Size */ QuantStepType m_qstQuantStep; /* packetization (has nothing to do with the rest) */ Int m_iPacketCurr; Int m_cBitPackedFrameSize; Int m_cBitPacketHeader; Int m_cdwPacketHeader; Int m_cBitPacketHeaderFractionDw; Int m_cBitPacketLength; /* utility vars for entropy decoding for high rate only */ Int m_cRunOfZeros; I16 m_iLevel; Int m_iSign; Int m_iHighCutOffCurr; Int m_iNextBarkIndex; Bool m_fNoiseSub; Int m_fltBitsPerSample; Int m_fltWeightedBitsPerSample; Int m_iMaxEscSize; /* in bits */ Int m_iMaxEscLevel; /* (1<<m_iMaxEscSize) */ Int m_iVersion; Status m_codecStatus; /* current status of the codec */ Bool m_fSeekAdjustment; Bool m_fPacketLossAdj; /* skip some samples when packetloss */ Int m_iSamplingRate; /* audio sampling rate in Hz */ U16 m_cChannel; U32 m_nBytePerSample; Int m_cSubband; /* no. of subbands in the MLT transform */ Bool m_fAllowSuperFrame; Bool m_fAllowSubFrame; Bool m_fV5Lpc;/* !! reset */ Int m_iCurrSubFrame; /* which subframe we are doing */ I16 m_iCurrReconCoef; /* which coef we are doing */ Bool m_fHeaderReset;/* !! dupe? needed for inv-quantization */ Int m_iSubFrameSizeWithUpdate; Int m_iMaxSubFrameDiv; /* maximum no. division into subwindows */ Int m_cMinSubFrameSample; /* min size of subframes in current frame; many change from frame to frame */ Int m_cMinSubFrameSampleHalf; /* min size of subframes in current frame; many change from frame to frame */ Int m_cMinSubFrameSampleQuad; /* min size of subframes in current frame; many change from frame to frame */ Int m_cPossibleWinSize; Int m_iIncr; /* log2(longest winsize / curr winsize) */ Int m_cSubFrameSample; /* for long win, same as m_cFrameSample */ Int m_cSubFrameSampleHalf; Int m_cSubFrameSampleQuad;/* !! yes! */ SubFrameConfigInfo *m_subfrmconfigPrev; SubFrameConfigInfo *m_subfrmconfigCurr; SubFrameConfigInfo *m_subfrmconfigNext; /* should be reset every subfrm in next version */ Int m_cBitsSubbandMax; /* no. of bits for m_cSubband; */ Int m_cFrameSample; /* no. of input/output samples = 2 * cSubband */ Int m_cFrameSampleHalf; /* no. of input/output samples = cSubband */ Int m_cFrameSampleQuad; /* no. of input/output samples = cSubband / 2 */ Int m_cLowCutOff; /* How many coeffs to zero at the low end of spectrum */ Int m_cHighCutOff; /* How many coeffs to zero at the high end of spectrum */ Int m_cLowCutOffLong; Int m_cHighCutOffLong; Int m_iWeightingMode;/* !! yes! */ StereoMode m_stereoMode; /* left-right or sum-difference coding */ Int m_iEntropyMode; /* entropy coding mode */ Int m_fltDitherLevel; /* =.12; Relative intensity of Roberts' pseudo-random noise quantization */ Int m_iQuantStepSize; Int m_fltFlatenFactor; /* Excess spectral noise power factor. Typical values are */ /* in the range 0.4 -- 0.9; best choice is 0.5 */ Int m_fltDctScale; Int m_cValidBarkBand; /* valid bark band in range; some are out of range in the subband decompositio */ Int* m_rgiBarkIndex; /* corresponding coef index for each valid bark */ Int m_iSizePrev; Int m_iSizeCurr; Int m_iSizeNext; Int m_iCoefRecurQ1; Int m_iCoefRecurQ2; Int m_iCoefRecurQ3; Int m_iCoefRecurQ4; /* random accessed memory */ /* overall */ PerChannelInfo* m_rgpcinfo; /* transform */ Int* m_rgiCoefReconOrig; /* weighting *//* !!yes? invQ needs it */ Int m_rgiMaskQ[NUM_BARK_BAND * 2]; Int m_rgcValidBarkBand[NUM_BARK_BAND+1]; Int m_rgiBarkIndexOrig[(NUM_BARK_BAND+1)*5]; /* output *//* !!yes? invQ needs it */ I16* m_piPrevOutput; /* previous encoded output; bottom half += top half of Curr; then gone *//* !!yes? invQ needs it */ I32 m_iDiscardSilence;#ifdef ENABLE_ALL_ENCOPT Int m_fltFirstNoiseFreq; Int m_iFirstNoiseBand; Int m_iFirstNoiseIndex; Int m_iNoisePeakIgnoreBand; /* Num of coefficients to ignore when detecting peaks during noise substitution */ Int m_rgiFirstNoiseBand[NUM_BARK_BAND+1]; Int* m_rgbBandNotCoded; Int* m_rgiNoisePower; FastFloat m_rgffltSqrtBWRatio[(NUM_BARK_BAND+1)*2];#if defined(_DEBUG) && defined(LPC_COMPARE) Float* m_rgfltLpsSpecCos [LPCORDER]; Float* m_rgfltLpsSpecSin [LPCORDER];#endif /* _DEBUG */#else /* ENABLE_ALL_ENCOPT */#endif /* ENABLE_ALL_ENCOPT */ Int* m_rgfltWeightFactor; UInt* m_rguiWeightFactor; /* share with m_rgiMaskQ when bark */ U32 m_iFrameNumber; /* frame counter to the common code */#if defined(INTERPOLATED_DOWNSAMPLE) Bool m_fLowPass; /* Specify independently of downsampling */ Bool m_fDownsample; /* Eg, Downsample 32kHz output to 22kHz for some devices */ Int m_iInterpolSrcBlkSize; /* Size of 1 indivisible source block */ Int m_iInterpolDstBlkSize; /* Size of 1 indivisible destination block */ Int m_iInterpolIncr; /* Pointer increment */ Int m_iInterpolCarry; /* Pointer increment "carry", +1 from time to time */ I32 m_iInterpolWeightIncr; /* FixedPt increment to interpolation weight */ Int m_iInterpolAddInterval; /* Add an extra sample at this interval of output samples */ Int m_iInterpolNextAdd; /* Countdown to extra sample */#endif /* defined(INTERPOLATED_DOWNSAMPLE) */ /* Without these features, no need for adjusted values, */ /* so make the code use the regular values */# define m_cSubbandAdjusted m_cSubband# define m_cFrameSampleAdjusted m_cFrameSample# define m_cFrameSampleHalfAdjusted m_cFrameSampleHalf# define m_cSubFrameSampleAdjusted m_cSubFrameSample# define m_cSubFrameSampleHalfAdjusted m_cSubFrameSampleHalf# define m_cSubFrameSampleQuadAdjusted m_cSubFrameSampleQuad# define m_cHighCutOffAdjusted m_cHighCutOff tRandState m_tRandState;} CAudioObject;void auNew(CAudioObject *pau);/* public and protected */#if defined(HALF_TRANSFORM)# define HALFTRANSFORM_ONLY(x) (x)# define UPSAMPLE_ONLY(x) (x)# define HALF(fHalfTransform, x) ((fHalfTransform) ? ((x)/2) : (x))#else /* defined(HALF_TRANSFORM) */# define HALFTRANSFORM_ONLY(x)# define UPSAMPLE_ONLY(x)# define HALF(fUpsample, x) (x)#endif /* defined(HALF_TRANSFORM) */#ifdef INTERPOLATED_DOWNSAMPLE#define DOWNSAMPLE_ONLY(x) (x)void prvInterpolate(CAudioObject *pau, I16 *piSourceBuffer, Int iNumSrcSamples, Int iChannels, I16 *piDestBuffer, Int *piNumDstSamples, U16* pcSamples);#else /* INTERPOLATED_DOWNSAMPLE */#define DOWNSAMPLE_ONLY(x)#endif /* INTERPOLATED_DOWNSAMPLE */#if defined(PAD2X_TRANSFORM)# define PAD2XTRANSFORM_ONLY(x) (x)# define DOUBLE(fPad2X, x) ((fPad2X) ? ((x)*2) : (x))#else /* defined(PAD2X_TRANSFORM) */# define PAD2XTRANSFORM_ONLY(x)# define DOUBLE(fUpsample, x) (x)#endif /* defined(PAD2X_TRANSFORM) */Void auPreGetPCM (CAudioObject* pau, U16* pcSampleDecoded);#if 0 /* GMGM */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?