APV: fixing color conversions and adding P210 and RGBA1010102 support
This patch fixes the following:
- Adding P210 and RGBA1010102 support to APV codec
- moving color conversion functions to proper location
- advertising adaptive playback
Test: CodecEncoderTest, CodecDecoderTest, CodecInfoTest
Bug: 376770121
Change-Id: Ic542c26d720763cd62c65f77239b12dbfbc3cb70
diff --git a/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp b/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
index 7a33af4..aa87e97 100644
--- a/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
+++ b/media/codec2/sfplugin/utils/Codec2CommonUtils.cpp
@@ -64,6 +64,13 @@
return kVendorApiLevel >= __ANDROID_API_T__;
}
+static bool isP210Allowed() {
+ static const int32_t kVendorApiLevel =
+ base::GetIntProperty<int32_t>("ro.vendor.api_level", 0);
+
+ return kVendorApiLevel > __ANDROID_API_V__;
+}
+
bool isHalPixelFormatSupported(AHardwareBuffer_Format format) {
// HAL_PIXEL_FORMAT_YCBCR_P010 requirement was added in T VSR, although it could have been
// supported prior to this.
@@ -76,6 +83,12 @@
return false;
}
+ // P210 is not available before Android B
+ if (format == (AHardwareBuffer_Format)AHARDWAREBUFFER_FORMAT_YCbCr_P210 &&
+ !isP210Allowed()) {
+ return false;
+ }
+
// Default scenario --- the consumer is display or GPU
const AHardwareBuffer_Desc consumableForDisplayOrGpu = {
.width = 320,