mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 14:59:44 +03:00
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment block. The change was generated with the following script: ---------------------------------------- dirs="include/libcamera src test utils" declare -rA patterns=( ['c']=' \* ' ['cpp']=' \* ' ['h']=' \* ' ['py']='# ' ['sh']='# ' ) for ext in ${!patterns[@]} ; do files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done) pattern=${patterns[${ext}]} for file in $files ; do name=$(basename ${file}) sed -i "s/^\(${pattern}\)${name} - /\1/" "$file" done done ---------------------------------------- This misses several files that are out of sync with the comment block header. Those will be addressed separately and manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
99 lines
2.5 KiB
C++
99 lines
2.5 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2023, Linaro Ltd
|
|
*
|
|
* Simple software ISP implementation
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <functional>
|
|
#include <initializer_list>
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <tuple>
|
|
#include <vector>
|
|
|
|
#include <libcamera/base/class.h>
|
|
#include <libcamera/base/log.h>
|
|
#include <libcamera/base/signal.h>
|
|
#include <libcamera/base/thread.h>
|
|
|
|
#include <libcamera/geometry.h>
|
|
#include <libcamera/pixel_format.h>
|
|
|
|
#include <libcamera/ipa/soft_ipa_interface.h>
|
|
#include <libcamera/ipa/soft_ipa_proxy.h>
|
|
|
|
#include "libcamera/internal/camera_sensor.h"
|
|
#include "libcamera/internal/dma_heaps.h"
|
|
#include "libcamera/internal/pipeline_handler.h"
|
|
#include "libcamera/internal/shared_mem_object.h"
|
|
#include "libcamera/internal/software_isp/debayer_params.h"
|
|
|
|
namespace libcamera {
|
|
|
|
class DebayerCpu;
|
|
class FrameBuffer;
|
|
class PixelFormat;
|
|
struct StreamConfiguration;
|
|
|
|
LOG_DECLARE_CATEGORY(SoftwareIsp)
|
|
|
|
class SoftwareIsp
|
|
{
|
|
public:
|
|
SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor);
|
|
~SoftwareIsp();
|
|
|
|
int loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; }
|
|
|
|
bool isValid() const;
|
|
|
|
std::vector<PixelFormat> formats(PixelFormat input);
|
|
|
|
SizeRange sizes(PixelFormat inputFormat, const Size &inputSize);
|
|
|
|
std::tuple<unsigned int, unsigned int>
|
|
strideAndFrameSize(const PixelFormat &outputFormat, const Size &size);
|
|
|
|
int configure(const StreamConfiguration &inputCfg,
|
|
const std::vector<std::reference_wrapper<StreamConfiguration>> &outputCfgs,
|
|
const ControlInfoMap &sensorControls);
|
|
|
|
int exportBuffers(unsigned int output, unsigned int count,
|
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers);
|
|
|
|
void processStats(const ControlList &sensorControls);
|
|
|
|
int start();
|
|
void stop();
|
|
|
|
int queueBuffers(FrameBuffer *input,
|
|
const std::map<unsigned int, FrameBuffer *> &outputs);
|
|
|
|
void process(FrameBuffer *input, FrameBuffer *output);
|
|
|
|
Signal<FrameBuffer *> inputBufferReady;
|
|
Signal<FrameBuffer *> outputBufferReady;
|
|
Signal<> ispStatsReady;
|
|
Signal<const ControlList &> setSensorControls;
|
|
|
|
private:
|
|
void saveIspParams();
|
|
void setSensorCtrls(const ControlList &sensorControls);
|
|
void statsReady();
|
|
void inputReady(FrameBuffer *input);
|
|
void outputReady(FrameBuffer *output);
|
|
|
|
std::unique_ptr<DebayerCpu> debayer_;
|
|
Thread ispWorkerThread_;
|
|
SharedMemObject<DebayerParams> sharedParams_;
|
|
DebayerParams debayerParams_;
|
|
DmaHeap dmaHeap_;
|
|
|
|
std::unique_ptr<ipa::soft::IPAProxySoft> ipa_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|