msaud.h
来自「ESS3890+SL原代码(1*16内存)」· C头文件 代码 · 共 595 行 · 第 1/2 页
H
595 行
U32 MaxSamplesPerPacket(U32 ulVersion, U32 ulSamplingRate, U32 ulChannels, U32 ulBitrate);I32 msaudioGetSamplePerFrame (Int cSamplePerSec, U32 dwBitPerSec, Int cChannel, Int iVersion);Void auDelete (CAudioObject* pau); /* destructor */WMARESULT auInit (CAudioObject* pau, Int iVersionNumber, Int cSubband, Int iSamplingRate, U16 cChannel, Int cBytePerSec, Int cbPacketLength, U16 iEncodeOpt, U16 iPlayerOpt);WMARESULT auGetPCM (CAudioObject* pau, U16* pcSample, U8* pbDst, U32 cbDstLength);WMARESULT auReconstruct (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);WMARESULT auSaveHistoryMono (CAudioObject* pau, PerChannelInfo* ppcinfo, Bool fForceTransformAll);WMARESULT auAdaptToSubFrameConfig (CAudioObject* pau);WMARESULT auAdaptToSubFrameConfigDEC (CAudioObject* pau);WMARESULT prvAdaptTrigToSubframeConfig(CAudioObject *pau);WMARESULT prvAdaptTrigToSubframeConfig_INT(CAudioObject *pau);Int auPowerToRMS(CAudioObject* pau, Int iCurrMaskQ, Int iPrevMaskQ, Int iPrevResult);Void auUpdateMaxEsc(CAudioObject* pau, Int iQuantStepSize);WMARESULT auDctIV(CAudioObject* pau, CoefType* rgiCoef, Float fltAfterScaleFactor, U32 *piMagnitude); /* DCT type 4 *//* LPC functions */#ifdef ENABLE_ALL_ENCOPTVoid auResampleWeightFactorLPC (CAudioObject* pau, PerChannelInfo* ppcinfo);Void auLsp2lpc(CAudioObject* pau, U8 *lsfQ, LpType *lpc, Int order);#endif /* ENABLE_ALL_ENCOPT */WMARESULT prvAllocate (CAudioObject* pau);#ifdef __cplusplus}#endif/* private: *//* *** TEMPORARY: prvAllocate moved from here to extern "C" block above *** */#endifVoid prvSetBarkIndex (CAudioObject* pau);#if 0WMARESULT prvInverseQuantizeHighRate (CAudioObject* pau, PerChannelInfo* ppcinfo, Int* rgiWeightFactor);WMARESULT auReconCoefficentsHighRate (CAudioObject* pau, Void* pcaller, PerChannelInfo* ppcinfo, Int* piBitCnt);WMARESULT prvInverseTransformMono (CAudioObject* pau, PerChannelInfo* ppcinfo, I16* piOutput, I16* piPrevOutput, I16* piPrevOutputSign, Bool fForceTransformAll);WMARESULT auReconMono ( CAudioObject* pau,PerChannelInfo* ppcinfo,I16* piOutput,I16* pcSampleGet,Bool fForceTransformAll);#if defined(WMA_TARGET_MIPS) && defined(BUILD_INTEGER)/* This function initalizes the function pointers for mips transforms */WMARESULT auInitMIPS(CAudioObject* pau);#endif#if defined(WMA_TARGET_X86)WMARESULT auDctIV_KNI(CAudioObject* pau, CoefType* rgiCoef, Float fltAfterScaleFactor, U32 *piMagnitude);WMARESULT auDctIV_INTEL(CAudioObject* pau, CoefType* rgiCoef, Float fltAfterScaleFactor, U32 *piMagnitude);#if !defined(BUILD_INTEGER) && !defined(UNDER_CE) && !defined(_Embedded_x86)typedef enum {INTELFFT_INIT_PROCESS, INTELFFT_INIT_THREAD, INTELFFT_FREE_THREAD, INTELFFT_FREE_PROCESS} INTELFFT_INITCODE;void prvFFT4DCT_INTEL(CoefType data[], Int nLog2np, FftDirection fftDirection);WMARESULT auInitIntelFFT(const CAudioObject *pau, const INTELFFT_INITCODE iCode);WMARESULT auFreeIntelFFT(const CAudioObject *pau, const INTELFFT_INITCODE iCode);#endif /* !defined(BUILD_INTEGER) && !defined(UNDER_CE) */#ifdef USE_SIN_COS_TABLES#ifndef BUILD_INTEGERWMARESULT auReconstruct_X86 (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);WMARESULT auReconMono_X86 ( CAudioObject* pau,PerChannelInfo* ppcinfo,I16* piOutput,I16* pcSampleGet,Bool fForceTransformAll);WMARESULT auReconStereo_MMX (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);WMARESULT auReconStereo_SIMDFP (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);#elseWMARESULT auReconstruct_MMX (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);WMARESULT auReconMono_MMX ( CAudioObject* pau,PerChannelInfo* ppcinfo,I16* piOutput,I16* pcSampleGet,Bool fForceTransformAll);#endif /* #ifndef BUILD_INTEGER */#endif /* #ifdef USE_SIN_COS_TABLES */WMARESULT prvInverseTransformMono_MMX (CAudioObject* pau, Float* rgfltCoefRecon, I32* piCurrOutput, Bool fForceTransformAll);#endif /* defined(WMA_TARGET_X86) */#if !(defined(WMA_TARGET_MIPS)&&defined(BUILD_INTEGER))Void prvFFT_Int(Int data[], Int np);Void prvFFT4DCT(CoefType data[], Int nLog2np, FftDirection fftDirection);#endif /* !WMA_TARGET_MIPS */#ifdef ENABLE_ALL_ENCOPT/* for noise sub and low rates only */WMARESULT prvInitNoiseSub (CAudioObject* pau);WMARESULT prvInverseQuantizeMidRate (CAudioObject* pau, PerChannelInfo* ppcinfo, Int* rgiWeightFactor);WMARESULT prvInverseQuantizeLowRate (CAudioObject* pau, PerChannelInfo* ppcinfo, Int* rgiWeightFactor);/* private lpc functions */WMARESULT prvLpcToSpectrum (CAudioObject* pau, const LpType* rgfltLpcCoef, PerChannelInfo* ppcinfo);Void prvInitInverseQuadRootTable (CAudioObject* pau);#endif /* ENABLE_ALL_ENCOPT */#ifdef __cplusplus}#endif#ifndef PREVOUTPUT_16BITS/* ************************************************************************** *//* Signbit Macros *//* I've put them here because they're used in both msaudio.c and float.c *//* ************************************************************************** */#define I17_MIN ((signed) 0xFFFF0000)#define I17_MAX ((signed) 0x0000FFFF)#define CALC_SIGN_OFFSETS(piSrcBase, piSrc, piSrcSignBase, piSrcSign, \ uiSignbitData, uiSignbitCount, cChan) \ { \ const int c_iOffset = (piSrc - piSrcBase)>>(cChan-1); \ const int c_iSignOffset = (c_iOffset+((BITS_PER_BYTE * sizeof(I16))-1)) \ / (BITS_PER_BYTE * sizeof(I16)); \ piSrcSign = piSrcSignBase + c_iSignOffset; \ uiSignbitCount = 16 - (c_iOffset % (BITS_PER_BYTE * sizeof(I16))); \ if (uiSignbitCount == 16) \ uiSignbitData = *piSrcSign++; \ else \ uiSignbitData = *(piSrcSign-1); \ }#define RECORD_SIGNBIT(iResult, piDstSign, uiSignbitData, uiSignbitCount, incr) \ uiSignbitData <<= 1; \ uiSignbitData |= ((iResult >> 31) & 0x00000001); \ uiSignbitCount += 1; \ if (uiSignbitCount >= 16) \ { /* Signbit register is full! Write it out */ \ *piDstSign = (I16) uiSignbitData; \ piDstSign += incr; \ DEBUG_ONLY( uiSignbitData = 0 ); \ uiSignbitCount = 0; \ }#define COMBINE_SIGNBIT(iResult, iSrc, piSrcSign, uiSignbitData, uiSignbitCount) \ if (0 == uiSignbitCount) \ { /* Signbit register is empty! Read new one in */ \ uiSignbitData = *piSrcSign; \ piSrcSign += 1; \ uiSignbitCount = 16; \ } \ if (uiSignbitData & 0x00008000) \ iResult = (-1) & 0xFFFF0000; \ else \ iResult = 0; \ iResult |= (iSrc & 0x0000FFFF); \ uiSignbitData <<= 1; \ uiSignbitCount -= 1;#define SAVE_SIGNBIT_STATE(piSrcSign,uiSignbitData) \ if (0 != uiSignbitCount) \ *(piSrcSign-1) = (I16)uiSignbitData; /* must save partial shift */#define ASSERT_SIGNBIT_POINTER(piSrcOrDstSign) \ assert( piSrcOrDstSign != NULL );#else /* PREVOUTPUT_16BITS *//* Use I16 min/max in place of I17 */#define I17_MIN SHRT_MIN#define I17_MAX SHRT_MAX#define CALC_SIGN_OFFSETS(piSrcBase, piSrc, piSrcSignBase, piSrcSign, \ uiSignData, uiSignCount, cChan) #define RECORD_SIGNBIT(iResult, piDstSign, uiSignbitData, uiSignbitCount, incr)#define COMBINE_SIGNBIT(iResult, iSrc, piSrcSign, uiSignbitData, uiSignbitCount) \ iResult = iSrc#define SAVE_SIGNBIT_STATE(piSrcSign,uiSignData)#define ASSERT_SIGNBIT_POINTER(piSrcOrDstSign)#endif /* PREVOUTPUT_16BITS */#if defined(INTERPOLATED_DOWNSAMPLE)#define INTERPOL_FRACTBITS 30void prvInterpolateInit(CAudioObject *pau, Int iSrcSampleRate, Int iDstSampleRate, Int iAddInterval);#ifdef BUILD_INTEGERvoid auLowPass(CAudioObject *pau, Int *rgiCoef, Int iNumCoefs);#elsevoid auLowPass(CAudioObject *pau, Float *rgfltCoef, Int iNumCoefs);#endif /* BUILD_INTEGER */#endif /* defined(INTERPOLATED_DOWNSAMPLE) */#ifndef BUILD_INTEGER/* do not scale WeightFactor when using float */#undef WEIGHTFACTOR_FRACT_BITS#define WEIGHTFACTOR_FRACT_BITS 0#endif/* Void auCalcQuantStep(Int iQuantStepSize, U32 *piQuantStep, U32 *piFractBits); */void qstCalcQuantStep(Int iQuantStepSize, QuantStepType *qst);QuantFloat prvWeightedQuantization(CAudioObject *pau, PerChannelInfo *ppcinfo, Int iBark);void SetActualPower(const I16 *piCoefQ, const int iCount, PerChannelInfo *ppcinfo, const Status codecStatus);void SetActualPowerHighRate(const I32 *piCoefRecon, const int iCount, PerChannelInfo *ppcinfo, const Status codecStatus);/* **************** Monitor Range of Values for Debugging ****************************** *//* Place MONITOR_RANGE(name,variable) in the code where you want to monitor a variable, *//* and use DUMP_MONITOR_RANGES(0) in the exit code where you want to print out the results *//* If you want to dump on a frame-by-frame basis, use REINIT_MONITOR_RANGE after the dump *//* Finally, add an appropriate DECL_MONITOR_RANGE(name) in wmaOS.c *//* and add DUMP_MONITOR_RANGE(name) to the DumpMonitorRanges() function there. *//* ************************************************************************************** */#if defined(_DEBUG) && defined(WMA_MONITOR)/* some MONITOR_RANGE variations can be defined. *//* First variation is to print the variable to stdout *//* # define WMA_MONITOR_PRINT "gMR_rgfltWeightFactor" *//* Second variation allows you to break when the fabs(variable) exceeds a threshold *//* # define WMA_MONITOR_BREAK "gMR_rgfltWeightFactor" *//* # define WMA_MONITOR_BREAK_THRESHOLD 50 *//* both of these variations are slow because strcmp is done at runtime instead of compile time - but this is debug code. */# ifdef WMA_MONITOR_PRINT# define MONITOR_RANGE(a,x) { extern double a[]; extern long lc##a; if ((double)(x)<a[0]) a[0]=(double)(x); if ((double)(x)>a[1]) a[1]=(double)(x); a[2] += (x); a[3] += (x)*(x); lc##a++; \ if (strcmp(#a,WMA_MONITOR_PRINT)==0) printf("%14.6g\n",(double)(x)); }# elif defined(WMA_MONITOR_BREAK)# define MONITOR_RANGE(a,x) { extern double a[]; extern long lc##a; if ((double)(x)<a[0]) a[0]=(double)(x); if ((double)(x)>a[1]) a[1]=(double)(x); a[2] += (x); a[3] += (x)*(x); lc##a++; \ if (strcmp(#a,WMA_MONITOR_BREAK)==0 && fabs(x)>WMA_MONITOR_BREAK_THRESHOLD) DEBUG_BREAK(); }# else# define MONITOR_RANGE(a,x) { extern double a[]; extern long lc##a; if ((double)(x)<a[0]) a[0]=(double)(x); if ((double)(x)>a[1]) a[1]=(double)(x); a[2] += (x); a[3] += (x)*(x); lc##a++; }# endif# define MONITOR_RANGE_CONDITIONAL(cond,a,x) if (cond) { extern double a[]; extern long lc##a; if ((double)(x)<a[0]) a[0]=(double)(x); if ((double)(x)>a[1]) a[1]=(double)(x); a[2] += (x); a[3] += (x)*(x); lc##a++; }# define MONITOR_COUNT(a,c) { extern long lc##a; lc##a+=c; }# define MONITOR_COUNT_CONDITIONAL(cond,a,c) if (cond) { extern long lc##a; lc##a+=c; }# define DUMP_MONITOR_RANGES(fAppend) { void DumpMonitorRanges(int f); DumpMonitorRanges(fAppend); }# define REINIT_MONITOR_RANGE(a) { extern double a[]; extern long lc##a; a[1] = -( a[0] = 1.0e30 ); a[2] = a[3] = 0; lc##a = 0; }# define DUMP_MONITOR_RANGE(a) { extern double a[]; extern long lc##a; if ( a[0] == 1.0e30 && a[3]==0 ) { a[0] = a[1] = 0; } if (lc##a>0) printf("%14.6g %14.6g %14.6g %14.6g %8ld " #a "\n", a[0], a[1], a[2]/lc##a, sqrt((lc##a*a[3]-a[2]*a[2])/((double)(lc##a)*(lc##a-1))), lc##a ); }#else /* not (defined(_DEBUG) && defined(WMA_MONITOR)) */# define MONITOR_RANGE(a,x)# define MONITOR_RANGE_CONDITIONAL(cond,a,x)# define MONITOR_COUNT(a,c)# define MONITOR_COUNT_CONDITIONAL(cond,a,c)# define DUMP_MONITOR_RANGES(fAppend)# define REINIT_MONITOR_RANGE(a)# define DUMP_MONITOR_RANGE(a) #endif#if defined(WMA_SHOW_FRAMES) && defined(_DEBUG) void prvWmaShowFrames(CAudioObject* pau, const char* pszID, const char* pszFmt, ...);#endif/* mallocAligned allocates a buffer of size (+iAlignToBytes for allignment padding) bytes *//* which is alligned on an iAllignToBytes byte boundary *//* the buffer must be deallocated using freeAligned *//* and it is only safe to use size bytes as the padding could be at the begining or ending */void *mallocAligned(size_t size,Int iAlignToBytes);void freeAligned(void *ptr);/* ----- Memory Allocation Functions ----- */typedef enum {MAS_ALLOCATE, MAS_LOCKED, MAS_DELETE} MEMALLOCSTATE;I32 auMallocGetCount(void);void auMallocSetState(const MEMALLOCSTATE maState, void *pBuf, const I32 iBufSize);void *auMalloc(const size_t iSize);void auFree(void *pFree);/* *************************************************************************** *//* Encoder/Decoder Separation *//* *************************************************************************** */#define PRECESSION_BITS_FOR_INVQUADROOT 12#if defined(_DEBUG) && defined(LPC_COMPARE)void prvSetupLpcSpecTrig(CAudioObject* pau);#define SETUP_LPC_SPEC_TRIG(pau) prvSetupLpcSpecTrig(pau)#else#define SETUP_LPC_SPEC_TRIG(pau) #endif#endif#endif /* __MSAUDIO_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?