michael@0: /* michael@0: * Copyright 2011 The LibYuv Project Authors. All rights reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: #include "libyuv/format_conversion.h" michael@0: michael@0: #include "libyuv/basic_types.h" michael@0: #include "libyuv/cpu_id.h" michael@0: #include "libyuv/video_common.h" michael@0: #include "libyuv/row.h" michael@0: michael@0: #ifdef __cplusplus michael@0: namespace libyuv { michael@0: extern "C" { michael@0: #endif michael@0: michael@0: // generate a selector mask useful for pshufb michael@0: static uint32 GenerateSelector(int select0, int select1) { michael@0: return (uint32)(select0) | michael@0: (uint32)((select1 + 4) << 8) | michael@0: (uint32)((select0 + 8) << 16) | michael@0: (uint32)((select1 + 12) << 24); michael@0: } michael@0: michael@0: static int MakeSelectors(const int blue_index, michael@0: const int green_index, michael@0: const int red_index, michael@0: uint32 dst_fourcc_bayer, michael@0: uint32* index_map) { michael@0: // Now build a lookup table containing the indices for the four pixels in each michael@0: // 2x2 Bayer grid. michael@0: switch (dst_fourcc_bayer) { michael@0: case FOURCC_BGGR: michael@0: index_map[0] = GenerateSelector(blue_index, green_index); michael@0: index_map[1] = GenerateSelector(green_index, red_index); michael@0: break; michael@0: case FOURCC_GBRG: michael@0: index_map[0] = GenerateSelector(green_index, blue_index); michael@0: index_map[1] = GenerateSelector(red_index, green_index); michael@0: break; michael@0: case FOURCC_RGGB: michael@0: index_map[0] = GenerateSelector(red_index, green_index); michael@0: index_map[1] = GenerateSelector(green_index, blue_index); michael@0: break; michael@0: case FOURCC_GRBG: michael@0: index_map[0] = GenerateSelector(green_index, red_index); michael@0: index_map[1] = GenerateSelector(blue_index, green_index); michael@0: break; michael@0: default: michael@0: return -1; // Bad FourCC michael@0: } michael@0: return 0; michael@0: } michael@0: michael@0: // Converts 32 bit ARGB to Bayer RGB formats. michael@0: LIBYUV_API michael@0: int ARGBToBayer(const uint8* src_argb, int src_stride_argb, michael@0: uint8* dst_bayer, int dst_stride_bayer, michael@0: int width, int height, michael@0: uint32 dst_fourcc_bayer) { michael@0: if (height < 0) { michael@0: height = -height; michael@0: src_argb = src_argb + (height - 1) * src_stride_argb; michael@0: src_stride_argb = -src_stride_argb; michael@0: } michael@0: void (*ARGBToBayerRow)(const uint8* src_argb, uint8* dst_bayer, michael@0: uint32 selector, int pix) = ARGBToBayerRow_C; michael@0: #if defined(HAS_ARGBTOBAYERROW_SSSE3) michael@0: if (TestCpuFlag(kCpuHasSSSE3) && width >= 8 && michael@0: IS_ALIGNED(src_argb, 16) && IS_ALIGNED(src_stride_argb, 16)) { michael@0: ARGBToBayerRow = ARGBToBayerRow_Any_SSSE3; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: ARGBToBayerRow = ARGBToBayerRow_SSSE3; michael@0: } michael@0: } michael@0: #elif defined(HAS_ARGBTOBAYERROW_NEON) michael@0: if (TestCpuFlag(kCpuHasNEON) && width >= 8) { michael@0: ARGBToBayerRow = ARGBToBayerRow_Any_NEON; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: ARGBToBayerRow = ARGBToBayerRow_NEON; michael@0: } michael@0: } michael@0: #endif michael@0: const int blue_index = 0; // Offsets for ARGB format michael@0: const int green_index = 1; michael@0: const int red_index = 2; michael@0: uint32 index_map[2]; michael@0: if (MakeSelectors(blue_index, green_index, red_index, michael@0: dst_fourcc_bayer, index_map)) { michael@0: return -1; // Bad FourCC michael@0: } michael@0: michael@0: for (int y = 0; y < height; ++y) { michael@0: ARGBToBayerRow(src_argb, dst_bayer, index_map[y & 1], width); michael@0: src_argb += src_stride_argb; michael@0: dst_bayer += dst_stride_bayer; michael@0: } michael@0: return 0; michael@0: } michael@0: michael@0: #define AVG(a, b) (((a) + (b)) >> 1) michael@0: michael@0: static void BayerRowBG(const uint8* src_bayer0, int src_stride_bayer, michael@0: uint8* dst_argb, int pix) { michael@0: const uint8* src_bayer1 = src_bayer0 + src_stride_bayer; michael@0: uint8 g = src_bayer0[1]; michael@0: uint8 r = src_bayer1[1]; michael@0: for (int x = 0; x < pix - 2; x += 2) { michael@0: dst_argb[0] = src_bayer0[0]; michael@0: dst_argb[1] = AVG(g, src_bayer0[1]); michael@0: dst_argb[2] = AVG(r, src_bayer1[1]); michael@0: dst_argb[3] = 255U; michael@0: dst_argb[4] = AVG(src_bayer0[0], src_bayer0[2]); michael@0: dst_argb[5] = src_bayer0[1]; michael@0: dst_argb[6] = src_bayer1[1]; michael@0: dst_argb[7] = 255U; michael@0: g = src_bayer0[1]; michael@0: r = src_bayer1[1]; michael@0: src_bayer0 += 2; michael@0: src_bayer1 += 2; michael@0: dst_argb += 8; michael@0: } michael@0: dst_argb[0] = src_bayer0[0]; michael@0: dst_argb[1] = AVG(g, src_bayer0[1]); michael@0: dst_argb[2] = AVG(r, src_bayer1[1]); michael@0: dst_argb[3] = 255U; michael@0: if (!(pix & 1)) { michael@0: dst_argb[4] = src_bayer0[0]; michael@0: dst_argb[5] = src_bayer0[1]; michael@0: dst_argb[6] = src_bayer1[1]; michael@0: dst_argb[7] = 255U; michael@0: } michael@0: } michael@0: michael@0: static void BayerRowRG(const uint8* src_bayer0, int src_stride_bayer, michael@0: uint8* dst_argb, int pix) { michael@0: const uint8* src_bayer1 = src_bayer0 + src_stride_bayer; michael@0: uint8 g = src_bayer0[1]; michael@0: uint8 b = src_bayer1[1]; michael@0: for (int x = 0; x < pix - 2; x += 2) { michael@0: dst_argb[0] = AVG(b, src_bayer1[1]); michael@0: dst_argb[1] = AVG(g, src_bayer0[1]); michael@0: dst_argb[2] = src_bayer0[0]; michael@0: dst_argb[3] = 255U; michael@0: dst_argb[4] = src_bayer1[1]; michael@0: dst_argb[5] = src_bayer0[1]; michael@0: dst_argb[6] = AVG(src_bayer0[0], src_bayer0[2]); michael@0: dst_argb[7] = 255U; michael@0: g = src_bayer0[1]; michael@0: b = src_bayer1[1]; michael@0: src_bayer0 += 2; michael@0: src_bayer1 += 2; michael@0: dst_argb += 8; michael@0: } michael@0: dst_argb[0] = AVG(b, src_bayer1[1]); michael@0: dst_argb[1] = AVG(g, src_bayer0[1]); michael@0: dst_argb[2] = src_bayer0[0]; michael@0: dst_argb[3] = 255U; michael@0: if (!(pix & 1)) { michael@0: dst_argb[4] = src_bayer1[1]; michael@0: dst_argb[5] = src_bayer0[1]; michael@0: dst_argb[6] = src_bayer0[0]; michael@0: dst_argb[7] = 255U; michael@0: } michael@0: } michael@0: michael@0: static void BayerRowGB(const uint8* src_bayer0, int src_stride_bayer, michael@0: uint8* dst_argb, int pix) { michael@0: const uint8* src_bayer1 = src_bayer0 + src_stride_bayer; michael@0: uint8 b = src_bayer0[1]; michael@0: for (int x = 0; x < pix - 2; x += 2) { michael@0: dst_argb[0] = AVG(b, src_bayer0[1]); michael@0: dst_argb[1] = src_bayer0[0]; michael@0: dst_argb[2] = src_bayer1[0]; michael@0: dst_argb[3] = 255U; michael@0: dst_argb[4] = src_bayer0[1]; michael@0: dst_argb[5] = AVG(src_bayer0[0], src_bayer0[2]); michael@0: dst_argb[6] = AVG(src_bayer1[0], src_bayer1[2]); michael@0: dst_argb[7] = 255U; michael@0: b = src_bayer0[1]; michael@0: src_bayer0 += 2; michael@0: src_bayer1 += 2; michael@0: dst_argb += 8; michael@0: } michael@0: dst_argb[0] = AVG(b, src_bayer0[1]); michael@0: dst_argb[1] = src_bayer0[0]; michael@0: dst_argb[2] = src_bayer1[0]; michael@0: dst_argb[3] = 255U; michael@0: if (!(pix & 1)) { michael@0: dst_argb[4] = src_bayer0[1]; michael@0: dst_argb[5] = src_bayer0[0]; michael@0: dst_argb[6] = src_bayer1[0]; michael@0: dst_argb[7] = 255U; michael@0: } michael@0: } michael@0: michael@0: static void BayerRowGR(const uint8* src_bayer0, int src_stride_bayer, michael@0: uint8* dst_argb, int pix) { michael@0: const uint8* src_bayer1 = src_bayer0 + src_stride_bayer; michael@0: uint8 r = src_bayer0[1]; michael@0: for (int x = 0; x < pix - 2; x += 2) { michael@0: dst_argb[0] = src_bayer1[0]; michael@0: dst_argb[1] = src_bayer0[0]; michael@0: dst_argb[2] = AVG(r, src_bayer0[1]); michael@0: dst_argb[3] = 255U; michael@0: dst_argb[4] = AVG(src_bayer1[0], src_bayer1[2]); michael@0: dst_argb[5] = AVG(src_bayer0[0], src_bayer0[2]); michael@0: dst_argb[6] = src_bayer0[1]; michael@0: dst_argb[7] = 255U; michael@0: r = src_bayer0[1]; michael@0: src_bayer0 += 2; michael@0: src_bayer1 += 2; michael@0: dst_argb += 8; michael@0: } michael@0: dst_argb[0] = src_bayer1[0]; michael@0: dst_argb[1] = src_bayer0[0]; michael@0: dst_argb[2] = AVG(r, src_bayer0[1]); michael@0: dst_argb[3] = 255U; michael@0: if (!(pix & 1)) { michael@0: dst_argb[4] = src_bayer1[0]; michael@0: dst_argb[5] = src_bayer0[0]; michael@0: dst_argb[6] = src_bayer0[1]; michael@0: dst_argb[7] = 255U; michael@0: } michael@0: } michael@0: michael@0: // Converts any Bayer RGB format to ARGB. michael@0: LIBYUV_API michael@0: int BayerToARGB(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_argb, int dst_stride_argb, michael@0: int width, int height, michael@0: uint32 src_fourcc_bayer) { michael@0: if (height < 0) { michael@0: height = -height; michael@0: dst_argb = dst_argb + (height - 1) * dst_stride_argb; michael@0: dst_stride_argb = -dst_stride_argb; michael@0: } michael@0: void (*BayerRow0)(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_argb, int pix); michael@0: void (*BayerRow1)(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_argb, int pix); michael@0: switch (src_fourcc_bayer) { michael@0: case FOURCC_BGGR: michael@0: BayerRow0 = BayerRowBG; michael@0: BayerRow1 = BayerRowGR; michael@0: break; michael@0: case FOURCC_GBRG: michael@0: BayerRow0 = BayerRowGB; michael@0: BayerRow1 = BayerRowRG; michael@0: break; michael@0: case FOURCC_GRBG: michael@0: BayerRow0 = BayerRowGR; michael@0: BayerRow1 = BayerRowBG; michael@0: break; michael@0: case FOURCC_RGGB: michael@0: BayerRow0 = BayerRowRG; michael@0: BayerRow1 = BayerRowGB; michael@0: break; michael@0: default: michael@0: return -1; // Bad FourCC michael@0: } michael@0: michael@0: for (int y = 0; y < height - 1; y += 2) { michael@0: BayerRow0(src_bayer, src_stride_bayer, dst_argb, width); michael@0: BayerRow1(src_bayer + src_stride_bayer, -src_stride_bayer, michael@0: dst_argb + dst_stride_argb, width); michael@0: src_bayer += src_stride_bayer * 2; michael@0: dst_argb += dst_stride_argb * 2; michael@0: } michael@0: if (height & 1) { michael@0: BayerRow0(src_bayer, src_stride_bayer, dst_argb, width); michael@0: } michael@0: return 0; michael@0: } michael@0: michael@0: // Converts any Bayer RGB format to ARGB. michael@0: LIBYUV_API michael@0: int BayerToI420(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_y, int dst_stride_y, michael@0: uint8* dst_u, int dst_stride_u, michael@0: uint8* dst_v, int dst_stride_v, michael@0: int width, int height, michael@0: uint32 src_fourcc_bayer) { michael@0: // Negative height means invert the image. michael@0: if (height < 0) { michael@0: height = -height; michael@0: int halfheight = (height + 1) >> 1; michael@0: dst_y = dst_y + (height - 1) * dst_stride_y; michael@0: dst_u = dst_u + (halfheight - 1) * dst_stride_u; michael@0: dst_v = dst_v + (halfheight - 1) * dst_stride_v; michael@0: dst_stride_y = -dst_stride_y; michael@0: dst_stride_u = -dst_stride_u; michael@0: dst_stride_v = -dst_stride_v; michael@0: } michael@0: void (*BayerRow0)(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_argb, int pix); michael@0: void (*BayerRow1)(const uint8* src_bayer, int src_stride_bayer, michael@0: uint8* dst_argb, int pix); michael@0: michael@0: void (*ARGBToUVRow)(const uint8* src_argb0, int src_stride_argb, michael@0: uint8* dst_u, uint8* dst_v, int width) = ARGBToUVRow_C; michael@0: void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) = michael@0: ARGBToYRow_C; michael@0: #if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3) michael@0: if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) { michael@0: ARGBToUVRow = ARGBToUVRow_Any_SSSE3; michael@0: ARGBToYRow = ARGBToYRow_Any_SSSE3; michael@0: if (IS_ALIGNED(width, 16)) { michael@0: ARGBToYRow = ARGBToYRow_Unaligned_SSSE3; michael@0: ARGBToUVRow = ARGBToUVRow_SSSE3; michael@0: if (IS_ALIGNED(dst_y, 16) && IS_ALIGNED(dst_stride_y, 16)) { michael@0: ARGBToYRow = ARGBToYRow_SSSE3; michael@0: } michael@0: } michael@0: } michael@0: #elif defined(HAS_ARGBTOYROW_NEON) michael@0: if (TestCpuFlag(kCpuHasNEON) && width >= 8) { michael@0: ARGBToYRow = ARGBToYRow_Any_NEON; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: ARGBToYRow = ARGBToYRow_NEON; michael@0: } michael@0: if (width >= 16) { michael@0: ARGBToUVRow = ARGBToUVRow_Any_NEON; michael@0: if (IS_ALIGNED(width, 16)) { michael@0: ARGBToUVRow = ARGBToUVRow_NEON; michael@0: } michael@0: } michael@0: } michael@0: #endif michael@0: michael@0: switch (src_fourcc_bayer) { michael@0: case FOURCC_BGGR: michael@0: BayerRow0 = BayerRowBG; michael@0: BayerRow1 = BayerRowGR; michael@0: break; michael@0: case FOURCC_GBRG: michael@0: BayerRow0 = BayerRowGB; michael@0: BayerRow1 = BayerRowRG; michael@0: break; michael@0: case FOURCC_GRBG: michael@0: BayerRow0 = BayerRowGR; michael@0: BayerRow1 = BayerRowBG; michael@0: break; michael@0: case FOURCC_RGGB: michael@0: BayerRow0 = BayerRowRG; michael@0: BayerRow1 = BayerRowGB; michael@0: break; michael@0: default: michael@0: return -1; // Bad FourCC michael@0: } michael@0: michael@0: // Allocate 2 rows of ARGB. michael@0: const int kRowSize = (width * 4 + 15) & ~15; michael@0: align_buffer_64(row, kRowSize * 2); michael@0: for (int y = 0; y < height - 1; y += 2) { michael@0: BayerRow0(src_bayer, src_stride_bayer, row, width); michael@0: BayerRow1(src_bayer + src_stride_bayer, -src_stride_bayer, michael@0: row + kRowSize, width); michael@0: ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); michael@0: ARGBToYRow(row, dst_y, width); michael@0: ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); michael@0: src_bayer += src_stride_bayer * 2; michael@0: dst_y += dst_stride_y * 2; michael@0: dst_u += dst_stride_u; michael@0: dst_v += dst_stride_v; michael@0: } michael@0: if (height & 1) { michael@0: BayerRow0(src_bayer, src_stride_bayer, row, width); michael@0: ARGBToUVRow(row, 0, dst_u, dst_v, width); michael@0: ARGBToYRow(row, dst_y, width); michael@0: } michael@0: free_aligned_buffer_64(row); michael@0: return 0; michael@0: } michael@0: michael@0: // Convert I420 to Bayer. michael@0: LIBYUV_API michael@0: int I420ToBayer(const uint8* src_y, int src_stride_y, michael@0: const uint8* src_u, int src_stride_u, michael@0: const uint8* src_v, int src_stride_v, michael@0: uint8* dst_bayer, int dst_stride_bayer, michael@0: int width, int height, michael@0: uint32 dst_fourcc_bayer) { michael@0: // Negative height means invert the image. michael@0: if (height < 0) { michael@0: height = -height; michael@0: int halfheight = (height + 1) >> 1; michael@0: src_y = src_y + (height - 1) * src_stride_y; michael@0: src_u = src_u + (halfheight - 1) * src_stride_u; michael@0: src_v = src_v + (halfheight - 1) * src_stride_v; michael@0: src_stride_y = -src_stride_y; michael@0: src_stride_u = -src_stride_u; michael@0: src_stride_v = -src_stride_v; michael@0: } michael@0: void (*I422ToARGBRow)(const uint8* y_buf, michael@0: const uint8* u_buf, michael@0: const uint8* v_buf, michael@0: uint8* rgb_buf, michael@0: int width) = I422ToARGBRow_C; michael@0: #if defined(HAS_I422TOARGBROW_SSSE3) michael@0: if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) { michael@0: I422ToARGBRow = I422ToARGBRow_Any_SSSE3; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: I422ToARGBRow = I422ToARGBRow_SSSE3; michael@0: } michael@0: } michael@0: #endif michael@0: #if defined(HAS_I422TOARGBROW_AVX2) michael@0: if (TestCpuFlag(kCpuHasAVX2) && width >= 16) { michael@0: I422ToARGBRow = I422ToARGBRow_Any_AVX2; michael@0: if (IS_ALIGNED(width, 16)) { michael@0: I422ToARGBRow = I422ToARGBRow_AVX2; michael@0: } michael@0: } michael@0: #endif michael@0: #if defined(HAS_I422TOARGBROW_NEON) michael@0: if (TestCpuFlag(kCpuHasNEON) && width >= 8) { michael@0: I422ToARGBRow = I422ToARGBRow_Any_NEON; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: I422ToARGBRow = I422ToARGBRow_NEON; michael@0: } michael@0: } michael@0: #endif michael@0: #if defined(HAS_I422TOARGBROW_MIPS_DSPR2) michael@0: if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && michael@0: IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && michael@0: IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && michael@0: IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2)) { michael@0: I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; michael@0: } michael@0: #endif michael@0: michael@0: void (*ARGBToBayerRow)(const uint8* src_argb, uint8* dst_bayer, michael@0: uint32 selector, int pix) = ARGBToBayerRow_C; michael@0: #if defined(HAS_ARGBTOBAYERROW_SSSE3) michael@0: if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) { michael@0: ARGBToBayerRow = ARGBToBayerRow_Any_SSSE3; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: ARGBToBayerRow = ARGBToBayerRow_SSSE3; michael@0: } michael@0: } michael@0: #elif defined(HAS_ARGBTOBAYERROW_NEON) michael@0: if (TestCpuFlag(kCpuHasNEON) && width >= 8) { michael@0: ARGBToBayerRow = ARGBToBayerRow_Any_NEON; michael@0: if (IS_ALIGNED(width, 8)) { michael@0: ARGBToBayerRow = ARGBToBayerRow_NEON; michael@0: } michael@0: } michael@0: #endif michael@0: michael@0: const int blue_index = 0; // Offsets for ARGB format michael@0: const int green_index = 1; michael@0: const int red_index = 2; michael@0: uint32 index_map[2]; michael@0: if (MakeSelectors(blue_index, green_index, red_index, michael@0: dst_fourcc_bayer, index_map)) { michael@0: return -1; // Bad FourCC michael@0: } michael@0: // Allocate a row of ARGB. michael@0: align_buffer_64(row, width * 4); michael@0: for (int y = 0; y < height; ++y) { michael@0: I422ToARGBRow(src_y, src_u, src_v, row, width); michael@0: ARGBToBayerRow(row, dst_bayer, index_map[y & 1], width); michael@0: dst_bayer += dst_stride_bayer; michael@0: src_y += src_stride_y; michael@0: if (y & 1) { michael@0: src_u += src_stride_u; michael@0: src_v += src_stride_v; michael@0: } michael@0: } michael@0: free_aligned_buffer_64(row); michael@0: return 0; michael@0: } michael@0: michael@0: #define MAKEBAYERFOURCC(BAYER) \ michael@0: LIBYUV_API \ michael@0: int Bayer##BAYER##ToI420(const uint8* src_bayer, int src_stride_bayer, \ michael@0: uint8* dst_y, int dst_stride_y, \ michael@0: uint8* dst_u, int dst_stride_u, \ michael@0: uint8* dst_v, int dst_stride_v, \ michael@0: int width, int height) { \ michael@0: return BayerToI420(src_bayer, src_stride_bayer, \ michael@0: dst_y, dst_stride_y, \ michael@0: dst_u, dst_stride_u, \ michael@0: dst_v, dst_stride_v, \ michael@0: width, height, \ michael@0: FOURCC_##BAYER); \ michael@0: } \ michael@0: \ michael@0: LIBYUV_API \ michael@0: int I420ToBayer##BAYER(const uint8* src_y, int src_stride_y, \ michael@0: const uint8* src_u, int src_stride_u, \ michael@0: const uint8* src_v, int src_stride_v, \ michael@0: uint8* dst_bayer, int dst_stride_bayer, \ michael@0: int width, int height) { \ michael@0: return I420ToBayer(src_y, src_stride_y, \ michael@0: src_u, src_stride_u, \ michael@0: src_v, src_stride_v, \ michael@0: dst_bayer, dst_stride_bayer, \ michael@0: width, height, \ michael@0: FOURCC_##BAYER); \ michael@0: } \ michael@0: \ michael@0: LIBYUV_API \ michael@0: int ARGBToBayer##BAYER(const uint8* src_argb, int src_stride_argb, \ michael@0: uint8* dst_bayer, int dst_stride_bayer, \ michael@0: int width, int height) { \ michael@0: return ARGBToBayer(src_argb, src_stride_argb, \ michael@0: dst_bayer, dst_stride_bayer, \ michael@0: width, height, \ michael@0: FOURCC_##BAYER); \ michael@0: } \ michael@0: \ michael@0: LIBYUV_API \ michael@0: int Bayer##BAYER##ToARGB(const uint8* src_bayer, int src_stride_bayer, \ michael@0: uint8* dst_argb, int dst_stride_argb, \ michael@0: int width, int height) { \ michael@0: return BayerToARGB(src_bayer, src_stride_bayer, \ michael@0: dst_argb, dst_stride_argb, \ michael@0: width, height, \ michael@0: FOURCC_##BAYER); \ michael@0: } michael@0: michael@0: MAKEBAYERFOURCC(BGGR) michael@0: MAKEBAYERFOURCC(GBRG) michael@0: MAKEBAYERFOURCC(GRBG) michael@0: MAKEBAYERFOURCC(RGGB) michael@0: michael@0: #ifdef __cplusplus michael@0: } // extern "C" michael@0: } // namespace libyuv michael@0: #endif