OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2016 The LibYuv 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 #ifndef INCLUDE_LIBYUV_MACROS_MSA_H_ | 11 #ifndef INCLUDE_LIBYUV_MACROS_MSA_H_ |
12 #define INCLUDE_LIBYUV_MACROS_MSA_H_ | 12 #define INCLUDE_LIBYUV_MACROS_MSA_H_ |
13 | 13 |
14 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) | 14 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) |
15 #include <stdint.h> | 15 #include <stdint.h> |
16 #include <msa.h> | 16 #include <msa.h> |
17 | 17 |
18 #define LD_B(RTYPE, psrc) *((RTYPE*)(psrc)) /* NOLINT */ | 18 #define LD_B(RTYPE, psrc) *((RTYPE*)(psrc)) /* NOLINT */ |
19 #define LD_UB(...) LD_B(v16u8, __VA_ARGS__) | 19 #define LD_UB(...) LD_B(v16u8, __VA_ARGS__) |
20 | 20 |
21 #define LD_H(RTYPE, psrc) *((RTYPE *) (psrc)) | |
22 | |
21 #define ST_B(RTYPE, in, pdst) *((RTYPE*)(pdst)) = (in) /* NOLINT */ | 23 #define ST_B(RTYPE, in, pdst) *((RTYPE*)(pdst)) = (in) /* NOLINT */ |
22 #define ST_UB(...) ST_B(v16u8, __VA_ARGS__) | 24 #define ST_UB(...) ST_B(v16u8, __VA_ARGS__) |
23 | 25 |
24 /* Description : Load two vectors with 16 'byte' sized elements | 26 /* Description : Load two vectors with 16 'byte' sized elements |
25 Arguments : Inputs - psrc, stride | 27 Arguments : Inputs - psrc, stride |
26 Outputs - out0, out1 | 28 Outputs - out0, out1 |
27 Return Type - as per RTYPE | 29 Return Type - as per RTYPE |
28 Details : Load 16 byte elements in 'out0' from (psrc) | 30 Details : Load 16 byte elements in 'out0' from (psrc) |
29 Load 16 byte elements in 'out1' from (psrc + stride) | 31 Load 16 byte elements in 'out1' from (psrc + stride) |
30 */ | 32 */ |
31 #define LD_B2(RTYPE, psrc, stride, out0, out1) { \ | 33 #define LD_B2(RTYPE, psrc, stride, out0, out1) { \ |
32 out0 = LD_B(RTYPE, (psrc)); \ | 34 out0 = LD_B(RTYPE, (psrc)); \ |
33 out1 = LD_B(RTYPE, (psrc) + stride); \ | 35 out1 = LD_B(RTYPE, (psrc) + stride); \ |
34 } | 36 } |
35 #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) | 37 #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) |
36 | 38 |
37 #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \ | 39 #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \ |
38 LD_B2(RTYPE, (psrc), stride, out0, out1); \ | 40 LD_B2(RTYPE, (psrc), stride, out0, out1); \ |
39 LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \ | 41 LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \ |
40 } | 42 } |
41 #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) | 43 #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) |
42 | 44 |
45 /* Description : Load vectors with 8 halfword elements with stride | |
46 Arguments : Inputs - psrc, stride | |
47 Outputs - out0, out1 | |
48 Details : Load 8 halfword elements in 'out0' from (psrc) | |
49 Load 8 halfword elements in 'out1' from (psrc + stride) | |
50 */ | |
51 #define LD_H2(RTYPE, psrc, stride, out0, out1) { \ | |
fbarchard1
2016/10/14 21:35:16
would it more clear in the calling code to do the
manojkumar.bhosale
2016/10/19 11:56:27
Removed this macro
| |
52 out0 = LD_H(RTYPE, (psrc)); \ | |
53 out1 = LD_H(RTYPE, (psrc) + (stride)); \ | |
54 } | |
55 #define LD_UH2(...) LD_H2(v8u16, __VA_ARGS__) | |
56 | |
43 /* Description : Store two vectors with stride each having 16 'byte' sized | 57 /* Description : Store two vectors with stride each having 16 'byte' sized |
44 elements | 58 elements |
45 Arguments : Inputs - in0, in1, pdst, stride | 59 Arguments : Inputs - in0, in1, pdst, stride |
46 Details : Store 16 byte elements from 'in0' to (pdst) | 60 Details : Store 16 byte elements from 'in0' to (pdst) |
47 Store 16 byte elements from 'in1' to (pdst + stride) | 61 Store 16 byte elements from 'in1' to (pdst + stride) |
48 */ | 62 */ |
49 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \ | 63 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \ |
50 ST_B(RTYPE, in0, (pdst)); \ | 64 ST_B(RTYPE, in0, (pdst)); \ |
51 ST_B(RTYPE, in1, (pdst) + stride); \ | 65 ST_B(RTYPE, in1, (pdst) + stride); \ |
52 } | 66 } |
(...skipping 27 matching lines...) Expand all Loading... | |
80 */ | 94 */ |
81 #define ILVRL_B2(RTYPE, in0, in1, out0, out1) { \ | 95 #define ILVRL_B2(RTYPE, in0, in1, out0, out1) { \ |
82 out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \ | 96 out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \ |
83 out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \ | 97 out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \ |
84 } | 98 } |
85 #define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__) | 99 #define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__) |
86 | 100 |
87 #endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */ | 101 #endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */ |
88 | 102 |
89 #endif // INCLUDE_LIBYUV_MACROS_MSA_H_ | 103 #endif // INCLUDE_LIBYUV_MACROS_MSA_H_ |
OLD | NEW |