[libcamera-devel] [PATCH v5 3/3] android: jpeg: post_processor: Use the new metadata functions

Kieran Bingham kieran.bingham at ideasonboard.com
Fri May 14 10:43:48 CEST 2021


On 14/05/2021 07:46, paul.elder at ideasonboard.com wrote:
> Hi me,

Hi You,


> On Fri, May 14, 2021 at 03:43:03PM +0900, Paul Elder wrote:
>> Now that CameraMetadata supports more convenient functions, use those
>> instead.
>>
>> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
>> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
>>
>> ---
>> No change in v5
>>
>> No change in v4
>>
>> New in v3
>> ---
>>  src/android/jpeg/post_processor_jpeg.cpp | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
>> index 3bf16996..2ecf5578 100644
>> --- a/src/android/jpeg/post_processor_jpeg.cpp
>> +++ b/src/android/jpeg/post_processor_jpeg.cpp
>> @@ -15,6 +15,7 @@
>>  #include "exif.h"
>>  
>>  #include <libcamera/formats.h>
>> +#include <libcamera/span.h>
> 
> We don't need this anymore, so this should be removed.
> 

Sounds better without it ;-)

And with that fixed.

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


> 
> Paul
> 
>>  
>>  #include "libcamera/internal/log.h"
>>  
>> @@ -103,7 +104,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
>>  	ret = requestMetadata.getEntry(ANDROID_JPEG_ORIENTATION, &entry);
>>  
>>  	const uint32_t jpegOrientation = ret ? *entry.data.i32 : 0;
>> -	resultMetadata->addEntry(ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1);
>> +	resultMetadata->addEntry(ANDROID_JPEG_ORIENTATION, jpegOrientation);
>>  	exif.setOrientation(jpegOrientation);
>>  
>>  	exif.setSize(streamSize_);
>> @@ -129,7 +130,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
>>  	if (ret) {
>>  		exif.setGPSDateTimestamp(*entry.data.i64);
>>  		resultMetadata->addEntry(ANDROID_JPEG_GPS_TIMESTAMP,
>> -					 entry.data.i64, 1);
>> +					 *entry.data.i64);
>>  	}
>>  
>>  	ret = requestMetadata.getEntry(ANDROID_JPEG_THUMBNAIL_SIZE, &entry);
>> @@ -140,7 +141,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
>>  
>>  		ret = requestMetadata.getEntry(ANDROID_JPEG_THUMBNAIL_QUALITY, &entry);
>>  		uint8_t quality = ret ? *entry.data.u8 : 95;
>> -		resultMetadata->addEntry(ANDROID_JPEG_THUMBNAIL_QUALITY, &quality, 1);
>> +		resultMetadata->addEntry(ANDROID_JPEG_THUMBNAIL_QUALITY, quality);
>>  
>>  		if (thumbnailSize != Size(0, 0)) {
>>  			std::vector<unsigned char> thumbnail;
>> @@ -172,7 +173,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
>>  
>>  	ret = requestMetadata.getEntry(ANDROID_JPEG_QUALITY, &entry);
>>  	const uint8_t quality = ret ? *entry.data.u8 : 95;
>> -	resultMetadata->addEntry(ANDROID_JPEG_QUALITY, &quality, 1);
>> +	resultMetadata->addEntry(ANDROID_JPEG_QUALITY, quality);
>>  
>>  	int jpeg_size = encoder_->encode(source, destination->plane(0),
>>  					 exif.data(), quality);
>> @@ -190,7 +191,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
>>  	blob->jpeg_size = jpeg_size;
>>  
>>  	/* Update the JPEG result Metadata. */
>> -	resultMetadata->addEntry(ANDROID_JPEG_SIZE, &jpeg_size, 1);
>> +	resultMetadata->addEntry(ANDROID_JPEG_SIZE, jpeg_size);
>>  
>>  	return 0;
>>  }
>> -- 
>> 2.27.0
>>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list