YCbCrUtils.h (1850B)
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef Y_CB_CR_UTILS_H_ 7 #define Y_CB_CR_UTILS_H_ 8 9 #include "ErrorList.h" 10 #include "ImageContainer.h" 11 #include "mozilla/gfx/Types.h" 12 13 namespace mozilla { 14 namespace gfx { 15 16 void 17 GetYCbCrToRGBDestFormatAndSize(const layers::PlanarYCbCrData& aData, 18 SurfaceFormat& aSuggestedFormat, 19 IntSize& aSuggestedSize); 20 21 nsresult 22 ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData, 23 const SurfaceFormat& aDestFormat, 24 const IntSize& aDestSize, 25 unsigned char* aDestBuffer, 26 int32_t aStride); 27 28 using PremultFunc = int (*)(const uint8_t* src_argb, int src_stride_argb, 29 uint8_t* dst_argb, int dst_stride_argb, int width, 30 int height); 31 32 // Convert given YUV data w/ or w/out alpha into BGRA or BGRX data. 33 nsresult 34 ConvertYCbCrToRGB32(const layers::PlanarYCbCrData& aData, 35 const SurfaceFormat& aDestFormat, 36 unsigned char* aDestBuffer, 37 int32_t aStride, 38 PremultFunc premultiplyAlphaOp); 39 40 nsresult 41 ConvertI420AlphaToARGB(const uint8_t* aSrcY, 42 const uint8_t* aSrcU, 43 const uint8_t* aSrcV, 44 const uint8_t* aSrcA, 45 int aSrcStrideYA, int aSrcStrideUV, 46 uint8_t* aDstARGB, int aDstStrideARGB, 47 int aWidth, int aHeight); 48 } // namespace gfx 49 } // namespace mozilla 50 51 #endif /* Y_CB_CR_UTILS_H_ */