msaudio.h
来自「AMLOGIC DPF source code」· C头文件 代码 · 共 688 行 · 第 1/2 页
H
688 行
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_ENCOPT
Void 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 ***
Void prvSetBarkIndex (CAudioObject* pau);
WMARESULT 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_X86)
WMARESULT auDctIV_KNI(CAudioObject* pau, CoefType* rgiCoef, Float fltAfterScaleFactor, U32 *piMagnitude);
WMARESULT auDctIV_INTEL(CAudioObject* pau, CoefType* rgiCoef, Float fltAfterScaleFactor, U32 *piMagnitude);
#ifdef USE_SIN_COS_TABLES
WMARESULT auReconstruct_MMX (CAudioObject* pau, I16* piOutput, I16* pcSampleGet, Bool fForceTransformAll);
WMARESULT auReconMono_MMX ( CAudioObject* pau,PerChannelInfo* ppcinfo,I16* piOutput,I16* pcSampleGet,Bool fForceTransformAll);
#endif //#ifdef USE_SIN_COS_TABLES
WMARESULT prvInverseTransformMono_MMX (CAudioObject* pau, Float* rgfltCoefRecon,
I32* piCurrOutput, Bool fForceTransformAll);
#endif // defined(WMA_TARGET_X86)
void prvFFT_Int(Int data[], Int np);
Void prvFFT4DCT(CoefType data[], Int nLog2np, FftDirection fftDirection);
#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
#if defined(INTERPOLATED_DOWNSAMPLE)
#define INTERPOL_FRACTBITS 30
void prvInterpolateInit(CAudioObject *pau, Int iSrcSampleRate,
Int iDstSampleRate, Int iAddInterval);
void auLowPass(CAudioObject *pau, Int *rgiCoef, Int iNumCoefs);
#endif // defined(INTERPOLATED_DOWNSAMPLE)
#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
//Void auCalcQuantStep(Int iQuantStepSize, U32 *piQuantStep, U32 *piFractBits);
QuantStepType qstCalcQuantStep(Int iQuantStepSize);
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
#if defined(HEAP_DEBUG_TEST) && defined(_DEBUG)
void HeapDebugCheck();
#define HEAP_DEBUG_CHECK HeapDebugCheck()
#else
#define HEAP_DEBUG_CHECK
#endif
// **************************************************************************
// 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
// **************************************************************************
// Player Options
// **************************************************************************
#define PLAYOPT_DOWNSAMPLE32TO22 0x0001
#define PLAYOPT_HALFTRANSFORM 0x0002
#define PLAYOPT_UPSAMPLE 0x0004
#define PLAYOPT_PAD2XTRANSFORM 0x0008
//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
typedef struct tagWMAFileHdrStateInternal
{
unsigned int currPacketOffset; /* not just for packets */
unsigned int nextPacketOffset;
/* ASF header */
unsigned int cbHeader;
unsigned int cbPacketSize;
unsigned int cbAudioSize;
unsigned int cPackets;
unsigned int msDuration;
unsigned int msPreroll;
unsigned int cbFirstPacketOffset;
unsigned int cbLastPacketOffset;
/* audio prop */
unsigned short nVersion;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned int nBlockAlign;
unsigned short nChannels;
unsigned int nSamplesPerBlock;
unsigned short nEncodeOpt;
/* DRM */
unsigned char pbSecretData[32];
unsigned int cbSecretData;
unsigned char pbType[16];
unsigned char pbKeyID[32];
/* Content Description */
unsigned int cbCDOffset;
unsigned short cbCDTitle;
unsigned short cbCDAuthor;
unsigned short cbCDCopyright;
unsigned short cbCDDescription;
unsigned short cbCDRating;
/* Extended Content Description */
/* Marker */
unsigned int m_dwMarkerNum;
/* License Store */
unsigned int m_dwLicenseLen;
unsigned char *m_pLicData;
// Members added by Amit
unsigned short wAudioStreamId;
} tWMAFileHdrStateInternal;
//typedef void * WMADecHANDLE;
/* internal structure for the WMAudio library state */
typedef struct tagWMAFileStateInternal
{
tWMAFileHdrStateInternal hdr_parse;
/* payload parsing */
unsigned int cbPayloadOffset;
unsigned int cbPayloadLeft;
unsigned char bBlockStart;
unsigned int cbBlockLeft;
/* packet parsing */
unsigned int iPayload;
unsigned short wPayStart;
/* other states */
unsigned char bHasDRM;
unsigned int nSampleCount;
/* objects */
unsigned char bDecInWaitState;
unsigned char bAllFramesDone;
unsigned char bFirst;
unsigned char *pCallBackBuffer;
} tWMAFileStateInternal;
#define WMAERR_OK 0
#define WMAERR_FAIL 1
#define WMAERR_INVALIDARG 2
#define WMAERR_BUFFERTOOSMALL 3
#define WMAERR_INVALIDHEADER 4
#define WMAERR_OUTOFMEMORY 5
#define WMAERR_CORRUPTDATA 6
#define WMAERR_NOTDONE 7 /* need more data to finish the work */
#define WMAERR_INVALIDSTATE 8
typedef enum tagWMAFileStatus
{
cWMA_NoErr, /* -> always first entry */
/* remaining entry order is not guaranteed */
cWMA_Failed,
cWMA_BadArgument,
cWMA_BadAsfHeader,
cWMA_BadPacketHeader,
cWMA_BrokenFrame,
cWMA_NoMoreFrames,
cWMA_BadSamplingRate,
cWMA_BadNumberOfChannels,
cWMA_BadVersionNumber,
cWMA_BadWeightingMode,
cWMA_BadPacketization,
cWMA_BadDRMType,
cWMA_DRMFailed,
cWMA_DRMUnsupported,
cWMA_DemoExpired,
cWMA_BadState,
cWMA_Internal, /* really bad */
cWMA_NoMoreDataThisTime
} tWMAFileStatus;
#endif //__MSAUDIO_H_
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?