[libcamera-devel,v3,3/5] ipa: libipa: Histogram: Constify the constructor span
diff mbox series

Message ID 20220224113347.80001-4-jeanmichel.hautbois@ideasonboard.com
State Accepted
Headers show
Series
  • IPA RkISP1 awb and misc improvements
Related show

Commit Message

Jean-Michel Hautbois Feb. 24, 2022, 11:33 a.m. UTC
The Histogram constructor does not modify the data. Pass it a Span<const
uint32_t> instead of a Span<uint32_t>.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
---
 src/ipa/libipa/histogram.cpp | 2 +-
 src/ipa/libipa/histogram.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Nicolas Dufresne via libcamera-devel March 8, 2022, 8:53 a.m. UTC | #1
Hi JM

On 2/24/22 17:03, Jean-Michel Hautbois wrote:
> The Histogram constructor does not modify the data. Pass it a Span<const
> uint32_t> instead of a Span<uint32_t>.
>
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>


Looks good to me,

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   src/ipa/libipa/histogram.cpp | 2 +-
>   src/ipa/libipa/histogram.h   | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp
> index 4d94571f..d8ad1c89 100644
> --- a/src/ipa/libipa/histogram.cpp
> +++ b/src/ipa/libipa/histogram.cpp
> @@ -32,7 +32,7 @@ namespace ipa {
>    * \brief Create a cumulative histogram
>    * \param[in] data A pre-sorted histogram to be passed
>    */
> -Histogram::Histogram(Span<uint32_t> data)
> +Histogram::Histogram(Span<const uint32_t> data)
>   {
>   	cumulative_.reserve(data.size());
>   	cumulative_.push_back(0);
> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
> index c40a366b..164d4603 100644
> --- a/src/ipa/libipa/histogram.h
> +++ b/src/ipa/libipa/histogram.h
> @@ -22,7 +22,7 @@ namespace ipa {
>   class Histogram
>   {
>   public:
> -	Histogram(Span<uint32_t> data);
> +	Histogram(Span<const uint32_t> data);
>   	size_t bins() const { return cumulative_.size() - 1; }
>   	uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
>   	uint64_t cumulativeFrequency(double bin) const;
Laurent Pinchart March 27, 2022, 8:25 p.m. UTC | #2
Hi Jean-Michel,

Thank you for the patch.

On Thu, Feb 24, 2022 at 12:33:45PM +0100, Jean-Michel Hautbois wrote:
> The Histogram constructor does not modify the data. Pass it a Span<const
> uint32_t> instead of a Span<uint32_t>.

You may want to avoid the line break between const and uint32_t.

> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/ipa/libipa/histogram.cpp | 2 +-
>  src/ipa/libipa/histogram.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp
> index 4d94571f..d8ad1c89 100644
> --- a/src/ipa/libipa/histogram.cpp
> +++ b/src/ipa/libipa/histogram.cpp
> @@ -32,7 +32,7 @@ namespace ipa {
>   * \brief Create a cumulative histogram
>   * \param[in] data A pre-sorted histogram to be passed
>   */
> -Histogram::Histogram(Span<uint32_t> data)
> +Histogram::Histogram(Span<const uint32_t> data)
>  {
>  	cumulative_.reserve(data.size());
>  	cumulative_.push_back(0);
> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
> index c40a366b..164d4603 100644
> --- a/src/ipa/libipa/histogram.h
> +++ b/src/ipa/libipa/histogram.h
> @@ -22,7 +22,7 @@ namespace ipa {
>  class Histogram
>  {
>  public:
> -	Histogram(Span<uint32_t> data);
> +	Histogram(Span<const uint32_t> data);
>  	size_t bins() const { return cumulative_.size() - 1; }
>  	uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
>  	uint64_t cumulativeFrequency(double bin) const;

Patch
diff mbox series

diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp
index 4d94571f..d8ad1c89 100644
--- a/src/ipa/libipa/histogram.cpp
+++ b/src/ipa/libipa/histogram.cpp
@@ -32,7 +32,7 @@  namespace ipa {
  * \brief Create a cumulative histogram
  * \param[in] data A pre-sorted histogram to be passed
  */
-Histogram::Histogram(Span<uint32_t> data)
+Histogram::Histogram(Span<const uint32_t> data)
 {
 	cumulative_.reserve(data.size());
 	cumulative_.push_back(0);
diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
index c40a366b..164d4603 100644
--- a/src/ipa/libipa/histogram.h
+++ b/src/ipa/libipa/histogram.h
@@ -22,7 +22,7 @@  namespace ipa {
 class Histogram
 {
 public:
-	Histogram(Span<uint32_t> data);
+	Histogram(Span<const uint32_t> data);
 	size_t bins() const { return cumulative_.size() - 1; }
 	uint64_t total() const { return cumulative_[cumulative_.size() - 1]; }
 	uint64_t cumulativeFrequency(double bin) const;