1 /* 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. 3 * 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 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ 12 #define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ 13 14 #include "libyuv/basic_types.h" 15 16 #ifdef __cplusplus 17 namespace libyuv { 18 extern "C" { 19 #endif 20 21 // Copy ARGB to ARGB. 22 #define ARGBToARGB ARGBCopy 23 LIBYUV_API 24 int ARGBCopy(const uint8_t* src_argb, 25 int src_stride_argb, 26 uint8_t* dst_argb, 27 int dst_stride_argb, 28 int width, 29 int height); 30 31 // Convert ARGB To BGRA. 32 LIBYUV_API 33 int ARGBToBGRA(const uint8_t* src_argb, 34 int src_stride_argb, 35 uint8_t* dst_bgra, 36 int dst_stride_bgra, 37 int width, 38 int height); 39 40 // Convert ARGB To ABGR. 41 LIBYUV_API 42 int ARGBToABGR(const uint8_t* src_argb, 43 int src_stride_argb, 44 uint8_t* dst_abgr, 45 int dst_stride_abgr, 46 int width, 47 int height); 48 49 // Convert ARGB To RGBA. 50 LIBYUV_API 51 int ARGBToRGBA(const uint8_t* src_argb, 52 int src_stride_argb, 53 uint8_t* dst_rgba, 54 int dst_stride_rgba, 55 int width, 56 int height); 57 58 // Aliases 59 #define ARGBToAB30 ABGRToAR30 60 #define ABGRToAB30 ARGBToAR30 61 62 // Convert ABGR To AR30. 63 LIBYUV_API 64 int ABGRToAR30(const uint8_t* src_abgr, 65 int src_stride_abgr, 66 uint8_t* dst_ar30, 67 int dst_stride_ar30, 68 int width, 69 int height); 70 71 // Convert ARGB To AR30. 72 LIBYUV_API 73 int ARGBToAR30(const uint8_t* src_argb, 74 int src_stride_argb, 75 uint8_t* dst_ar30, 76 int dst_stride_ar30, 77 int width, 78 int height); 79 80 // Aliases 81 #define ABGRToRGB24 ARGBToRAW 82 #define ABGRToRAW ARGBToRGB24 83 84 // Convert ARGB To RGB24. 85 LIBYUV_API 86 int ARGBToRGB24(const uint8_t* src_argb, 87 int src_stride_argb, 88 uint8_t* dst_rgb24, 89 int dst_stride_rgb24, 90 int width, 91 int height); 92 93 // Convert ARGB To RAW. 94 LIBYUV_API 95 int ARGBToRAW(const uint8_t* src_argb, 96 int src_stride_argb, 97 uint8_t* dst_raw, 98 int dst_stride_raw, 99 int width, 100 int height); 101 102 // Convert ARGB To RGB565. 103 LIBYUV_API 104 int ARGBToRGB565(const uint8_t* src_argb, 105 int src_stride_argb, 106 uint8_t* dst_rgb565, 107 int dst_stride_rgb565, 108 int width, 109 int height); 110 111 // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes). 112 // Values in dither matrix from 0 to 7 recommended. 113 // The order of the dither matrix is first byte is upper left. 114 // TODO(fbarchard): Consider pointer to 2d array for dither4x4. 115 // const uint8_t(*dither)[4][4]; 116 LIBYUV_API 117 int ARGBToRGB565Dither(const uint8_t* src_argb, 118 int src_stride_argb, 119 uint8_t* dst_rgb565, 120 int dst_stride_rgb565, 121 const uint8_t* dither4x4, 122 int width, 123 int height); 124 125 // Convert ARGB To ARGB1555. 126 LIBYUV_API 127 int ARGBToARGB1555(const uint8_t* src_argb, 128 int src_stride_argb, 129 uint8_t* dst_argb1555, 130 int dst_stride_argb1555, 131 int width, 132 int height); 133 134 // Convert ARGB To ARGB4444. 135 LIBYUV_API 136 int ARGBToARGB4444(const uint8_t* src_argb, 137 int src_stride_argb, 138 uint8_t* dst_argb4444, 139 int dst_stride_argb4444, 140 int width, 141 int height); 142 143 // Convert ARGB To I444. 144 LIBYUV_API 145 int ARGBToI444(const uint8_t* src_argb, 146 int src_stride_argb, 147 uint8_t* dst_y, 148 int dst_stride_y, 149 uint8_t* dst_u, 150 int dst_stride_u, 151 uint8_t* dst_v, 152 int dst_stride_v, 153 int width, 154 int height); 155 156 // Convert ARGB to AR64. 157 LIBYUV_API 158 int ARGBToAR64(const uint8_t* src_argb, 159 int src_stride_argb, 160 uint16_t* dst_ar64, 161 int dst_stride_ar64, 162 int width, 163 int height); 164 165 // Convert ABGR to AB64. 166 #define ABGRToAB64 ARGBToAR64 167 168 // Convert ARGB to AB64. 169 LIBYUV_API 170 int ARGBToAB64(const uint8_t* src_argb, 171 int src_stride_argb, 172 uint16_t* dst_ab64, 173 int dst_stride_ab64, 174 int width, 175 int height); 176 177 // Convert ABGR to AR64. 178 #define ABGRToAR64 ARGBToAB64 179 180 // Convert ARGB To I422. 181 LIBYUV_API 182 int ARGBToI422(const uint8_t* src_argb, 183 int src_stride_argb, 184 uint8_t* dst_y, 185 int dst_stride_y, 186 uint8_t* dst_u, 187 int dst_stride_u, 188 uint8_t* dst_v, 189 int dst_stride_v, 190 int width, 191 int height); 192 193 // Convert ARGB To I420. (also in convert.h) 194 LIBYUV_API 195 int ARGBToI420(const uint8_t* src_argb, 196 int src_stride_argb, 197 uint8_t* dst_y, 198 int dst_stride_y, 199 uint8_t* dst_u, 200 int dst_stride_u, 201 uint8_t* dst_v, 202 int dst_stride_v, 203 int width, 204 int height); 205 206 // Convert ARGB to J420. (JPeg full range I420). 207 LIBYUV_API 208 int ARGBToJ420(const uint8_t* src_argb, 209 int src_stride_argb, 210 uint8_t* dst_yj, 211 int dst_stride_yj, 212 uint8_t* dst_u, 213 int dst_stride_u, 214 uint8_t* dst_v, 215 int dst_stride_v, 216 int width, 217 int height); 218 219 // Convert ARGB to J422. 220 LIBYUV_API 221 int ARGBToJ422(const uint8_t* src_argb, 222 int src_stride_argb, 223 uint8_t* dst_yj, 224 int dst_stride_yj, 225 uint8_t* dst_u, 226 int dst_stride_u, 227 uint8_t* dst_v, 228 int dst_stride_v, 229 int width, 230 int height); 231 232 // Convert ARGB to J400. (JPeg full range). 233 LIBYUV_API 234 int ARGBToJ400(const uint8_t* src_argb, 235 int src_stride_argb, 236 uint8_t* dst_yj, 237 int dst_stride_yj, 238 int width, 239 int height); 240 241 // Convert RGBA to J400. (JPeg full range). 242 LIBYUV_API 243 int RGBAToJ400(const uint8_t* src_rgba, 244 int src_stride_rgba, 245 uint8_t* dst_yj, 246 int dst_stride_yj, 247 int width, 248 int height); 249 250 // Convert ARGB to I400. 251 LIBYUV_API 252 int ARGBToI400(const uint8_t* src_argb, 253 int src_stride_argb, 254 uint8_t* dst_y, 255 int dst_stride_y, 256 int width, 257 int height); 258 259 // Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB) 260 LIBYUV_API 261 int ARGBToG(const uint8_t* src_argb, 262 int src_stride_argb, 263 uint8_t* dst_g, 264 int dst_stride_g, 265 int width, 266 int height); 267 268 // Convert ARGB To NV12. 269 LIBYUV_API 270 int ARGBToNV12(const uint8_t* src_argb, 271 int src_stride_argb, 272 uint8_t* dst_y, 273 int dst_stride_y, 274 uint8_t* dst_uv, 275 int dst_stride_uv, 276 int width, 277 int height); 278 279 // Convert ARGB To NV21. 280 LIBYUV_API 281 int ARGBToNV21(const uint8_t* src_argb, 282 int src_stride_argb, 283 uint8_t* dst_y, 284 int dst_stride_y, 285 uint8_t* dst_vu, 286 int dst_stride_vu, 287 int width, 288 int height); 289 290 // Convert ABGR To NV12. 291 LIBYUV_API 292 int ABGRToNV12(const uint8_t* src_abgr, 293 int src_stride_abgr, 294 uint8_t* dst_y, 295 int dst_stride_y, 296 uint8_t* dst_uv, 297 int dst_stride_uv, 298 int width, 299 int height); 300 301 // Convert ABGR To NV21. 302 LIBYUV_API 303 int ABGRToNV21(const uint8_t* src_abgr, 304 int src_stride_abgr, 305 uint8_t* dst_y, 306 int dst_stride_y, 307 uint8_t* dst_vu, 308 int dst_stride_vu, 309 int width, 310 int height); 311 312 // Convert ARGB To YUY2. 313 LIBYUV_API 314 int ARGBToYUY2(const uint8_t* src_argb, 315 int src_stride_argb, 316 uint8_t* dst_yuy2, 317 int dst_stride_yuy2, 318 int width, 319 int height); 320 321 // Convert ARGB To UYVY. 322 LIBYUV_API 323 int ARGBToUYVY(const uint8_t* src_argb, 324 int src_stride_argb, 325 uint8_t* dst_uyvy, 326 int dst_stride_uyvy, 327 int width, 328 int height); 329 330 // RAW to JNV21 full range NV21 331 LIBYUV_API 332 int RAWToJNV21(const uint8_t* src_raw, 333 int src_stride_raw, 334 uint8_t* dst_y, 335 int dst_stride_y, 336 uint8_t* dst_vu, 337 int dst_stride_vu, 338 int width, 339 int height); 340 341 #ifdef __cplusplus 342 } // extern "C" 343 } // namespace libyuv 344 #endif 345 346 #endif // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_ 347