[libcamera-devel,2/2] android: jpeg: encoder: Use pass-by-value for Exif parameter
diff mbox series

Message ID 20201023051411.81515-2-email@uajain.com
State Accepted
Commit c430d39d203488cf93ab4f12ff9eb8b3c6380212
Headers show
Series
  • [libcamera-devel,1/2] android: jpeg: Drop "libcamera::" namespace from functions' arguments
Related show

Commit Message

Umang Jain Oct. 23, 2020, 5:14 a.m. UTC
Following the reasoning of pass-by-value for libcamera::Span
parameters from 90c193f2a700("android: Modify Encoder interface") i.e.
they are easy to copy/move/construct, align the Exif parameter passing
to the encoder interface in this consistent way.

Signed-off-by: Umang Jain <email@uajain.com>
---
 src/android/jpeg/encoder.h           | 2 +-
 src/android/jpeg/encoder_libjpeg.cpp | 2 +-
 src/android/jpeg/encoder_libjpeg.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart Oct. 23, 2020, 5:16 a.m. UTC | #1
Hi Umang,

Thank you for the patch.

On Fri, Oct 23, 2020 at 10:44:11AM +0530, Umang Jain wrote:
> Following the reasoning of pass-by-value for libcamera::Span
> parameters from 90c193f2a700("android: Modify Encoder interface") i.e.
> they are easy to copy/move/construct, align the Exif parameter passing
> to the encoder interface in this consistent way.
> 
> Signed-off-by: Umang Jain <email@uajain.com>

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

> ---
>  src/android/jpeg/encoder.h           | 2 +-
>  src/android/jpeg/encoder_libjpeg.cpp | 2 +-
>  src/android/jpeg/encoder_libjpeg.h   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
> index 270ea60..94b3340 100644
> --- a/src/android/jpeg/encoder.h
> +++ b/src/android/jpeg/encoder.h
> @@ -19,7 +19,7 @@ public:
>  	virtual int configure(const libcamera::StreamConfiguration &cfg) = 0;
>  	virtual int encode(const libcamera::FrameBuffer &source,
>  			   libcamera::Span<uint8_t> destination,
> -			   const libcamera::Span<const uint8_t> &exifData) = 0;
> +			   libcamera::Span<const uint8_t> exifData) = 0;
>  };
>  
>  #endif /* __ANDROID_JPEG_ENCODER_H__ */
> diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp
> index 4bea10c..cfa5332 100644
> --- a/src/android/jpeg/encoder_libjpeg.cpp
> +++ b/src/android/jpeg/encoder_libjpeg.cpp
> @@ -180,7 +180,7 @@ void EncoderLibJpeg::compressNV(const MappedBuffer *frame)
>  }
>  
>  int EncoderLibJpeg::encode(const FrameBuffer &source, Span<uint8_t> dest,
> -			   const Span<const uint8_t> &exifData)
> +			   Span<const uint8_t> exifData)
>  {
>  	MappedFrameBuffer frame(&source, PROT_READ);
>  	if (!frame.isValid()) {
> diff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h
> index 391a53c..40505dd 100644
> --- a/src/android/jpeg/encoder_libjpeg.h
> +++ b/src/android/jpeg/encoder_libjpeg.h
> @@ -23,7 +23,7 @@ public:
>  	int configure(const libcamera::StreamConfiguration &cfg) override;
>  	int encode(const libcamera::FrameBuffer &source,
>  		   libcamera::Span<uint8_t> destination,
> -		   const libcamera::Span<const uint8_t> &exifData) override;
> +		   libcamera::Span<const uint8_t> exifData) override;
>  
>  private:
>  	void compressRGB(const libcamera::MappedBuffer *frame);

Patch
diff mbox series

diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
index 270ea60..94b3340 100644
--- a/src/android/jpeg/encoder.h
+++ b/src/android/jpeg/encoder.h
@@ -19,7 +19,7 @@  public:
 	virtual int configure(const libcamera::StreamConfiguration &cfg) = 0;
 	virtual int encode(const libcamera::FrameBuffer &source,
 			   libcamera::Span<uint8_t> destination,
-			   const libcamera::Span<const uint8_t> &exifData) = 0;
+			   libcamera::Span<const uint8_t> exifData) = 0;
 };
 
 #endif /* __ANDROID_JPEG_ENCODER_H__ */
diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp
index 4bea10c..cfa5332 100644
--- a/src/android/jpeg/encoder_libjpeg.cpp
+++ b/src/android/jpeg/encoder_libjpeg.cpp
@@ -180,7 +180,7 @@  void EncoderLibJpeg::compressNV(const MappedBuffer *frame)
 }
 
 int EncoderLibJpeg::encode(const FrameBuffer &source, Span<uint8_t> dest,
-			   const Span<const uint8_t> &exifData)
+			   Span<const uint8_t> exifData)
 {
 	MappedFrameBuffer frame(&source, PROT_READ);
 	if (!frame.isValid()) {
diff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h
index 391a53c..40505dd 100644
--- a/src/android/jpeg/encoder_libjpeg.h
+++ b/src/android/jpeg/encoder_libjpeg.h
@@ -23,7 +23,7 @@  public:
 	int configure(const libcamera::StreamConfiguration &cfg) override;
 	int encode(const libcamera::FrameBuffer &source,
 		   libcamera::Span<uint8_t> destination,
-		   const libcamera::Span<const uint8_t> &exifData) override;
+		   libcamera::Span<const uint8_t> exifData) override;
 
 private:
 	void compressRGB(const libcamera::MappedBuffer *frame);