[libcamera-devel] [PATCH 9/9] android: Elevate min duration to 30 FPS if it's lower within 2%

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Feb 16 02:01:12 CET 2022


On Wed, Feb 16, 2022 at 03:00:43AM +0200, Laurent Pinchart wrote:
> Hi Han-Lin,
> 
> Thank you for the patch.
> 
> I'm CC'ing Jacopo and Umang as they've both spent a large amount of time
> solving issues related to frame durations.

And now with Umang's correct address.

> On Wed, Feb 09, 2022 at 03:19:17PM +0800, Han-Lin Chen wrote:
> > It's notice that Chrome Camera App filters out the resolutions which cannot
> > achieve 30 FPS. Elevate the minimum frame duration to 30 FPS if FPS is lower
> > within 2%.
> 
> Unless I'm mistaken this patch doesn't depend on the rest of the series,
> so we can review and merge it separately.
> 
> > Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
> > ---
> >  src/android/camera_capabilities.cpp | 31 +++++++++++++++++++----------
> >  1 file changed, 20 insertions(+), 11 deletions(-)
> > 
> > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp
> > index 55d651f3..e10ab036 100644
> > --- a/src/android/camera_capabilities.cpp
> > +++ b/src/android/camera_capabilities.cpp
> > @@ -655,7 +655,9 @@ int CameraCapabilities::initializeStreamConfigurations()
> >  			int64_t maxFrameDuration = frameDurations->second.max().get<int64_t>() * 1000;
> >  
> >  			/*
> > -			 * Cap min frame duration to 30 FPS with 1% tolerance.
> > +			 * Cap min frame duration to 30 FPS with 1% tolerance,
> > +			 * and elevate min frame duration to 30 FPS with 2%
> > +			 * tolerance.
> >  			 *
> >  			 * 30 frames per second has been validated as the most
> >  			 * opportune frame rate for quality tuning, and power
> > @@ -675,17 +677,24 @@ int CameraCapabilities::initializeStreamConfigurations()
> >  			 * to the in-development configuration API rework.
> >  			 */
> >  			int64_t minFrameDurationCap = 1e9 / 30.0;
> > -			if (minFrameDuration < minFrameDurationCap) {
> > -				float tolerance =
> > -					(minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap;
> > +			float tolerance =
> > +				(minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap;
> >  
> > -				/*
> > -				 * If the tolerance is less than 1%, do not cap
> > -				 * the frame duration.
> > -				 */
> > -				if (tolerance > 1.0)
> > -					minFrameDuration = minFrameDurationCap;
> > -			}
> > +			/*
> > +			 * If the tolerance is less than 1%, do not cap
> > +			 * the frame duration.
> > +			 */
> > +			if (tolerance > 1.0)
> > +				minFrameDuration = minFrameDurationCap;
> > +
> > +			/*
> > +			 * Some applications, ex: Chrome Camera App filters out
> > +			 * the resolutions which cannot achieve 30 FPS. Elevate
> > +			 * the minimum frame duration to 30 FPS if FPS is lower
> > +			 * within 2%.
> > +			 */
> > +			if (tolerance < 0 && tolerance > -2.0)
> > +				minFrameDuration = minFrameDurationCap;
> >  
> >  			streamConfigurations_.push_back({
> >  				res, androidFormat, minFrameDuration, maxFrameDuration,

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list