OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 #undef YG | 165 #undef YG |
166 #undef YGB | 166 #undef YGB |
167 #undef UB | 167 #undef UB |
168 #undef UG | 168 #undef UG |
169 #undef VG | 169 #undef VG |
170 #undef VR | 170 #undef VR |
171 #undef BB | 171 #undef BB |
172 #undef BG | 172 #undef BG |
173 #undef BR | 173 #undef BR |
174 | 174 |
| 175 // JPEG YUV to RGB reference |
| 176 // * R = Y - V * -1.40200 |
| 177 // * G = Y - U * 0.34414 - V * 0.71414 |
| 178 // * B = Y - U * -1.77200 |
| 179 |
| 180 // Y contribution to R,G,B. Scale and bias. |
| 181 // TODO(fbarchard): Consider moving constants into a common header. |
| 182 #define YGJ 16320 /* round(1.000 * 64 * 256 * 256 / 257) */ |
| 183 #define YGBJ 32 /* 64 / 2 */ |
| 184 |
| 185 // U and V contributions to R,G,B. |
| 186 #define UBJ -113 /* round(-1.77200 * 64) */ |
| 187 #define UGJ 22 /* round(0.34414 * 64) */ |
| 188 #define VGJ 46 /* round(0.71414 * 64) */ |
| 189 #define VRJ -90 /* round(-1.40200 * 64) */ |
| 190 |
| 191 // Bias values to subtract 16 from Y and 128 from U and V. |
| 192 #define BBJ (UBJ * 128 + YGBJ) |
| 193 #define BGJ (UGJ * 128 + VGJ * 128 + YGBJ) |
| 194 #define BRJ (VRJ * 128 + YGBJ) |
| 195 |
| 196 // JPEG constants for YUV to RGB. |
| 197 YuvConstantsNEON SIMD_ALIGNED(kYuvJConstantsNEON) = { |
| 198 { -UBJ, -UBJ, -UBJ, -UBJ, -VRJ, -VRJ, -VRJ, -VRJ, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 199 { UGJ, UGJ, UGJ, UGJ, VGJ, VGJ, VGJ, VGJ, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 200 { BBJ, BGJ, BRJ, 0, 0, 0, 0, 0 }, |
| 201 { 0x0101 * YGJ, 0, 0, 0 } |
| 202 }; |
| 203 |
| 204 #undef YGJ |
| 205 #undef YGBJ |
| 206 #undef UBJ |
| 207 #undef UGJ |
| 208 #undef VGJ |
| 209 #undef VRJ |
| 210 #undef BBJ |
| 211 #undef BGJ |
| 212 #undef BRJ |
| 213 |
| 214 |
175 void I444ToARGBRow_NEON(const uint8* src_y, | 215 void I444ToARGBRow_NEON(const uint8* src_y, |
176 const uint8* src_u, | 216 const uint8* src_u, |
177 const uint8* src_v, | 217 const uint8* src_v, |
178 uint8* dst_argb, | 218 uint8* dst_argb, |
179 int width) { | 219 int width) { |
180 asm volatile ( | 220 asm volatile ( |
181 YUV422TORGB_SETUP_REG | 221 YUV422TORGB_SETUP_REG |
182 "1: \n" | 222 "1: \n" |
183 READYUV444 | 223 READYUV444 |
184 YUV422TORGB | 224 YUV422TORGB |
(...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3001 "r"(6) // %5 | 3041 "r"(6) // %5 |
3002 : "cc", "memory", "q0", "q1" // Clobber List | 3042 : "cc", "memory", "q0", "q1" // Clobber List |
3003 ); | 3043 ); |
3004 } | 3044 } |
3005 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) | 3045 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) |
3006 | 3046 |
3007 #ifdef __cplusplus | 3047 #ifdef __cplusplus |
3008 } // extern "C" | 3048 } // extern "C" |
3009 } // namespace libyuv | 3049 } // namespace libyuv |
3010 #endif | 3050 #endif |
OLD | NEW |