[PATCH v3 06/16] libcamera: software_isp: Add SwStatsCpu class
Hans de Goede
hdegoede at redhat.com
Thu Feb 29 15:20:37 CET 2024
Hi,
On 2/27/24 17:23, Barnabás Pőcze wrote:
> Hi
>
>
> 2024. február 27., kedd 14:07 keltezéssel, Hans de Goede <hdegoede at redhat.com> írta:
>
>> [...]
>>>> +/**
>>>> + * \brief Configure the statistics object for the passed in input format.
>>>> + * \param[in] inputCfg The input format
>>>> + *
>>>> + * \return 0 on success, a negative errno value on failure
>>>> + */
>>>> +int SwStatsCpu::configure(const StreamConfiguration &inputCfg)
>>>> +{
>>>> + BayerFormat bayerFormat =
>>>> + BayerFormat::fromPixelFormat(inputCfg.pixelFormat);
>>>> +
>>>> + if (bayerFormat.bitDepth == 10 &&
>>>> + bayerFormat.packing == BayerFormat::Packing::CSI2) {
>>>> + patternSize_.height = 2;
>>>> + patternSize_.width = 4; /* 5 bytes per *4* pixels */
>>>> + /* Skip every 3th and 4th line, sample every other 2x2 block */
>>>> + ySkipMask_ = 0x02;
>>>> + xShift_ = 0;
>>>> +
>>>> + switch (bayerFormat.order) {
>>>> + case BayerFormat::BGGR:
>>>> + case BayerFormat::GRBG:
>>>> + stats0_ = (SwStatsCpu::statsProcessFn)&SwStatsCpu::statsBGGR10PLine0;
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> Isn't the type cast superfluous? (The same below.)
>>
>> You would think so but gcc enforces this for c++ when assigning
>> function pointers. I tried removing the cast when reworking
>> Andrey's original code and gcc gave an error without the cast.
>> [...]
>
> Is the code in this patchset different from what's on gitlab? Because I tested
> the SoftwareISP-v06{,-ynk,-pdm} branches from https://gitlab.freedesktop.org/camera/libcamera-softisp
> and they all seemed to compile without the cast.
>
> I think the reason why it was needed is because in the previous version inheritance
> was used (SwStatsCpu -> SwStats), i.e. you cast a "pointer-to-member-function of derived"
> to "pointer-to-member-function of base". But now there is no inheritance, so the
> implicit conversion should work.
You are right I have dropped the casts for v4 of the series which I will
post real soon.
Regards,
Hans
More information about the libcamera-devel
mailing list