libcamera v0.2.0+3-70b69666-nvm
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
swisp_simple.h
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2023, Linaro Ltd
4 *
5 * swisp_simple.h - Simple software ISP implementation
6 */
7
8#pragma once
9
10#include <libcamera/base/log.h>
12
14
15#include <libcamera/ipa/soft_ipa_interface.h>
16#include <libcamera/ipa/soft_ipa_proxy.h>
17
18#include "libcamera/internal/dma_heaps.h"
19#include "libcamera/internal/software_isp.h"
20#include "libcamera/internal/software_isp/debayer_cpu.h"
21
22namespace libcamera {
23
30{
31public:
38 SwIspSimple(PipelineHandler *pipe, const ControlInfoMap &sensorControls);
39 ~SwIspSimple() {}
40
47 int loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }
48
54 bool isValid() const;
55
62 std::vector<PixelFormat> formats(PixelFormat input);
63
71 SizeRange sizes(PixelFormat inputFormat, const Size &inputSize);
72
80 std::tuple<unsigned int, unsigned int>
81 strideAndFrameSize(const PixelFormat &outputFormat, const Size &size);
82
91 int configure(const StreamConfiguration &inputCfg,
92 const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,
93 const ControlInfoMap &sensorControls);
94
103 int exportBuffers(unsigned int output, unsigned int count,
104 std::vector<std::unique_ptr<FrameBuffer>> *buffers);
105
110 void processStats(const ControlList &sensorControls);
111
117 int start();
118
122 void stop();
123
131 int queueBuffers(FrameBuffer *input,
132 const std::map<unsigned int, FrameBuffer *> &outputs);
133
140
146 void process(FrameBuffer *input, FrameBuffer *output);
147
148private:
149 void saveIspParams(int dummy);
150 void statsReady(int dummy);
151 void inputReady(FrameBuffer *input);
152 void outputReady(FrameBuffer *output);
153
154 std::unique_ptr<DebayerCpu> debayer_;
155 Thread ispWorkerThread_;
156 SharedMemObject<DebayerParams> sharedParams_;
157 DebayerParams debayerParams_;
158 DmaHeap dmaHeap_;
159
160 std::unique_ptr<ipa::soft::IPAProxySoft> ipa_;
161};
162
163} /* namespace libcamera */
A map of ControlId to ControlInfo.
Definition controls.h:306
Associate a list of ControlId with their values for an object.
Definition controls.h:350
Definition dma_heaps.h:18
Frame buffer data and its associated dynamic metadata.
Definition framebuffer.h:50
Create and manage cameras based on a set of media devices.
Definition pipeline_handler.h:39
libcamera image pixel format
Definition pixel_format.h:18
Helper class for shared memory allocations.
Definition shared_mem_object.h:31
Generic signal and slot communication mechanism.
Definition signal.h:39
Describe a range of sizes.
Definition geometry.h:201
Describe a two-dimensional size.
Definition geometry.h:53
Base class for the Software ISP.
Definition software_isp.h:40
Class for the Simple Software ISP.
Definition swisp_simple.h:30
void processStats(const ControlList &sensorControls)
Process the statistics gathered.
Definition swisp_simple.cpp:81
int start()
Starts the Software ISP worker.
Definition swisp_simple.cpp:192
SizeRange sizes(PixelFormat inputFormat, const Size &inputSize)
Get the supported output sizes for the given input format and size.
Definition swisp_simple.cpp:105
int exportBuffers(unsigned int output, unsigned int count, std::vector< std::unique_ptr< FrameBuffer > > *buffers)
Exports the buffers for use in processing.
Definition swisp_simple.cpp:133
Signal< const ControlList & > & getSignalSetSensorControls()
Get the signal for when the sensor controls are set.
Definition swisp_simple.cpp:87
bool isValid() const
Gets if there is a valid debayer object.
Definition swisp_simple.cpp:93
int loadConfiguration(const std::string &filename)
Load a configuration from a file.
Definition swisp_simple.h:47
void process(FrameBuffer *input, FrameBuffer *output)
Process the input framebuffer.
Definition swisp_simple.cpp:210
void stop()
Stops the Software ISP worker.
Definition swisp_simple.cpp:202
std::tuple< unsigned int, unsigned int > strideAndFrameSize(const PixelFormat &outputFormat, const Size &size)
Get the stride and the frame size.
Definition swisp_simple.cpp:113
int queueBuffers(FrameBuffer *input, const std::map< unsigned int, FrameBuffer * > &outputs)
Queues buffers for processing.
Definition swisp_simple.cpp:163
int configure(const StreamConfiguration &inputCfg, const std::vector< std::reference_wrapper< StreamConfiguration > > &outputCfgs, const ControlInfoMap &sensorControls)
Configure the SwIspSimple object according to the passed in parameters.
Definition swisp_simple.cpp:120
A thread of execution.
Definition thread.h:29
Logging infrastructure.
Top-level libcamera namespace.
Definition backtrace.h:17
libcamera pixel format
Struct to hold the debayer parameters.
Definition debayer_params.h:18
Configuration parameters for a stream.
Definition stream.h:41
Thread support.