Skip to content

Commit 983ffa7

Browse files
committed
Merge branch 'master' into next
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2 parents 90a1d9c + 86c45c8 commit 983ffa7

File tree

119 files changed

+1236
-497
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+1236
-497
lines changed

Documentation/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,8 @@ endif
116116
# Sphinx
117117
#
118118

119-
sphinx = find_program('sphinx-build-3', required : false)
120-
if not sphinx.found()
121-
sphinx = find_program('sphinx-build', required : get_option('documentation'))
122-
endif
119+
sphinx = find_program('sphinx-build-3', 'sphinx-build',
120+
required : get_option('documentation'))
123121

124122
if sphinx.found()
125123
docs_sources = [

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ A C++ toolchain: [required]
7676
Either {g++, clang}
7777

7878
Meson Build system: [required]
79-
meson (>= 0.60) ninja-build pkg-config
79+
meson (>= 0.63) ninja-build pkg-config
8080

8181
for the libcamera core: [required]
8282
libyaml-dev python3-yaml python3-ply python3-jinja2
@@ -115,6 +115,7 @@ for cam: [optional]
115115
- libdrm-dev: Enables the KMS sink
116116
- libjpeg-dev: Enables MJPEG on the SDL sink
117117
- libsdl2-dev: Enables the SDL sink
118+
- libtiff-dev: Enables writing DNG
118119

119120
for qcam: [optional]
120121
libtiff-dev qt6-base-dev qt6-tools-dev-tools

include/libcamera/base/bound_method.h

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,15 @@ class BoundMethodArgs : public BoundMethodBase
9898
using PackType = BoundMethodPack<R, Args...>;
9999

100100
private:
101-
template<std::size_t... I, typename T = R>
102-
std::enable_if_t<!std::is_void<T>::value, void>
103-
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
101+
template<std::size_t... I>
102+
void invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
104103
{
105-
PackType *args = static_cast<PackType *>(pack);
106-
args->ret_ = invoke(std::get<I>(args->args_)...);
107-
}
104+
[[maybe_unused]] auto *args = static_cast<PackType *>(pack);
108105

109-
template<std::size_t... I, typename T = R>
110-
std::enable_if_t<std::is_void<T>::value, void>
111-
invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
112-
{
113-
/* args is effectively unused when the sequence I is empty. */
114-
PackType *args [[gnu::unused]] = static_cast<PackType *>(pack);
115-
invoke(std::get<I>(args->args_)...);
106+
if constexpr (!std::is_void_v<R>)
107+
args->ret_ = invoke(std::get<I>(args->args_)...);
108+
else
109+
invoke(std::get<I>(args->args_)...);
116110
}
117111

118112
public:

include/libcamera/base/mutex.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ namespace libcamera {
2323
class LIBCAMERA_TSA_CAPABILITY("mutex") Mutex final
2424
{
2525
public:
26-
constexpr Mutex()
27-
{
28-
}
29-
3026
void lock() LIBCAMERA_TSA_ACQUIRE()
3127
{
3228
mutex_.lock();
@@ -84,10 +80,6 @@ class LIBCAMERA_TSA_SCOPED_CAPABILITY MutexLocker final
8480
class ConditionVariable final
8581
{
8682
public:
87-
ConditionVariable()
88-
{
89-
}
90-
9183
void notify_one() noexcept
9284
{
9385
cv_.notify_one();

include/libcamera/base/object.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <list>
1111
#include <memory>
12+
#include <utility>
1213
#include <vector>
1314

1415
#include <libcamera/base/bound_method.h>
@@ -39,7 +40,7 @@ class Object
3940
{
4041
T *obj = static_cast<T *>(this);
4142
auto *method = new BoundMethodMember<T, R, FuncArgs...>(obj, this, func, type);
42-
return method->activate(args..., true);
43+
return method->activate(std::forward<Args>(args)..., true);
4344
}
4445

4546
Thread *thread() const { return thread_; }

include/libcamera/base/span.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,7 @@ class Span<T, dynamic_extent>
346346
}
347347

348348
constexpr Span(const Span &other) noexcept = default;
349-
350-
constexpr Span &operator=(const Span &other) noexcept
351-
{
352-
data_ = other.data_;
353-
size_ = other.size_;
354-
return *this;
355-
}
349+
constexpr Span &operator=(const Span &other) noexcept = default;
356350

357351
constexpr iterator begin() const { return data(); }
358352
constexpr const_iterator cbegin() const { return begin(); }

include/libcamera/camera_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <memory>
1111
#include <string>
12+
#include <string_view>
1213
#include <sys/types.h>
1314
#include <vector>
1415

@@ -31,7 +32,7 @@ class CameraManager : public Object, public Extensible
3132
void stop();
3233

3334
std::vector<std::shared_ptr<Camera>> cameras() const;
34-
std::shared_ptr<Camera> get(const std::string &id);
35+
std::shared_ptr<Camera> get(std::string_view id);
3536

3637
static const std::string &version() { return version_; }
3738

include/libcamera/controls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {
125125
};
126126

127127
template<typename T>
128-
struct control_type<T, std::enable_if_t<std::is_enum_v<T>>> : public control_type<int32_t> {
128+
struct control_type<T, std::enable_if_t<std::is_enum_v<T> && sizeof(T) == sizeof(int32_t)>> : public control_type<int32_t> {
129129
};
130130

131131
} /* namespace details */

include/libcamera/internal/ipa_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99

10+
#include <memory>
1011
#include <stdint.h>
1112
#include <vector>
1213

@@ -67,7 +68,7 @@ class IPAManager
6768

6869
bool isSignatureValid(IPAModule *ipa) const;
6970

70-
std::vector<IPAModule *> modules_;
71+
std::vector<std::unique_ptr<IPAModule>> modules_;
7172

7273
#if HAVE_IPA_PUBKEY
7374
static const uint8_t publicKeyData_[];

include/libcamera/internal/media_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class MediaEntity : public MediaObject
112112
unsigned int deviceMinor() const { return minor_; }
113113

114114
const std::vector<MediaPad *> &pads() const { return pads_; }
115-
const std::vector<MediaEntity *> ancillaryEntities() const { return ancillaryEntities_; }
115+
const std::vector<MediaEntity *> &ancillaryEntities() const { return ancillaryEntities_; }
116116

117117
const MediaPad *getPadByIndex(unsigned int index) const;
118118
const MediaPad *getPadById(unsigned int id) const;

include/libcamera/internal/software_isp/debayer_params.h

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: LGPL-2.1-or-later */
22
/*
3-
* Copyright (C) 2023, 2024 Red Hat Inc.
3+
* Copyright (C) 2023-2025 Red Hat Inc.
44
*
55
* Authors:
66
* Hans de Goede <hdegoede@redhat.com>
@@ -18,11 +18,37 @@ namespace libcamera {
1818
struct DebayerParams {
1919
static constexpr unsigned int kRGBLookupSize = 256;
2020

21-
using ColorLookupTable = std::array<uint8_t, kRGBLookupSize>;
21+
struct CcmColumn {
22+
int16_t r;
23+
int16_t g;
24+
int16_t b;
25+
};
2226

23-
ColorLookupTable red;
24-
ColorLookupTable green;
25-
ColorLookupTable blue;
27+
using LookupTable = std::array<uint8_t, kRGBLookupSize>;
28+
using CcmLookupTable = std::array<CcmColumn, kRGBLookupSize>;
29+
30+
/*
31+
* Color lookup tables when CCM is not used.
32+
*
33+
* Each color of a debayered pixel is amended by the corresponding
34+
* value in the given table.
35+
*/
36+
LookupTable red;
37+
LookupTable green;
38+
LookupTable blue;
39+
40+
/*
41+
* Color and gamma lookup tables when CCM is used.
42+
*
43+
* Each of the CcmLookupTable's corresponds to a CCM column; together they
44+
* make a complete 3x3 CCM lookup table. The CCM is applied on debayered
45+
* pixels and then the gamma lookup table is used to set the resulting
46+
* values of all the three colors.
47+
*/
48+
CcmLookupTable redCcm;
49+
CcmLookupTable greenCcm;
50+
CcmLookupTable blueCcm;
51+
LookupTable gammaLut;
2652
};
2753

2854
} /* namespace libcamera */

include/libcamera/internal/software_isp/software_isp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class SoftwareIsp : public Object
8585
Signal<FrameBuffer *> inputBufferReady;
8686
Signal<FrameBuffer *> outputBufferReady;
8787
Signal<uint32_t, uint32_t> ispStatsReady;
88+
Signal<uint32_t, const ControlList &> metadataReady;
8889
Signal<const ControlList &> setSensorControls;
8990

9091
private:
@@ -99,6 +100,7 @@ class SoftwareIsp : public Object
99100
SharedMemObject<DebayerParams> sharedParams_;
100101
DebayerParams debayerParams_;
101102
DmaBufAllocator dmaHeap_;
103+
bool ccmEnabled_;
102104

103105
std::unique_ptr<ipa::soft::IPAProxySoft> ipa_;
104106
std::deque<FrameBuffer *> queuedInputBuffers_;

include/libcamera/internal/v4l2_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class V4L2Device : protected Loggable
4545
const std::string &deviceNode() const { return deviceNode_; }
4646
std::string devicePath() const;
4747

48+
bool supportsFrameStartEvent();
4849
int setFrameStartEnabled(bool enable);
4950
Signal<uint32_t> frameStart;
5051

include/libcamera/internal/v4l2_videodevice.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#pragma once
99

1010
#include <array>
11-
#include <atomic>
1211
#include <memory>
1312
#include <optional>
1413
#include <ostream>
@@ -159,7 +158,7 @@ class V4L2BufferCache
159158
std::vector<Plane> planes_;
160159
};
161160

162-
std::atomic<uint64_t> lastUsedCounter_;
161+
uint64_t lastUsedCounter_;
163162
std::vector<Entry> cache_;
164163
/* \todo Expose the miss counter through an instrumentation API. */
165164
unsigned int missCounter_;

include/libcamera/ipa/soft.mojom

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ interface IPASoftInterface {
1616
init(libcamera.IPASettings settings,
1717
libcamera.SharedFD fdStats,
1818
libcamera.SharedFD fdParams,
19-
libcamera.ControlInfoMap sensorCtrlInfoMap)
20-
=> (int32 ret, libcamera.ControlInfoMap ipaControls);
19+
libcamera.IPACameraSensorInfo sensorInfo,
20+
libcamera.ControlInfoMap sensorControls)
21+
=> (int32 ret, libcamera.ControlInfoMap ipaControls, bool ccmEnabled);
2122
start() => (int32 ret);
2223
stop();
2324
configure(IPAConfigInfo configInfo)
@@ -33,4 +34,5 @@ interface IPASoftInterface {
3334
interface IPASoftEventInterface {
3435
setSensorControls(libcamera.ControlList sensorControls);
3536
setIspParams();
37+
metadataReady(uint32 frame, libcamera.ControlList metadata);
3638
};

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
project('libcamera', 'c', 'cpp',
44
meson_version : '>= 0.63',
5-
version : '0.4.0',
5+
version : '0.5.0',
66
default_options : [
77
'werror=true',
88
'warning_level=2',

meson_options.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ option('cam',
1818

1919
option('documentation',
2020
type : 'feature',
21+
value : 'auto',
2122
description : 'Generate the project documentation')
2223

2324
option('doc_werror',
@@ -32,7 +33,8 @@ option('gstreamer',
3233

3334
option('ipas',
3435
type : 'array',
35-
choices : ['ipu3', 'mali-c55', 'rkisp1', 'rpi/pisp', 'rpi/vc4', 'simple', 'vimc'],
36+
choices : ['ipu3', 'mali-c55', 'rkisp1', 'rpi/pisp', 'rpi/vc4', 'simple',
37+
'vimc'],
3638
description : 'Select which IPA modules to build')
3739

3840
option('lc-compliance',

src/apps/cam/camera_session.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
* Camera capture session
66
*/
77

8+
#include "camera_session.h"
9+
810
#include <iomanip>
911
#include <iostream>
1012
#include <limits.h>
13+
#include <optional>
1114
#include <sstream>
1215

1316
#include <libcamera/control_ids.h>
@@ -16,7 +19,6 @@
1619
#include "../common/event_loop.h"
1720
#include "../common/stream_options.h"
1821

19-
#include "camera_session.h"
2022
#include "capture_script.h"
2123
#include "file_sink.h"
2224
#ifdef HAVE_KMS
@@ -173,6 +175,11 @@ void CameraSession::listControls() const
173175
std::cout << "Control: " << io.str()
174176
<< id->vendor() << "::" << id->name() << ":"
175177
<< std::endl;
178+
179+
std::optional<int32_t> def;
180+
if (!info.def().isNone())
181+
def = info.def().get<int32_t>();
182+
176183
for (const auto &value : info.values()) {
177184
int32_t val = value.get<int32_t>();
178185
const auto &it = id->enumerators().find(val);
@@ -182,7 +189,10 @@ void CameraSession::listControls() const
182189
std::cout << "UNKNOWN";
183190
else
184191
std::cout << it->second;
185-
std::cout << " (" << val << ")" << std::endl;
192+
193+
std::cout << " (" << val << ")"
194+
<< (val == def ? " [default]" : "")
195+
<< std::endl;
186196
}
187197
}
188198

0 commit comments

Comments
 (0)