| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2014 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 "sqadd " #vB ".8h, v24.8h, v0.8h \n" /* B */ \ | 122 "sqadd " #vB ".8h, v24.8h, v0.8h \n" /* B */ \ |
| 123 "sqadd " #vG ".8h, v25.8h, v0.8h \n" /* G */ \ | 123 "sqadd " #vG ".8h, v25.8h, v0.8h \n" /* G */ \ |
| 124 "sqadd " #vR ".8h, v26.8h, v0.8h \n" /* R */ \ | 124 "sqadd " #vR ".8h, v26.8h, v0.8h \n" /* R */ \ |
| 125 "sqadd " #vB ".8h, " #vB ".8h, v3.8h \n" /* B */ \ | 125 "sqadd " #vB ".8h, " #vB ".8h, v3.8h \n" /* B */ \ |
| 126 "sqsub " #vG ".8h, " #vG ".8h, v6.8h \n" /* G */ \ | 126 "sqsub " #vG ".8h, " #vG ".8h, v6.8h \n" /* G */ \ |
| 127 "sqadd " #vR ".8h, " #vR ".8h, v7.8h \n" /* R */ \ | 127 "sqadd " #vR ".8h, " #vR ".8h, v7.8h \n" /* R */ \ |
| 128 "sqshrun " #vB ".8b, " #vB ".8h, #6 \n" /* B */ \ | 128 "sqshrun " #vB ".8b, " #vB ".8h, #6 \n" /* B */ \ |
| 129 "sqshrun " #vG ".8b, " #vG ".8h, #6 \n" /* G */ \ | 129 "sqshrun " #vG ".8b, " #vG ".8h, #6 \n" /* G */ \ |
| 130 "sqshrun " #vR ".8b, " #vR ".8h, #6 \n" /* R */ \ | 130 "sqshrun " #vR ".8b, " #vR ".8h, #6 \n" /* R */ \ |
| 131 | 131 |
| 132 // BT.601 YUV to RGB reference | |
| 133 // R = (Y - 16) * 1.164 - V * -1.596 | |
| 134 // G = (Y - 16) * 1.164 - U * 0.391 - V * 0.813 | |
| 135 // B = (Y - 16) * 1.164 - U * -2.018 | |
| 136 | |
| 137 // Y contribution to R,G,B. Scale and bias. | |
| 138 // TODO(fbarchard): Consider moving constants into a common header. | |
| 139 #define YG 18997 /* round(1.164 * 64 * 256 * 256 / 257) */ | |
| 140 #define YGB -1160 /* 1.164 * 64 * -16 + 64 / 2 */ | |
| 141 | |
| 142 // U and V contributions to R,G,B. | |
| 143 #define UB -128 /* max(-128, round(-2.018 * 64)) */ | |
| 144 #define UG 25 /* round(0.391 * 64) */ | |
| 145 #define VG 52 /* round(0.813 * 64) */ | |
| 146 #define VR -102 /* round(-1.596 * 64) */ | |
| 147 | |
| 148 // Bias values to subtract 16 from Y and 128 from U and V. | |
| 149 #define BB (UB * 128 + YGB) | |
| 150 #define BG (UG * 128 + VG * 128 + YGB) | |
| 151 #define BR (VR * 128 + YGB) | |
| 152 | |
| 153 YuvConstantsNEON SIMD_ALIGNED(kYuvConstantsNEON) = { | |
| 154 { -UB, -UB, -UB, -UB, -VR, -VR, -VR, -VR, 0, 0, 0, 0, 0, 0, 0, 0 }, | |
| 155 { UG, UG, UG, UG, VG, VG, VG, VG, 0, 0, 0, 0, 0, 0, 0, 0 }, | |
| 156 { BB, BG, BR, 0, 0, 0, 0, 0 }, | |
| 157 { 0x0101 * YG, 0, 0, 0 } | |
| 158 }; | |
| 159 | |
| 160 #undef YG | |
| 161 #undef YGB | |
| 162 #undef UB | |
| 163 #undef UG | |
| 164 #undef VG | |
| 165 #undef VR | |
| 166 #undef BB | |
| 167 #undef BG | |
| 168 #undef BR | |
| 169 | |
| 170 // TODO(fbarchard): Use structure for constants like 32 bit code. | 132 // TODO(fbarchard): Use structure for constants like 32 bit code. |
| 171 #define RGBTOUV_SETUP_REG \ | 133 #define RGBTOUV_SETUP_REG \ |
| 172 "movi v20.8h, #56, lsl #0 \n" /* UB/VR coefficient (0.875) / 2 */ \ | 134 "movi v20.8h, #56, lsl #0 \n" /* UB/VR coefficient (0.875) / 2 */ \ |
| 173 "movi v21.8h, #37, lsl #0 \n" /* UG coefficient (-0.5781) / 2 */ \ | 135 "movi v21.8h, #37, lsl #0 \n" /* UG coefficient (-0.5781) / 2 */ \ |
| 174 "movi v22.8h, #19, lsl #0 \n" /* UR coefficient (-0.2969) / 2 */ \ | 136 "movi v22.8h, #19, lsl #0 \n" /* UR coefficient (-0.2969) / 2 */ \ |
| 175 "movi v23.8h, #9, lsl #0 \n" /* VB coefficient (-0.1406) / 2 */ \ | 137 "movi v23.8h, #9, lsl #0 \n" /* VB coefficient (-0.1406) / 2 */ \ |
| 176 "movi v24.8h, #47, lsl #0 \n" /* VG coefficient (-0.7344) / 2 */ \ | 138 "movi v24.8h, #47, lsl #0 \n" /* VG coefficient (-0.7344) / 2 */ \ |
| 177 "movi v25.16b, #0x80 \n" /* 128.5 (0x8080 in 16-bit) */ | 139 "movi v25.16b, #0x80 \n" /* 128.5 (0x8080 in 16-bit) */ |
| 178 | 140 |
| 179 #ifdef HAS_I444TOARGBROW_NEON | 141 #ifdef HAS_I444TOARGBROW_NEON |
| (...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 : "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List | 3051 : "cc", "memory", "v0", "v1", "v2", "v3" // Clobber List |
| 3090 ); | 3052 ); |
| 3091 } | 3053 } |
| 3092 #endif // HAS_SOBELYROW_NEON | 3054 #endif // HAS_SOBELYROW_NEON |
| 3093 #endif // !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__) | 3055 #endif // !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__) |
| 3094 | 3056 |
| 3095 #ifdef __cplusplus | 3057 #ifdef __cplusplus |
| 3096 } // extern "C" | 3058 } // extern "C" |
| 3097 } // namespace libyuv | 3059 } // namespace libyuv |
| 3098 #endif | 3060 #endif |
| OLD | NEW |