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_FORMATCONVERSION_H_ // NOLINT 12 #define INCLUDE_LIBYUV_FORMATCONVERSION_H_ 13 14 #include "libyuv/basic_types.h" 15 16 #ifdef __cplusplus 17 namespace libyuv { 18 extern "C" { 19 #endif 20 21 // Convert Bayer RGB formats to I420. 22 LIBYUV_API 23 int BayerBGGRToI420(const uint8* src_bayer, int src_stride_bayer, 24 uint8* dst_y, int dst_stride_y, 25 uint8* dst_u, int dst_stride_u, 26 uint8* dst_v, int dst_stride_v, 27 int width, int height); 28 29 LIBYUV_API 30 int BayerGBRGToI420(const uint8* src_bayer, int src_stride_bayer, 31 uint8* dst_y, int dst_stride_y, 32 uint8* dst_u, int dst_stride_u, 33 uint8* dst_v, int dst_stride_v, 34 int width, int height); 35 36 LIBYUV_API 37 int BayerGRBGToI420(const uint8* src_bayer, int src_stride_bayer, 38 uint8* dst_y, int dst_stride_y, 39 uint8* dst_u, int dst_stride_u, 40 uint8* dst_v, int dst_stride_v, 41 int width, int height); 42 43 LIBYUV_API 44 int BayerRGGBToI420(const uint8* src_bayer, int src_stride_bayer, 45 uint8* dst_y, int dst_stride_y, 46 uint8* dst_u, int dst_stride_u, 47 uint8* dst_v, int dst_stride_v, 48 int width, int height); 49 50 // Temporary API mapper. 51 #define BayerRGBToI420(b, bs, f, y, ys, u, us, v, vs, w, h) \ 52 BayerToI420(b, bs, y, ys, u, us, v, vs, w, h, f) 53 54 LIBYUV_API 55 int BayerToI420(const uint8* src_bayer, int src_stride_bayer, 56 uint8* dst_y, int dst_stride_y, 57 uint8* dst_u, int dst_stride_u, 58 uint8* dst_v, int dst_stride_v, 59 int width, int height, 60 uint32 src_fourcc_bayer); 61 62 // Convert I420 to Bayer RGB formats. 63 LIBYUV_API 64 int I420ToBayerBGGR(const uint8* src_y, int src_stride_y, 65 const uint8* src_u, int src_stride_u, 66 const uint8* src_v, int src_stride_v, 67 uint8* dst_frame, int dst_stride_frame, 68 int width, int height); 69 70 LIBYUV_API 71 int I420ToBayerGBRG(const uint8* src_y, int src_stride_y, 72 const uint8* src_u, int src_stride_u, 73 const uint8* src_v, int src_stride_v, 74 uint8* dst_frame, int dst_stride_frame, 75 int width, int height); 76 77 LIBYUV_API 78 int I420ToBayerGRBG(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 I420ToBayerRGGB(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 // Temporary API mapper. 92 #define I420ToBayerRGB(y, ys, u, us, v, vs, b, bs, f, w, h) \ 93 I420ToBayer(y, ys, u, us, v, vs, b, bs, w, h, f) 94 95 LIBYUV_API 96 int I420ToBayer(const uint8* src_y, int src_stride_y, 97 const uint8* src_u, int src_stride_u, 98 const uint8* src_v, int src_stride_v, 99 uint8* dst_frame, int dst_stride_frame, 100 int width, int height, 101 uint32 dst_fourcc_bayer); 102 103 // Convert Bayer RGB formats to ARGB. 104 LIBYUV_API 105 int BayerBGGRToARGB(const uint8* src_bayer, int src_stride_bayer, 106 uint8* dst_argb, int dst_stride_argb, 107 int width, int height); 108 109 LIBYUV_API 110 int BayerGBRGToARGB(const uint8* src_bayer, int src_stride_bayer, 111 uint8* dst_argb, int dst_stride_argb, 112 int width, int height); 113 114 LIBYUV_API 115 int BayerGRBGToARGB(const uint8* src_bayer, int src_stride_bayer, 116 uint8* dst_argb, int dst_stride_argb, 117 int width, int height); 118 119 LIBYUV_API 120 int BayerRGGBToARGB(const uint8* src_bayer, int src_stride_bayer, 121 uint8* dst_argb, int dst_stride_argb, 122 int width, int height); 123 124 // Temporary API mapper. 125 #define BayerRGBToARGB(b, bs, f, a, as, w, h) BayerToARGB(b, bs, a, as, w, h, f) 126 127 LIBYUV_API 128 int BayerToARGB(const uint8* src_bayer, int src_stride_bayer, 129 uint8* dst_argb, int dst_stride_argb, 130 int width, int height, 131 uint32 src_fourcc_bayer); 132 133 // Converts ARGB to Bayer RGB formats. 134 LIBYUV_API 135 int ARGBToBayerBGGR(const uint8* src_argb, int src_stride_argb, 136 uint8* dst_bayer, int dst_stride_bayer, 137 int width, int height); 138 139 LIBYUV_API 140 int ARGBToBayerGBRG(const uint8* src_argb, int src_stride_argb, 141 uint8* dst_bayer, int dst_stride_bayer, 142 int width, int height); 143 144 LIBYUV_API 145 int ARGBToBayerGRBG(const uint8* src_argb, int src_stride_argb, 146 uint8* dst_bayer, int dst_stride_bayer, 147 int width, int height); 148 149 LIBYUV_API 150 int ARGBToBayerRGGB(const uint8* src_argb, int src_stride_argb, 151 uint8* dst_bayer, int dst_stride_bayer, 152 int width, int height); 153 154 // Temporary API mapper. 155 #define ARGBToBayerRGB(a, as, b, bs, f, w, h) ARGBToBayer(b, bs, a, as, w, h, f) 156 157 LIBYUV_API 158 int ARGBToBayer(const uint8* src_argb, int src_stride_argb, 159 uint8* dst_bayer, int dst_stride_bayer, 160 int width, int height, 161 uint32 dst_fourcc_bayer); 162 163 #ifdef __cplusplus 164 } // extern "C" 165 } // namespace libyuv 166 #endif 167 168 #endif // INCLUDE_LIBYUV_FORMATCONVERSION_H_ NOLINT 169