[PATCH v2 5/9] ipa: rkisp1: params: Check for empty parameters
Kieran Bingham
kieran.bingham at ideasonboard.com
Sun Apr 13 19:50:47 CEST 2025
Quoting Stefan Klug (2025-04-11 13:36:33)
> Add functions to check for empty parameter blocks. Modify the constructor
> so that a parameter block constructed from an empty span stays empty.
>
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
>
> ---
>
> Changes in v2:
> - Removed unrelated get() functions
> ---
> src/ipa/rkisp1/params.cpp | 3 +++
> src/ipa/rkisp1/params.h | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/src/ipa/rkisp1/params.cpp b/src/ipa/rkisp1/params.cpp
> index 4c0b051ce65d..b4a889e415fc 100644
> --- a/src/ipa/rkisp1/params.cpp
> +++ b/src/ipa/rkisp1/params.cpp
> @@ -82,6 +82,9 @@ RkISP1ParamsBlockBase::RkISP1ParamsBlockBase(RkISP1Params *params, BlockType typ
> const Span<uint8_t> &data)
> : params_(params), type_(type)
> {
> + if (data.empty())
> + return;
> +
> if (params_->format() == V4L2_META_FMT_RK_ISP1_EXT_PARAMS) {
> header_ = data.subspan(0, sizeof(rkisp1_ext_params_block_header));
> data_ = data.subspan(sizeof(rkisp1_ext_params_block_header));
> diff --git a/src/ipa/rkisp1/params.h b/src/ipa/rkisp1/params.h
> index 40450e34497a..04b06c2a6266 100644
> --- a/src/ipa/rkisp1/params.h
> +++ b/src/ipa/rkisp1/params.h
> @@ -89,6 +89,9 @@ public:
>
> void setEnabled(bool enabled);
>
> + bool isValid() const { return !data_.empty(); }
> + explicit operator bool() const { return !data_.empty(); }
I suppose bool could be implemented by referencing isValid() but both
are equivalent...
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> +
> private:
> LIBCAMERA_DISABLE_COPY(RkISP1ParamsBlockBase)
>
> --
> 2.43.0
>
More information about the libcamera-devel
mailing list