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

Commit 0e8c901d authored by Jayant Chowdhary's avatar Jayant Chowdhary Committed by Android (Google) Code Review
Browse files

Merge "Add RAW_DEPTH private format and allow AImageReader creation with it."

parents f31b173d 5fa1276d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include "NdkImagePriv.h"
#include "NdkImageReaderPriv.h"
#include <private/media/NdkImage.h>

#include <cutils/atomic.h>
#include <utils/Log.h>
@@ -63,6 +64,7 @@ AImageReader::isSupportedFormatAndUsage(int32_t format, uint64_t usage) {
        case AIMAGE_FORMAT_YUV_420_888:
        case AIMAGE_FORMAT_JPEG:
        case AIMAGE_FORMAT_RAW16:
        case AIMAGE_FORMAT_RAW_DEPTH:
        case AIMAGE_FORMAT_RAW_PRIVATE:
        case AIMAGE_FORMAT_RAW10:
        case AIMAGE_FORMAT_RAW12:
@@ -92,6 +94,7 @@ AImageReader::getNumPlanesForFormat(int32_t format) {
        case AIMAGE_FORMAT_RGBA_FP16:
        case AIMAGE_FORMAT_JPEG:
        case AIMAGE_FORMAT_RAW16:
        case AIMAGE_FORMAT_RAW_DEPTH:
        case AIMAGE_FORMAT_RAW_PRIVATE:
        case AIMAGE_FORMAT_RAW10:
        case AIMAGE_FORMAT_RAW12:
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _PRIVATE_MEDIA_NDKIMAGE_H_
#define _PRIVATE_MEDIA_NDKIMAGE_H_
// Formats not listed in the public API, but still available to AImageReader
enum AIMAGE_PRIVATE_FORMATS {
    /**
     * Unprocessed implementation-dependent raw
     * depth measurements, opaque with 16 bit
     * samples.
     *
     */

    AIMAGE_FORMAT_RAW_DEPTH = 0x1002,
};
#endif // _PRIVATE_MEDIA_NDKIMAGE
+22 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <gtest/gtest.h>
#include <media/NdkImageReader.h>
#include <media/NdkImage.h>
#include <private/media/NdkImage.h>
#include <mediautils/AImageReaderUtils.h>
#include <gui/IGraphicBufferProducer.h>
#include <gui/bufferqueue/1.0/H2BGraphicBufferProducer.h>
@@ -182,4 +183,25 @@ TEST_F(AImageReaderWindowHandleTest, CreateWindowNativeHandle) {
    EXPECT_TRUE(imageAvailable_) <<  "Timed out waiting for image data to be handled!\n";
}

class AImageReaderPrivateFormatTest : public ::testing::Test {
  public:
    void SetUp() override {
        auto status = AImageReader_new(kImageWidth, kImageHeight, AIMAGE_FORMAT_RAW_DEPTH,
                                       kMaxImages, &imgReader);
        EXPECT_TRUE(status == AMEDIA_OK);
    }

    void TearDown() override {
        if (imgReader) {
            AImageReader_delete(imgReader);
        }
    }
    AImageReader *imgReader = nullptr;
};

TEST_F(AImageReaderPrivateFormatTest, CreateTest) {
    EXPECT_TRUE(imgReader != nullptr);
}


}  // namespace android