Skip to content

Commit 94615ab

Browse files
committed
Merge remote-tracking branch 'origin/master' into next
2 parents e53bdf1 + b65df7e commit 94615ab

Some content is hidden

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

47 files changed

+711
-381
lines changed

.b4-config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[b4]
2+
send-series-to = [email protected]

Documentation/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ if doxygen.found() and dot.found()
103103
input : [
104104
doxyfile,
105105
doxyfile_common,
106+
doxygen_public_input,
106107
doxygen_internal_input,
107108
],
108109
output : 'internal-api-html',

include/libcamera/base/bound_method.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ class BoundMethodPack : public BoundMethodPackBase
3838
{
3939
}
4040

41-
R returnValue()
42-
{
43-
return ret_;
44-
}
45-
4641
std::tuple<typename std::remove_reference_t<Args>...> args_;
4742
R ret_;
4843
};
@@ -56,10 +51,6 @@ class BoundMethodPack<void, Args...> : public BoundMethodPackBase
5651
{
5752
}
5853

59-
void returnValue()
60-
{
61-
}
62-
6354
std::tuple<typename std::remove_reference_t<Args>...> args_;
6455
};
6556

@@ -140,8 +131,10 @@ class BoundMethodFunctor : public BoundMethodArgs<R, Args...>
140131
return func_(args...);
141132

142133
auto pack = std::make_shared<PackType>(args...);
143-
bool sync = BoundMethodBase::activatePack(pack, deleteMethod);
144-
return sync ? pack->returnValue() : R();
134+
[[maybe_unused]] bool sync = BoundMethodBase::activatePack(pack, deleteMethod);
135+
136+
if constexpr (!std::is_void_v<R>)
137+
return sync ? std::move(pack->ret_) : R();
145138
}
146139

147140
R invoke(Args... args) override
@@ -175,8 +168,10 @@ class BoundMethodMember : public BoundMethodArgs<R, Args...>
175168
}
176169

177170
auto pack = std::make_shared<PackType>(args...);
178-
bool sync = BoundMethodBase::activatePack(pack, deleteMethod);
179-
return sync ? pack->returnValue() : R();
171+
[[maybe_unused]] bool sync = BoundMethodBase::activatePack(pack, deleteMethod);
172+
173+
if constexpr (!std::is_void_v<R>)
174+
return sync ? std::move(pack->ret_) : R();
180175
}
181176

182177
R invoke(Args... args) override

