summaryrefslogtreecommitdiffstats
path: root/tests/camera2
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2014-11-07 18:35:40 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-07 18:35:40 +0000
commit3d31e157d0df55287aa53adabbaf6884fd12e911 (patch)
tree4a096264257464f8f58bacc728e318d6584e1079 /tests/camera2
parent1bb4d46ccf8d36389acaf58321da4a35fc610afe (diff)
parent8d3acf6e6e58c392fcdc4913e49c6b1ded8117c8 (diff)
downloadhardware_libhardware-3d31e157d0df55287aa53adabbaf6884fd12e911.zip
hardware_libhardware-3d31e157d0df55287aa53adabbaf6884fd12e911.tar.gz
hardware_libhardware-3d31e157d0df55287aa53adabbaf6884fd12e911.tar.bz2
am 8d3acf6e: Merge "Camera2/3 HAL test: cleanup deprecated keys" into lmp-mr1-dev
* commit '8d3acf6e6e58c392fcdc4913e49c6b1ded8117c8': Camera2/3 HAL test: cleanup deprecated keys
Diffstat (limited to 'tests/camera2')
-rw-r--r--tests/camera2/CameraBurstTests.cpp57
-rw-r--r--tests/camera2/CameraMetadataTests.cpp45
-rw-r--r--tests/camera2/CameraMultiStreamTests.cpp71
-rw-r--r--tests/camera2/CameraStreamFixture.h89
-rw-r--r--tests/camera2/camera2.cpp112
5 files changed, 272 insertions, 102 deletions
diff --git a/tests/camera2/CameraBurstTests.cpp b/tests/camera2/CameraBurstTests.cpp
index 58763de..8dcc2a2 100644
--- a/tests/camera2/CameraBurstTests.cpp
+++ b/tests/camera2/CameraBurstTests.cpp
@@ -311,8 +311,7 @@ TEST_F(CameraBurstTest, ManualExposureControl) {
* $ setenv CAMERA2_TEST_VARIABLE_BURST_DUMP_FRAMES 1
* $ /data/nativetest/camera2_test/camera2_test --gtest_filter="*VariableBurst"
*/
-// Disable this test for now, as we need cleanup the usage of the deprecated tag quite a bit.
-TEST_F(CameraBurstTest, DISABLED_VariableBurst) {
+TEST_F(CameraBurstTest, VariableBurst) {
TEST_EXTENSION_FORKING_INIT;
@@ -413,34 +412,38 @@ TEST_F(CameraBurstTest, DISABLED_VariableBurst) {
dout << std::endl;
{
- camera_metadata_ro_entry availableProcessedSizes =
- GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
-
- camera_metadata_ro_entry availableProcessedMinFrameDurations =
- GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS);
-
- EXPECT_EQ(availableProcessedSizes.count,
- availableProcessedMinFrameDurations.count * 2) <<
- "The number of minimum frame durations doesn't match the number of "
- "available sizes. Using fallback values";
-
- if (availableProcessedSizes.count ==
- availableProcessedMinFrameDurations.count * 2) {
- bool gotSize = false;
- for (size_t i = 0; i < availableProcessedSizes.count; i += 2) {
- if (availableProcessedSizes.data.i32[i] == mWidth &&
- availableProcessedSizes.data.i32[i+1] == mHeight) {
- gotSize = true;
- minDuration = availableProcessedMinFrameDurations.data.i64[i/2];
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_ro_entry availableProcessedSizes =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
+
+ camera_metadata_ro_entry availableProcessedMinFrameDurations =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS);
+
+ EXPECT_EQ(availableProcessedSizes.count,
+ availableProcessedMinFrameDurations.count * 2) <<
+ "The number of minimum frame durations doesn't match the number of "
+ "available sizes. Using fallback values";
+
+ if (availableProcessedSizes.count ==
+ availableProcessedMinFrameDurations.count * 2) {
+ bool gotSize = false;
+ for (size_t i = 0; i < availableProcessedSizes.count; i += 2) {
+ if (availableProcessedSizes.data.i32[i] == mWidth &&
+ availableProcessedSizes.data.i32[i+1] == mHeight) {
+ gotSize = true;
+ minDuration = availableProcessedMinFrameDurations.data.i64[i/2];
+ }
}
+ EXPECT_TRUE(gotSize) << "Can't find stream size in list of "
+ "available sizes: " << mWidth << ", " << mHeight;
}
- EXPECT_TRUE(gotSize) << "Can't find stream size in list of "
- "available sizes: " << mWidth << ", " << mHeight;
- }
- if (minDuration == 0) {
- minDuration = 1 * SEC / 30; // Fall back to 30 fps as minimum duration
+ if (minDuration == 0) {
+ minDuration = 1 * SEC / 30; // Fall back to 30 fps as minimum duration
+ }
+ } else {
+ minDuration = getMinFrameDurationFor(
+ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, mWidth, mHeight);
}
-
ASSERT_LT(0, minDuration);
camera_metadata_ro_entry maxFrameDuration =
diff --git a/tests/camera2/CameraMetadataTests.cpp b/tests/camera2/CameraMetadataTests.cpp
index eddc593..94fa911 100644
--- a/tests/camera2/CameraMetadataTests.cpp
+++ b/tests/camera2/CameraMetadataTests.cpp
@@ -162,26 +162,33 @@ TEST_F(CameraMetadataTest, RequiredFormats) {
TEST_F(CameraMetadataTest, SaneResolutions) {
TEST_EXTENSION_FORKING_INIT;
- // Iff there are listed raw resolutions, the format should be available
- int rawResolutionsCount =
- GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_RAW_SIZES);
- if (rawResolutionsCount > 0) {
- EXPECT_TRUE(
- HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
- HAL_PIXEL_FORMAT_RAW_SENSOR));
- }
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ // Iff there are listed raw resolutions, the format should be available
+ int rawResolutionsCount =
+ GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_RAW_SIZES);
+ if (rawResolutionsCount > 0) {
+ EXPECT_TRUE(
+ HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
+ HAL_PIXEL_FORMAT_RAW_SENSOR));
+ }
- // Required processed sizes.
- int processedSizeCount =
- GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
- EXPECT_NE(0, processedSizeCount);
- EXPECT_EQ(0, processedSizeCount % 2); // multiple of 2 (w,h)
-
- // Required JPEG sizes
- int jpegSizeCount =
- GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_JPEG_SIZES);
- EXPECT_NE(0, jpegSizeCount);
- EXPECT_EQ(0, jpegSizeCount % 2); // multiple of 2 (w,h)
+ // Required processed sizes.
+ int processedSizeCount =
+ GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
+ EXPECT_NE(0, processedSizeCount);
+ EXPECT_EQ(0, processedSizeCount % 2); // multiple of 2 (w,h)
+
+ // Required JPEG sizes
+ int jpegSizeCount =
+ GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_JPEG_SIZES);
+ EXPECT_NE(0, jpegSizeCount);
+ EXPECT_EQ(0, jpegSizeCount % 2); // multiple of 2 (w,h)
+ } else {
+ int strmConfigCount =
+ GetEntryCountFromStaticTag(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
+ EXPECT_NE(0, strmConfigCount);
+ EXPECT_EQ(0, strmConfigCount % 4); // multiple of 4 (format,w,h,output?)
+ }
}
diff --git a/tests/camera2/CameraMultiStreamTests.cpp b/tests/camera2/CameraMultiStreamTests.cpp
index 2742466..b92d8cc 100644
--- a/tests/camera2/CameraMultiStreamTests.cpp
+++ b/tests/camera2/CameraMultiStreamTests.cpp
@@ -472,19 +472,42 @@ TEST_F(CameraMultiStreamTest, DISABLED_MultiBurst) {
TEST_EXTENSION_FORKING_INIT;
- camera_metadata_ro_entry availableProcessedSizes =
- GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
- ASSERT_EQ(0u, availableProcessedSizes.count % 2);
- ASSERT_GE(availableProcessedSizes.count, 2u);
- camera_metadata_ro_entry availableProcessedMinFrameDurations =
- GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS);
- EXPECT_EQ(availableProcessedSizes.count,
- availableProcessedMinFrameDurations.count * 2);
-
- camera_metadata_ro_entry availableJpegSizes =
- GetStaticEntry(ANDROID_SCALER_AVAILABLE_JPEG_SIZES);
- ASSERT_EQ(0u, availableJpegSizes.count % 2);
- ASSERT_GE(availableJpegSizes.count, 2u);
+ const int32_t* implDefData;
+ size_t implDefCount;
+ const int32_t* jpegData;
+ size_t jpegCount;
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_ro_entry availableProcessedSizes =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES);
+ ASSERT_EQ(0u, availableProcessedSizes.count % 2);
+ ASSERT_GE(availableProcessedSizes.count, 2u);
+ camera_metadata_ro_entry availableProcessedMinFrameDurations =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS);
+ EXPECT_EQ(availableProcessedSizes.count,
+ availableProcessedMinFrameDurations.count * 2);
+
+ camera_metadata_ro_entry availableJpegSizes =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_JPEG_SIZES);
+ ASSERT_EQ(0u, availableJpegSizes.count % 2);
+ ASSERT_GE(availableJpegSizes.count, 2u);
+ implDefData = availableProcessedSizes.data.i32;
+ implDefCount = availableProcessedSizes.count;
+ jpegData = availableJpegSizes.data.i32;
+ jpegCount = availableJpegSizes.count;
+ } else {
+ const int32_t *implDefResolutions;
+ size_t implDefResolutionsCount;
+
+ getResolutionList(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, &implDefData, &implDefCount);
+ ASSERT_NE(0u, implDefCount)
+ << "Missing implementation defined sizes";
+ ASSERT_EQ(0u, implDefCount % 2);
+ ASSERT_GE(implDefCount, 2u);
+
+ getResolutionList(HAL_PIXEL_FORMAT_BLOB, &jpegData, &jpegCount);
+ ASSERT_EQ(0u, jpegCount % 2);
+ ASSERT_GE(jpegCount, 2u);
+ }
camera_metadata_ro_entry hardwareLevel =
GetStaticEntry(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL);
@@ -504,23 +527,25 @@ TEST_F(CameraMultiStreamTest, DISABLED_MultiBurst) {
}
// Find the right sizes for preview, metering, and capture streams
- // assumes at least 2 entries in availableProcessedSizes.
int64_t minFrameDuration = DEFAULT_FRAME_DURATION;
Size processedMinSize, processedMaxSize, jpegMaxSize;
- const int32_t* data = availableProcessedSizes.data.i32;
- size_t count = availableProcessedSizes.count;
int32_t minIdx, maxIdx;
- GetMinSize(data, count, &processedMinSize, &minIdx);
- GetMaxSize(data, count, &processedMaxSize, &maxIdx);
+ GetMinSize(implDefData, implDefCount, &processedMinSize, &minIdx);
+ GetMaxSize(implDefData, implDefCount, &processedMaxSize, &maxIdx);
ALOGV("Found processed max size: %dx%d, min size = %dx%d",
processedMaxSize.width, processedMaxSize.height,
processedMinSize.width, processedMinSize.height);
- if (availableProcessedSizes.count ==
- availableProcessedMinFrameDurations.count * 2) {
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_ro_entry availableProcessedMinFrameDurations =
+ GetStaticEntry(ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS);
minFrameDuration =
availableProcessedMinFrameDurations.data.i64[maxIdx / 2];
+ } else {
+ minFrameDuration = getMinFrameDurationFor(
+ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
+ processedMaxSize.width, processedMaxSize.height);
}
EXPECT_GT(minFrameDuration, 0);
@@ -531,9 +556,7 @@ TEST_F(CameraMultiStreamTest, DISABLED_MultiBurst) {
ALOGV("targeted minimal frame duration is: %"PRId64"ns", minFrameDuration);
- data = &(availableJpegSizes.data.i32[0]);
- count = availableJpegSizes.count;
- GetMaxSize(data, count, &jpegMaxSize, &maxIdx);
+ GetMaxSize(jpegData, jpegCount, &jpegMaxSize, &maxIdx);
ALOGV("Found Jpeg size max idx = %d", maxIdx);
// Max Jpeg size should be available in processed sizes. Use it for
@@ -627,7 +650,7 @@ TEST_F(CameraMultiStreamTest, DISABLED_MultiBurst) {
// purely by analog gain if possible.
Vector<int32_t> sensitivities;
Vector<int64_t> exposures;
- count = (maxAnalogSensitivity - minSensitivity + 99) / 100;
+ size_t count = (maxAnalogSensitivity - minSensitivity + 99) / 100;
sensitivities.push_back(minSensitivity);
for (size_t i = 1; i < count; i++) {
sensitivities.push_back(minSensitivity + i * 100);
diff --git a/tests/camera2/CameraStreamFixture.h b/tests/camera2/CameraStreamFixture.h
index f56daf0..20cbe98 100644
--- a/tests/camera2/CameraStreamFixture.h
+++ b/tests/camera2/CameraStreamFixture.h
@@ -96,7 +96,7 @@ private:
sp<CameraDeviceBase> device = mDevice;
/* use an arbitrary w,h */
- {
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
const int tag = ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES;
const CameraMetadata& staticInfo = device->info();
@@ -106,9 +106,22 @@ private:
ASSERT_LE(2u, entry.count);
/* this seems like it would always be the smallest w,h
- but we actually make no contract that it's sorted asc */;
+ but we actually make no contract that it's sorted asc */
mWidth = entry.data.i32[0];
mHeight = entry.data.i32[1];
+ } else {
+ buildOutputResolutions();
+ const int32_t *implDefResolutions;
+ size_t implDefResolutionsCount;
+
+ int format = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
+
+ getResolutionList(format,
+ &implDefResolutions, &implDefResolutionsCount);
+ ASSERT_NE(0u, implDefResolutionsCount)
+ << "Missing implementation defined sizes";
+ mWidth = implDefResolutions[0];
+ mHeight = implDefResolutions[1];
}
}
void TearDown() {
@@ -117,12 +130,82 @@ private:
// important: shut down HAL before releasing streams
CameraModuleFixture::TearDown();
+ deleteOutputResolutions();
mNativeWindow.clear();
mCpuConsumer.clear();
mFrameListener.clear();
}
protected:
+
+ int64_t getMinFrameDurationFor(int32_t format, int32_t width, int32_t height) {
+ int64_t minFrameDuration = -1L;
+ const int tag = ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS;
+ sp<CameraDeviceBase> device = mDevice;
+ const CameraMetadata& staticInfo = device->info();
+ camera_metadata_ro_entry_t availableMinDurations = staticInfo.find(tag);
+ for (uint32_t i = 0; i < availableMinDurations.count; i += 4) {
+ if (format == availableMinDurations.data.i64[i] &&
+ width == availableMinDurations.data.i64[i + 1] &&
+ height == availableMinDurations.data.i64[i + 2]) {
+ minFrameDuration = availableMinDurations.data.i64[i + 3];
+ break;
+ }
+ }
+ return minFrameDuration;
+ }
+
+ void buildOutputResolutions() {
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ return;
+ }
+ if (mOutputResolutions.isEmpty()) {
+ const int tag = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS;
+ const CameraMetadata& staticInfo = mDevice->info();
+ camera_metadata_ro_entry_t availableStrmConfigs = staticInfo.find(tag);
+ ASSERT_EQ(0u, availableStrmConfigs.count % 4);
+ for (uint32_t i = 0; i < availableStrmConfigs.count; i += 4) {
+ int32_t format = availableStrmConfigs.data.i32[i];
+ int32_t width = availableStrmConfigs.data.i32[i + 1];
+ int32_t height = availableStrmConfigs.data.i32[i + 2];
+ int32_t inOrOut = availableStrmConfigs.data.i32[i + 3];
+ if (inOrOut == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
+ int index = mOutputResolutions.indexOfKey(format);
+ if (index < 0) {
+ index = mOutputResolutions.add(format, new Vector<int32_t>());
+ ASSERT_TRUE(index >= 0);
+ }
+ Vector<int32_t> *resolutions = mOutputResolutions.editValueAt(index);
+ resolutions->add(width);
+ resolutions->add(height);
+ }
+ }
+ }
+ }
+
+ void getResolutionList(int32_t format,
+ const int32_t **list,
+ size_t *count) {
+ status_t res;
+ ALOGV("Getting resolutions for format %x", format);
+ if (getDeviceVersion() < CAMERA_DEVICE_API_VERSION_3_2) {
+ return;
+ }
+ int index = mOutputResolutions.indexOfKey(format);
+ ASSERT_TRUE(index >= 0);
+ Vector<int32_t>* resolutions = mOutputResolutions.valueAt(index);
+ *list = resolutions->array();
+ *count = resolutions->size();
+ }
+
+ void deleteOutputResolutions() {
+ for (uint32_t i = 0; i < mOutputResolutions.size(); i++) {
+ Vector<int32_t>* resolutions = mOutputResolutions.editValueAt(i);
+ delete resolutions;
+ }
+ mOutputResolutions.clear();
+ }
+
struct FrameListener : public ConsumerBase::FrameAvailableListener {
FrameListener() {
@@ -280,7 +363,7 @@ protected:
android::sp<FrameListener> mFrameListener;
android::sp<CpuConsumer> mCpuConsumer;
android::sp<ANativeWindow> mNativeWindow;
-
+ KeyedVector<int32_t, Vector<int32_t>* > mOutputResolutions;
private:
CameraStreamParams mParam;
diff --git a/tests/camera2/camera2.cpp b/tests/camera2/camera2.cpp
index e3e7d9a..72b7b61 100644
--- a/tests/camera2/camera2.cpp
+++ b/tests/camera2/camera2.cpp
@@ -23,6 +23,7 @@
#include <fstream>
#include <utils/Vector.h>
+#include <utils/KeyedVector.h>
#include <gui/CpuConsumer.h>
#include <ui/PixelFormat.h>
#include <system/camera_metadata.h>
@@ -202,7 +203,9 @@ class Camera2Test: public testing::Test {
res = sCameraModule->get_camera_info(id, &info);
ASSERT_EQ(OK, res);
+ mDeviceVersion = info.device_version;
mStaticInfo = info.static_camera_characteristics;
+ buildOutputResolutions();
res = configureCameraDevice(mDevice,
mRequests,
@@ -241,44 +244,91 @@ class Camera2Test: public testing::Test {
ASSERT_GT(mStreams.size(), i) << "Stream id not found:" << id;
}
+ void buildOutputResolutions() {
+ status_t res;
+ if (mDeviceVersion < CAMERA_DEVICE_API_VERSION_3_2) {
+ return;
+ }
+ if (mOutputResolutions.isEmpty()) {
+ camera_metadata_ro_entry_t availableStrmConfigs;
+ res = find_camera_metadata_ro_entry(mStaticInfo,
+ ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,
+ &availableStrmConfigs);
+ ASSERT_EQ(OK, res);
+ ASSERT_EQ(0u, availableStrmConfigs.count % 4);
+ for (uint32_t i = 0; i < availableStrmConfigs.count; i += 4) {
+ int32_t format = availableStrmConfigs.data.i32[i];
+ int32_t width = availableStrmConfigs.data.i32[i + 1];
+ int32_t height = availableStrmConfigs.data.i32[i + 2];
+ int32_t inOrOut = availableStrmConfigs.data.i32[i + 3];
+ if (inOrOut == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
+ int index = mOutputResolutions.indexOfKey(format);
+ if (index < 0) {
+ index = mOutputResolutions.add(format, new Vector<int32_t>());
+ ASSERT_TRUE(index >= 0);
+ }
+ Vector<int32_t> *resolutions = mOutputResolutions.editValueAt(index);
+ resolutions->add(width);
+ resolutions->add(height);
+ }
+ }
+ }
+ }
+
+ void deleteOutputResolutions() {
+ for (uint32_t i = 0; i < mOutputResolutions.size(); i++) {
+ Vector<int32_t>* resolutions = mOutputResolutions.editValueAt(i);
+ delete resolutions;
+ }
+ mOutputResolutions.clear();
+ }
+
void getResolutionList(int32_t format,
const int32_t **list,
size_t *count) {
- ALOGV("Getting resolutions for format %x", format);
status_t res;
- if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
- camera_metadata_ro_entry_t availableFormats;
- res = find_camera_metadata_ro_entry(mStaticInfo,
- ANDROID_SCALER_AVAILABLE_FORMATS,
- &availableFormats);
- ASSERT_EQ(OK, res);
+ ALOGV("Getting resolutions for format %x", format);
+ if (mDeviceVersion < CAMERA_DEVICE_API_VERSION_3_2) {
+ if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
+ camera_metadata_ro_entry_t availableFormats;
+ res = find_camera_metadata_ro_entry(mStaticInfo,
+ ANDROID_SCALER_AVAILABLE_FORMATS,
+ &availableFormats);
+ ASSERT_EQ(OK, res);
+
+ uint32_t formatIdx;
+ for (formatIdx=0; formatIdx < availableFormats.count; formatIdx++) {
+ if (availableFormats.data.i32[formatIdx] == format) break;
+ }
+ ASSERT_NE(availableFormats.count, formatIdx)
+ << "No support found for format 0x" << std::hex << format;
+ }
- uint32_t formatIdx;
- for (formatIdx=0; formatIdx < availableFormats.count; formatIdx++) {
- if (availableFormats.data.i32[formatIdx] == format) break;
+ camera_metadata_ro_entry_t availableSizes;
+ if (format == HAL_PIXEL_FORMAT_RAW_SENSOR) {
+ res = find_camera_metadata_ro_entry(mStaticInfo,
+ ANDROID_SCALER_AVAILABLE_RAW_SIZES,
+ &availableSizes);
+ } else if (format == HAL_PIXEL_FORMAT_BLOB) {
+ res = find_camera_metadata_ro_entry(mStaticInfo,
+ ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
+ &availableSizes);
+ } else {
+ res = find_camera_metadata_ro_entry(mStaticInfo,
+ ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
+ &availableSizes);
}
- ASSERT_NE(availableFormats.count, formatIdx)
- << "No support found for format 0x" << std::hex << format;
- }
+ ASSERT_EQ(OK, res);
- camera_metadata_ro_entry_t availableSizes;
- if (format == HAL_PIXEL_FORMAT_RAW_SENSOR) {
- res = find_camera_metadata_ro_entry(mStaticInfo,
- ANDROID_SCALER_AVAILABLE_RAW_SIZES,
- &availableSizes);
- } else if (format == HAL_PIXEL_FORMAT_BLOB) {
- res = find_camera_metadata_ro_entry(mStaticInfo,
- ANDROID_SCALER_AVAILABLE_JPEG_SIZES,
- &availableSizes);
+ *list = availableSizes.data.i32;
+ *count = availableSizes.count;
} else {
- res = find_camera_metadata_ro_entry(mStaticInfo,
- ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES,
- &availableSizes);
+ int index = mOutputResolutions.indexOfKey(format);
+ ASSERT_TRUE(index >= 0);
+ Vector<int32_t>* resolutions = mOutputResolutions.valueAt(index);
+ *list = resolutions->array();
+ *count = resolutions->size();
}
- ASSERT_EQ(OK, res);
-
- *list = availableSizes.data.i32;
- *count = availableSizes.count;
}
status_t waitUntilDrained() {
@@ -325,11 +375,13 @@ class Camera2Test: public testing::Test {
closeCameraDevice(&mDevice);
}
+ deleteOutputResolutions();
TearDownModule();
}
int mId;
camera2_device *mDevice;
+ uint32_t mDeviceVersion;
const camera_metadata_t *mStaticInfo;
MetadataQueue mRequests;
@@ -337,11 +389,13 @@ class Camera2Test: public testing::Test {
NotifierListener mNotifications;
Vector<StreamAdapter*> mStreams;
+ KeyedVector<int32_t, Vector<int32_t>* > mOutputResolutions;
private:
static camera_module_t *sCameraModule;
static int sNumCameras;
static bool *sCameraSupportsHal2;
+
};
camera_module_t *Camera2Test::sCameraModule = NULL;