From 79ad8fe8a7dcf5245f73936948dd09965527109e Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Tue, 25 Jan 2022 16:34:24 -0800 Subject: media: MediaCodec: add RGBA_1010102 and RGBA_F16 format support Due to existing naming conventions these become COLOR_Format32bitABGR2101010 and COLOR_Format64bitABGRFloat. Bug: 197651595 Test: build Change-Id: I9ce6177ec9d2a73ab9faa67c1d7c7d42fc9a35f7 --- core/api/current.txt | 2 ++ media/java/android/media/MediaCodecInfo.java | 39 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 8684cf5e0fd6..4706dac1986b 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -21951,9 +21951,11 @@ package android.media { field public static final int COLOR_Format24bitBGR888 = 12; // 0xc field @Deprecated public static final int COLOR_Format24bitRGB888 = 11; // 0xb field @Deprecated public static final int COLOR_Format25bitARGB1888 = 14; // 0xe + field public static final int COLOR_Format32bitABGR2101010 = 2130750114; // 0x7f00aaa2 field public static final int COLOR_Format32bitABGR8888 = 2130747392; // 0x7f00a000 field @Deprecated public static final int COLOR_Format32bitARGB8888 = 16; // 0x10 field @Deprecated public static final int COLOR_Format32bitBGRA8888 = 15; // 0xf + field public static final int COLOR_Format64bitABGRFloat = 2130710294; // 0x7f000f16 field @Deprecated public static final int COLOR_Format8bitRGB332 = 2; // 0x2 field @Deprecated public static final int COLOR_FormatCbYCrY = 27; // 0x1b field @Deprecated public static final int COLOR_FormatCrYCbY = 28; // 0x1c diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index e75df1d9b691..e2d6333c81ba 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -438,6 +438,25 @@ public final class MediaCodecInfo { // Note: in OMX this is called OMX_COLOR_FormatAndroidOpaque. public static final int COLOR_FormatSurface = 0x7F000789; + /** + * 64 bits per pixel RGBA color format, with 16-bit signed + * floating point red, green, blue, and alpha components. + *

+ * + *

+         *         byte              byte             byte              byte
+         *  <-- i -->|<- i+1 ->|<- i+2 ->|<- i+3 ->|<- i+4 ->|<- i+5 ->|<- i+6 ->|<- i+7 ->
+         * +---------+---------+-------------------+---------+---------+---------+---------+
+         * |        RED        |       GREEN       |       BLUE        |       ALPHA       |
+         * +---------+---------+-------------------+---------+---------+---------+---------+
+         *  0       7 0       7 0       7 0       7 0       7 0       7 0       7 0       7
+         * 
+ * + * This corresponds to {@link android.graphics.PixelFormat#RGBA_F16}. + */ + @SuppressLint("AllUpper") + public static final int COLOR_Format64bitABGRFloat = 0x7F000F16; + /** * 32 bits per pixel RGBA color format, with 8-bit red, green, blue, and alpha components. *

@@ -455,6 +474,26 @@ public final class MediaCodecInfo { */ public static final int COLOR_Format32bitABGR8888 = 0x7F00A000; + /** + * 32 bits per pixel RGBA color format, with 10-bit red, green, + * blue, and 2-bit alpha components. + *

+ * Using 32-bit little-endian representation, colors stored as + * Red 9:0, Green 19:10, Blue 29:20, and Alpha 31:30. + *

+         *         byte              byte             byte              byte
+         *  <------ i -----> | <---- i+1 ----> | <---- i+2 ----> | <---- i+3 ----->
+         * +-----------------+---+-------------+-------+---------+-----------+-----+
+         * |       RED           |      GREEN          |       BLUE          |ALPHA|
+         * +-----------------+---+-------------+-------+---------+-----------+-----+
+         *  0               7 0 1 2           7 0     3 4       7 0         5 6   7
+         * 
+ * + * This corresponds to {@link android.graphics.PixelFormat#RGBA_1010102}. + */ + @SuppressLint("AllUpper") + public static final int COLOR_Format32bitABGR2101010 = 0x7F00AAA2; + /** * Flexible 12 bits per pixel, subsampled YUV color format with 8-bit chroma and luma * components. -- cgit v1.2.3-59-g8ed1b