[v4,09/21] ipa: libipa: ccm: Use 32-bit offsets
diff mbox series

Message ID 20261113164054.267164-10-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: rcar-gen4 + rpp-x1
Related show

Commit Message

Barnabás Pőcze Nov. 13, 2026, 4:40 p.m. UTC
The currently used 16-bit offsets are not enough for all platforms. Offsets
should ideally be defined as normalized numbers instead of effectively "raw"
register values. But that requires breaking the tuning files, so it is
postponsed, and this temporary solution is used.

Link: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/371
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/ipu3/algorithms/ccm.cpp   | 2 +-
 src/ipa/libipa/ccm.cpp            | 2 +-
 src/ipa/libipa/ccm.h              | 4 ++--
 src/ipa/rkisp1/algorithms/ccm.cpp | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Comments

Kieran Bingham Nov. 13, 2026, 5:58 p.m. UTC | #1
Quoting Barnabás Pőcze (2026-11-13 16:40:42)
> The currently used 16-bit offsets are not enough for all platforms. Offsets
> should ideally be defined as normalized numbers instead of effectively "raw"
> register values. But that requires breaking the tuning files, so it is
> postponsed, and this temporary solution is used.
> 
> Link: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/371

Sounds ok to me.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  src/ipa/ipu3/algorithms/ccm.cpp   | 2 +-
>  src/ipa/libipa/ccm.cpp            | 2 +-
>  src/ipa/libipa/ccm.h              | 4 ++--
>  src/ipa/rkisp1/algorithms/ccm.cpp | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/ipa/ipu3/algorithms/ccm.cpp b/src/ipa/ipu3/algorithms/ccm.cpp
> index 105d815b03..95ba67f8d1 100644
> --- a/src/ipa/ipu3/algorithms/ccm.cpp
> +++ b/src/ipa/ipu3/algorithms/ccm.cpp
> @@ -57,7 +57,7 @@ void Ccm::queueRequest(IPAContext &context, [[maybe_unused]] const uint32_t fram
>  void Ccm::setParameters(ipu3_uapi_params *params, IPAFrameContext &context)
>  {
>         const Matrix<float, 3, 3> &matrix = context.ccm.ccm;
> -       const Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;
> +       const Matrix<int32_t, 3, 1> &offsets = context.ccm.offsets;
>  
>         params->use.acc_ccm = 1;
>  
> diff --git a/src/ipa/libipa/ccm.cpp b/src/ipa/libipa/ccm.cpp
> index 8f3652f7e3..a19ae9f778 100644
> --- a/src/ipa/libipa/ccm.cpp
> +++ b/src/ipa/libipa/ccm.cpp
> @@ -83,7 +83,7 @@ int CcmAlgorithmBase::init(const ValueNode &tuningData)
>                         << "Failed to parse 'offsets' "
>                         << "parameter from tuning file; falling back to zero offsets";
>  
> -               offsets_.setData({ { 0, Matrix<int16_t, 3, 1>({ 0, 0, 0 }) } });
> +               offsets_.setData({ { 0, Matrix<int32_t, 3, 1>({ 0, 0, 0 }) } });
>         }
>  
>         return 0;
> diff --git a/src/ipa/libipa/ccm.h b/src/ipa/libipa/ccm.h
> index b72b25e2a3..c17d1ef303 100644
> --- a/src/ipa/libipa/ccm.h
> +++ b/src/ipa/libipa/ccm.h
> @@ -23,7 +23,7 @@ namespace ccm {
>  
>  struct CcmContext {
>         Matrix<float, 3, 3> ccm;
> -       Matrix<int16_t, 3, 1> offsets;
> +       Matrix<int32_t, 3, 1> offsets;
>  };
>  
>  struct ActiveState {
> @@ -50,7 +50,7 @@ public:
>  private:
>         unsigned int ct_;
>         Interpolator<Matrix<float, 3, 3>> ccm_;
> -       Interpolator<Matrix<int16_t, 3, 1>> offsets_;
> +       Interpolator<Matrix<int32_t, 3, 1>> offsets_;
>  };
>  
>  template<typename Q>
> diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp
> index 0e54c98710..f54edd44d1 100644
> --- a/src/ipa/rkisp1/algorithms/ccm.cpp
> +++ b/src/ipa/rkisp1/algorithms/ccm.cpp
> @@ -67,7 +67,7 @@ void Ccm::queueRequest(IPAContext &context,
>  void Ccm::setParameters(RkISP1Params *params, IPAFrameContext &context)
>  {
>         const Matrix<float, 3, 3> &matrix = context.ccm.ccm;
> -       const Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;
> +       const Matrix<int32_t, 3, 1> &offsets = context.ccm.offsets;
>  
>         auto config = params->block<BlockType::Ctk>();
>         config.setEnabled(true);
> -- 
> 2.56.1
>

Patch
diff mbox series

diff --git a/src/ipa/ipu3/algorithms/ccm.cpp b/src/ipa/ipu3/algorithms/ccm.cpp
index 105d815b03..95ba67f8d1 100644
--- a/src/ipa/ipu3/algorithms/ccm.cpp
+++ b/src/ipa/ipu3/algorithms/ccm.cpp
@@ -57,7 +57,7 @@  void Ccm::queueRequest(IPAContext &context, [[maybe_unused]] const uint32_t fram
 void Ccm::setParameters(ipu3_uapi_params *params, IPAFrameContext &context)
 {
 	const Matrix<float, 3, 3> &matrix = context.ccm.ccm;
-	const Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;
+	const Matrix<int32_t, 3, 1> &offsets = context.ccm.offsets;
 
 	params->use.acc_ccm = 1;
 
diff --git a/src/ipa/libipa/ccm.cpp b/src/ipa/libipa/ccm.cpp
index 8f3652f7e3..a19ae9f778 100644
--- a/src/ipa/libipa/ccm.cpp
+++ b/src/ipa/libipa/ccm.cpp
@@ -83,7 +83,7 @@  int CcmAlgorithmBase::init(const ValueNode &tuningData)
 			<< "Failed to parse 'offsets' "
 			<< "parameter from tuning file; falling back to zero offsets";
 
-		offsets_.setData({ { 0, Matrix<int16_t, 3, 1>({ 0, 0, 0 }) } });
+		offsets_.setData({ { 0, Matrix<int32_t, 3, 1>({ 0, 0, 0 }) } });
 	}
 
 	return 0;
diff --git a/src/ipa/libipa/ccm.h b/src/ipa/libipa/ccm.h
index b72b25e2a3..c17d1ef303 100644
--- a/src/ipa/libipa/ccm.h
+++ b/src/ipa/libipa/ccm.h
@@ -23,7 +23,7 @@  namespace ccm {
 
 struct CcmContext {
 	Matrix<float, 3, 3> ccm;
-	Matrix<int16_t, 3, 1> offsets;
+	Matrix<int32_t, 3, 1> offsets;
 };
 
 struct ActiveState {
@@ -50,7 +50,7 @@  public:
 private:
 	unsigned int ct_;
 	Interpolator<Matrix<float, 3, 3>> ccm_;
-	Interpolator<Matrix<int16_t, 3, 1>> offsets_;
+	Interpolator<Matrix<int32_t, 3, 1>> offsets_;
 };
 
 template<typename Q>
diff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp
index 0e54c98710..f54edd44d1 100644
--- a/src/ipa/rkisp1/algorithms/ccm.cpp
+++ b/src/ipa/rkisp1/algorithms/ccm.cpp
@@ -67,7 +67,7 @@  void Ccm::queueRequest(IPAContext &context,
 void Ccm::setParameters(RkISP1Params *params, IPAFrameContext &context)
 {
 	const Matrix<float, 3, 3> &matrix = context.ccm.ccm;
-	const Matrix<int16_t, 3, 1> &offsets = context.ccm.offsets;
+	const Matrix<int32_t, 3, 1> &offsets = context.ccm.offsets;
 
 	auto config = params->block<BlockType::Ctk>();
 	config.setEnabled(true);