[libcamera-devel] [PATCH 2/5] android: jpeg: thumbnailer: Use MappedFrameBuffer::planes()

Jacopo Mondi jacopo at jmondi.org
Tue Aug 31 12:35:51 CEST 2021


Hi Hiro,

On Tue, Aug 31, 2021 at 03:34:35PM +0900, Hirokazu Honda wrote:
> Thumbnailer gets the address of NV12 UV Plane by computing the
> first plane size. MappedFrameBuffer::planes() returns the plane
> address. This replaces the address computation with
> MappedFrameBuffer::planes() in Thumbnailer.
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> ---
>  src/android/jpeg/thumbnailer.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/android/jpeg/thumbnailer.cpp b/src/android/jpeg/thumbnailer.cpp
> index 043c7b33..fe2c4969 100644
> --- a/src/android/jpeg/thumbnailer.cpp
> +++ b/src/android/jpeg/thumbnailer.cpp
> @@ -63,7 +63,7 @@ void Thumbnailer::createThumbnail(const FrameBuffer &source,
>
>  	/* Image scaling block implementing nearest-neighbour algorithm. */
>  	unsigned char *src = static_cast<unsigned char *>(frame.planes()[0].data());
> -	unsigned char *srcC = src + sh * sw;
> +	unsigned char *srcC = static_cast<unsigned char *>(frame.planes()[1].data());

I am not sure I really understand the thumbnailer code, but this seems
sane.

Assuming the new srcC value is the same as the old one
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

>  	unsigned char *srcCb, *srcCr;
>  	unsigned char *dstY, *srcY;
>
> --
> 2.33.0.259.gc128427fd7-goog
>


More information about the libcamera-devel mailing list