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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 #undef YGJ | 204 #undef YGJ |
205 #undef YGBJ | 205 #undef YGBJ |
206 #undef UBJ | 206 #undef UBJ |
207 #undef UGJ | 207 #undef UGJ |
208 #undef VGJ | 208 #undef VGJ |
209 #undef VRJ | 209 #undef VRJ |
210 #undef BBJ | 210 #undef BBJ |
211 #undef BGJ | 211 #undef BGJ |
212 #undef BRJ | 212 #undef BRJ |
213 | 213 |
| 214 // BT.709 YUV to RGB reference |
| 215 // * R = Y - V * -1.28033 |
| 216 // * G = Y - U * 0.21482 - V * 0.38059 |
| 217 // * B = Y - U * -2.12798 |
| 218 |
| 219 // Y contribution to R,G,B. Scale and bias. |
| 220 // TODO(fbarchard): Consider moving constants into a common header. |
| 221 #define YGH 16320 /* round(1.000 * 64 * 256 * 256 / 257) */ |
| 222 #define YGBH 32 /* 64 / 2 */ |
| 223 |
| 224 // U and V contributions to R,G,B. |
| 225 #define UBH -128 /* max(-128, round(-2.12798 * 64)) */ |
| 226 #define UGH 14 /* round(0.21482 * 64) */ |
| 227 #define VGH 24 /* round(0.38059 * 64) */ |
| 228 #define VRH -82 /* round(-1.28033 * 64) */ |
| 229 |
| 230 // Bias values to round, and subtract 128 from U and V. |
| 231 #define BBH (UBH * 128 + YGBH) |
| 232 #define BGH (UGH * 128 + VGH * 128 + YGBH) |
| 233 #define BRH (VRH * 128 + YGBH) |
| 234 |
| 235 // BT.709 constants for YUV to RGB. |
| 236 YuvConstantsNEON SIMD_ALIGNED(kYuvHConstantsNEON) = { |
| 237 { -UBH, -UBH, -UBH, -UBH, -VRH, -VRH, -VRH, -VRH, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 238 { UGH, UGH, UGH, UGH, VGH, VGH, VGH, VGH, 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 239 { BBH, BGH, BRH, 0, 0, 0, 0, 0 }, |
| 240 { 0x0101 * YGH, 0, 0, 0 } |
| 241 }; |
| 242 |
| 243 #undef YGH |
| 244 #undef YGBH |
| 245 #undef UBH |
| 246 #undef UGH |
| 247 #undef VGH |
| 248 #undef VRH |
| 249 #undef BBH |
| 250 #undef BGH |
| 251 #undef BRH |
214 | 252 |
215 void I444ToARGBRow_NEON(const uint8* src_y, | 253 void I444ToARGBRow_NEON(const uint8* src_y, |
216 const uint8* src_u, | 254 const uint8* src_u, |
217 const uint8* src_v, | 255 const uint8* src_v, |
218 uint8* dst_argb, | 256 uint8* dst_argb, |
219 int width) { | 257 int width) { |
220 asm volatile ( | 258 asm volatile ( |
221 YUV422TORGB_SETUP_REG | 259 YUV422TORGB_SETUP_REG |
222 "1: \n" | 260 "1: \n" |
223 READYUV444 | 261 READYUV444 |
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 "r"(6) // %5 | 3079 "r"(6) // %5 |
3042 : "cc", "memory", "q0", "q1" // Clobber List | 3080 : "cc", "memory", "q0", "q1" // Clobber List |
3043 ); | 3081 ); |
3044 } | 3082 } |
3045 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) | 3083 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) |
3046 | 3084 |
3047 #ifdef __cplusplus | 3085 #ifdef __cplusplus |
3048 } // extern "C" | 3086 } // extern "C" |
3049 } // namespace libyuv | 3087 } // namespace libyuv |
3050 #endif | 3088 #endif |
OLD | NEW |