summaryrefslogtreecommitdiff
path: root/src/ipa/simple/algorithms/blc.cpp
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2025-01-23 12:40:55 +0100
committerStefan Klug <stefan.klug@ideasonboard.com>2025-02-21 17:35:03 +0100
commit7ea83d5f7b5d579c14ab183c163a13869652126a (patch)
tree3de59833e8dae9e1c88a5ebce4381c0063cc1665 /src/ipa/simple/algorithms/blc.cpp
parentd19ae2a228f3ad9ba792f905de09d5f4a71a9c20 (diff)
libipa: Add grey world AWB algorithm
Add the grey world algorithm that is currently used in rkisp1 to libipa. No changes in functionality were made. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/ipa/simple/algorithms/blc.cpp')
0 files changed, 0 insertions, 0 deletions
52'>52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * stream.h - Video stream for a Camera
 */
#ifndef __LIBCAMERA_STREAM_H__
#define __LIBCAMERA_STREAM_H__

#include <map>
#include <memory>
#include <string>
#include <vector>

#include <libcamera/buffer.h>
#include <libcamera/geometry.h>

namespace libcamera {

class Camera;
class Stream;

class StreamFormats
{
public:
	StreamFormats();
	StreamFormats(const std::map<unsigned int, std::vector<SizeRange>> &formats);

	std::vector<unsigned int> pixelformats() const;
	std::vector<Size> sizes(unsigned int pixelformat) const;

	SizeRange range(unsigned int pixelformat) const;

private:
	std::map<unsigned int, std::vector<SizeRange>> formats_;
};

enum MemoryType {
	InternalMemory,
	ExternalMemory,
};

struct StreamConfiguration {
	StreamConfiguration();
	StreamConfiguration(const StreamFormats &formats);

	unsigned int pixelFormat;
	Size size;

	MemoryType memoryType;
	unsigned int bufferCount;

	Stream *stream() const { return stream_; }
	void setStream(Stream *stream) { stream_ = stream; }
	const StreamFormats &formats() const { return formats_; }

	std::string toString() const;

private:
	Stream *stream_;
	StreamFormats formats_;
};

enum StreamRole {
	StillCapture,
	VideoRecording,
	Viewfinder,
};

using StreamRoles = std::vector<StreamRole>;

class Stream
{
public:
	Stream();

	std::unique_ptr<Buffer> createBuffer(unsigned int index);
	std::unique_ptr<Buffer> createBuffer(const std::array<int, 3> &fds);

	BufferPool &bufferPool() { return bufferPool_; }
	std::vector<BufferMemory> &buffers() { return bufferPool_.buffers(); }
	const StreamConfiguration &configuration() const { return configuration_; }
	MemoryType memoryType() const { return memoryType_; }

protected:
	friend class Camera;

	void createBuffers(MemoryType memory, unsigned int count);
	void destroyBuffers();

	BufferPool bufferPool_;
	StreamConfiguration configuration_;
	MemoryType memoryType_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_STREAM_H__ */