mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 01:25:08 +03:00
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 <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
36 lines
855 B
C++
36 lines
855 B
C++
/* 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 <libcamera/geometry.h>
|
|
|
|
#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<unsigned char> *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__ */
|