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

Commit 4bd48112 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add YCBCR_P210 format" into main

parents 393c8e64 746b9347
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16369,6 +16369,7 @@ package android.graphics {
    field public static final int UNKNOWN = 0; // 0x0
    field public static final int Y8 = 538982489; // 0x20203859
    field public static final int YCBCR_P010 = 54; // 0x36
    field @FlaggedApi("android.media.codec.p210_format_support") public static final int YCBCR_P210 = 60; // 0x3c
    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
@@ -18718,6 +18719,7 @@ package android.hardware {
    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
    field @FlaggedApi("android.media.codec.p210_format_support") public static final int YCBCR_P210 = 60; // 0x3c
  }
  @FlaggedApi("android.hardware.flags.overlayproperties_class_api") public final class OverlayProperties implements android.os.Parcelable {
@@ -22985,6 +22987,7 @@ package android.media {
    field public static final int COLOR_FormatYUV444Flexible = 2135181448; // 0x7f444888
    field @Deprecated public static final int COLOR_FormatYUV444Interleaved = 29; // 0x1d
    field public static final int COLOR_FormatYUVP010 = 54; // 0x36
    field @FlaggedApi("android.media.codec.p210_format_support") public static final int COLOR_FormatYUVP210 = 60; // 0x3c
    field @Deprecated public static final int COLOR_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00
    field @Deprecated public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 2130706688; // 0x7f000100
    field public static final String FEATURE_AdaptivePlayback = "adaptive-playback";
+11 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
            DS_FP32UI8,
            S_UI8,
            YCBCR_P010,
            YCBCR_P210,
            R_8,
            R_16,
            RG_1616,
@@ -111,6 +112,16 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
     * little-endian value, with the lower 6 bits set to zero.
     */
    public static final int YCBCR_P010    = 0x36;
    /**
     * <p>Android YUV P210 format.</p>
     *
     * P210 is a 4:2:2 YCbCr semiplanar format comprised of a WxH Y plane
     * followed by a WxH CbCr plane. Each sample is represented by a 16-bit
     * little-endian value, with the lower 6 bits set to zero.
     */
    @FlaggedApi(android.media.codec.Flags.FLAG_P210_FORMAT_SUPPORT)
    public static final int YCBCR_P210    = 0x3c;

    /** Format: 8 bits red */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
    public static final int R_8           = 0x38;
+27 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.graphics;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;

import java.lang.annotation.Retention;
@@ -41,6 +42,7 @@ public class ImageFormat {
             Y8,
             Y16,
             YCBCR_P010,
             YCBCR_P210,
             NV16,
             NV21,
             YUY2,
@@ -205,6 +207,26 @@ public class ImageFormat {
     */
    public static final int YCBCR_P010 = 0x36;

    /**
     * <p>Android YUV P210 format.</p>
     *
     * P210 is a 4:2:2 YCbCr semiplanar format comprised of a WxH Y plane
     * followed by a WxH CbCr plane. Each sample is represented by a 16-bit
     * little-endian value, with the lower 6 bits set to zero.
     *
     * <p>For example, the {@link android.media.Image} object can provide data
     * in this format from a {@link android.hardware.camera2.CameraDevice}
     * through a {@link android.media.ImageReader} object if this format is
     * supported by {@link android.hardware.camera2.CameraDevice}.</p>
     *
     * @see android.media.Image
     * @see android.media.ImageReader
     * @see android.hardware.camera2.CameraDevice
     *
     */
    @FlaggedApi(android.media.codec.Flags.FLAG_P210_FORMAT_SUPPORT)
    public static final int YCBCR_P210 = 0x3c;

    /**
     * YCbCr format, used for video.
     *
@@ -849,6 +871,8 @@ public class ImageFormat {
                return 16;
            case YCBCR_P010:
                return 24;
            case YCBCR_P210:
                return 32;
            case RAW_DEPTH10:
            case RAW10:
                return 10;
@@ -899,7 +923,9 @@ public class ImageFormat {
            case JPEG_R:
                return true;
        }

        if (android.media.codec.Flags.p210FormatSupport() && format == YCBCR_P210) {
            return true;
        }
        return false;
    }
}
+27 −0
Original line number Diff line number Diff line
@@ -462,6 +462,33 @@ public final class MediaCodecInfo {
        @SuppressLint("AllUpper")
        public static final int COLOR_FormatYUVP010                 = 54;

        /**
         * P210 is 10-bit-per component 4:2:2 YCbCr semiplanar format.
         * <p>
         * This format uses 32 allocated bits per pixel with 20 bits of
         * data per pixel. Chroma planes are subsampled by 2 both
         * horizontally. Each chroma and luma component
         * has 16 allocated bits in little-endian configuration with 10
         * MSB of actual data.
         *
         * <pre>
         *            byte                   byte
         *  <--------- i --------> | <------ i + 1 ------>
         * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
         * |     UNUSED      |      Y/Cb/Cr                |
         * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
         *  0               5 6   7 0                    7
         * bit
         * </pre>
         *
         * Use this format with {@link Image}. This format corresponds
         * to {@link android.graphics.ImageFormat#YCBCR_P210}.
         * <p>
         */
        @SuppressLint("AllUpper")
        @FlaggedApi(android.media.codec.Flags.FLAG_P210_FORMAT_SUPPORT)
        public static final int COLOR_FormatYUVP210                 = 60;

        /** @deprecated Use {@link #COLOR_FormatYUV420Flexible}. */
        public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100;
        // COLOR_FormatSurface indicates that the data will be a GraphicBuffer metadata reference.