1 /* 2 * Copyright 2011 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_H_ 12 #define INCLUDE_LIBYUV_CONVERT_FROM_H_ 13 14 #include "libyuv/basic_types.h" 15 #include "libyuv/rotate.h" 16 17 #ifdef __cplusplus 18 namespace libyuv { 19 extern "C" { 20 #endif 21 22 // See Also convert.h for conversions from formats to I420. 23 24 // Convert 8 bit YUV to 10 bit. 25 #define H420ToH010 I420ToI010 26 LIBYUV_API 27 int I420ToI010(const uint8_t* src_y, 28 int src_stride_y, 29 const uint8_t* src_u, 30 int src_stride_u, 31 const uint8_t* src_v, 32 int src_stride_v, 33 uint16_t* dst_y, 34 int dst_stride_y, 35 uint16_t* dst_u, 36 int dst_stride_u, 37 uint16_t* dst_v, 38 int dst_stride_v, 39 int width, 40 int height); 41 42 // Convert 8 bit YUV to 12 bit. 43 #define H420ToH012 I420ToI012 44 LIBYUV_API 45 int I420ToI012(const uint8_t* src_y, 46 int src_stride_y, 47 const uint8_t* src_u, 48 int src_stride_u, 49 const uint8_t* src_v, 50 int src_stride_v, 51 uint16_t* dst_y, 52 int dst_stride_y, 53 uint16_t* dst_u, 54 int dst_stride_u, 55 uint16_t* dst_v, 56 int dst_stride_v, 57 int width, 58 int height); 59 60 LIBYUV_API 61 int I420ToI422(const uint8_t* src_y, 62 int src_stride_y, 63 const uint8_t* src_u, 64 int src_stride_u, 65 const uint8_t* src_v, 66 int src_stride_v, 67 uint8_t* dst_y, 68 int dst_stride_y, 69 uint8_t* dst_u, 70 int dst_stride_u, 71 uint8_t* dst_v, 72 int dst_stride_v, 73 int width, 74 int height); 75 76 LIBYUV_API 77 int I420ToI444(const uint8_t* src_y, 78 int src_stride_y, 79 const uint8_t* src_u, 80 int src_stride_u, 81 const uint8_t* src_v, 82 int src_stride_v, 83 uint8_t* dst_y, 84 int dst_stride_y, 85 uint8_t* dst_u, 86 int dst_stride_u, 87 uint8_t* dst_v, 88 int dst_stride_v, 89 int width, 90 int height); 91 92 // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21. 93 LIBYUV_API 94 int I400Copy(const uint8_t* src_y, 95 int src_stride_y, 96 uint8_t* dst_y, 97 int dst_stride_y, 98 int width, 99 int height); 100 101 LIBYUV_API 102 int I420ToNV12(const uint8_t* src_y, 103 int src_stride_y, 104 const uint8_t* src_u, 105 int src_stride_u, 106 const uint8_t* src_v, 107 int src_stride_v, 108 uint8_t* dst_y, 109 int dst_stride_y, 110 uint8_t* dst_uv, 111 int dst_stride_uv, 112 int width, 113 int height); 114 115 LIBYUV_API 116 int I420ToNV21(const uint8_t* src_y, 117 int src_stride_y, 118 const uint8_t* src_u, 119 int src_stride_u, 120 const uint8_t* src_v, 121 int src_stride_v, 122 uint8_t* dst_y, 123 int dst_stride_y, 124 uint8_t* dst_vu, 125 int dst_stride_vu, 126 int width, 127 int height); 128 129 LIBYUV_API 130 int I420ToYUY2(const uint8_t* src_y, 131 int src_stride_y, 132 const uint8_t* src_u, 133 int src_stride_u, 134 const uint8_t* src_v, 135 int src_stride_v, 136 uint8_t* dst_yuy2, 137 int dst_stride_yuy2, 138 int width, 139 int height); 140 141 LIBYUV_API 142 int I420ToUYVY(const uint8_t* src_y, 143 int src_stride_y, 144 const uint8_t* src_u, 145 int src_stride_u, 146 const uint8_t* src_v, 147 int src_stride_v, 148 uint8_t* dst_uyvy, 149 int dst_stride_uyvy, 150 int width, 151 int height); 152 153 // The following are from convert_argb.h 154 // DEPRECATED: The prototypes will be removed in future. Use convert_argb.h 155 156 // Convert I420 to ARGB. 157 LIBYUV_API 158 int I420ToARGB(const uint8_t* src_y, 159 int src_stride_y, 160 const uint8_t* src_u, 161 int src_stride_u, 162 const uint8_t* src_v, 163 int src_stride_v, 164 uint8_t* dst_argb, 165 int dst_stride_argb, 166 int width, 167 int height); 168 169 // Convert I420 to ABGR. 170 LIBYUV_API 171 int I420ToABGR(const uint8_t* src_y, 172 int src_stride_y, 173 const uint8_t* src_u, 174 int src_stride_u, 175 const uint8_t* src_v, 176 int src_stride_v, 177 uint8_t* dst_abgr, 178 int dst_stride_abgr, 179 int width, 180 int height); 181 182 // Convert I420 to specified format. 183 // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the 184 // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. 185 LIBYUV_API 186 int ConvertFromI420(const uint8_t* y, 187 int y_stride, 188 const uint8_t* u, 189 int u_stride, 190 const uint8_t* v, 191 int v_stride, 192 uint8_t* dst_sample, 193 int dst_sample_stride, 194 int width, 195 int height, 196 uint32_t fourcc); 197 198 #ifdef __cplusplus 199 } // extern "C" 200 } // namespace libyuv 201 #endif 202 203 #endif // INCLUDE_LIBYUV_CONVERT_FROM_H_ 204