ImageFormat: add PRIVATE format

Bug: 19865019
Change-Id: I1a9335fe1733a5b28d9cb20485b509fb216cb52b
This commit is contained in:
Zhijun He
2015-03-20 11:39:55 -07:00
parent 8a78286915
commit 2f17431194
5 changed files with 34 additions and 1 deletions

View File

@@ -11138,6 +11138,7 @@ package android.graphics {
field public static final int JPEG = 256; // 0x100
field public static final int NV16 = 16; // 0x10
field public static final int NV21 = 17; // 0x11
field public static final int PRIVATE = 34; // 0x22
field public static final int RAW10 = 37; // 0x25
field public static final int RAW_SENSOR = 32; // 0x20
field public static final int RGB_565 = 4; // 0x4

View File

@@ -11422,6 +11422,7 @@ package android.graphics {
field public static final int JPEG = 256; // 0x100
field public static final int NV16 = 16; // 0x10
field public static final int NV21 = 17; // 0x11
field public static final int PRIVATE = 34; // 0x22
field public static final int RAW10 = 37; // 0x25
field public static final int RAW_SENSOR = 32; // 0x20
field public static final int RGB_565 = 4; // 0x4

View File

@@ -192,6 +192,9 @@ PublicFormat android_view_Surface_mapHalFormatDataspaceToPublicFormat(
case HAL_PIXEL_FORMAT_YCbCr_422_I:
// Name differs, though the value is the same
return PublicFormat::YUY2;
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
// Name differs, though the value is the same
return PublicFormat::PRIVATE;
case HAL_PIXEL_FORMAT_Y16:
// Dataspace-dependent
switch (dataSpace) {
@@ -216,7 +219,6 @@ PublicFormat android_view_Surface_mapHalFormatDataspaceToPublicFormat(
break;
case HAL_PIXEL_FORMAT_BGRA_8888:
case HAL_PIXEL_FORMAT_RAW_OPAQUE:
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
// Not defined in public API
return PublicFormat::UNKNOWN;

View File

@@ -387,6 +387,33 @@ public class ImageFormat {
*/
public static final int DEPTH_POINT_CLOUD = 0x101;
/**
* Android private opaque image format.
* <p>
* The choices of the actual format and pixel data layout are entirely up to
* the device-specific and framework internal implementations, and may vary
* depending on use cases even for the same device. The buffers of this
* format can be produced by components like
* {@link android.media.ImageWriter ImageWriter} , and interpreted correctly
* by consumers like {@link android.hardware.camera2.CameraDevice
* CameraDevice} based on the device/framework private information. However,
* these buffers are not directly accessible to the application.
* </p>
* <p>
* When an {@link android.media.Image Image} of this format is obtained from
* an {@link android.media.ImageReader ImageReader} or
* {@link android.media.ImageWriter ImageWriter}, the
* {@link android.media.Image#getPlanes() getPlanes()} method will return an
* empty {@link android.media.Image.Plane Plane} array.
* </p>
* <p>
* If a buffer of this format is to be used as an OpenGL ES texture, the
* framework will assume that sampling the texture will always return an
* alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).
* </p>
*/
public static final int PRIVATE = 0x22;
/**
* Use this function to retrieve the number of bits per pixel of an
* ImageFormat.
@@ -447,6 +474,7 @@ public class ImageFormat {
case RAW10:
case DEPTH16:
case DEPTH_POINT_CLOUD:
case PRIVATE:
return true;
}

View File

@@ -43,6 +43,7 @@ enum class PublicFormat {
NV21 = 0x11,
YUY2 = 0x14,
RAW_SENSOR = 0x20,
PRIVATE = 0x22,
YUV_420_888 = 0x23,
RAW10 = 0x25,
JPEG = 0x100,