C2 vp9, av1: Add support for conversion to RGBA1010102 for 10-bit decode
In Android T and above, HAL_PIXEL_FORMAT_RGBA_1010102 corresponds to
actual RGBA 1010102 format which was earlier used to return YUV 1010102
data. Now when HAL_PIXEL_FORMAT_RGBA_1010102 is selected, YUV 10 bit
output from decoder is converted to RGBA 1010102 format.
This conversion to RGBA is done only in Android T and above to ensure
that these libraries continue to work as per the old convention when
running on older android versions.
Bug: 229002916
Test: decode 10-bit av1 clip in gallery
Test: atest android.mediav2.cts.CodecDecoderSurfaceTest \
android.mediav2.cts.AdaptivePlaybackTest \
android.mediav2.cts.CodecDecoderTest -- --module-arg \
CtsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2.android.
Change-Id: I0b7fd8b581e39df65c5984ece4a6fdbe646d18a1
diff --git a/media/codec2/components/aom/C2SoftAomDec.cpp b/media/codec2/components/aom/C2SoftAomDec.cpp
index c7985ca..39bbe1c 100644
--- a/media/codec2/components/aom/C2SoftAomDec.cpp
+++ b/media/codec2/components/aom/C2SoftAomDec.cpp
@@ -588,10 +588,9 @@
const uint16_t *srcV = (const uint16_t *)img->planes[AOM_PLANE_V];
if (format == HAL_PIXEL_FORMAT_RGBA_1010102) {
- convertYUV420Planar16ToY410((uint32_t *)dstY, srcY, srcU, srcV, srcYStride / 2,
- srcUStride / 2, srcVStride / 2,
- dstYStride / sizeof(uint32_t),
- mWidth, mHeight);
+ convertYUV420Planar16ToY410OrRGBA1010102(
+ (uint32_t *)dstY, srcY, srcU, srcV, srcYStride / 2, srcUStride / 2,
+ srcVStride / 2, dstYStride / sizeof(uint32_t), mWidth, mHeight);
} else {
convertYUV420Planar16ToYV12(dstY, dstU, dstV, srcY, srcU, srcV, srcYStride / 2,
srcUStride / 2, srcVStride / 2, dstYStride, dstUVStride,