diff options
author | Jeremy Andrews <athenian200@outlook.com> | 2023-10-23 22:20:36 -0500 |
---|---|---|
committer | Jeremy Andrews <athenian200@outlook.com> | 2023-10-24 00:58:50 -0500 |
commit | c48055d6ea9a63ee8a19a38c3e8759e3630b00fe (patch) | |
tree | 9efd7e9163ab4a6fbb296986101a1a027723efc7 /gfx | |
parent | 8b746b6c127dcf9c83ef860f28ebd2f2e367f5df (diff) | |
download | uxp-c48055d6ea9a63ee8a19a38c3e8759e3630b00fe.tar.gz |
Issue #2357 - VPXDecoder does not decode alpha frames.
Another requirement to have transparency in videos. Straight port of Firefox 53 implementation, save for some oddities relating to needing to put uint8_t instead of uint8 in yuv_convert to get this to compile.
Ref: BZ 1321076, 1329104
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/ycbcr/YCbCrUtils.cpp | 21 | ||||
-rw-r--r-- | gfx/ycbcr/YCbCrUtils.h | 11 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert.cpp | 21 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert.h | 12 |
4 files changed, 65 insertions, 0 deletions
diff --git a/gfx/ycbcr/YCbCrUtils.cpp b/gfx/ycbcr/YCbCrUtils.cpp index f5a4353e2f..0f9c2c8ebc 100644 --- a/gfx/ycbcr/YCbCrUtils.cpp +++ b/gfx/ycbcr/YCbCrUtils.cpp @@ -155,5 +155,26 @@ ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData, } } +void +ConvertYCbCrAToARGB(const uint8_t* aSrcY, + const uint8_t* aSrcU, + const uint8_t* aSrcV, + const uint8_t* aSrcA, + int aSrcStrideYA, int aSrcStrideUV, + uint8_t* aDstARGB, int aDstStrideARGB, + int aWidth, int aHeight) { + + ConvertYCbCrAToARGB32(aSrcY, + aSrcU, + aSrcV, + aSrcA, + aDstARGB, + aWidth, + aHeight, + aSrcStrideYA, + aSrcStrideUV, + aDstStrideARGB); +} + } // namespace gfx } // namespace mozilla diff --git a/gfx/ycbcr/YCbCrUtils.h b/gfx/ycbcr/YCbCrUtils.h index 1cd2e1c4fd..dcc7b5e9aa 100644 --- a/gfx/ycbcr/YCbCrUtils.h +++ b/gfx/ycbcr/YCbCrUtils.h @@ -24,6 +24,17 @@ ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData, unsigned char* aDestBuffer, int32_t aStride); +// Currently this function only has support for I420 type. +void +ConvertYCbCrAToARGB(const uint8_t* aSrcY, + const uint8_t* aSrcU, + const uint8_t* aSrcV, + const uint8_t* aSrcA, + int aSrcStrideYA, int aSrcStrideUV, + uint8_t* aDstARGB, int aDstStrideARGB, + int aWidth, int aHeight); + + } // namespace gfx } // namespace mozilla diff --git a/gfx/ycbcr/yuv_convert.cpp b/gfx/ycbcr/yuv_convert.cpp index d3a8c53312..89f6dcfa06 100644 --- a/gfx/ycbcr/yuv_convert.cpp +++ b/gfx/ycbcr/yuv_convert.cpp @@ -550,6 +550,27 @@ void ScaleYCbCrToRGB32_deprecated(const uint8_t* y_buf, if (has_mmx) EMMS(); } +void ConvertYCbCrAToARGB32(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + const uint8_t* a_buf, + uint8_t* argb_buf, + int pic_width, + int pic_height, + int ya_pitch, + int uv_pitch, + int argb_pitch) { + + // The downstream graphics stack expects an attenuated input, hence why the + // attenuation parameter is set. + DebugOnly<int> err = libyuv::I420AlphaToARGB(y_buf, ya_pitch, + u_buf, uv_pitch, + v_buf, uv_pitch, + a_buf, ya_pitch, + argb_buf, argb_pitch, + pic_width, pic_height, 1); + MOZ_ASSERT(!err); +} } // namespace gfx } // namespace mozilla diff --git a/gfx/ycbcr/yuv_convert.h b/gfx/ycbcr/yuv_convert.h index 108e14b679..2e85ada0a3 100644 --- a/gfx/ycbcr/yuv_convert.h +++ b/gfx/ycbcr/yuv_convert.h @@ -106,6 +106,18 @@ void ScaleYCbCrToRGB32_deprecated(const uint8_t* yplane, Rotate view_rotate, ScaleFilter filter); +void ConvertYCbCrAToARGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + const uint8_t* aplane, + uint8_t* argbframe, + int pic_width, + int pic_height, + int yastride, + int uvstride, + int argbstride); + + } // namespace gfx } // namespace mozilla |