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

Commit f6e6a8e5 authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

NDK: add RAW_DEPTH10 image format to NDK

Test: NDK client can create corrsponding AImageReader
Bug: 153663201
Change-Id: I442623067c9dad601a7507d57f1b016a44e70f1c
parent 38a0290c
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -24,6 +24,28 @@

using namespace android;

// Formats not listed in the public API, but still available to AImageReader
// Enum value must match corresponding enum in ui/PublicFormat.h (which is not
// available to VNDK)
enum AIMAGE_PRIVATE_FORMATS {
    /**
     * Unprocessed implementation-dependent raw
     * depth measurements, opaque with 16 bit
     * samples.
     *
     */

    AIMAGE_FORMAT_RAW_DEPTH = 0x1002,

    /**
     * Device specific 10 bits depth RAW image format.
     *
     * <p>Unprocessed implementation-dependent raw depth measurements, opaque with 10 bit samples
     * and device specific bit layout.</p>
     */
    AIMAGE_FORMAT_RAW_DEPTH10 = 0x1003,
};

/**
 * ACameraMetadata Implementation
 */
@@ -290,6 +312,10 @@ ACameraMetadata::filterStreamConfigurations() {
            format = AIMAGE_FORMAT_DEPTH_POINT_CLOUD;
        } else if (format == HAL_PIXEL_FORMAT_Y16) {
            format = AIMAGE_FORMAT_DEPTH16;
        } else if (format == HAL_PIXEL_FORMAT_RAW16) {
            format = static_cast<int32_t>(AIMAGE_FORMAT_RAW_DEPTH);
        } else if (format == HAL_PIXEL_FORMAT_RAW10) {
            format = static_cast<int32_t>(AIMAGE_FORMAT_RAW_DEPTH10);
        }

        filteredDepthStreamConfigs.push_back(format);
+8 −0
Original line number Diff line number Diff line
@@ -40,6 +40,14 @@ enum AIMAGE_PRIVATE_FORMATS {
     */

    AIMAGE_FORMAT_RAW_DEPTH = 0x1002,

    /**
     * Device specific 10 bits depth RAW image format.
     *
     * <p>Unprocessed implementation-dependent raw depth measurements, opaque with 10 bit samples
     * and device specific bit layout.</p>
     */
    AIMAGE_FORMAT_RAW_DEPTH10 = 0x1003,
};

// TODO: this only supports ImageReader
+2 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ AImageReader::isSupportedFormatAndUsage(int32_t format, uint64_t usage) {
        case AIMAGE_FORMAT_Y8:
        case AIMAGE_FORMAT_HEIC:
        case AIMAGE_FORMAT_DEPTH_JPEG:
        case AIMAGE_FORMAT_RAW_DEPTH10:
            return true;
        case AIMAGE_FORMAT_PRIVATE:
            // For private format, cpu usage is prohibited.
@@ -102,6 +103,7 @@ AImageReader::getNumPlanesForFormat(int32_t format) {
        case AIMAGE_FORMAT_Y8:
        case AIMAGE_FORMAT_HEIC:
        case AIMAGE_FORMAT_DEPTH_JPEG:
        case AIMAGE_FORMAT_RAW_DEPTH10:
            return 1;
        case AIMAGE_FORMAT_PRIVATE:
            return 0;