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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 out1 = LD_B(RTYPE, (psrc) + stride); \ | 33 out1 = LD_B(RTYPE, (psrc) + stride); \ |
34 } | 34 } |
35 #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) | 35 #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__) |
36 | 36 |
37 #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \ | 37 #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) { \ |
38 LD_B2(RTYPE, (psrc), stride, out0, out1); \ | 38 LD_B2(RTYPE, (psrc), stride, out0, out1); \ |
39 LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \ | 39 LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \ |
40 } | 40 } |
41 #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) | 41 #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__) |
42 | 42 |
| 43 #define LD_B8(RTYPE, psrc, stride, \ |
| 44 out0, out1, out2, out3, out4, out5, out6, out7) { \ |
| 45 LD_B4(RTYPE, (psrc), stride, out0, out1, out2, out3); \ |
| 46 LD_B4(RTYPE, (psrc) + 4 * stride, stride, out4, out5, out6, out7); \ |
| 47 } |
| 48 #define LD_UB8(...) LD_B8(v16u8, __VA_ARGS__) |
| 49 |
43 /* Description : Store two vectors with stride each having 16 'byte' sized | 50 /* Description : Store two vectors with stride each having 16 'byte' sized |
44 elements | 51 elements |
45 Arguments : Inputs - in0, in1, pdst, stride | 52 Arguments : Inputs - in0, in1, pdst, stride |
46 Details : Store 16 byte elements from 'in0' to (pdst) | 53 Details : Store 16 byte elements from 'in0' to (pdst) |
47 Store 16 byte elements from 'in1' to (pdst + stride) | 54 Store 16 byte elements from 'in1' to (pdst + stride) |
48 */ | 55 */ |
49 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \ | 56 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \ |
50 ST_B(RTYPE, in0, (pdst)); \ | 57 ST_B(RTYPE, in0, (pdst)); \ |
51 ST_B(RTYPE, in1, (pdst) + stride); \ | 58 ST_B(RTYPE, in1, (pdst) + stride); \ |
52 } | 59 } |
(...skipping 24 matching lines...) Expand all Loading... |
77 Return Type - as per RTYPE | 84 Return Type - as per RTYPE |
78 Details : Right half of byte elements from 'in0' and 'in1' are | 85 Details : Right half of byte elements from 'in0' and 'in1' are |
79 interleaved and written to 'out0' | 86 interleaved and written to 'out0' |
80 */ | 87 */ |
81 #define ILVRL_B2(RTYPE, in0, in1, out0, out1) { \ | 88 #define ILVRL_B2(RTYPE, in0, in1, out0, out1) { \ |
82 out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \ | 89 out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \ |
83 out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \ | 90 out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \ |
84 } | 91 } |
85 #define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__) | 92 #define ILVRL_B2_UB(...) ILVRL_B2(v16u8, __VA_ARGS__) |
86 | 93 |
| 94 /* Description : Pack even byte elements of vector pairs |
| 95 Arguments : Inputs - in0, in1, in2, in3 |
| 96 Outputs - out0, out1 |
| 97 Return Type - as per RTYPE |
| 98 Details : Even byte elements of 'in0' are copied to the left half of |
| 99 'out0' & even byte elements of 'in1' are copied to the right |
| 100 half of 'out0'. |
| 101 */ |
| 102 #define PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) { \ |
| 103 out0 = (RTYPE) __msa_pckev_b((v16i8) in0, (v16i8) in1); \ |
| 104 out1 = (RTYPE) __msa_pckev_b((v16i8) in2, (v16i8) in3); \ |
| 105 } |
| 106 #define PCKEV_B2_UB(...) PCKEV_B2(v16u8, __VA_ARGS__) |
| 107 |
| 108 #define PCKEV_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ |
| 109 out0, out1, out2, out3) { \ |
| 110 PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1); \ |
| 111 PCKEV_B2(RTYPE, in4, in5, in6, in7, out2, out3); \ |
| 112 } |
| 113 #define PCKEV_B4_UB(...) PCKEV_B4(v16u8, __VA_ARGS__) |
| 114 |
| 115 /* Description : Pack odd byte elements of vector pairs |
| 116 Arguments : Inputs - in0, in1, in2, in3 |
| 117 Outputs - out0, out1 |
| 118 Return Type - as per RTYPE |
| 119 Details : Odd byte elements of 'in0' are copied to the left half of |
| 120 'out0' & odd byte elements of 'in1' are copied to the right |
| 121 half of 'out0'. |
| 122 */ |
| 123 #define PCKOD_B2(RTYPE, in0, in1, in2, in3, out0, out1) { \ |
| 124 out0 = (RTYPE) __msa_pckod_b((v16i8) in0, (v16i8) in1); \ |
| 125 out1 = (RTYPE) __msa_pckod_b((v16i8) in2, (v16i8) in3); \ |
| 126 } |
| 127 #define PCKOD_B2_UB(...) PCKOD_B2(v16u8, __VA_ARGS__) |
| 128 |
| 129 #define PCKOD_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ |
| 130 out0, out1, out2, out3) { \ |
| 131 PCKOD_B2(RTYPE, in0, in1, in2, in3, out0, out1); \ |
| 132 PCKOD_B2(RTYPE, in4, in5, in6, in7, out2, out3); \ |
| 133 } |
| 134 #define PCKOD_B4_UB(...) PCKOD_B4(v16u8, __VA_ARGS__) |
| 135 |
| 136 /* Description : average with rounding (in0 + in1 + 1) / 2. |
| 137 Arguments : Inputs - in0, in1, in2, in3, |
| 138 Outputs - out0, out1 |
| 139 Return Type - as per RTYPE |
| 140 Details : Each unsigned byte element from 'in0' vector is added with |
| 141 each unsigned byte element from 'in1' vector. Then the average |
| 142 with rounding is calculated and written to 'out0' |
| 143 */ |
| 144 #define AVER_UB2(RTYPE, in0, in1, in2, in3, out0, out1) { \ |
| 145 out0 = (RTYPE) __msa_aver_u_b((v16u8) in0, (v16u8) in1); \ |
| 146 out1 = (RTYPE) __msa_aver_u_b((v16u8) in2, (v16u8) in3); \ |
| 147 } |
| 148 #define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__) |
| 149 |
87 #endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */ | 150 #endif /* !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) */ |
88 | 151 |
89 #endif // INCLUDE_LIBYUV_MACROS_MSA_H_ | 152 #endif // INCLUDE_LIBYUV_MACROS_MSA_H_ |
OLD | NEW |