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

📄 omxsp_iirone_direct_s16.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** *  * File Name:  omxSP_IIROne_Direct_S16.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * * Description: * This file contains module for single sample IIR filtering * */#include "omxtypes.h"#include "armOMX.h"#include "omxSP.h"#include "armCOMM.h"#include "armSP.h"/** * Function:  omxSP_IIROne_Direct_S16   (2.2.3.2.2) * * Description: * Single sample IIR filtering for 16-bit data.  This function applies the  * direct form II IIR filter defined by the coefficient vector pTaps to a  * single sample of input data. The internal accumulator width must be at  * least 32 bits, and the result is saturated if the operation produces a  * value outside the range of a signed 16-bit integer, i.e., the output will  * saturate to 0x8000 (-32768) for a negative overflow or 0x7fff (32767) for a  * positive overflow.  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.   *   pTaps - pointer to the 2L+2 -element vector that contains the combined  *            numerator and denominator filter coefficients from the system  *            transfer function, H(z). Coefficient scaling and coefficient  *            vector organization should follow the conventions described  *            above. The value of the coefficient scaleFactor exponent must be  *            non-negative (sf>=0).  *   order - the maximum of the degrees of the numerator and denominator  *            coefficient polynomials from the system transfer function, H(z).  *            In the notation of section 2.2.3.2, the parameter  *            order=max(K,M)=L gives the maximum delay, in samples, used to  *            compute each output sample.  *   pDelayLine - pointer to the L-element filter memory buffer (state). The  *            user is responsible for allocation, initialization, and  *            deallocation. The filter memory elements are initialized to zero  *            in most applications.  * * 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,  *              pTaps, or pDelayLine.  *    -    order < 1  *    -    pTaps[order+1] < 0 (negative scaling)  * */OMXResult omxSP_IIROne_Direct_S16 (     OMX_S16 val,     OMX_S16 * pResult,     const OMX_S16 * pTaps,     OMX_INT order,     OMX_S32 * pDelayLine ){    const OMX_S16 *pTapsAk;    const OMX_S16 *pTapsBm;    OMX_S32       macAk,macBm,temp;    OMX_INT       scaleFactor,tapNum;        /* Argument Check */    armRetArgErrIf( pResult    == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf( pDelayLine == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf( pTaps      == NULL, OMX_Sts_BadArgErr);    armRetArgErrIf( order      <  0   , OMX_Sts_BadArgErr);    armRetArgErrIf( pTaps[order + 1]  <  0 , OMX_Sts_BadArgErr);    /* Processing */    order       = order + 1;    scaleFactor = pTaps[order + 1];    pTapsAk     = pTaps + order + 1;    pTapsBm     = pTaps;    macAk    = 0;    macBm    = 0;    pDelayLine--;        for(tapNum = order; tapNum != 0; tapNum--)    {        macAk = armSatMac_S16S32_S32(macAk, pDelayLine[tapNum], pTapsAk[tapNum]);        macBm = armSatMac_S16S32_S32(macBm, pDelayLine[tapNum], pTapsBm[tapNum]);                /*shifting the delay line*/        if(tapNum != 1)        {            pDelayLine[tapNum] = pDelayLine[tapNum - 1];        }    }        temp  = armSatRoundLeftShift_S32(val, scaleFactor);    macAk = armSatSub_S32( temp , macAk);        macAk = armSatRoundLeftShift_S32(macAk,-scaleFactor);    macBm = armSatMac_S16S32_S32(macBm,macAk,pTapsBm[0]);        pDelayLine[1] = macAk;    *pResult      = armSatRoundRightShift_S32_S16(macBm, scaleFactor);    return OMX_Sts_NoErr;}/*End of File*/

⌨️ 快捷键说明

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