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

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Aug 31 23:15:21 CEST 2021


Hi Hiro,

Thank you for the patch.

On Tue, Aug 31, 2021 at 12:35:51PM +0200, Jacopo Mondi wrote:
> 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>

It looks much nicer, happy to see the mapped frame buffer API making the
code cleaner.

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

> >  	unsigned char *srcCb, *srcCr;
> >  	unsigned char *dstY, *srcY;
> >

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list