From f0421988dc7d91fbd221e2282f839cb51e1a3f8c Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Wed, 28 Oct 2020 02:54:46 +0530 Subject: android: jpeg: Introduce a simple image thumbnailer Add a basic image Thumbnailer class for the frames being captured. Currently, the thumbnailer can scale NV12 frames. It shall be used to generate a thumbnail image for EXIF metadata, in the subsequent commit. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Kieran Bingham --- src/android/jpeg/thumbnailer.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/android/jpeg/thumbnailer.h (limited to 'src/android/jpeg/thumbnailer.h') diff --git a/src/android/jpeg/thumbnailer.h b/src/android/jpeg/thumbnailer.h new file mode 100644 index 00000000..98f11833 --- /dev/null +++ b/src/android/jpeg/thumbnailer.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * thumbnailer.h - Simple image thumbnailer + */ +#ifndef __ANDROID_JPEG_THUMBNAILER_H__ +#define __ANDROID_JPEG_THUMBNAILER_H__ + +#include + +#include "libcamera/internal/buffer.h" +#include "libcamera/internal/formats.h" + +class Thumbnailer +{ +public: + Thumbnailer(); + + void configure(const libcamera::Size &sourceSize, + libcamera::PixelFormat pixelFormat); + void createThumbnail(const libcamera::FrameBuffer &source, + std::vector *dest); + const libcamera::Size &size() const { return targetSize_; } + +private: + libcamera::Size computeThumbnailSize() const; + + libcamera::PixelFormat pixelFormat_; + libcamera::Size sourceSize_; + libcamera::Size targetSize_; + + bool valid_; +}; + +#endif /* __ANDROID_JPEG_THUMBNAILER_H__ */ -- cgit v1.2.1