• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  ** Copyright 2003-2010, VisualOn, Inc.
3  **
4  ** Licensed under the Apache License, Version 2.0 (the "License");
5  ** you may not use this file except in compliance with the License.
6  ** You may obtain a copy of the License at
7  **
8  **     http://www.apache.org/licenses/LICENSE-2.0
9  **
10  ** Unless required by applicable law or agreed to in writing, software
11  ** distributed under the License is distributed on an "AS IS" BASIS,
12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ** See the License for the specific language governing permissions and
14  ** limitations under the License.
15  */
16 /*******************************************************************************
17 	File:		spreading.c
18 
19 	Content:	Spreading of energy function
20 
21 *******************************************************************************/
22 
23 #include "basic_op.h"
24 #include "oper_32b.h"
25 #include "spreading.h"
26 
27 /*********************************************************************************
28 *
29 * function name: SpreadingMax
30 * description:  spreading the energy
31 *				 higher frequencies thr(n) = max(thr(n), sh(n)*thr(n-1))
32 *				 lower frequencies  thr(n) = max(thr(n), sl(n)*thr(n+1))
33 *
34 **********************************************************************************/
SpreadingMax(const Word16 pbCnt,const Word16 * maskLowFactor,const Word16 * maskHighFactor,Word32 * pbSpreadedEnergy)35 void SpreadingMax(const Word16 pbCnt,
36                   const Word16 *maskLowFactor,
37                   const Word16 *maskHighFactor,
38                   Word32       *pbSpreadedEnergy)
39 {
40   Word32 i;
41 
42   /* slope to higher frequencies */
43   for (i=1; i<pbCnt; i++) {
44     pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
45                                 L_mpy_ls(pbSpreadedEnergy[i-1], maskHighFactor[i]));
46   }
47   /* slope to lower frequencies */
48   for (i=pbCnt - 2; i>=0; i--) {
49     pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
50                                 L_mpy_ls(pbSpreadedEnergy[i+1], maskLowFactor[i]));
51   }
52 }
53