[libcamera-devel,v2,4/4] ipa: raspberrypi: Fix default frame durations calculation
diff mbox series

Message ID 20230327093439.24670-5-naush@raspberrypi.com
State Accepted
Headers show
Series
  • Raspberry Pi: Sensor limits
Related show

Commit Message

Naushir Patuck March 27, 2023, 9:34 a.m. UTC
Fix a bug in the default frame durations calculation where the min/max
values are swapped round. This is a rarely travelled code path, so has
not actually caused a reported failure.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Plowman March 27, 2023, 1:33 p.m. UTC | #1
Hi Naush

Thanks for the patch.

On Mon, 27 Mar 2023 at 10:34, Naushir Patuck via libcamera-devel
<libcamera-devel@lists.libcamera.org> wrote:
>
> Fix a bug in the default frame durations calculation where the min/max
> values are swapped round. This is a rarely travelled code path, so has
> not actually caused a reported failure.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index c10e57e07ab0..66a020d022cd 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -1486,8 +1486,8 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur
>          * This will only be applied once AGC recalculations occur.
>          * The values may be clamped based on the sensor mode capabilities as well.
>          */
> -       minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMaxFrameDuration;
> -       maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMinFrameDuration;
> +       minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMinFrameDuration;
> +       maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMaxFrameDuration;

Indeed, good spot!

Reviewed-by: David Plowman <david.plowman@raspberrypi.com>

Thanks!
David

>         minFrameDuration_ = std::clamp(minFrameDuration_,
>                                        mode_.minFrameDuration, mode_.maxFrameDuration);
>         maxFrameDuration_ = std::clamp(maxFrameDuration_,
> --
> 2.34.1
>
Jacopo Mondi March 27, 2023, 1:44 p.m. UTC | #2
Hi Naush

On Mon, Mar 27, 2023 at 10:34:39AM +0100, Naushir Patuck via libcamera-devel wrote:
> Fix a bug in the default frame durations calculation where the min/max
> values are swapped round. This is a rarely travelled code path, so has
> not actually caused a reported failure.
>
> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index c10e57e07ab0..66a020d022cd 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -1486,8 +1486,8 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur
>  	 * This will only be applied once AGC recalculations occur.
>  	 * The values may be clamped based on the sensor mode capabilities as well.
>  	 */
> -	minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMaxFrameDuration;
> -	maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMinFrameDuration;
> +	minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMinFrameDuration;
> +	maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMaxFrameDuration;
>  	minFrameDuration_ = std::clamp(minFrameDuration_,
>  				       mode_.minFrameDuration, mode_.maxFrameDuration);
>  	maxFrameDuration_ = std::clamp(maxFrameDuration_,
> --
> 2.34.1
>

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index c10e57e07ab0..66a020d022cd 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -1486,8 +1486,8 @@  void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur
 	 * This will only be applied once AGC recalculations occur.
 	 * The values may be clamped based on the sensor mode capabilities as well.
 	 */
-	minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMaxFrameDuration;
-	maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMinFrameDuration;
+	minFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMinFrameDuration;
+	maxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMaxFrameDuration;
 	minFrameDuration_ = std::clamp(minFrameDuration_,
 				       mode_.minFrameDuration, mode_.maxFrameDuration);
 	maxFrameDuration_ = std::clamp(maxFrameDuration_,