OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 { | 34 { |
35 int16_t j,shft; | 35 int16_t j,shft; |
36 int32_t tmp; | 36 int32_t tmp; |
37 int16_t *eSh_ptr; | 37 int16_t *eSh_ptr; |
38 int16_t *eW16_ptr; | 38 int16_t *eW16_ptr; |
39 | 39 |
40 | 40 |
41 eSh_ptr = &energyShifts[1+base_size]; | 41 eSh_ptr = &energyShifts[1+base_size]; |
42 eW16_ptr = &energyW16[1+base_size]; | 42 eW16_ptr = &energyW16[1+base_size]; |
43 | 43 |
44 for(j=0;j<range-1;j++) { | 44 for (j = 0; j + 1 < range; j++) { |
45 | 45 |
46 /* Calculate next energy by a +/- | 46 /* Calculate next energy by a +/- |
47 operation on the edge samples */ | 47 operation on the edge samples */ |
48 tmp = (*ppi) * (*ppi) - (*ppo) * (*ppo); | 48 tmp = (*ppi) * (*ppi) - (*ppo) * (*ppo); |
49 energy += tmp >> scale; | 49 energy += tmp >> scale; |
50 energy = WEBRTC_SPL_MAX(energy, 0); | 50 energy = WEBRTC_SPL_MAX(energy, 0); |
51 | 51 |
52 ppi--; | 52 ppi--; |
53 ppo--; | 53 ppo--; |
54 | 54 |
55 /* Normalize the energy into a int16_t and store | 55 /* Normalize the energy into a int16_t and store |
56 the number of shifts */ | 56 the number of shifts */ |
57 | 57 |
58 shft = (int16_t)WebRtcSpl_NormW32(energy); | 58 shft = (int16_t)WebRtcSpl_NormW32(energy); |
59 *eSh_ptr++ = shft; | 59 *eSh_ptr++ = shft; |
60 | 60 |
61 tmp = energy << shft; | 61 tmp = energy << shft; |
62 *eW16_ptr++ = (int16_t)(tmp >> 16); | 62 *eW16_ptr++ = (int16_t)(tmp >> 16); |
63 } | 63 } |
64 } | 64 } |
OLD | NEW |