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_ // NOLINT 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 // I420Copy in convert to I420ToI420. 25 26 LIBYUV_API 27 int I420ToI422(const uint8* src_y, int src_stride_y, 28 const uint8* src_u, int src_stride_u, 29 const uint8* src_v, int src_stride_v, 30 uint8* dst_y, int dst_stride_y, 31 uint8* dst_u, int dst_stride_u, 32 uint8* dst_v, int dst_stride_v, 33 int width, int height); 34 35 LIBYUV_API 36 int I420ToI444(const uint8* src_y, int src_stride_y, 37 const uint8* src_u, int src_stride_u, 38 const uint8* src_v, int src_stride_v, 39 uint8* dst_y, int dst_stride_y, 40 uint8* dst_u, int dst_stride_u, 41 uint8* dst_v, int dst_stride_v, 42 int width, int height); 43 44 LIBYUV_API 45 int I420ToI411(const uint8* src_y, int src_stride_y, 46 const uint8* src_u, int src_stride_u, 47 const uint8* src_v, int src_stride_v, 48 uint8* dst_y, int dst_stride_y, 49 uint8* dst_u, int dst_stride_u, 50 uint8* dst_v, int dst_stride_v, 51 int width, int height); 52 53 // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21. 54 LIBYUV_API 55 int I400Copy(const uint8* src_y, int src_stride_y, 56 uint8* dst_y, int dst_stride_y, 57 int width, int height); 58 59 LIBYUV_API 60 int I420ToNV12(const uint8* src_y, int src_stride_y, 61 const uint8* src_u, int src_stride_u, 62 const uint8* src_v, int src_stride_v, 63 uint8* dst_y, int dst_stride_y, 64 uint8* dst_uv, int dst_stride_uv, 65 int width, int height); 66 67 LIBYUV_API 68 int I420ToNV21(const uint8* src_y, int src_stride_y, 69 const uint8* src_u, int src_stride_u, 70 const uint8* src_v, int src_stride_v, 71 uint8* dst_y, int dst_stride_y, 72 uint8* dst_vu, int dst_stride_vu, 73 int width, int height); 74 75 LIBYUV_API 76 int I420ToYUY2(const uint8* src_y, int src_stride_y, 77 const uint8* src_u, int src_stride_u, 78 const uint8* src_v, int src_stride_v, 79 uint8* dst_frame, int dst_stride_frame, 80 int width, int height); 81 82 LIBYUV_API 83 int I420ToUYVY(const uint8* src_y, int src_stride_y, 84 const uint8* src_u, int src_stride_u, 85 const uint8* src_v, int src_stride_v, 86 uint8* dst_frame, int dst_stride_frame, 87 int width, int height); 88 89 LIBYUV_API 90 int I420ToARGB(const uint8* src_y, int src_stride_y, 91 const uint8* src_u, int src_stride_u, 92 const uint8* src_v, int src_stride_v, 93 uint8* dst_argb, int dst_stride_argb, 94 int width, int height); 95 96 LIBYUV_API 97 int I420ToBGRA(const uint8* src_y, int src_stride_y, 98 const uint8* src_u, int src_stride_u, 99 const uint8* src_v, int src_stride_v, 100 uint8* dst_argb, int dst_stride_argb, 101 int width, int height); 102 103 LIBYUV_API 104 int I420ToABGR(const uint8* src_y, int src_stride_y, 105 const uint8* src_u, int src_stride_u, 106 const uint8* src_v, int src_stride_v, 107 uint8* dst_argb, int dst_stride_argb, 108 int width, int height); 109 110 LIBYUV_API 111 int I420ToRGBA(const uint8* src_y, int src_stride_y, 112 const uint8* src_u, int src_stride_u, 113 const uint8* src_v, int src_stride_v, 114 uint8* dst_rgba, int dst_stride_rgba, 115 int width, int height); 116 117 LIBYUV_API 118 int I420ToRGB24(const uint8* src_y, int src_stride_y, 119 const uint8* src_u, int src_stride_u, 120 const uint8* src_v, int src_stride_v, 121 uint8* dst_frame, int dst_stride_frame, 122 int width, int height); 123 124 LIBYUV_API 125 int I420ToRAW(const uint8* src_y, int src_stride_y, 126 const uint8* src_u, int src_stride_u, 127 const uint8* src_v, int src_stride_v, 128 uint8* dst_frame, int dst_stride_frame, 129 int width, int height); 130 131 LIBYUV_API 132 int I420ToRGB565(const uint8* src_y, int src_stride_y, 133 const uint8* src_u, int src_stride_u, 134 const uint8* src_v, int src_stride_v, 135 uint8* dst_frame, int dst_stride_frame, 136 int width, int height); 137 138 // Convert I420 To RGB565 with 4x4 dither matrix (16 bytes). 139 // Values in dither matrix from 0 to 7 recommended. 140 // The order of the dither matrix is first byte is upper left. 141 142 LIBYUV_API 143 int I420ToRGB565Dither(const uint8* src_y, int src_stride_y, 144 const uint8* src_u, int src_stride_u, 145 const uint8* src_v, int src_stride_v, 146 uint8* dst_frame, int dst_stride_frame, 147 const uint8* dither4x4, int width, int height); 148 149 LIBYUV_API 150 int I420ToARGB1555(const uint8* src_y, int src_stride_y, 151 const uint8* src_u, int src_stride_u, 152 const uint8* src_v, int src_stride_v, 153 uint8* dst_frame, int dst_stride_frame, 154 int width, int height); 155 156 LIBYUV_API 157 int I420ToARGB4444(const uint8* src_y, int src_stride_y, 158 const uint8* src_u, int src_stride_u, 159 const uint8* src_v, int src_stride_v, 160 uint8* dst_frame, int dst_stride_frame, 161 int width, int height); 162 163 // Convert I420 to specified format. 164 // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the 165 // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. 166 LIBYUV_API 167 int ConvertFromI420(const uint8* y, int y_stride, 168 const uint8* u, int u_stride, 169 const uint8* v, int v_stride, 170 uint8* dst_sample, int dst_sample_stride, 171 int width, int height, 172 uint32 format); 173 174 #ifdef __cplusplus 175 } // extern "C" 176 } // namespace libyuv 177 #endif 178 179 #endif // INCLUDE_LIBYUV_CONVERT_FROM_H_ NOLINT 180