Age | Commit message (Collapse) | Author |
|
The SDL_UpdateNVTexture() function, used for NV12 texture support, has
been introduced in SDL2 2.0.16. Compiling against older SDL versions
fails with
../src/cam/sdl_texture_yuv.cpp: In member function ‘virtual void SDLTextureNV12::update(const std::vector<libcamera::Span<const unsigned char> >&)’:
../src/cam/sdl_texture_yuv.cpp:19:2: error: ‘SDL_UpdateNVTexture’ was not declared in this scope; did you mean ‘SDL_UpdateYUVTexture’?
19 | SDL_UpdateNVTexture(ptr_, &rect_, data[0].data(), pitch_,
| ^~~~~~~~~~~~~~~~~~~
| SDL_UpdateYUVTexture
Fix it with conditional compilation based on the SDL version.
Fixes: 7b8df9fe6b3e ("cam: sdl_sink: Add NV12 texture support")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
|
|
Extend the SDL sink with support for NV12 textures, useful on platforms
that don't support packed YUYV formats.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
In order to prepare for NV12 support, implement support for multi-planar
formats in the SDL sink. This mainly consists in passing a vector of
plane data to the SDLTexture::update() function instead of a single
value.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
In preparation for the addition of NV12 support in the SDL sink, rename
the sdl_texture_yuyv.{cpp,h} files to just "yuv". Separate
sdl_texture_nv12.{cpp,h} files could be added instead, but given how
short the implementation will be, grouping all YUV formats in a single
file is better.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The line stride of the texture is currently hardcoded based on the image
width, which may not match the real stride. Use the stride value from
the stream configuration instead.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
One typo is corrected, and this format is added to one further table
where it was missing entirely.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The python3-yaml package (containing the PyYAML Python package) shipped
by Debian stable is documented as a YAML 1.1 parser:
Python3-yaml is a complete YAML 1.1 parser and emitter for Python3.
PyYAML doesn't implement YAML 1.2 support, but ignores the minor number
of the YAML directive, and thus doesn't choke on the libcamera internal
files used to generate format- and control-related source code that
explicitly state conformance with YAML 1.2. Still, given that we don't
use any feature of YAML 1.2, and that the tuning data files now use YAML
1.1, switch the internal YAML files to version 1.1 as well for
consistency.
The main drawback of YAML 1.1 is that the unquoted literal strings Yes,
No, On and Off will be parsed as booleans. We need to be careful to
avoid those values in YAML files, until libcamera can switch to YAML 1.2
once more recent versions of libyaml get shipped by the distributions we
want to support. This is however not an issue introduced by this change,
as the existing YAML 1.2 files were parsed with the YAML 1.1 string
literal parsing rules anyway.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
YAML 1.2 support has been added in libyaml in version 0.2.3. Debian
stable ships version 0.2.2 of libyaml, which causes parse errors of the
tuning tuning data files due to the YAML 1.2 directive at the beginning.
As we don't use any feature of YAML 1.2, downgrade the data files to
YAML 1.1.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Currently the pipeline handler advertises controls handled by the IPA
from a ControlInfoMap it manually constructs. This is wrong, as the IPA
module is the component that knows what controls it supports. Fix this
by moving the ControlInfoMap construction to the IPA module, and pass it
to the pipeline handler as a return value from the IPA init() function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Florian Sylvestre <fsylvestre@baylibre.com>
|
|
Several NXP i.MX8 SoCs (such as the i.MX8MN and i.MX8MP) contain a
camera pipeline made of sensor interfaces (with parallel and/or CSI-2
receivers) and an image processing engine named ISI. The ISI contains an
input crossbar switch and one or more processing pipelines capable of
format conversion and scaling.
This is a good candidate for the simple pipeline handler as a first
step. The i.MX8MP should eventually graduate to having its own pipeline
handler as it also contains two ISP instances (supported by the rkisp1
driver).
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
If a subdev supports the internal routing API, pads unrelated to the
pipeline for a given camera sensor may carry streams for other cameras.
The link setup logic is updated to take this into account, by avoiding
disabling links to unrelated pads.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
When traversing the media graph to discover a pipeline from the camera
sensor to a video node, all sink-to-source paths inside subdevs are
considered. This can lead to invalid paths being followed, when a subdev
has restrictions on its internal routing.
The V4L2 API supports exposing subdev internal routing to userspace.
Make use of this feature, when implemented by a subdev, to restrict the
internal paths to the currently active routes. If a subdev doesn't
implement the internal routing operations, all source pads are
considered, as done today.
This change is needed to properly support multiple sensors with devices
such as the NXP i.MX8 ISI or the MediaTek i350 and i500 SENINF. Support
for changing routes dynamically will be added later when required.
Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
To setup links the pipeline handler iterates over all entities in the
pipeline and disables all links but the ones we want to enable. Some
entities don't allow multiple sink links to be enabled, so the iteration
needs to be based on sink entities, disabling all their links first and
then enabling the sink link that is part of the pipeline.
The loop implementation iterates over all Entity instances, and uses
their source link to locate the MediaEntity for the connected sink. The
sink entity is then processed in the context of the source's loop
iteration. This prevents the code from being able to access extra
information about the sink entity, as we only have access to the
MediaEntity, not the Entity.
To prepare for subdev routing support that will require accessing
additional entity information, refactor the loop to process the sink
entity in the context of its Entity instance.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Reset the routing table of subdevices supporting the V4L2 streams API to
its default state when initializing the pipeline handler. This avoids
issues caused by usage of leftover state.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Extend the V4L2Subdevice class to support getting and setting routing
tables.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Collect subdev capabilities at open() time.
Model the V4L2SubdevCapabilties as V4L2Capability from the video
device class.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The V4L2Subdevice::Whence enumerations defines two values that should
correspond to the V4L2_SUBDEV_FORMAT_ACTIVE and V4L2_SUBDEV_FORMAT_TRY
definitions.
The V4L2 symbols are defined as:
V4L2_SUBDEV_FORMAT_TRY = 0,
V4L2_SUBDEV_FORMAT_ACTIVE = 1,
While the libcamera defined enumeration is:
enum Whence {
ActiveFormat,
TryFormat,
}
As V4L2Subdevice::Whence values are used to populate data types
defined in v4l2-subdev.h used as arguments to VIDIOC_SUBDEV_*
ioctls, the V4L2Subdevice class is required to adjust their value as:
subdevFmt.which = whence == ActiveFormat ? V4L2_SUBDEV_FORMAT_ACTIVE
: V4L2_SUBDEV_FORMAT_TRY;
Drop the adjustment by defining :
Whence::TryFormat = V4L2_SUBDEV_FORMAT_TRY;
Whence::ActiveFormat = V4L2_SUBDEV_FORMAT_ACTIVE;
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add missing 32-bit packet YUV 4:4:4 formats. These formats are used by
the i.MX8 ISI driver.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The YamlParser::getList<>() function returns an std::optional<> to allow
callers to identify cases where parsing the .yaml file failed from cases
where the parsed list is just empty.
The current implementation returns a default constructed std::optional
in case of errors with
return {};
The returned value is thus equal to std::nullopt, but the code can be
easily misinterpreted as returning an empty vector by a reader.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG formats are under-specified
and are used interchangeably by kernel drivers.
Map both of them to formats::MJPEG and use the newly re-introduced
V4L2VideoDevice::toV4L2PixelFormat() to map to the one actually used by
the video device.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Now that V4L2PixelFormat::fromPixelFormat() returns a list of formats
to chose from, select the one supported by the video device by matching
against the list of supported pixel formats.
The first format found to match one of the device supported ones is
returned.
As the list of pixel formats supported by the video device does not
change at run-time, cache it at device open() time. Maximize the
lookup efficiency by storing the list of supported V4L2PixelFormat in an
std::unordered_set<>.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Multiple V4L2 formats can be associated with a single PixelFormat.
Now that users of V4L2PixelFormat::fromPixelFormat() have been converted
to use V4L2VideoDevice::toV4L2PixelFormat(), return the full list of
V4L2 formats in order to prepare to match them against the ones
supported by the video device.
The V4L2 compatibility layer, not having any video device to interact
with, is converted to use the first returned format unconditionally.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
This is a partial revert of commit 395d43d6d75b ("libcamera:
v4l2_videodevice: Drop toV4L2PixelFormat()")
The function was removed because it incorrectly maps non-contiguous V4L2
format variants (ie V4L2_PIX_FMT_YUV420M) to the API version supported
by the video device (singleplanar API and multiplanar API). It was
decided at the time to remove the function and let its users call
directly V4L2PixelFormat::fromPixelFormat() which accepts a
'multiplanar' flags.
As we aim to associate multiple V4L2PixelFormat to a single libcamera
format, the next patches will verify which of them is actually supported
by the video device. For now, return the contiguous version
unconditionally.
Re-introduce V4L2VideoDevice::toV4L2PixelFormat() and convert all
the V4L2PixelFormat::fromPixelFormat() users to use it.
The V4L2 compatibility layer is the only outlier as it doesn't have a
video device to poke, hence it still uses
V4L2PixelFormat::fromPixelFormat().
Next patches will implement the device format matching logic and handle
the non-contiguous plane issue in V4L2VideoDevice::toV4L2PixelFormat().
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
To each libcamera PixelFormat two V4L2 formats are associated, the
'single' and 'multi' format variants.
The two versions list plane contiguous and non-contiguous format
variants, and an optional argument to V4L2PixelFormat::fromPixelFormat()
was used to select which one to pick.
In order to prepare to remove V4L2PixelFormat::fromPixelFormat(), and
considering that no caller in the codebase uses the non-contiguous
format variant, merge the two formats vectors in a single one and
default the selection to the first available one, which is functionally
equivalent to what is currently implemented.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
The PixelFormatInfo::info(const V4L2PixelFormat &format) function
returns the PixelFormatInfo associated with a V4L2 pixel format.
As the pixelFormatInfo map is indexed using PixelFormat and a V4L2
format can easily be converted to a PixelFormat, simply return
the info() function overload instead of maintaining two similar
implementations of the same function.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
When we switch camera mode following a pipeline reconfiguration, the
embedded data parser should be "reset" to discard any data that it may
have cached and that might now be invalid.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Building on gcc8 on Debian 10 fails with
asyncThread_ = std::thread(std::bind(&Awb::asyncFunc, this));
../src/ipa/raspberrypi/controller/rpi/awb.cpp:177:34: note: ‘std::bind’
is defined in header ‘<functional>’; did you forget to ‘#include
<functional>’?
Fix that by including <functional> in awb.cpp.
Fixes: c1597f989654 ("ipa: raspberrypi: Use YamlParser to replace dependency on boost")
Reported-by: https://buildbot.libcamera.org/#/builders/6/builds/414
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
|
|
The Pwl class uses std::function, defined in <functional>, without
including the header directly. This results in a compilation error with
the Fedora 36 compiler toolchain (gcc 12.1.1):
In file included from ../src/ipa/raspberrypi/controller/rpi/awb.h:14,
from ../src/ipa/raspberrypi/controller/rpi/awb.cpp:14:
../src/ipa/raspberrypi/controller/rpi/../pwl.h:97:18: error: 'std::function' has not been declared
97 | void map(std::function<void(double x, double y)> f) const;
| ^~~
Fix it by including <functional>.
Fixes: c1597f989654 ("ipa: raspberrypi: Use YamlParser to replace dependency on boost")
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Usage of the std::enable_if_t type doesn't need to be prefixed by
typename. Drop the unnecessary keyword.
Reported-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The Controller(char const *jsonFilename) is not valid anymore since
Controller::read() can now return an error on a failure. Additionally, this
constructor is not actually used, so remove it.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add ColorProcessing algorithm that is in charge to manage brightness,
contrast and saturation controls. These controls are currently based on
user controls.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Denoise and Sharpness filters will be applied by RkISP1 during the
demosaicing step. The denoise filter is responsible for removing noise
from the image, while the sharpness filter will enhance its acutance.
Add filter algorithm with denoise and sharpness values based on user
controls.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The Defect Pixel Cluster Correction algorithm is responsible to minimize
the impact of defective pixels. The on-the-fly method is actually used,
based on coefficient provided by the tuning file.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The Lens Shading Correction algorithm applies multipliers to all pixels
to compensate for the lens shading effect. The coefficients are
specified in a downscaled table in the YAML tuning file.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The GammaSensorLinearization algorithm linearizes the sensor output to
compensate the sensor non-linearities by applying piecewise linear
functions to the red, green and blue channels.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
usage
The std::optional<T>::value_or(U &&default_value) function returns the
contained value if available, or default_value if the std::optional has
no value. If the desired default value is a default-constructed T, the
obvious option is to call std::optional<T>::value_or(T{}). This approach
has two drawbacks:
- The \a default_value T{} is constructed even if the std::optional
instance has a value, which impacts efficiency.
- The T{} default constructor needs to be spelled out explicitly in the
value_or() call, leading to long lines if the type is complex.
Introduce a defopt variable that solves these issues by providing a
value that can be passed to std::optional<T>::value_or() and get
implicitly converted to a default-constructed T.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The SDLTexture::update() function isn't meant to modify the data it
receives. Make the Span type const to ensure this at compile time. While
at it, pass the Span by value instead of reference, as a Span is only a
pointer and size, which will fit in registers and will avoid pointer
dereferences in the callee.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
We were using the libjpeg functionality of SDL2_image only, instead just
use libjpeg directly to reduce our dependancy count, it is a more
commonly available library.
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Replace the manual implementation of the readList() functions with
YamlObject::getList().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
Allow to retrieve a YAML list of any already supported types in a
std::vector.
Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use the convert_tuning.py script to convert all existing tuning files to
version 2.0.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
The existing tuning file format (version 1.0) requires the controller algorithms
to run in the same order as listed in the JSON structure. The JSON specification
does not mandate any such ordering, but the Boost JSON parser would maintain
this order.
In order to remove this reliance on the parser to provide ordering, introduce a
new version 2.0 format for the camera tuning file. In this version, the
algorithms are specified in a top level list node ("algorithms"), which does
require strict ordering of the elements.
A "version" node is added to distinguish between the version 1.0 and 2.0
formats. The absence of the "version" node implies version 1.0.
A "target" node is also added to specify the target platform for this
configuration.
Update the controller to support either version of the tuning file by looking
at the version node. CreateAlgorithm member function to now load and configure
each algorithm. Additionally, make CreateAlgorithm a private member, it does not
get called externally.
If a version 1.0 format tuning file is used, throw a warning message indicating
it will be soon deprecated.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The Raspberry Pi IPA module depends on boost only to parse the JSON
tuning data files. As libcamera depends on libyaml, use the YamlParser
class to parse those files and drop the dependency on boost.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
|
|
Replace the Fatal log messages that cause an abort during tuning data
read with Error messages and proper error propagation to the caller.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
Update the AGC metering functions that deal with reading tuning data to
propagate errors to the caller, using std::tie and std::tuple to group
the error code and return value.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
When encountering errors, the Algorithm::read() function either uses
LOG(Fatal) or throws exceptions from the boost property_tree functions.
To prepare for replacing boost JSON parse with the YamlParser class,
give the Algorithm::read() function the ability to return an error code,
and propagate it all the way to the IPA module init() function.
All algorithm classes return a hardcoded 0 value for now, subsequent
commits will change that.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
Tuning data files mostly use spaces for indentation, with occasional
stray tabs. Use spaces consistently. This allows parsing the tuning
files with libyaml, preparing to replace the dependency on boost.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
The std::map container used to store dictionary items in YamlObject
doesn't preserve the YAML data order, as maps are ordered by key, not by
insertion order. While this is compliant with the YAML specification
which doesn't guarantee ordering of mappings, the Raspberry Pi IPA
relies on elements being ordered as in the YAML data. To replace the
dependency on boost with the YamlParser class, we thus need to guarantee
that the order is preserved.
Preserve the order by storing items in list_ unconditionally. Turn the
list_ vector from storing YamlObject unique pointers to storing
key-value pairs, with the key being absent when the object is a list,
not a dictionary.
The YamlObject implementation is updated to preserve the existing API,
with the only difference being that YamlObject::memberNames() now
returns member names in the same order as in the YAML file.
The ordering is an implementation detail, so changing it doesn't violate
the YAML specification. The documentation is not updated to reflect
this, as we don't want any new user to rely on a particular ordering.
This commit could be reverted if desired when the Raspberry Pi IPA
updates to a new tuning data format and drops support for the old
format.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
|
|
The YamlObject::get() function takes a default value and an optional
bool ok flag to handle parsing errors. This ad-hoc mechanism complicates
error handling in callers.
A better API is possible by dropping the default value and ok flag and
returning an std::optional. Not only does it simplify the calls, it also
lets callers handle errors through the standard std::optional class
instead of the current ad-hoc mechanism.
Provide a get() wrapper around std::optional::value_or() to further
simplify callers that don't need any specific error handling.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Remove "Agc:" as that gets prefixed by the logging system.
s/AgcConfig/AgcMeteringMode/ and s/AgcConfig/AgcMeteringMode where appropriate.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|