[libcamera-devel] [RFC PATCH 3/6] android: camera_device: Add ANDROID_JPEG_MAX_SIZE
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Jul 22 00:01:23 CEST 2020
Provide a key for ANDROID_JPEG_MAX_SIZE. The value of 13MB is currently
arbitrary, but taken from the USB Camera HAL in CrOS platform2:
// android.jpeg
update_static(ANDROID_JPEG_MAX_SIZE, int32_t{13 << 20});
update_request(ANDROID_JPEG_QUALITY, uint8_t{90});
update_request(ANDROID_JPEG_THUMBNAIL_QUALITY, uint8_t{90});
update_request(ANDROID_JPEG_ORIENTATION, int32_t{0});
Note: The metadata entries/size updates are probably wrong, and should
be automated.
Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
src/android/camera_device.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3f3d7857f0ab..56652ac57676 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -407,10 +407,10 @@ std::tuple<uint32_t, uint32_t> CameraDevice::calculateStaticMetadataSize()
{
/*
* \todo Keep this in sync with the actual number of entries.
- * Currently: 50 entries, 647 bytes of static metadata
+ * Currently: 51 entries, 651 bytes of static metadata
*/
- uint32_t numEntries = 50;
- uint32_t byteSize = 647;
+ uint32_t numEntries = 51;
+ uint32_t byteSize = 651;
/*
* Calculate space occupation in bytes for dynamically built metadata
@@ -567,6 +567,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
availableThumbnailSizes.data(),
availableThumbnailSizes.size());
+ int32_t jpegMaxSize = 13 << 20; /* 13631488 from USB HAL */
+ staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1);
+
/* Sensor static metadata. */
int32_t pixelArraySize[] = {
2592, 1944,
@@ -773,6 +776,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
ANDROID_CONTROL_AWB_LOCK_AVAILABLE,
ANDROID_CONTROL_AVAILABLE_MODES,
ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,
+ ANDROID_JPEG_MAX_SIZE,
ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
ANDROID_SENSOR_INFO_SENSITIVITY_RANGE,
--
2.25.1
More information about the libcamera-devel
mailing list