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 // TODO(fbarchard): I420ToM420 60 61 LIBYUV_API 62 int I420ToNV12(const uint8* src_y, int src_stride_y, 63 const uint8* src_u, int src_stride_u, 64 const uint8* src_v, int src_stride_v, 65 uint8* dst_y, int dst_stride_y, 66 uint8* dst_uv, int dst_stride_uv, 67 int width, int height); 68 69 LIBYUV_API 70 int I420ToNV21(const uint8* src_y, int src_stride_y, 71 const uint8* src_u, int src_stride_u, 72 const uint8* src_v, int src_stride_v, 73 uint8* dst_y, int dst_stride_y, 74 uint8* dst_vu, int dst_stride_vu, 75 int width, int height); 76 77 LIBYUV_API 78 int I420ToYUY2(const uint8* src_y, int src_stride_y, 79 const uint8* src_u, int src_stride_u, 80 const uint8* src_v, int src_stride_v, 81 uint8* dst_frame, int dst_stride_frame, 82 int width, int height); 83 84 LIBYUV_API 85 int I420ToUYVY(const uint8* src_y, int src_stride_y, 86 const uint8* src_u, int src_stride_u, 87 const uint8* src_v, int src_stride_v, 88 uint8* dst_frame, int dst_stride_frame, 89 int width, int height); 90 91 LIBYUV_API 92 int I420ToARGB(const uint8* src_y, int src_stride_y, 93 const uint8* src_u, int src_stride_u, 94 const uint8* src_v, int src_stride_v, 95 uint8* dst_argb, int dst_stride_argb, 96 int width, int height); 97 98 LIBYUV_API 99 int I420ToBGRA(const uint8* src_y, int src_stride_y, 100 const uint8* src_u, int src_stride_u, 101 const uint8* src_v, int src_stride_v, 102 uint8* dst_argb, int dst_stride_argb, 103 int width, int height); 104 105 LIBYUV_API 106 int I420ToABGR(const uint8* src_y, int src_stride_y, 107 const uint8* src_u, int src_stride_u, 108 const uint8* src_v, int src_stride_v, 109 uint8* dst_argb, int dst_stride_argb, 110 int width, int height); 111 112 LIBYUV_API 113 int I420ToRGBA(const uint8* src_y, int src_stride_y, 114 const uint8* src_u, int src_stride_u, 115 const uint8* src_v, int src_stride_v, 116 uint8* dst_rgba, int dst_stride_rgba, 117 int width, int height); 118 119 LIBYUV_API 120 int I420ToRGB24(const uint8* src_y, int src_stride_y, 121 const uint8* src_u, int src_stride_u, 122 const uint8* src_v, int src_stride_v, 123 uint8* dst_frame, int dst_stride_frame, 124 int width, int height); 125 126 LIBYUV_API 127 int I420ToRAW(const uint8* src_y, int src_stride_y, 128 const uint8* src_u, int src_stride_u, 129 const uint8* src_v, int src_stride_v, 130 uint8* dst_frame, int dst_stride_frame, 131 int width, int height); 132 133 LIBYUV_API 134 int I420ToRGB565(const uint8* src_y, int src_stride_y, 135 const uint8* src_u, int src_stride_u, 136 const uint8* src_v, int src_stride_v, 137 uint8* dst_frame, int dst_stride_frame, 138 int width, int height); 139 140 // Convert I420 To RGB565 with 4x4 dither matrix (16 bytes). 141 // Values in dither matrix from 0 to 7 recommended. 142 // The order of the dither matrix is first byte is upper left. 143 144 LIBYUV_API 145 int I420ToRGB565Dither(const uint8* src_y, int src_stride_y, 146 const uint8* src_u, int src_stride_u, 147 const uint8* src_v, int src_stride_v, 148 uint8* dst_frame, int dst_stride_frame, 149 const uint8* dither4x4, int width, int height); 150 151 LIBYUV_API 152 int I420ToARGB1555(const uint8* src_y, int src_stride_y, 153 const uint8* src_u, int src_stride_u, 154 const uint8* src_v, int src_stride_v, 155 uint8* dst_frame, int dst_stride_frame, 156 int width, int height); 157 158 LIBYUV_API 159 int I420ToARGB4444(const uint8* src_y, int src_stride_y, 160 const uint8* src_u, int src_stride_u, 161 const uint8* src_v, int src_stride_v, 162 uint8* dst_frame, int dst_stride_frame, 163 int width, int height); 164 165 // Convert I420 to specified format. 166 // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the 167 // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal. 168 LIBYUV_API 169 int ConvertFromI420(const uint8* y, int y_stride, 170 const uint8* u, int u_stride, 171 const uint8* v, int v_stride, 172 uint8* dst_sample, int dst_sample_stride, 173 int width, int height, 174 uint32 format); 175 176 #ifdef __cplusplus 177 } // extern "C" 178 } // namespace libyuv 179 #endif 180 181 #endif // INCLUDE_LIBYUV_CONVERT_FROM_H_ NOLINT 182