[libcamera-devel] [PATCH] android: Check exposure time range for manual sensor capability

Jacopo Mondi jacopo at jmondi.org
Fri Aug 27 08:28:13 CEST 2021


Hi Paul,

On Fri, Aug 27, 2021 at 12:02:47PM +0900, paul.elder at ideasonboard.com wrote:
> Hi Jacopo,
>
> On Wed, Aug 25, 2021 at 11:02:22AM +0200, Jacopo Mondi wrote:
> > Hi Paul,
> >
> > On Mon, Aug 23, 2021 at 07:32:58PM +0900, Paul Elder wrote:
> > > In the manual sensor capability validator, add a check for the exposure
> > > time range.
> > >
> > > Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> > > ---
> > >  src/android/camera_capabilities.cpp | 22 ++++++++++++++++++++++
> > >  1 file changed, 22 insertions(+)
> > >
> > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> > > index bd661675..5b560b4f 100644
> > > --- a/src/android/camera_capabilities.cpp
> > > +++ b/src/android/camera_capabilities.cpp
> > > @@ -217,6 +217,8 @@ std::vector<U> setMetadata(CameraMetadata *metadata, uint32_t tag,
> > >
> > >  bool CameraCapabilities::validateManualSensorCapability()
> > >  {
> > > +	camera_metadata_ro_entry_t entry;
> > > +
> > >  	const char *noMode = "Manual sensor capability unavailable: ";
> > >
> > >  	if (!staticMetadata_->entryContains<uint8_t>(ANDROID_CONTROL_AE_AVAILABLE_MODES,
> > > @@ -231,6 +233,26 @@ bool CameraCapabilities::validateManualSensorCapability()
> > >  		return false;
> > >  	}
> > >
> > > +	if (!staticMetadata_->hasEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE)) {
> > > +		LOG(HAL, Info) << noMode << "missing exposure time range";
> > > +		return false;
> > > +	}
> > > +
> > > +	staticMetadata_->getEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, &entry);
> > > +	if (100000 < entry.data.i32[0]) {
> > > +		LOG(HAL, Info)
> > > +			<< noMode
> > > +			<< "exposure time range minimum must be no larger than 100us";
> > > +		return false;
> > > +	}
> > > +
> > > +	if (entry.data.i32[1] < 100000000) {
> > > +		LOG(HAL, Info)
> > > +			<< noMode
> > > +			<< "exposure time range maximum must be no smaller than 100ms";
> > > +		return false;
> > > +	}
> > > +
> >
> > Why I don't see such requirement for MANUAL_SENSOR capability
> > description, but rather in the FULL level description only ?
> >
> > android.sensor.info.exposureTimeRange:
> > For FULL capability devices (android.info.supportedHardwareLevel ==
> > FULL),The maximum of the range SHOULD be at least 1 second (1e9), MUST
> > be at least 100ms.
>
> From what I saw [1], the first is an overall requirement, while the
> second is only a FULL requirement.
>
> The minimum exposure time will be less than 100 us. For FULL capability
> devices (android.info.supportedHardwareLevel == FULL), the maximum
> exposure time will be greater than 100

Reading again this quotation, yes it seems the first is a generic
requirement.

>
> So can I assume that the first is satisfied? Or should we check it when
> it's set in the static metadata and reject it there?

I think it would be better verified at static metadata initialization
time ? What do you think ?

	const auto &exposureInfo = controlsInfo.find(&controls::ExposureTime);
	if (exposureInfo != controlsInfo.end()) {
		int64_t exposureTimeRange[2] = {
			exposureInfo->second.min().get<int32_t>() * 1000LL,
			exposureInfo->second.max().get<int32_t>() * 1000LL,

                        ---> HERE ?
		};
		staticMetadata_->addEntry(ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE,
					  exposureTimeRange, 2);
	}

while the second requirement has to be verified when testing for FULL
level support ?

Thanks
   j

>
> Also I guess the checks should be "or equal to" :)
>
> [1] https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#SENSOR_INFO_EXPOSURE_TIME_RANGE
>
>
> Thanks,
>
> Paul
>
> >
> > >  	/*
> > >  	 * \todo Return true here after we satisfy all the requirements:
> > >  	 * https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR
> > > --
> > > 2.27.0
> > >


More information about the libcamera-devel mailing list