summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller/rpi/contrast.hpp
blob: 85624539a1da9eeb4ca870953ea26c34279e2f7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright (C) 2019, Raspberry Pi (Trading) Limited
 *
 * contrast.hpp - contrast (gamma) control algorithm
 */
#pragma once

#include <mutex>

#include "../contrast_algorithm.hpp"
#include "../pwl.hpp"

namespace RPiController {

// Back End algorithm to appaly correct digital gain. Should be placed after
// Back End AWB.

struct ContrastConfig {
	bool ce_enable;
	double lo_histogram;
	double lo_level;
	double lo_max;
	double hi_histogram;
	double hi_level;
	double hi_max;
	Pwl gamma_curve;
};

class Contrast : public ContrastAlgorithm
{
public:
	Contrast(Controller *controller = NULL);
	char const *Name() const override;
	void Read(boost::property_tree::ptree const &params) override;
	void SetBrightness(double brightness) override;
	void SetContrast(double contrast) override;
	void Initialise() override;
	void Prepare(Metadata *image_metadata) override;
	void Process(StatisticsPtr &stats, Metadata *image_metadata) override;

private:
	ContrastConfig config_;
	double brightness_;
	double contrast_;
	ContrastStatus status_;
	std::mutex mutex_;
};

} // namespace RPiController
locator.cpp', 'geometry.cpp', 'ipa_controls.cpp', 'ipa_data_serializer.cpp', 'ipa_interface.cpp', 'ipa_manager.cpp', 'ipa_module.cpp', 'ipa_proxy.cpp', 'ipc_pipe.cpp', 'ipc_pipe_unixsocket.cpp', 'ipc_unixsocket.cpp', 'log.cpp', 'media_device.cpp', 'media_object.cpp', 'message.cpp', 'object.cpp', 'pipeline_handler.cpp', 'pixel_format.cpp', 'process.cpp', 'pub_key.cpp', 'request.cpp', 'semaphore.cpp', 'signal.cpp', 'stream.cpp', 'sysfs.cpp', 'thread.cpp', 'timer.cpp', 'transform.cpp', 'utils.cpp', 'v4l2_controls.cpp', 'v4l2_device.cpp', 'v4l2_pixelformat.cpp', 'v4l2_subdevice.cpp', 'v4l2_videodevice.cpp', ]) libcamera_sources += libcamera_public_headers libcamera_sources += libcamera_generated_ipa_headers libcamera_sources += libcamera_tracepoint_header includes = [ libcamera_includes, ] subdir('pipeline') subdir('proxy') libatomic = cc.find_library('atomic', required : false) libdl = cc.find_library('dl') libgnutls = cc.find_library('gnutls', required : true) libudev = dependency('libudev', required : false) if libgnutls.found() config_h.set('HAVE_GNUTLS', 1) endif if liblttng.found() config_h.set('HAVE_TRACING', 1) libcamera_sources += files(['tracepoints.cpp']) endif if libudev.found() config_h.set('HAVE_LIBUDEV', 1) libcamera_sources += files([ 'device_enumerator_udev.cpp', ]) endif control_sources = [] foreach source : control_source_files input_files = files(source +'.yaml', source + '.cpp.in') control_sources += custom_target(source + '_cpp', input : input_files, output : source + '.cpp', command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@']) endforeach libcamera_sources += control_sources gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh') version_cpp = vcs_tag(command : [gen_version, meson.build_root()], input : 'version.cpp.in', output : 'version.cpp', fallback : meson.project_version()) libcamera_sources += version_cpp if ipa_sign_module ipa_pub_key_cpp = custom_target('ipa_pub_key_cpp', input : [ipa_priv_key, 'ipa_pub_key.cpp.in'], output : 'ipa_pub_key.cpp', command : [gen_ipa_pub_key, '@INPUT@', '@OUTPUT@']) libcamera_sources += ipa_pub_key_cpp endif libcamera_deps = [ libatomic, libdl, libgnutls, liblttng, libudev, dependency('threads'), ] libcamera_link_with = [] if android_enabled libcamera_sources += android_hal_sources includes += android_includes libcamera_link_with += android_camera_metadata libcamera_deps += android_deps endif # We add '/' to the build_rpath as a 'safe' path to act as a boolean flag. # The build_rpath is stripped at install time by meson, so we determine at # runtime if the library is running from an installed location by checking # for the presence or abscence of the dynamic tag. libcamera = shared_library('camera', libcamera_sources, install : true, link_with : libcamera_link_with, include_directories : includes, build_rpath : '/', dependencies : libcamera_deps) libcamera_dep = declare_dependency(sources : [ libcamera_ipa_headers, libcamera_public_headers, ], include_directories : libcamera_includes, link_with : libcamera) subdir('proxy/worker')