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/common_audio/signal_processing/dot_product_with_scale.h" | 22 #include "webrtc/common_audio/signal_processing/dot_product_with_scale.h" |
23 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
24 | 24 |
25 // Macros specific for the fixed point implementation | 25 // Macros specific for the fixed point implementation |
26 #define WEBRTC_SPL_WORD16_MAX 32767 | 26 #define WEBRTC_SPL_WORD16_MAX 32767 |
27 #define WEBRTC_SPL_WORD16_MIN -32768 | 27 #define WEBRTC_SPL_WORD16_MIN -32768 |
28 #define WEBRTC_SPL_WORD32_MAX (int32_t)0x7fffffff | 28 #define WEBRTC_SPL_WORD32_MAX (int32_t)0x7fffffff |
29 #define WEBRTC_SPL_WORD32_MIN (int32_t)0x80000000 | 29 #define WEBRTC_SPL_WORD32_MIN (int32_t)0x80000000 |
(...skipping 23 matching lines...) Expand all Loading... |
53 #define WEBRTC_SPL_MUL_16_16(a, b) \ | 53 #define WEBRTC_SPL_MUL_16_16(a, b) \ |
54 ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) | 54 ((int32_t) (((int16_t)(a)) * ((int16_t)(b)))) |
55 #define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ | 55 #define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ |
56 (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ | 56 (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ |
57 + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) | 57 + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) |
58 #endif | 58 #endif |
59 #endif | 59 #endif |
60 | 60 |
61 #define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \ | 61 #define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \ |
62 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 5) + \ | 62 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 5) + \ |
63 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x0200) >> 10)) | 63 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x0200) >> 10)) |
64 #define WEBRTC_SPL_MUL_16_32_RSFT14(a, b) \ | 64 #define WEBRTC_SPL_MUL_16_32_RSFT14(a, b) \ |
65 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 2) + \ | 65 (WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 2) + \ |
66 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x1000) >> 13)) | 66 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x1000) >> 13)) |
67 #define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ | 67 #define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ |
68 ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 1)) + \ | 68 ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) * (1 << 1)) + \ |
69 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x2000) >> 14)) | 69 (((WEBRTC_SPL_MUL_16_U16(a, (uint16_t)(b)) >> 1) + 0x2000) >> 14)) |
70 | 70 |
71 #define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ | 71 #define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ |
72 (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) | 72 (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) |
73 | 73 |
74 #define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ | 74 #define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ |
75 ((WEBRTC_SPL_MUL_16_16(a, b) + ((int32_t) \ | 75 ((WEBRTC_SPL_MUL_16_16(a, b) + ((int32_t) \ |
76 (((int32_t)1) << ((c) - 1)))) >> (c)) | 76 (((int32_t)1) << ((c) - 1)))) >> (c)) |
77 | 77 |
78 // C + the 32 most significant bits of A * B | 78 // C + the 32 most significant bits of A * B |
79 #define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ | 79 #define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ |
80 (C + (B >> 16) * A + (((uint32_t)(0x0000FFFF & B) * A) >> 16)) | 80 (C + (B >> 16) * A + (((uint32_t)(B & 0x0000FFFF) * A) >> 16)) |
81 | 81 |
82 #define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b) | 82 #define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b) |
83 | 83 |
84 // Shifting with negative numbers allowed | 84 // Shifting with negative numbers allowed |
85 // Positive means left shift | 85 // Positive means left shift |
86 #define WEBRTC_SPL_SHIFT_W32(x, c) ((c) >= 0 ? (x) * (1 << (c)) : (x) >> -(c)) | 86 #define WEBRTC_SPL_SHIFT_W32(x, c) ((c) >= 0 ? (x) * (1 << (c)) : (x) >> -(c)) |
87 | 87 |
88 // Shifting with negative numbers not allowed | 88 // Shifting with negative numbers not allowed |
89 // We cannot do casting here due to signed/unsigned problem | 89 // We cannot do casting here due to signed/unsigned problem |
90 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) | 90 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) |
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, | 899 void WebRtcSpl_SynthesisQMF(const int16_t* low_band, |
900 const int16_t* high_band, | 900 const int16_t* high_band, |
901 size_t band_length, | 901 size_t band_length, |
902 int16_t* out_data, | 902 int16_t* out_data, |
903 int32_t* filter_state1, | 903 int32_t* filter_state1, |
904 int32_t* filter_state2); | 904 int32_t* filter_state2); |
905 | 905 |
906 #ifdef __cplusplus | 906 #ifdef __cplusplus |
907 } | 907 } |
908 #endif // __cplusplus | 908 #endif // __cplusplus |
909 #endif // WEBRTC_SPL_SIGNAL_PROCESSING_LIBRARY_H_ | 909 #endif // WEBRTC_COMMON_AUDIO_SIGNAL_PROCESSING_INCLUDE_SIGNAL_PROCESSING_LIBRA
RY_H_ |
910 | 910 |
911 // | 911 // |
912 // WebRtcSpl_AddSatW16(...) | 912 // WebRtcSpl_AddSatW16(...) |
913 // WebRtcSpl_AddSatW32(...) | 913 // WebRtcSpl_AddSatW32(...) |
914 // | 914 // |
915 // Returns the result of a saturated 16-bit, respectively 32-bit, addition of | 915 // Returns the result of a saturated 16-bit, respectively 32-bit, addition of |
916 // the numbers specified by the |var1| and |var2| parameters. | 916 // the numbers specified by the |var1| and |var2| parameters. |
917 // | 917 // |
918 // Input: | 918 // Input: |
919 // - var1 : Input variable 1 | 919 // - var1 : Input variable 1 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 // This function multiply a 16-bit word by a 16-bit word, and accumulate this | 1618 // This function multiply a 16-bit word by a 16-bit word, and accumulate this |
1619 // value to a 32-bit integer. | 1619 // value to a 32-bit integer. |
1620 // | 1620 // |
1621 // Input: | 1621 // Input: |
1622 // - a : The value of the first 16-bit word. | 1622 // - a : The value of the first 16-bit word. |
1623 // - b : The value of the second 16-bit word. | 1623 // - b : The value of the second 16-bit word. |
1624 // - c : The value of an 32-bit integer. | 1624 // - c : The value of an 32-bit integer. |
1625 // | 1625 // |
1626 // Return Value: The value of a * b + c. | 1626 // Return Value: The value of a * b + c. |
1627 // | 1627 // |
OLD | NEW |