Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1eb818e5 authored by Zhijun He's avatar Zhijun He
Browse files

Add Y8 and Y16 image format

These APIs are hidden. Also correct the value of RAW_SENSOR.

Bug: 9254294
Change-Id: Ic6271f5f6bfcfdd8b545d69a9a2154241c34d73b
parent b31e370a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9014,7 +9014,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 RAW_SENSOR = 513; // 0x201
    field public static final int RAW_SENSOR = 32; // 0x20
    field public static final int RGB_565 = 4; // 0x4
    field public static final int UNKNOWN = 0; // 0x0
    field public static final int YUV_420_888 = 35; // 0x23
+66 −2
Original line number Diff line number Diff line
@@ -72,6 +72,66 @@ public class ImageFormat {
     */
    public static final int YV12 = 0x32315659;

    /**
     * <p>Android Y8 format.</p>
     *
     * <p>Y8 is a YUV planar format comprised of a WxH Y plane only, with each pixel
     * being represented by 8 bits. It is equivalent to just the Y plane from {@link #YV12}
     * format.</p>
     *
     * <p>This format assumes
     * <ul>
     * <li>an even width</li>
     * <li>an even height</li>
     * <li>a horizontal stride multiple of 16 pixels</li>
     * </ul>
     * </p>
     *
     * <pre> y_size = stride * height </pre>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.hardware.photography.CameraDevice}
     * through a {@link android.media.ImageReader} object if this format is
     * supported by {@link android.hardware.photography.CameraDevice}.</p>
     *
     * @see android.media.Image
     * @see android.media.ImageReader
     * @see android.hardware.photography.CameraDevice
     *
     * @hide
     */
    public static final int Y8 = 0x20203859;

    /**
     * <p>Android Y16 format.</p>
     *
     * Y16 is a YUV planar format comprised of a WxH Y plane, with each pixel
     * being represented by 16 bits. It is just like {@link #Y8}, but has 16
     * bits per pixel (little endian).</p>
     *
     * <p>This format assumes
     * <ul>
     * <li>an even width</li>
     * <li>an even height</li>
     * <li>a horizontal stride multiple of 16 pixels</li>
     * </ul>
     * </p>
     *
     * <pre> y_size = stride * height </pre>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.hardware.photography.CameraDevice}
     * through a {@link android.media.ImageReader} object if this format is
     * supported by {@link android.hardware.photography.CameraDevice}.</p>
     *
     * @see android.media.Image
     * @see android.media.ImageReader
     * @see android.hardware.photography.CameraDevice
     *
     * @hide
     */
    public static final int Y16 = 0x20363159;

    /**
     * YCbCr format, used for video. Whether this format is supported by the
     * camera hardware can be determined by
@@ -117,7 +177,7 @@ public class ImageFormat {
     *
     * @see android.media.Image
     * @see android.media.ImageReader
     * @see android.hardware.camera.CameraDevice
     * @see android.hardware.photography.CameraDevice
     */
    public static final int YUV_420_888 = 0x23;

@@ -132,7 +192,7 @@ public class ImageFormat {
     * the {@link android.hardware.photography.CameraDevice} which produced the
     * image.</p>
     */
    public static final int RAW_SENSOR = 0x201;
    public static final int RAW_SENSOR = 0x20;

    /**
     * Raw bayer format used for images, which is 10 bit precision samples
@@ -162,6 +222,10 @@ public class ImageFormat {
                return 16;
            case YV12:
                return 12;
            case Y8:
                return 8;
            case Y16:
                return 16;
            case NV21:
                return 12;
            case YUV_420_888: