| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 "vqadd.s16 q8, q0, q13 \n" /* B */ \ | 127 "vqadd.s16 q8, q0, q13 \n" /* B */ \ |
| 128 "vqadd.s16 q9, q0, q14 \n" /* R */ \ | 128 "vqadd.s16 q9, q0, q14 \n" /* R */ \ |
| 129 "vqadd.s16 q0, q0, q4 \n" /* G */ \ | 129 "vqadd.s16 q0, q0, q4 \n" /* G */ \ |
| 130 "vqadd.s16 q8, q8, q1 \n" /* B */ \ | 130 "vqadd.s16 q8, q8, q1 \n" /* B */ \ |
| 131 "vqadd.s16 q9, q9, q10 \n" /* R */ \ | 131 "vqadd.s16 q9, q9, q10 \n" /* R */ \ |
| 132 "vqsub.s16 q0, q0, q3 \n" /* G */ \ | 132 "vqsub.s16 q0, q0, q3 \n" /* G */ \ |
| 133 "vqshrun.s16 d20, q8, #6 \n" /* B */ \ | 133 "vqshrun.s16 d20, q8, #6 \n" /* B */ \ |
| 134 "vqshrun.s16 d22, q9, #6 \n" /* R */ \ | 134 "vqshrun.s16 d22, q9, #6 \n" /* R */ \ |
| 135 "vqshrun.s16 d21, q0, #6 \n" /* G */ | 135 "vqshrun.s16 d21, q0, #6 \n" /* G */ |
| 136 | 136 |
| 137 // BT.601 YUV to RGB reference | |
| 138 // R = (Y - 16) * 1.164 - V * -1.596 | |
| 139 // G = (Y - 16) * 1.164 - U * 0.391 - V * 0.813 | |
| 140 // B = (Y - 16) * 1.164 - U * -2.018 | |
| 141 | |
| 142 // Y contribution to R,G,B. Scale and bias. | |
| 143 // TODO(fbarchard): Consider moving constants into a common header. | |
| 144 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */ | |
| 145 #define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */ | |
| 146 | |
| 147 // U and V contributions to R,G,B. | |
| 148 #define UB -128 /* max(-128, round(-2.018 * 64)) */ | |
| 149 #define UG 25 /* round(0.391 * 64) */ | |
| 150 #define VG 52 /* round(0.813 * 64) */ | |
| 151 #define VR -102 /* round(-1.596 * 64) */ | |
| 152 | |
| 153 // Bias values to subtract 16 from Y and 128 from U and V. | |
| 154 #define BB (UB * 128 + YGB) | |
| 155 #define BG (UG * 128 + VG * 128 + YGB) | |
| 156 #define BR (VR * 128 + YGB) | |
| 157 | |
| 158 YuvConstantsNEON SIMD_ALIGNED(kYuvConstantsNEON) = { | |
| 159 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, | |
| 160 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, | |
| 161 { BB, BG, BR, 0, 0, 0, 0, 0 }, | |
| 162 { 0x0101 * YG, 0, 0, 0 } | |
| 163 }; | |
| 164 | |
| 165 #undef YG | |
| 166 #undef YGB | |
| 167 #undef UB | |
| 168 #undef UG | |
| 169 #undef VG | |
| 170 #undef VR | |
| 171 #undef BB | |
| 172 #undef BG | |
| 173 #undef BR | |
| 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 // 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 | |
| 252 | |
| 253 void I444ToARGBRow_NEON(const uint8* src_y, | 137 void I444ToARGBRow_NEON(const uint8* src_y, |
| 254 const uint8* src_u, | 138 const uint8* src_u, |
| 255 const uint8* src_v, | 139 const uint8* src_v, |
| 256 uint8* dst_argb, | 140 uint8* dst_argb, |
| 257 int width) { | 141 int width) { |
| 258 asm volatile ( | 142 asm volatile ( |
| 259 YUV422TORGB_SETUP_REG | 143 YUV422TORGB_SETUP_REG |
| 260 "1: \n" | 144 "1: \n" |
| 261 READYUV444 | 145 READYUV444 |
| 262 YUV422TORGB | 146 YUV422TORGB |
| (...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3080 "r"(6) // %5 | 2964 "r"(6) // %5 |
| 3081 : "cc", "memory", "q0", "q1" // Clobber List | 2965 : "cc", "memory", "q0", "q1" // Clobber List |
| 3082 ); | 2966 ); |
| 3083 } | 2967 } |
| 3084 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) | 2968 #endif // defined(__ARM_NEON__) && !defined(__aarch64__) |
| 3085 | 2969 |
| 3086 #ifdef __cplusplus | 2970 #ifdef __cplusplus |
| 3087 } // extern "C" | 2971 } // extern "C" |
| 3088 } // namespace libyuv | 2972 } // namespace libyuv |
| 3089 #endif | 2973 #endif |
| OLD | NEW |