OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 | 11 |
12 /* | 12 /* |
13 * This header file includes all of the fix point signal processing library (SPL
) function | 13 * This header file includes all of the fix point signal processing library (SPL
) function |
14 * descriptions and declarations. | 14 * descriptions and declarations. |
15 * For specific function calls, see bottom of file. | 15 * For specific function calls, see bottom of file. |
16 */ | 16 */ |
17 | 17 |
18 #ifndef WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ | 18 #ifndef WEBRTC_COMMON_AUDIO_SIGNAL_PROCESSING_INCLUDE_SIGNAL_PROCESSING_LIBRARY_
H_ |
19 #define WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ | 19 #define WEBRTC_COMMON_AUDIO_SIGNAL_PROCESSING_INCLUDE_SIGNAL_PROCESSING_LIBRARY_
H_ |
20 | 20 |
21 #include <string.h> | 21 #include <string.h> |
22 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
23 | 23 |
24 // Macros specific for the fixed point implementation | 24 // Macros specific for the fixed point implementation |
25 #define WEBRTC_SPL_WORD16_MAX 32767 | 25 #define WEBRTC_SPL_WORD16_MAX 32767 |
26 #define WEBRTC_SPL_WORD16_MIN -32768 | 26 #define WEBRTC_SPL_WORD16_MIN -32768 |
27 #define WEBRTC_SPL_WORD32_MAX (int32_t)0x7fffffff | 27 #define WEBRTC_SPL_WORD32_MAX (int32_t)0x7fffffff |
28 #define WEBRTC_SPL_WORD32_MIN (int32_t)0x80000000 | 28 #define WEBRTC_SPL_WORD32_MIN (int32_t)0x80000000 |
29 #define WEBRTC_SPL_MAX_LPC_ORDER 14 | 29 #define WEBRTC_SPL_MAX_LPC_ORDER 14 |
(...skipping 22 matching lines...) Expand all Loading... |
52 #define WEBRTC_SPL_MUL_16_16(a, b) \ | 52 #define WEBRTC_SPL_MUL_16_16(a, b) \ |
53 ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) | 53 ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) |
54 #define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ | 54 #define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ |
55 (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ | 55 (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ |
56 + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) | 56 + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) |
57 #endif | 57 #endif |
58 #endif | 58 #endif |
59 | 59 |
60 #define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \ | 60 #define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \ |
61 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 5) + \ | 61 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 5) + \ |
62 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x0200) >> 10)) | 62 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x0200) >> 10)) |
63 #define WEBRTC_SPL_MUL_16_32_RSFT14(a, b) \ | 63 #define WEBRTC_SPL_MUL_16_32_RSFT14(a, b) \ |
64 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 2) + \ | 64 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 2) + \ |
65 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x1000) >> 13)) | 65 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x1000) >> 13)) |
66 #define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ | 66 #define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ |
67 ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 1)) + \ | 67 ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 1)) + \ |
68 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x2000) >> 14)) | 68 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x2000) >> 14)) |
69 | 69 |
70 #define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ | 70 #define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ |
71 (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) | 71 (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) |
72 | 72 |
73 #define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ | 73 #define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ |
74 ((WEBRTC_SPL_MUL_16_16(a, b) + ((int32_t) \ | 74 ((WEBRTC_SPL_MUL_16_16(a, b) + ((int32_t) \ |
75 (((int32_t)1) << ((c) - 1)))) >> (c)) | 75 (((int32_t)1) << ((c) - 1)))) >> (c)) |
76 | 76 |
77 // C + the 32 most significant bits of A * B | 77 // C + the 32 most significant bits of A * B |
78 #define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ | 78 #define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ |
79 (C + (B >> 16) * A + (((uint32_t)(0x0000FFFF & B) * A) >> 16)) | 79 (C + (B >> 16) * A + (((uint32_t)(B & 0x0000FFFF) * A) >> 16)) |
80 | 80 |
81 #define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b) | 81 #define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b) |
82 | 82 |
83 // Shifting with negative numbers allowed | 83 // Shifting with negative numbers allowed |
84 // Positive means left shift | 84 // Positive means left shift |
85 #define WEBRTC_SPL_SHIFT_W32(x, c) ((c) >= 0 ? (x) * (1 << (c)) : (x) >> -(c)) | 85 #define WEBRTC_SPL_SHIFT_W32(x, c) ((c) >= 0 ? (x) * (1 << (c)) : (x) >> -(c)) |
86 | 86 |
87 // Shifting with negative numbers not allowed | 87 // Shifting with negative numbers not allowed |
88 // We cannot do casting here due to signed/unsigned problem | 88 // We cannot do casting here due to signed/unsigned problem |
89 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) | 89 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, | 914 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, |
915 const int16_t* high_band, | 915 const int16_t* high_band, |
916 size_t band_length, | 916 size_t band_length, |
917 int16_t* out_data, | 917 int16_t* out_data, |
918 int32_t* filter_state1, | 918 int32_t* filter_state1, |
919 int32_t* filter_state2); | 919 int32_t* filter_state2); |
920 | 920 |
921 #ifdef __cplusplus | 921 #ifdef __cplusplus |
922 } | 922 } |
923 #endif // __cplusplus | 923 #endif // __cplusplus |
924 #endif // WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ | 924 #endif // WEBRTC_COMMON_AUDIO_SIGNAL_PROCESSING_INCLUDE_SIGNAL_PROCESSING_LIBRA
RY_H_ |
925 | 925 |
926 // | 926 // |
927 // WebRtcSpl_AddSatW16(...) | 927 // WebRtcSpl_AddSatW16(...) |
928 // WebRtcSpl_AddSatW32(...) | 928 // WebRtcSpl_AddSatW32(...) |
929 // | 929 // |
930 // Returns the result of a saturated 16-bit, respectively 32-bit, addition of | 930 // Returns the result of a saturated 16-bit, respectively 32-bit, addition of |
931 // the numbers specified by the |var1| and |var2| parameters. | 931 // the numbers specified by the |var1| and |var2| parameters. |
932 // | 932 // |
933 // Input: | 933 // Input: |
934 // - var1 : Input variable 1 | 934 // - var1 : Input variable 1 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 // This function multiply a 16-bit word by a 16-bit word, and accumulate this | 1633 // This function multiply a 16-bit word by a 16-bit word, and accumulate this |
1634 // value to a 32-bit integer. | 1634 // value to a 32-bit integer. |
1635 // | 1635 // |
1636 // Input: | 1636 // Input: |
1637 // - a : The value of the first 16-bit word. | 1637 // - a : The value of the first 16-bit word. |
1638 // - b : The value of the second 16-bit word. | 1638 // - b : The value of the second 16-bit word. |
1639 // - c : The value of an 32-bit integer. | 1639 // - c : The value of an 32-bit integer. |
1640 // | 1640 // |
1641 // Return Value: The value of a * b + c. | 1641 // Return Value: The value of a * b + c. |
1642 // | 1642 // |
OLD | NEW |