[PATCH resend 5/5] libcamera: swstats_cpu: Add processFrame() method

Hans de Goede hdegoede at redhat.com
Fri May 9 13:44:08 CEST 2025


Hi,

On 6-Dec-24 7:18 PM, Laurent Pinchart wrote:
> On Fri, Dec 06, 2024 at 02:56:00PM +0100, Milan Zamazal wrote:
>> Laurent Pinchart writes:
>>> On Fri, Dec 06, 2024 at 01:14:35PM +0000, Kieran Bingham wrote:
>>>> Quoting Hans de Goede (2024-12-05 19:25:19)
>>>>> Add a method to the SwstatsCpu class to process a whole Framebuffer in
>>>
>>>>> one go, rather then line by line. This is useful for gathering stats
>>>>> when debayering is not necessary or is not done on the CPU.
>>>>
>>>> This is the bit I can see will be useful for any scenario where we don't
>>>> have stats. I think for instance on RKISP1 when running raw mode we
>>>> don't get stats, so something like this would be helpful to be able to
>>>> support some AEGC control which would likely be beneficial for tuning or
>>>> capturing raw streams.
>>>
>>> I'm in two minds about that. If it's only about tuning with ISPs that
>>> can't generate statistics when capturing raw frames, an application-side
>>> AE could be a better option. We should discuss it when the need arises
>>> before writing code.
>>
>> Another use, discussed in one of the recent software ISP syncs, would be
>> to get statistics from CPU when doing debayering on a GPU.
> 
> That use case is an important one. I hope we'll eventualy get the GPU to
> calculates stats too, but in the interim period the CPU is useful.
> 
>> And when all I need is getting raw frames, let's say from `simple'
>> pipeline for debugging purposes or something similar, getting them
>> reasonably exposed out of the box may be convenient.
> 
> In that case I'd expect the frames to go through the software ISP, and
> if the user only wants raw frames, we would "configure" the software ISP
> to only produce statistics, not processed frames.

Right, but even in that case we still need the processFrame() method
for doing stats on a full frame of raw bayer data. ATM the statistics
are done 2 lines at a time driven by the debayer code, so that
the bayer code operates on src data which is still hot in the cache
because of the stats code just having read it.

Without actually calling the main debayer loop since we don't want
to debayer we will need another loop which just calls the existing
line based statistics code on all lines (all lines in the statistics
window). This other loop is what this patch provides.

Regards,

Hans




More information about the libcamera-devel mailing list