⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxsp_firone_direct_s16_sfs.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** *  * File Name:  omxSP_FIROne_Direct_S16_Sfs.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * Description: * */#include "omxtypes.h"#include "armOMX.h"#include "omxSP.h"#include "armCOMM.h"#define ARM_SP_Q_OFFSET     (15)/** * Function:  omxSP_FIROne_Direct_S16_Sfs   (2.2.3.1.2) * * Description: * Single-sample FIR filtering for 16-bit data type. These functions apply  * the FIR filter defined by the coefficient vector pTapsQ15 to a single  * sample of input data. The output is multiplied by 2 to the negative power  * of scalefactor (i.e., 2^-scalefactor) before returning to the user.   * Scaling and rounding conventions are defined in section 1.6.7.   * The internal accumulator width must be at least 32 bits.   * The result is undefined if any of the partially accumulated values exceeds  * the range of a signed 32-bit integer.  * * Input Arguments: *    *   val      - the single input sample to which the filter is  *            applied.   *   pTapsQ15 - pointer to the vector that contains the filter coefficients,  *            represented in Q0.15 format (as defined in section 1.6.5). Given  *            that: *                    -32768 = pTapsQ15(k) < 32768,  *                         0 = k < tapsLen,  *            the range on the actual filter coefficients is -1 = bK <1, and  *            therefore coefficient normalization may be required during the  *            filter design process.  *   tapsLen - the number of taps, or, equivalently, the filter order + 1  *   pDelayLine - pointer to the 2.tapsLen -element filter memory buffer  *            (state). The user is responsible for allocation, initialization,  *            and de-allocation. The filter memory elements are initialized to  *            zero in most applications.  *   pDelayLineIndex - pointer to the filter memory index that is maintained  *            internally by the function. The user should initialize the value  *            of this index to zero.  *   scaleFactor - saturation fixed scaleFactor  * * Output Arguments: *    *   pResult - pointer to the filtered output sample  * * Return Value: *     *    OMX_Sts_NoErr - no error  *    OMX_Sts_BadArgErr - bad arguments; returned if one or more of the  *              following is true:  *    -    One or more of the following pointers is NULL:  *            -  pResult,  *            -  pTapsQ15,  *            -  pDelayLine, or  *            -  pDelayLineIndex  *    -    tapslen < 1  *    -    scaleFactor < 0  *    -    *pDelayLineIndex < 0 or *pDelayLineIndex >= (2 * tapslen)  * */OMXResult omxSP_FIROne_Direct_S16_Sfs(     OMX_S16 val,     OMX_S16 * pResult,     const OMX_S16 * pTapsQ15,     OMX_INT tapsLen,     OMX_S16 * pDelayLine,     OMX_INT * pDelayLineIndex,     OMX_INT scaleFactor ){    OMX_U32 index;    OMX_S32 accum;    OMX_S16 *pDelayCurrent;    int     TempSF;    /* Input parameter check */ 	armRetArgErrIf((pResult == NULL), OMX_Sts_BadArgErr)	armRetArgErrIf((pTapsQ15 == NULL), OMX_Sts_BadArgErr)	armRetArgErrIf((tapsLen <= 0), OMX_Sts_BadArgErr)	armRetArgErrIf((pDelayLine == NULL), OMX_Sts_BadArgErr)	armRetArgErrIf((pDelayLineIndex == NULL), OMX_Sts_BadArgErr)	armRetArgErrIf((*pDelayLineIndex < 0), OMX_Sts_BadArgErr)	armRetArgErrIf((*pDelayLineIndex >= (2 * tapsLen)), OMX_Sts_BadArgErr)    	/* Update the delay state */	pDelayCurrent = (pDelayLine + *pDelayLineIndex);		/* Save the input at both location in pMemory */	*pDelayCurrent = *(pDelayCurrent + tapsLen) = val;		/* calculate sigma for output */	accum = 0;	for (index = 0; index < tapsLen ; index++)	{        accum = armSatMac_S32(accum, pTapsQ15 [index], pDelayCurrent [index]);	}		if (--(*pDelayLineIndex) < 0)	{		*pDelayLineIndex = tapsLen - 1;     	}	    /* adjust the Q format here */    TempSF = (ARM_SP_Q_OFFSET + scaleFactor);        /* 32 bit saturated left shift */    accum = armSatRoundLeftShift_S32(accum, -TempSF);    *pResult = (OMX_S16) accum;         /* 16 bit saturation */    if (*pResult != accum)    {        *pResult = (accum < 0) ? OMX_MIN_S16 : OMX_MAX_S16;    }    return OMX_Sts_NoErr;}/***************************************************************************** *                              END OF FILE *****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -