📄 omxsp_blockexp_s16.c
字号:
/** * * File Name: omxSP_BlockExp_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 block exponent computation * */#include "omxtypes.h"#include "armOMX.h"#include "omxSP.h"/** * Function: omxSP_BlockExp_S16 (2.2.2.2.2) * * Description: * Block exponent calculation for 16-bit and 32-bit signals (count leading * sign bits). These functions compute the number of extra sign bits of all * values in the 16-bit and 32-bit input vector pSrc and return the minimum * sign bit count. This is also the maximum shift value that could be used in * scaling the block of data. The functions BlockExp_S16 and * BlockExp_S32 return the values 15 and 31, respectively, for input vectors in * which all entries are equal to zero. * * Note: These functions differ from other DL functions by not returning the * standard OMXError but the actual result. * * Input Arguments: * * pSrc - pointer to the input vector * len - number of elements contained in the input and output * vectors (0 < len < 65536) * * Output Arguments: * * none * * Return Value: * * Maximum exponent that may be used in scaling * */OMX_S32 omxSP_BlockExp_S16( const OMX_S16 *pSrc, int len ){ OMX_S16 Var,MaxVar; OMX_S32 MinSignBits; /* Compute the Leading zeros */ MaxVar = 0; do { Var = *pSrc++; /* Invert the bits of a Negative number */ if(Var < 0) { Var = ~Var; } /* Compute the Maximum */ if(Var > MaxVar) { MaxVar = Var; } len--; }while(len != 0); for (MinSignBits=15; (MaxVar>>(15-MinSignBits))!=0 ; MinSignBits--); return MinSignBits;}/* End of File */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -