ipa: rpi: sync: Convert wallclock from nanoseconds to microseconds
diff mbox series

Message ID 20250814072816.35592-1-david.plowman@raspberrypi.com
State Not Applicable
Headers show
Series
  • ipa: rpi: sync: Convert wallclock from nanoseconds to microseconds
Related show

Commit Message

David Plowman Aug. 14, 2025, 7:28 a.m. UTC
The wallclock timestamp has been changed to nanosecond units, and all
the calculations here assume it's in microseconds, so add the
necessary conversion.

Fixes: 29a88d85b730 ("libcamera: controls: Use nanoseconds units for FrameWallClock")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/controller/rpi/sync.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Plowman Aug. 14, 2025, 7:33 a.m. UTC | #1
Ah. Hold on, this file (sync.cpp) isn't even in upstream libcamera, is
it? Can we delete it then, please?

Thanks!
David

On Thu, 14 Aug 2025 at 08:28, David Plowman
<david.plowman@raspberrypi.com> wrote:
>
> The wallclock timestamp has been changed to nanosecond units, and all
> the calculations here assume it's in microseconds, so add the
> necessary conversion.
>
> Fixes: 29a88d85b730 ("libcamera: controls: Use nanoseconds units for FrameWallClock")
> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> ---
>  src/ipa/rpi/controller/rpi/sync.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/rpi/controller/rpi/sync.cpp b/src/ipa/rpi/controller/rpi/sync.cpp
> index 39bf5de7..5f9c3c22 100644
> --- a/src/ipa/rpi/controller/rpi/sync.cpp
> +++ b/src/ipa/rpi/controller/rpi/sync.cpp
> @@ -163,8 +163,8 @@ void Sync::process([[maybe_unused]] StatisticsPtr &stats, Metadata *imageMetadat
>
>         imageMetadata->get("sync.params", local);
>
> -       /* The wallclock has already been de-jittered for us. */
> -       uint64_t wallClockFrameTimestamp = local.wallClock;
> +       /* The wallclock has already been de-jittered for us. Convert from ns into us. */
> +       uint64_t wallClockFrameTimestamp = local.wallClock / 1000;
>
>         /*
>          * This is the headline frame duration in microseconds as programmed into the sensor. Strictly,
> --
> 2.39.5
>
Barnabás Pőcze Aug. 14, 2025, 7:35 a.m. UTC | #2
Hi

2025. 08. 14. 9:33 keltezéssel, David Plowman írta:
> Ah. Hold on, this file (sync.cpp) isn't even in upstream libcamera, is
> it? Can we delete it then, please?

I don't see it in the upstream repository.


Regards,
Barnabás Pőcze


> 
> Thanks!
> David
> 
> On Thu, 14 Aug 2025 at 08:28, David Plowman
> <david.plowman@raspberrypi.com> wrote:
>>
>> The wallclock timestamp has been changed to nanosecond units, and all
>> the calculations here assume it's in microseconds, so add the
>> necessary conversion.
>>
>> Fixes: 29a88d85b730 ("libcamera: controls: Use nanoseconds units for FrameWallClock")
>> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
>> ---
>>   src/ipa/rpi/controller/rpi/sync.cpp | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/ipa/rpi/controller/rpi/sync.cpp b/src/ipa/rpi/controller/rpi/sync.cpp
>> index 39bf5de7..5f9c3c22 100644
>> --- a/src/ipa/rpi/controller/rpi/sync.cpp
>> +++ b/src/ipa/rpi/controller/rpi/sync.cpp
>> @@ -163,8 +163,8 @@ void Sync::process([[maybe_unused]] StatisticsPtr &stats, Metadata *imageMetadat
>>
>>          imageMetadata->get("sync.params", local);
>>
>> -       /* The wallclock has already been de-jittered for us. */
>> -       uint64_t wallClockFrameTimestamp = local.wallClock;
>> +       /* The wallclock has already been de-jittered for us. Convert from ns into us. */
>> +       uint64_t wallClockFrameTimestamp = local.wallClock / 1000;
>>
>>          /*
>>           * This is the headline frame duration in microseconds as programmed into the sensor. Strictly,
>> --
>> 2.39.5
>>
David Plowman Aug. 14, 2025, 7:37 a.m. UTC | #3
Sorry, I meant delete/ignore the patch email!! :)

Thanks

On Thu, 14 Aug 2025 at 08:35, Barnabás Pőcze
<barnabas.pocze@ideasonboard.com> wrote:
>
> Hi
>
> 2025. 08. 14. 9:33 keltezéssel, David Plowman írta:
> > Ah. Hold on, this file (sync.cpp) isn't even in upstream libcamera, is
> > it? Can we delete it then, please?
>
> I don't see it in the upstream repository.
>
>
> Regards,
> Barnabás Pőcze
>
>
> >
> > Thanks!
> > David
> >
> > On Thu, 14 Aug 2025 at 08:28, David Plowman
> > <david.plowman@raspberrypi.com> wrote:
> >>
> >> The wallclock timestamp has been changed to nanosecond units, and all
> >> the calculations here assume it's in microseconds, so add the
> >> necessary conversion.
> >>
> >> Fixes: 29a88d85b730 ("libcamera: controls: Use nanoseconds units for FrameWallClock")
> >> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
> >> ---
> >>   src/ipa/rpi/controller/rpi/sync.cpp | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/ipa/rpi/controller/rpi/sync.cpp b/src/ipa/rpi/controller/rpi/sync.cpp
> >> index 39bf5de7..5f9c3c22 100644
> >> --- a/src/ipa/rpi/controller/rpi/sync.cpp
> >> +++ b/src/ipa/rpi/controller/rpi/sync.cpp
> >> @@ -163,8 +163,8 @@ void Sync::process([[maybe_unused]] StatisticsPtr &stats, Metadata *imageMetadat
> >>
> >>          imageMetadata->get("sync.params", local);
> >>
> >> -       /* The wallclock has already been de-jittered for us. */
> >> -       uint64_t wallClockFrameTimestamp = local.wallClock;
> >> +       /* The wallclock has already been de-jittered for us. Convert from ns into us. */
> >> +       uint64_t wallClockFrameTimestamp = local.wallClock / 1000;
> >>
> >>          /*
> >>           * This is the headline frame duration in microseconds as programmed into the sensor. Strictly,
> >> --
> >> 2.39.5
> >>
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/controller/rpi/sync.cpp b/src/ipa/rpi/controller/rpi/sync.cpp
index 39bf5de7..5f9c3c22 100644
--- a/src/ipa/rpi/controller/rpi/sync.cpp
+++ b/src/ipa/rpi/controller/rpi/sync.cpp
@@ -163,8 +163,8 @@  void Sync::process([[maybe_unused]] StatisticsPtr &stats, Metadata *imageMetadat
 
 	imageMetadata->get("sync.params", local);
 
-	/* The wallclock has already been de-jittered for us. */
-	uint64_t wallClockFrameTimestamp = local.wallClock;
+	/* The wallclock has already been de-jittered for us. Convert from ns into us. */
+	uint64_t wallClockFrameTimestamp = local.wallClock / 1000;
 
 	/*
 	 * This is the headline frame duration in microseconds as programmed into the sensor. Strictly,