From c5c45e50392c1e04838bfe3d80de5de3988c6c59 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 30 Jan 2014 23:36:50 -0800 Subject: [PATCH] cmVectOpTemplateHdr/Code.h : Added cmVox_NormToAbsMax() and cmVox_LinSpace(). --- vop/cmVectOpsTemplateCode.h | 32 ++++++++++++++++++++++++++++++++ vop/cmVectOpsTemplateHdr.h | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/vop/cmVectOpsTemplateCode.h b/vop/cmVectOpsTemplateCode.h index a0a1a5c..13dcec7 100644 --- a/vop/cmVectOpsTemplateCode.h +++ b/vop/cmVectOpsTemplateCode.h @@ -310,6 +310,29 @@ unsigned VECT_OP_FUNC(NormToMax)( VECT_OP_TYPE* dp, unsigned dn ) return i; } +unsigned VECT_OP_FUNC(NormToAbsMax)( VECT_OP_TYPE* dp, unsigned dn, VECT_OP_TYPE fact ) +{ + if( dn == 0 ) + return cmInvalidIdx; + + unsigned i = 0; + unsigned mi = 0; + VECT_OP_TYPE mx = fabs(dp[0]); + + for(i=1; imx ) + { + mi = i; + mx = fabs(dp[i]); + } + + VECT_OP_FUNC(MultVS)(dp,dn,fact/mx); + + return mi; + +} + + VECT_OP_TYPE VECT_OP_FUNC(AlphaNorm)(const VECT_OP_TYPE* sp, unsigned sn, VECT_OP_TYPE alpha ) { double sum = 0; @@ -1903,6 +1926,15 @@ VECT_OP_TYPE VECT_OP_FUNC(SynthPinkNoise)( VECT_OP_TYPE* dbp, unsigned n, VECT_O return *sp; } +VECT_OP_TYPE* VECT_OP_FUNC(LinSpace)( VECT_OP_TYPE* dbp, unsigned dn, VECT_OP_TYPE base, VECT_OP_TYPE limit ) +{ + unsigned i = 0; + for(; i