Message ID | 20211221051549.2647005-1-paul.elder@ideasonboard.com |
---|---|
State | New |
Delegated to: | Paul Elder |
Headers | show |
Series |
|
Related | show |
Quoting Paul Elder (2021-12-21 05:15:49) > Plumb SENSOR_INFO_WHITE_LEVEL into the static metadata. Get the > information from the maximum bit depth raw format supported by the > sensor. Since we hardcode accept only 16-bit raw formats, take that "Since we hardcode that we only accept 16-bit ...." > hardcoded value. While at it, save the hardcoded value in a variable so > that if it is changed in the future this gets updated automatically. > > Note that nothing is added to the capability detector, as white level > will always be added to the static metadata. Add a comment to document > it. > > Bug: https://bugs.libcamera.org/show_bug.cgi?id=49 > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > src/android/camera_capabilities.cpp | 9 ++++++++- > src/android/camera_capabilities.h | 1 + > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp > index d5e79057..bc62a928 100644 > --- a/src/android/camera_capabilities.cpp > +++ b/src/android/camera_capabilities.cpp > @@ -447,6 +447,7 @@ int CameraCapabilities::initialize(std::shared_ptr<Camera> camera, > orientation_ = orientation; > facing_ = facing; > minISO_ = minISO; > + rawBitDepth_ = 16; > rawStreamAvailable_ = false; > maxFrameDuration_ = 0; > > @@ -667,7 +668,7 @@ int CameraCapabilities::initializeStreamConfigurations() > const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat); > switch (info.colourEncoding) { > case PixelFormatInfo::ColourEncodingRAW: > - if (info.bitsPerPixel != 16) > + if (info.bitsPerPixel != rawBitDepth_) Should this print a warning to say we're ignoring non-16-bit raw formats? Otherwise, seems ok, on the assumption that we don't currently care about non-16-bit raw support. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > continue; > > rawStreamAvailable_ = true; > @@ -1335,6 +1336,12 @@ int CameraCapabilities::initializeStaticMetadata() > staticMetadata_->addEntry(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, > maxFrameDuration_); > > + /* This is required for FULL. */ > + int whiteLevel = (1 << rawBitDepth_) - 1; > + staticMetadata_->addEntry(ANDROID_SENSOR_INFO_WHITE_LEVEL, > + whiteLevel); > + availableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_WHITE_LEVEL); > + > /* Statistics static metadata. */ > uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; > staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES, > diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h > index 7f554c63..2e6595fb 100644 > --- a/src/android/camera_capabilities.h > +++ b/src/android/camera_capabilities.h > @@ -71,6 +71,7 @@ private: > int facing_; > int orientation_; > int minISO_; > + unsigned int rawBitDepth_; > bool rawStreamAvailable_; > int64_t maxFrameDuration_; > camera_metadata_enum_android_info_supported_hardware_level hwLevel_; > -- > 2.27.0 >
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index d5e79057..bc62a928 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -447,6 +447,7 @@ int CameraCapabilities::initialize(std::shared_ptr<Camera> camera, orientation_ = orientation; facing_ = facing; minISO_ = minISO; + rawBitDepth_ = 16; rawStreamAvailable_ = false; maxFrameDuration_ = 0; @@ -667,7 +668,7 @@ int CameraCapabilities::initializeStreamConfigurations() const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat); switch (info.colourEncoding) { case PixelFormatInfo::ColourEncodingRAW: - if (info.bitsPerPixel != 16) + if (info.bitsPerPixel != rawBitDepth_) continue; rawStreamAvailable_ = true; @@ -1335,6 +1336,12 @@ int CameraCapabilities::initializeStaticMetadata() staticMetadata_->addEntry(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, maxFrameDuration_); + /* This is required for FULL. */ + int whiteLevel = (1 << rawBitDepth_) - 1; + staticMetadata_->addEntry(ANDROID_SENSOR_INFO_WHITE_LEVEL, + whiteLevel); + availableCharacteristicsKeys_.insert(ANDROID_SENSOR_INFO_WHITE_LEVEL); + /* Statistics static metadata. */ uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES, diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h index 7f554c63..2e6595fb 100644 --- a/src/android/camera_capabilities.h +++ b/src/android/camera_capabilities.h @@ -71,6 +71,7 @@ private: int facing_; int orientation_; int minISO_; + unsigned int rawBitDepth_; bool rawStreamAvailable_; int64_t maxFrameDuration_; camera_metadata_enum_android_info_supported_hardware_level hwLevel_;
Plumb SENSOR_INFO_WHITE_LEVEL into the static metadata. Get the information from the maximum bit depth raw format supported by the sensor. Since we hardcode accept only 16-bit raw formats, take that hardcoded value. While at it, save the hardcoded value in a variable so that if it is changed in the future this gets updated automatically. Note that nothing is added to the capability detector, as white level will always be added to the static metadata. Add a comment to document it. Bug: https://bugs.libcamera.org/show_bug.cgi?id=49 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/android/camera_capabilities.cpp | 9 ++++++++- src/android/camera_capabilities.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-)