Commit graph

328 commits

Author SHA1 Message Date
Stefan Klug
60d60c1367 libtuning: module: awb: Add bayes AWB support
To support the bayesian AWB algorithm in libtuning, the necessary data
needs to be collected and written to the tuning file.

Extend libtuning to calculate and output that additional data.

Prior probabilities and AwbModes are manually specified and not
calculated in the tuning process. Add sample values from the RaspberryPi
tuning files to the example config file.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-02-21 17:35:03 +01:00
Paul Elder
187f2d537b gstreamer: Generate the new AEGC controls
Since AeEnable will be replaced with ExposureTimeMode and
AnalogueGainMode so that the two can be set between auto/manual
independently, update the gstreamer control ids generation to conform
with this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Nicolas Nicolas <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20 21:36:40 +02:00
Paul Elder
8d50577c0f utils: codegen: controls.py: Fix missing direction error message
The error message for missing direction field prints the direction value
(usually 'None') instead of the name of the field 'direction'. Fix this.

Fixes: 39fe4ad968 ("utils: codegen: controls.py: Parse direction information")
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-09 14:12:50 -06:00
Stefan Klug
fa2e8621f5 utils: gen-debug-controls: Output direction flag
The yaml definitions for controls now require a direction attribute
which is not auto generated by gen-debug-controls.py. Fix that.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-23 11:16:08 +00:00
Stefan Klug
6efbe35de5 utils: tuning: rkisp1: Replace static AWB with new AWB module
The rkisp1 tuner used a static module to insert the AWB algorithm into
the tuning file. Replace that with the new AWB module.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20 17:22:42 +01:00
Stefan Klug
b1ec488f1b libtuning: Add initial AWB module
This AWB module uses the awb function from Raspberry Pi to calculate the
needed white balance gains per colour temperature. It stores these gains
in the tuning file.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20 17:22:42 +01:00
Stefan Klug
731cc02e79 libtuning: Fix access to color member in ctt_awb.awb()
The color temperature member of the image object was named "col" in the
past. Now it is named "color" (which is still not very expressive).
There are still a few unspotted accesses to the col member. Fix them to
access the color member.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20 17:22:42 +01:00
Stefan Klug
83e186a094 libtuning: Remove the Cam object from ctt_awb.awb()
Replace the Cam object with a list parameter to be able to call the
ctt_awb.awb() function from libtuning code.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20 17:22:42 +01:00
Stefan Klug
3077f951c1 libtuning: Use logging framework in ctt_awb.awb()
To be able to use the awb function copied from the Raspberry Pi tuning
scripts in the libtuning code, we need to remove the Cam object. Use the
logging framework to replace all accesses to Cam.log.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20 17:22:42 +01:00
Stefan Klug
24e00be9f3 utils: tuning: libtuning: Fix tuning for non RGGB RAWs
Tuning fails for raw images that don't have the channels ordered in
RGGB.  In 19dc8c28f6 ("utils: tuning: libtuning: Implement the core of
libtuning") the channels of the image were reordered to RGGB
unconditionally in _read_image_dng(). That change was not applied to the
ctt_awb code, so that the channels were reordered twice. Fix by removing
the double ordering.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Tested-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18 17:20:32 +01:00
Paul Elder
39fe4ad968 utils: codegen: controls.py: Parse direction information
In preparation for adding support for querying direction information
from controls, parse the direction information from control ID
definitions. This can later be plugged in directly to the IPA code
generators simply by using ctrl.direction.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-18 17:26:52 +09:00
Stefan Klug
9fc86dc02a libipa: agc_mean_luminance: Rename yaml key from exposure-time to exposureTime
In d0478c41f4 ("libcamera: Rename "shutter speed" to "exposure time"")
the tuning file entry "shutter" was renamed to "exposure-time". As the
tuning files use camel cased key names, change "exposure-time" to
"exposureTime" for consistency. It doesn't break our users setups as
there are no tuning files using that entry in the wild (at least
officially).

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-12-04 17:09:26 +01:00
Laurent Pinchart
d0478c41f4 libcamera: Rename "shutter speed" to "exposure time"
The terms "shutter" and "shutter speed" are used through libcamera to
mean "exposure time". This is confusing, both due to "speed" being used
as "time" while it should be the inverse (i.e. a maximum speed should
correspond to the minimum time), and due to "shutter speed" and
"exposure time" being used in different places with the same meaning.

To improve clarity of the code base and the documentation, use "exposure
time" consistently to replace "shutter speed".

This rename highlighted another vocabulary issue in libcamera. The
ExposureModeHelper::splitExposure() function used to document that it
splits "exposure time into shutter time and gain". It has been reworded
to "split exposure into exposure time and gain". That is not entirely
satisfactory, as "exposure" has a defined meaning in photography (see
https://en.wikipedia.org/wiki/Exposure_(photography)) that is not
expressed as a duration. This issue if left to be addressed separately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-26 19:05:17 +02:00
Stefan Klug
f7121716db utils: Add script to generate control_ids_debug.yaml
For flexible debugging it is helpful to minimize the roundtrip time.
This script parses the source tree and looks for usages of

set<type>(controls::debug::Something,

and adds (or removes) the controls as necessary from the yaml
description. It is meant to be used during development to ease the
creation of the correct yaml entries.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-13 11:47:06 +01:00
Jaslo Ziska
27cece6653 gstreamer: Generate controls from control_ids_*.yaml files
This commit implements gstreamer controls for the libcamera element by
generating the controls from the control_ids_*.yaml files using a new
gen-gst-controls.py script. The appropriate meson files are also changed
to automatically run the script when building.

The gen-gst-controls.py script works similar to the gen-controls.py
script by parsing the control_ids_*.yaml files and generating C++ code
for each exposed control.
For the controls to be used as gstreamer properties the type for each
control needs to be translated to the appropriate glib type and a
GEnumValue is generated for each enum control. Then a
g_object_install_property(), _get_property() and _set_property()
function is generated for each control.
The vendor controls get prefixed with "$vendor-" in the final gstreamer
property name.

The C++ code generated by the gen-gst-controls.py script is written into
the template gstlibcamerasrc-controls.cpp.in file. The matching
gstlibcamerasrc-controls.h header defines the GstCameraControls class
which handles the installation of the gstreamer properties as well as
keeping track of the control values and setting and getting the
controls. The content of these functions is generated in the Python
script.

Finally the libcamerasrc element itself is edited to make use of the new
GstCameraControls class. The way this works is by defining a PROP_LAST
enum variant which is passed to the installProperties() function so the
properties are defined with the appropriate offset. When getting or
setting a property PROP_LAST is subtracted from the requested property
to translate the control back into a libcamera::controls:: enum
variant.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 16:28:09 +00:00
Laurent Pinchart
7ff6fd9774 utils: checkstyle.py: Centralize dependency handling for checkers
The checkstyle.py script depends on external tools. Those dependencies
are handled in different ways in different parts of the code. Centralize
the management of checker-specific dependencies to simplify the checkers
and output more consistent error messages.

This fixes a crash in the Pep8Formatter class when the autopep8
dependency is not found.

Fixes: 8ffaf376bb ("utils: checkstyle: Add a python formatter")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 03:50:12 +02:00
Laurent Pinchart
5722438754 utils: checkstyle.py: Print issues using __str__
CommitIssue and StyleIssue classes have different string
representations, which are handled by type-specific print() calls in the
code that handles the issues. This requires the user to know which type
of issue it is dealing with. Simplify that by moving the string
representation logic to a __str__() method.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 03:50:12 +02:00
Laurent Pinchart
b488a862df utils: checkstyle.py: Turn check() into a class method for all checkers
The check() method of StyleChecker subclasses are instance methods,
while CommitChecker subclasses use class methods. This makes unified
handling of checkers more complicated. Turn the StyleChecker check()
method into a class method, passing it the contents to be checked
directly.

While at it, fix two style issues reported by checkstyle.py.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 03:50:11 +02:00
Laurent Pinchart
5f7bcd93fd utils: checkstyle.py: Factor out common code to new CheckerBase class
The CommitChecker, StyleChecker and Formatter classes duplicate code.
Create a new CheckerBase class to factor out common code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 03:50:11 +02:00
Bernhard M. Wiedemann
ae51d30468 libcamera: tracepoints: Fix copyright year for reproducible builds
The tracepoints.h file is generated from the tracepoints.h.in template
by the gen-tp-header.py script. The template contains a {{year}}
placeholder for the copyright year, which the script fills with the
current year. This breaks reproducible builds with at least the openSUSE
debugsource package.

As the gen-tp-header.py script doesn't add any copyrightable contents to
the tracepoints.h file, fix this by replacing the {{year}} placeholder
with the year of the last copyright-worthy change to tracepoints.h.in.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-18 23:39:11 +03:00
Laurent Pinchart
fc761ffe49 hooks: pre-push: Verify that co-authors have a SoB line
The Co-developed-by tag must be followed by a corresponding SoB line.
Enforce this rule in the git pre-push hook.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-08 18:06:30 +03:00
Kieran Bingham
44b49af7a0 utils: abi-compat: sort meson options
Sort the options passed to meson setup alphabetically when performing a
slimline libcamera build.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-25 10:36:40 +01:00
Kieran Bingham
9155d79f4d utils: abi-compat: Disable python build
While building the core libcamera library for ABI compatibility checks,
the pycamera python bindings may get built if the required dependencies
are found.

The ABI compatibility checks do not validate or verify the Python API -
so remove this from the intermediate build steps.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-25 10:36:37 +01:00
Stefan Klug
8161018b9b utils: checkstyle: Remove style checker for python pep8
The issues detected and fixed by autopep8 are the same as the ones
detected by pycodestyle. As the formatter runs unconditionally we can
remove the checker.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-04 17:22:59 +02:00
Stefan Klug
8ffaf376bb utils: checkstyle: Add a python formatter
Reporting style issues on python files is great, automatically fixing
them is even better. Add a call to autopep8 for python files. This fixes
the same issues as the ones reported by pycodestyle.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-09-04 17:22:36 +02:00
Laurent Pinchart
b318101ada libcamera: ipa: Drop unneded includes from ipa_interface.h
The ipa_interface.h file includes a number of headers that are not
directly used. Remove them, and add them to the source files that
include ipa_interface.h as required.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-09-03 15:25:55 +03:00
Laurent Pinchart
0e333755ff utils: ipc: Include <string> in generated headers where needed
Depending on the types used in the IPA interface, generated headers may
use the std::string class. Include <string> when needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-09-03 15:25:45 +03:00
Laurent Pinchart
67b87ccb87 utils: update-kernel-headers: Support relative path to kernel git tree
When given a relative path to the kernel git tree,
update-kernel-headers.sh fails to execute the headers_install.sh script
from the kernel sources. Fix it by turning the kernel directory into an
absolute path.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-08-27 12:16:10 +03:00
Laurent Pinchart
5c1cb5e5bc py: gen-py-controls: Use Control class
Replace manual extraction of data from YAML with the Control helper
class. This centralizes YAML parsing and avoids manual mistakes.

In order to import the controls module, add the utils/codegen/ directory
to the PYTHONPATH through the Python build environment.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-16 00:28:32 +03:00
Laurent Pinchart
6a96113107 utils: codegen: gen-controls.py: Move helper classes to separate file
The ControlEnum and Control helper classes defined in gen-controls.py
are useful for other generator scripts. Move them to a separate file to
make it possible to share them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-16 00:28:32 +03:00
Laurent Pinchart
dc067c4bce utils: codegen: gen-controls.py: Convert to jinja2 templates
Jinja2 templates help separate the logic related to the template from
the generation of the data. The python code becomes much clearer as a
result.

As an added bonus, we can use a single template file for both controls
and properties.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-16 00:27:54 +03:00
Laurent Pinchart
48f9660acd utils: codegen: gen-header.sh: Generate libcamera.h based on meson.build
The libcamera.h header is a top-level library header that contains every
other libcamera header. It is currently generated by listing the files
in include/libcamera/ and dropping the .in suffix from template files.
This assumes a 1:1 mapping between generated header file names and the
name of their templates.

Drop that assumption and base the libcamera.h generation on the
libcamera public headers listed in meson.build. This makes the
libcamera.h header generation more future-proof.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-16 00:00:28 +03:00
Laurent Pinchart
a5f12d2eb3 meson: utils: Provide environment for Python scripts
Python scripts run as part of the build process need to take a few
actions specific to the environment in which they operate. One of those
is disabling the Python bytecode cache, to avoid writing .pyc files to
the source tree. This is done manually in the IPC generate.py and
parser.py scripts.

The current implementation is not ideal because it hardcodes in the
scripts information related to the environment in which they operate. As
those scripts are part of libcamera this is more of a theoretical issue
than a practical one. A second issue is that future Python scripts will
need to duplicate similar mechanisms, resulting in a higher maintenance
burden.

Address the issue with a different approach, by creating a meson
environment for the Python scripts, and passing it to the
custom_target() functions. The environment only disables the bytecode
cache for now.

The diffstat shows an increase in code size. This is expected to be
offset by usage of the environment for more Python scripts, as well as
support of more variables in the environment.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-16 00:00:23 +03:00
Laurent Pinchart
50c92cc7e2 meson: Move all code generation scripts to utils/codegen/
We have multiple code generation scripts in utils/, mixed with other
miscellaneous utilities, as well as a larger code base based on mojom in
utils/ipc/. To make code sharing easier between the generator scripts,
without creating a mess in the utils/ directory, move all the code
generation code to utils/codegen/.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-15 23:59:08 +03:00
Stefan Klug
53108b6ff1 utils: tuning: Change Tuner.add() to accept a list of modules
Change the first parameter of Tuner.add() to accept either a list of
modules or a single module. This allows more compact code and is in sync
with Tuner.set_output_order().

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-14 16:22:07 +02:00
Stefan Klug
1dfedac794 utils: tuning: rkisp1: Clean up tuner construction
The instances of the static modules need to be passed to
tuner.set_output_order() instead of the class.  This is the reason for
the intermediate variables. To keep the code tidy, apply the same
pattern to the other modules.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-08-14 11:37:14 +02:00
Laurent Pinchart
2d5cea862d utils: checkstyle.py: Add __repr__ method to Commit class
When debugging issues with the Commit class, a __repr__ method proved to
be useful to quickly print all the parsed information about a commit. To
avoid reimplementing the method over and over again in the future, add
it to the class, even if it is not actually used.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12 15:44:23 +03:00
Laurent Pinchart
35f045f978 utils: checkstyle.py: Skip title and trailers checkers for pre-commit
When running checkstyle.py in a pre-commit hook, there is either no
commit message at all (when committing staged changes as a new commit),
or the commit message comes from a previous commit being amended. In
either case, there's no new commit message yet, and thus nothing to
validate for the title and trailers checkers. The trailers checker, in
particular, will always flag an error, making all commits fail.

To fix that, just skip the two checkers during pre-commit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12 15:44:22 +03:00
Laurent Pinchart
eeb435bbda utils: checkstyle.py: Rework commit message parsing
When parsing commit messages, the Commit class tries to optimize the
process by invoking git-show once only, extracting both the commit
author, title and modified files in one go. As a result, the derived
Amendment class needs to implement the commit parsing separately, as the
modified files need to be extracted differently for amendments (and the
commit ID also needs to be retrieved differently). Furthermore, because
of the list of named files, extracting the trailers needs to invoke
git-show separately.

Improve the situation by reworking the commit message parsing in three
steps. In the first step, use git-show to extract the commit ID, author,
title and body. In the second step, invoke git-interpret-trailers to
extract the trailers from the body that was previously extracted. The
third and final step extracts the list of modified files, using
different methods for regular commits and amendments.

This allows sharing code for the first two steps between the Commit and
Amendment classes, making the code simpler. The Commit class still
invokes git three times, while the Amendment class runs it three times
instead of four, improving performance slightly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12 15:44:17 +03:00
Laurent Pinchart
6f1df8d606 utils: checkstyle.py: Fix trailer parsing for commits with changelogs
Trailers are extracted from commits using the '(trailers:*)' formatting
specifier. git ignores dividers when doing so, as if the --no-divider
options was passed to git-interpret-trailers. This prevents trailers
from being located when the patch contains a local changelog.

There is unfortuantely no 'no-no-divider' option to the trailers format
specifier. Fix the issue by extracting trailers with
git-interpret-trailers, that gives better control of the parsing.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07 18:58:54 +03:00
Laurent Pinchart
93506de63a utils: checkstyle.py: Validate SoB trailer against author
The TrailersChecker enforces the presence of a Signed-off-by tag in the
trailer, but doesn't verify that the tag matches the commit's author.
Add that verification, as required by the libcamera contribution
process.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07 18:38:45 +03:00
Laurent Pinchart
fd130ef21b utils: checkstyle.py: Add author property to Commit class
Extend the Commit class with an author property, retrieved from the
commit. It will be used to extend checkers.

While at it, drop the unneeded .strip() call when retrieving the title
for amendment commits. The call got carried over from code that
initially needed it to strip the new line character, but that need
disappeard with usage of .splitlines().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07 18:38:44 +03:00
Laurent Pinchart
8af95d6854 utils: checkstyle.py: Warn when no valid Signed-off-by line is found
All commits to libcamera must include a Signed-off-by line, and that
rule is enforced through git hooks and CI. This however doesn't prevent
patches from being submitted without an SoB tag, as noticed multiple
times in the past. Extend the checkstyle.py trailer checker to issue a
warning when the SoB line is missing to try and improve the situation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05 19:37:29 +03:00
Zach DeCook
a61241eb8b utils: gen-version: Use posix compliant date
The version string of libcamera is presently appended with a date/time
argument in the case of a dirty tree to show further detail of when it
was built. This string is generated with the iso-8601 parameter to
'date' and produces a date string in the form:
"2024-06-17T22:15:30+01:00"

Strict posix shells or implementations of 'date' which may be optimised
for size such as the one provided by busybox or Alpine Linux may not
support the '--iso-8601' flag.

To support builds on those platforms, use a direct POSIX-compliant
date-format string instead matching as closely as possible to the
iso-8601 definition.

An exact match is not possible with those restrictions so 'date
%Y-%m-%dT%H:%M:%S%Z' is used which produces 2024-06-17T22:15:30BST.

The use of the human readable timezone identifier provides a friendlier
output for the string than a timezone offset at the expense of being
less sortable in the exceptionally low risk and unlikely event of two
custom builds being compared at the same time of different timezones.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Zach DeCook <zachdecook@librem.one>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25 09:57:54 +01:00
Stefan Klug
974a526c83 libtuning: agc: rkisp1: Increase y-target
With the addition of gamma out correction the relative luminance target
was set too low. As brightness is a bit subjective it is difficult to
come up with the "correct" value. With 0.5 the patch 22 on the macbeth
chart (neutral grey, 18% reflectance) ended up a bit below 50% grey,
which seems reasonable.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05 22:38:20 +02:00
Stefan Klug
d5db46232e libtuning: lsc: Prevent negative values
In cases where the calibration image contains super dark areas, or when
an invalid blacklevel was supplied, the grid might get close to zero or
negative. This would have bad effects on the 1/grid later. So clamp the
values to a small positive number.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05 22:38:20 +02:00
Stefan Klug
e91f6c384f libtuning: lsc: rkisp1: Do not calculate ratios to green
The current LSC algorithm for the rkisp1 just forwards the LSC tables to
the hardware, so absolute factors are needed and not ratios compared to
green. Therefore every channel needs to be calculated independently.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05 22:38:20 +02:00
Stefan Klug
e0f41b7401 tuning: rkisp1: Add some static modules
Add awb, blc, cproc, filter, and gamma to the tuning file.  These don't
need any configuration.

At the moment there are no inter-module dependencies in the tuning
process. We can therefore safely sort them alphabetically. As soon as
the first dependency gets introduced (most likely lsc -> ccm) we will
see how to solve that.

The output order controls the order of processing in the IPA. It is now
also in alphabetical order which happens to be no change for the modules
that existed previously. For the others, there is no need for a specific
order.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05 22:38:20 +02:00
Stefan Klug
9eb26a8716 libtuning: Add static module
Add a static module class, that can be used to add static data to the
tuning file. This is propably not the best solution, but allows us to
progress without writing lots of dummy classes for static cases.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05 22:38:19 +02:00
Stefan Klug
8e411bfaef libtuning: Only warn if processing returns None
There are valid cases where a module returns None. E.g. no images were
provided for LSC calibration. We should however define proper semantics
there. Continue with a warning for now.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05 22:38:19 +02:00