[libcamera-devel] ipa: tweak constant expressions that fail to be determined on ppc64el
diff mbox series

Message ID mailman.9.1665409834.871.libcamera-devel@lists.libcamera.org
State New
Headers show
Series
  • [libcamera-devel] ipa: tweak constant expressions that fail to be determined on ppc64el
Related show

Commit Message

Olivier Gayot Oct. 10, 2022, 1:45 p.m. UTC
From: Olivier Gayot <olivier.gayot@canonical.com>

On ppc64el, GCC fails to determine the result of some long double
expressions at compile time. This makes libcamera fail to build with GCC
on that architecture.

e.g.:

constexpr auto x = 1.0l/30.0;

in ‘constexpr’ expansion of ‘std::chrono::operator/<long double, std::ratio<1>,
  double>(std::literals::chrono_literals::operator""s(1.0e+0l), 6.0e+1)’
/usr/include/c++/11/chrono:710:39: error: ‘(1.0e+0l / 6.0e+1)’ is not a constant expression
  710 |         return __cd(__cd(__d).count() / __s);

Tweaking the expressions just a bit makes GCC happy and allows libcamera
to build properly on ppc64el.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 14b06a4f..3e4383f9 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -60,7 +60,7 @@  using utils::Duration;
 /* Configure the sensor with these values initially. */
 constexpr double defaultAnalogueGain = 1.0;
 constexpr Duration defaultExposureTime = 20.0ms;
-constexpr Duration defaultMinFrameDuration = 1.0s / 30.0;
+constexpr Duration defaultMinFrameDuration = 1s / 30.0;
 constexpr Duration defaultMaxFrameDuration = 250.0s;
 
 /*
@@ -69,7 +69,7 @@  constexpr Duration defaultMaxFrameDuration = 250.0s;
  * we rate-limit the controller Prepare() and Process() calls to lower than or
  * equal to this rate.
  */
-constexpr Duration controllerMinFrameDuration = 1.0s / 30.0;
+constexpr Duration controllerMinFrameDuration = 1s / 30.0;
 
 /* List of controls handled by the Raspberry Pi IPA */
 static const ControlInfoMap::Map ipaControls{