include/libcamera/control_ids.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ extern const std::array<const ControlValue, {{ctrl.enum_values_count}}> {{ctrl.n
4949
extern const std::map<std::string, {{ctrl.type}}> {{ctrl.name}}NameValueMap;
5050
{% endif -%}
5151
extern const Control<{{ctrl.type}}> {{ctrl.name}};
52+
#define LIBCAMERA_HAS_{{vendor|upper}}_VENDOR_{{mode|upper}}_{{ctrl.name|snake_case|upper}}
5253
{% endfor -%}
5354

5455
{% if vendor != 'libcamera' %}

include/libcamera/internal/camera.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <atomic>
1111
#include <list>
1212
#include <memory>
13+
#include <queue>
1314
#include <set>
1415
#include <stdint.h>
1516
#include <string>
@@ -36,6 +37,7 @@ class Camera::Private : public Extensible::Private
3637
const PipelineHandler *pipe() const { return pipe_.get(); }
3738

3839
std::list<Request *> queuedRequests_;
40+
std::queue<Request *> waitingRequests_;
3941
ControlInfoMap controlInfo_;
4042
ControlList properties_;
4143

include/libcamera/internal/delayed_controls.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#include <stdint.h>
1111
#include <unordered_map>
1212

13+
#include <libcamera/base/object.h>
14+
1315
#include <libcamera/controls.h>
1416

1517
namespace libcamera {
1618

1719
class V4L2Device;
1820

19-
class DelayedControls
21+
class DelayedControls : public Object
2022
{
2123
public:
2224
struct ControlParams {

include/libcamera/internal/pipeline_handler.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#pragma once
99

1010
#include <memory>
11-
#include <queue>
1211
#include <string>
1312
#include <sys/types.h>
1413
#include <vector>
@@ -34,7 +33,8 @@ class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
3433
public Object
3534
{
3635
public:
37-
PipelineHandler(CameraManager *manager);
36+
PipelineHandler(CameraManager *manager,
37+
unsigned int maxQueuedRequestsDevice = 32);
3838
virtual ~PipelineHandler();
3939

4040
virtual bool match(DeviceEnumerator *enumerator) = 0;
@@ -81,6 +81,7 @@ class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
8181
virtual void releaseDevice(Camera *camera);
8282

8383
CameraManager *manager_;
84+
const unsigned int maxQueuedRequestsDevice_;
8485

8586
private:
8687
void unlockMediaDevices();
@@ -89,13 +90,11 @@ class PipelineHandler : public std::enable_shared_from_this<PipelineHandler>,
8990
virtual void disconnect();
9091

9192
void doQueueRequest(Request *request);
92-
void doQueueRequests();
93+
void doQueueRequests(Camera *camera);
9394

9495
std::vector<std::shared_ptr<MediaDevice>> mediaDevices_;
9596
std::vector<std::weak_ptr<Camera>> cameras_;
9697

97-
std::queue<Request *> waitingRequests_;
98-
9998
const char *name_;
10099
unsigned int useCount_;
101100

include/libcamera/ipa/mali-c55.mojom

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface IPAMaliC55Interface {
2828
};
2929

3030
interface IPAMaliC55EventInterface {
31-
paramsComputed(uint32 request);
31+
paramsComputed(uint32 request, uint32 bytesused);
3232
statsProcessed(uint32 request, libcamera.ControlList metadata);
3333
setSensorControls(libcamera.ControlList sensorControls);
3434
};

src/apps/cam/camera_session.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,17 @@ void CameraSession::listProperties() const
236236
const ControlId *id = properties::properties.at(key);
237237

238238
std::cout << "Property: " << id->name() << " = "
239-
<< value.toString() << std::endl;
239+
<< value.toString();
240+
241+
if (!id->enumerators().empty()) {
242+
int32_t val = value.get<int32_t>();
243+
const auto &iter = id->enumerators().find(val);
244+
245+
if (iter != id->enumerators().end())
246+
std::cout << " (" << iter->second << ")";
247+
}
248+
249+
std::cout << std::endl;
240250
}
241251
}
242252

src/ipa/libipa/agc_mean_luminance.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ static constexpr uint32_t kNumStartupFrames = 10;
4444
*/
4545
static constexpr double kDefaultRelativeLuminanceTarget = 0.16;
4646

47+
/*
48+
* Maximum relative luminance target
49+
*
50+
* This value limits the relative luminance target after applying the exposure
51+
* compensation. Targeting a value above this limit results in saturation
52+
* and the inability to regulate properly.
53+
*/
54+
static constexpr double kMaxRelativeLuminanceTarget = 0.95;
55+
4756
/**
4857
* \struct AgcMeanLuminance::AgcConstraint
4958
* \brief The boundaries and target for an AeConstraintMode constraint
@@ -134,7 +143,8 @@ static constexpr double kDefaultRelativeLuminanceTarget = 0.16;
134143
*/
135144

136145
AgcMeanLuminance::AgcMeanLuminance()
137-
: frameCount_(0), filteredExposure_(0s), relativeLuminanceTarget_(0)
146+
: exposureCompensation_(1.0), frameCount_(0), filteredExposure_(0s),
147+
relativeLuminanceTarget_(0)
138148
{
139149
}
140150

@@ -368,6 +378,15 @@ int AgcMeanLuminance::parseTuningData(const YamlObject &tuningData)
368378
return parseExposureModes(tuningData);
369379
}
370380

381+
/**
382+
* \fn AgcMeanLuminance::setExposureCompensation()
383+
* \brief Set the exposure compensation value
384+
* \param[in] gain The exposure compensation gain
385+
*
386+
* This function sets the exposure compensation value to be used in the
387+
* AGC calculations. It is expressed as gain instead of EV.
388+
*/
389+
371390
/**
372391
* \brief Set the ExposureModeHelper limits for this class
373392
* \param[in] minExposureTime Minimum exposure time to allow
@@ -424,7 +443,8 @@ void AgcMeanLuminance::setLimits(utils::Duration minExposureTime,
424443
*/
425444
double AgcMeanLuminance::estimateInitialGain() const
426445
{
427-
double yTarget = relativeLuminanceTarget_;
446+
double yTarget = std::min(relativeLuminanceTarget_ * exposureCompensation_,
447+
kMaxRelativeLuminanceTarget);
428448
double yGain = 1.0;
429449

430450
/*
@@ -467,12 +487,20 @@ double AgcMeanLuminance::constraintClampGain(uint32_t constraintModeIndex,
467487
hist.interQuantileMean(constraint.qLo, constraint.qHi);
468488

469489
if (constraint.bound == AgcConstraint::Bound::Lower &&
470-
newGain > gain)
490+
newGain > gain) {
471491
gain = newGain;
492+
LOG(AgcMeanLuminance, Debug)
493+
<< "Apply lower bound: " << gain << " to "
494+
<< newGain;
495+
}
472496

473497
if (constraint.bound == AgcConstraint::Bound::Upper &&
474-
newGain < gain)
498+
newGain < gain) {
475499
gain = newGain;
500+
LOG(AgcMeanLuminance, Debug)
501+
<< "Apply upper bound: " << gain << " to "
502+
<< newGain;
503+
}
476504
}
477505

478506
return gain;

0 commit comments

Comments
 (0)