| 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 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #ifndef MIPS32_LE | 50 #ifndef MIPS32_LE |
| 51 // For MIPS platforms, these are inline functions in spl_inl_mips.h | 51 // For MIPS platforms, these are inline functions in spl_inl_mips.h |
| 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) << 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) << 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) \ | 67 ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 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)(0x0000FFFF & B) * 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) \ | 85 #define WEBRTC_SPL_SHIFT_W32(x, c) ((c) >= 0 ? (x) * (1 << (c)) : (x) >> -(c)) |
| 86 (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c)))) | |
| 87 | 86 |
| 88 // Shifting with negative numbers not allowed | 87 // Shifting with negative numbers not allowed |
| 89 // We cannot do casting here due to signed/unsigned problem | 88 // We cannot do casting here due to signed/unsigned problem |
| 90 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) | 89 #define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c)) |
| 91 | 90 |
| 92 #define WEBRTC_SPL_RSHIFT_U32(x, c) ((uint32_t)(x) >> (c)) | 91 #define WEBRTC_SPL_RSHIFT_U32(x, c) ((uint32_t)(x) >> (c)) |
| 93 | 92 |
| 94 #define WEBRTC_SPL_RAND(a) \ | 93 #define WEBRTC_SPL_RAND(a) \ |
| 95 ((int16_t)((((int16_t)a * 18816) >> 7) & 0x00007fff)) | 94 ((int16_t)((((int16_t)a * 18816) >> 7) & 0x00007fff)) |
| 96 | 95 |
| (...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 // This function multiply a 16-bit word by a 16-bit word, and accumulate this | 1635 // This function multiply a 16-bit word by a 16-bit word, and accumulate this |
| 1637 // value to a 32-bit integer. | 1636 // value to a 32-bit integer. |
| 1638 // | 1637 // |
| 1639 // Input: | 1638 // Input: |
| 1640 // - a : The value of the first 16-bit word. | 1639 // - a : The value of the first 16-bit word. |
| 1641 // - b : The value of the second 16-bit word. | 1640 // - b : The value of the second 16-bit word. |
| 1642 // - c : The value of an 32-bit integer. | 1641 // - c : The value of an 32-bit integer. |
| 1643 // | 1642 // |
| 1644 // Return Value: The value of a * b + c. | 1643 // Return Value: The value of a * b + c. |
| 1645 // | 1644 // |
| OLD | NEW |