📄 armippp_computebinomialcoeff.c
字号:
/** * * * File Name: armIPPP_ComputeBinomialCoeff.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Description : Computes the product of binomial coefficient of two terms. * */#include "omxtypes.h"#include "armIP.h"/** * Function: armIPPP_ComputeBinomialCoeff * * Description: * Computes the binomial coefficient of the expression * [(x-xOff)^mOrd * (y-yOff)^nOrd * f(x,y)] for the (r1,r2)th term, * where (0 <= r1 <= mOrd) and (0 <= r2 <= nOrd). * * Return Value: * OMX_S64 -- The value of binomial coefficient */ OMX_S64 armIPPP_ComputeBinomialCoeff( OMX_INT mOrd, OMX_INT nOrd, OMX_U8 r1, OMX_U8 r2, OMX_INT xOff, OMX_INT yOff ){ OMX_S64 coeff; OMX_S32 comb1, comb2; OMX_S32 numerator = 1, denominator = 1; OMX_INT i; /** ------------------------------------------------------------------------------ Computing the binomial coefficient of [(x-xOff)^mOrd * (y-yOff)^nOrd * f(x,y)] for the (r1,r2)th term, where (0 <= r1 <= mOrd) and (0 <= r2 <= nOrd). BinCoeff = C(mOrd,r1) * C(nOrd,r2) * xOff^(mOrd-r1) * yOff^(nOrd-r2), where C is the combination function. ------------------------------------------------------------------------------ */ for(i = 0; i < r1; i++) { numerator *= (mOrd - i); denominator *= (r1 - i); } comb1 = armRoundFloatToS16((OMX_F32)numerator/denominator); numerator = denominator = 1; for(i = 0; i < r2; i++) { numerator *= (nOrd - i); denominator *= (r2 - i); } comb2 = armRoundFloatToS16((OMX_F32)numerator/denominator); coeff = armIPPP_Power_S64(xOff,(mOrd-r1)) * armIPPP_Power_S64(yOff,(nOrd-r2)) * comb1 * comb2; return coeff;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -