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

Commit 1af95701 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "media: add flexible YUV422, 444, and RGB/RGBA formats"

parents 931ae62f d1d27c15
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -11337,6 +11337,8 @@ package android.graphics {
    method public static int getBitsPerPixel(int);
    field public static final int DEPTH16 = 1144402265; // 0x44363159
    field public static final int DEPTH_POINT_CLOUD = 257; // 0x101
    field public static final int FLEX_RGBA_8888 = 42; // 0x2a
    field public static final int FLEX_RGB_888 = 41; // 0x29
    field public static final int JPEG = 256; // 0x100
    field public static final int NV16 = 16; // 0x10
    field public static final int NV21 = 17; // 0x11
@@ -11347,6 +11349,8 @@ package android.graphics {
    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
    field public static final int YUV_422_888 = 39; // 0x27
    field public static final int YUV_444_888 = 40; // 0x28
    field public static final int YUY2 = 20; // 0x14
    field public static final int YV12 = 842094169; // 0x32315659
  }
+4 −0
Original line number Diff line number Diff line
@@ -11632,6 +11632,8 @@ package android.graphics {
    method public static int getBitsPerPixel(int);
    field public static final int DEPTH16 = 1144402265; // 0x44363159
    field public static final int DEPTH_POINT_CLOUD = 257; // 0x101
    field public static final int FLEX_RGBA_8888 = 42; // 0x2a
    field public static final int FLEX_RGB_888 = 41; // 0x29
    field public static final int JPEG = 256; // 0x100
    field public static final int NV16 = 16; // 0x10
    field public static final int NV21 = 17; // 0x11
@@ -11642,6 +11644,8 @@ package android.graphics {
    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
    field public static final int YUV_422_888 = 39; // 0x27
    field public static final int YUV_444_888 = 40; // 0x28
    field public static final int YUY2 = 20; // 0x14
    field public static final int YV12 = 842094169; // 0x32315659
  }
+142 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class ImageFormat {
    public static final int JPEG = 0x100;

    /**
     * <p>Multi-plane Android YUV format</p>
     * <p>Multi-plane Android YUV 420 format</p>
     *
     * <p>This format is a generic YCbCr format, capable of describing any 4:2:0
     * chroma-subsampled planar or semiplanar buffer (but not fully interleaved),
@@ -218,6 +218,135 @@ public class ImageFormat {
     */
    public static final int YUV_420_888 = 0x23;

    /**
     * <p>Multi-plane Android YUV 422 format</p>
     *
     * <p>This format is a generic YCbCr format, capable of describing any 4:2:2
     * chroma-subsampled (planar, semiplanar or interleaved) format,
     * with 8 bits per color sample.</p>
     *
     * <p>Images in this format are always represented by three separate buffers
     * of data, one for each color plane. Additional information always
     * accompanies the buffers, describing the row stride and the pixel stride
     * for each plane.</p>
     *
     * <p>The order of planes in the array returned by
     * {@link android.media.Image#getPlanes() Image#getPlanes()} is guaranteed such that
     * plane #0 is always Y, plane #1 is always U (Cb), and plane #2 is always V (Cr).</p>
     *
     * <p>In contrast to the {@link #YUV_420_888} format, the Y-plane may have a pixel
     * stride greater than 1 in
     * {@link android.media.Image.Plane#getPixelStride() yPlane.getPixelStride()}.</p>
     *
     * <p>The U/V planes are guaranteed to have the same row stride and pixel stride
     * (in particular,
     * {@link android.media.Image.Plane#getRowStride() uPlane.getRowStride()}
     * == {@link android.media.Image.Plane#getRowStride() vPlane.getRowStride()} and
     * {@link android.media.Image.Plane#getPixelStride() uPlane.getPixelStride()}
     * == {@link android.media.Image.Plane#getPixelStride() vPlane.getPixelStride()};
     * ).</p>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.media.MediaCodec}
     * through {@link android.media.MediaCodec#getOutputImage} object.</p>
     *
     * @see android.media.Image
     * @see android.media.MediaCodec
     */
    public static final int YUV_422_888 = 0x27;

    /**
     * <p>Multi-plane Android YUV 444 format</p>
     *
     * <p>This format is a generic YCbCr format, capable of describing any 4:4:4
     * (planar, semiplanar or interleaved) format,
     * with 8 bits per color sample.</p>
     *
     * <p>Images in this format are always represented by three separate buffers
     * of data, one for each color plane. Additional information always
     * accompanies the buffers, describing the row stride and the pixel stride
     * for each plane.</p>
     *
     * <p>The order of planes in the array returned by
     * {@link android.media.Image#getPlanes() Image#getPlanes()} is guaranteed such that
     * plane #0 is always Y, plane #1 is always U (Cb), and plane #2 is always V (Cr).</p>
     *
     * <p>In contrast to the {@link #YUV_420_888} format, the Y-plane may have a pixel
     * stride greater than 1 in
     * {@link android.media.Image.Plane#getPixelStride() yPlane.getPixelStride()}.</p>
     *
     * <p>The U/V planes are guaranteed to have the same row stride and pixel stride
     * (in particular,
     * {@link android.media.Image.Plane#getRowStride() uPlane.getRowStride()}
     * == {@link android.media.Image.Plane#getRowStride() vPlane.getRowStride()} and
     * {@link android.media.Image.Plane#getPixelStride() uPlane.getPixelStride()}
     * == {@link android.media.Image.Plane#getPixelStride() vPlane.getPixelStride()};
     * ).</p>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.media.MediaCodec}
     * through {@link android.media.MediaCodec#getOutputImage} object.</p>
     *
     * @see android.media.Image
     * @see android.media.MediaCodec
     */
    public static final int YUV_444_888 = 0x28;

    /**
     * <p>Multi-plane Android RGB format</p>
     *
     * <p>This format is a generic RGB format, capable of describing most RGB formats,
     * with 8 bits per color sample.</p>
     *
     * <p>Images in this format are always represented by three separate buffers
     * of data, one for each color plane. Additional information always
     * accompanies the buffers, describing the row stride and the pixel stride
     * for each plane.</p>
     *
     * <p>The order of planes in the array returned by
     * {@link android.media.Image#getPlanes() Image#getPlanes()} is guaranteed such that
     * plane #0 is always R (red), plane #1 is always G (green), and plane #2 is always B
     * (blue).</p>
     *
     * <p>All three planes are guaranteed to have the same row strides and pixel strides.</p>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.media.MediaCodec}
     * through {@link android.media.MediaCodec#getOutputImage} object.</p>
     *
     * @see android.media.Image
     * @see android.media.MediaCodec
     */
    public static final int FLEX_RGB_888 = 0x29;

    /**
     * <p>Multi-plane Android RGBA format</p>
     *
     * <p>This format is a generic RGBA format, capable of describing most RGBA formats,
     * with 8 bits per color sample.</p>
     *
     * <p>Images in this format are always represented by four separate buffers
     * of data, one for each color plane. Additional information always
     * accompanies the buffers, describing the row stride and the pixel stride
     * for each plane.</p>
     *
     * <p>The order of planes in the array returned by
     * {@link android.media.Image#getPlanes() Image#getPlanes()} is guaranteed such that
     * plane #0 is always R (red), plane #1 is always G (green), plane #2 is always B (blue),
     * and plane #3 is always A (alpha). This format may represent pre-multiplied or
     * non-premultiplied alpha.</p>
     *
     * <p>All four planes are guaranteed to have the same row strides and pixel strides.</p>
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.media.MediaCodec}
     * through {@link android.media.MediaCodec#getOutputImage} object.</p>
     *
     * @see android.media.Image
     * @see android.media.MediaCodec
     */
    public static final int FLEX_RGBA_8888 = 0x2A;

    /**
     * <p>General raw camera sensor image format, usually representing a
     * single-channel Bayer-mosaic image. Each pixel color sample is stored with
@@ -543,6 +672,14 @@ public class ImageFormat {
                return 12;
            case YUV_420_888:
                return 12;
            case YUV_422_888:
                return 16;
            case YUV_444_888:
                return 24;
            case FLEX_RGB_888:
                return 24;
            case FLEX_RGBA_8888:
                return 32;
            case RAW_SENSOR:
                return 16;
            case RAW10:
@@ -574,6 +711,10 @@ public class ImageFormat {
            case JPEG:
            case NV21:
            case YUV_420_888:
            case YUV_422_888:
            case YUV_444_888:
            case FLEX_RGB_888:
            case FLEX_RGBA_8888:
            case RAW_SENSOR:
            case RAW10:
            case RAW12:
+32 −0
Original line number Diff line number Diff line
@@ -86,6 +86,38 @@ public abstract class Image implements AutoCloseable {
     *     Each plane has its own row stride and pixel stride.</td>
     * </tr>
     * <tr>
     *   <td>{@link android.graphics.ImageFormat#YUV_422_888 YUV_422_888}</td>
     *   <td>3</td>
     *   <td>A luminance plane followed by the Cb and Cr chroma planes.
     *     The chroma planes have half the width and the full height of the luminance
     *     plane (4:2:2 subsampling). Each pixel sample in each plane has 8 bits.
     *     Each plane has its own row stride and pixel stride.</td>
     * </tr>
     * <tr>
     *   <td>{@link android.graphics.ImageFormat#YUV_444_888 YUV_444_888}</td>
     *   <td>3</td>
     *   <td>A luminance plane followed by the Cb and Cr chroma planes.
     *     The chroma planes have the same width and height as that of the luminance
     *     plane (4:4:4 subsampling). Each pixel sample in each plane has 8 bits.
     *     Each plane has its own row stride and pixel stride.</td>
     * </tr>
     * <tr>
     *   <td>{@link android.graphics.ImageFormat#FLEX_RGB_888 FLEX_RGB_888}</td>
     *   <td>3</td>
     *   <td>A R (red) plane followed by the G (green) and B (blue) planes.
     *     All planes have the same widths and heights.
     *     Each pixel sample in each plane has 8 bits.
     *     Each plane has its own row stride and pixel stride.</td>
     * </tr>
     * <tr>
     *   <td>{@link android.graphics.ImageFormat#FLEX_RGBA_8888 FLEX_RGBA_8888}</td>
     *   <td>4</td>
     *   <td>A R (red) plane followed by the G (green), B (blue), and
     *     A (alpha) planes. All planes have the same widths and heights.
     *     Each pixel sample in each plane has 8 bits.
     *     Each plane has its own row stride and pixel stride.</td>
     * </tr>
     * <tr>
     *   <td>{@link android.graphics.ImageFormat#RAW_SENSOR RAW_SENSOR}</td>
     *   <td>1</td>
     *   <td>A single plane of raw sensor image data, with 16 bits per color
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ public class ImageReader implements AutoCloseable {
     * </p>
     * <p>
     * Opaque ImageReaders are more efficient to use when application access to
     * image data is not necessary, comparing to ImageReaders using a non-opaque
     * image data is not necessary, compared to ImageReaders using a non-opaque
     * format such as {@link ImageFormat#YUV_420_888 YUV_420_888}.
     * </p>
     *