From 2cf5c84530e3ad99f6d3871717e49223607ec329 Mon Sep 17 00:00:00 2001
From: John Reck
Date: Thu, 17 Feb 2022 17:43:36 -0500
Subject: [PATCH] Add P010 constant for HardwareBuffer
Also fix a typo in ImageFormat's docs
Fixes: 218928677
Test: make
Change-Id: Icc5d32afac113e639a81a11c86bee1698ef12861
(cherry picked from commit 000c374e2b00e9192c944e61531570654f720d24)
---
core/api/current.txt | 1 +
core/java/android/hardware/HardwareBuffer.java | 10 ++++++++++
graphics/java/android/graphics/ImageFormat.java | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/core/api/current.txt b/core/api/current.txt
index 5b1f59a9e88f3..56415ec14564f 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -16870,6 +16870,7 @@ package android.hardware {
field public static final long USAGE_SENSOR_DIRECT_DATA = 8388608L; // 0x800000L
field public static final long USAGE_VIDEO_ENCODE = 65536L; // 0x10000L
field public static final int YCBCR_420_888 = 35; // 0x23
+ field public static final int YCBCR_P010 = 54; // 0x36
}
public final class Sensor {
diff --git a/core/java/android/hardware/HardwareBuffer.java b/core/java/android/hardware/HardwareBuffer.java
index ac1bcf3186be3..1e4c950132055 100644
--- a/core/java/android/hardware/HardwareBuffer.java
+++ b/core/java/android/hardware/HardwareBuffer.java
@@ -63,6 +63,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
D_FP32,
DS_FP32UI8,
S_UI8,
+ YCBCR_P010,
})
public @interface Format {
}
@@ -96,6 +97,14 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
public static final int DS_FP32UI8 = 0x34;
/** Format: 8 bits stencil */
public static final int S_UI8 = 0x35;
+ /**
+ * Android YUV P010 format.
+ *
+ * P010 is a 4:2:0 YCbCr semiplanar format comprised of a WxH Y plane
+ * followed by a Wx(H/2) CbCr plane. Each sample is represented by a 16-bit
+ * little-endian value, with the lower 6 bits set to zero.
+ */
+ public static final int YCBCR_P010 = 0x36;
// Note: do not rename, this field is used by native code
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@@ -422,6 +431,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
case D_FP32:
case DS_FP32UI8:
case S_UI8:
+ case YCBCR_P010:
return true;
}
return false;
diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java
index 9feb619b34e37..b341a4e27e678 100644
--- a/graphics/java/android/graphics/ImageFormat.java
+++ b/graphics/java/android/graphics/ImageFormat.java
@@ -428,7 +428,7 @@ public class ImageFormat {
/**
* Private raw camera sensor image format, a single channel image with
- * implementation depedent pixel layout.
+ * implementation dependent pixel layout.
*
* RAW_PRIVATE is a format for unprocessed raw image buffers coming from an
* image sensor. The actual structure of buffers of this format is