Skip to content

Commit

Permalink
pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi code
Browse files Browse the repository at this point in the history
Split the Raspberry Pi pipeline handler and IPA source code into common
and VC4/BCM2835 specific file structures.

For the pipeline handler, the common code files now live in
src/libcamera/pipeline/rpi/common/
and the VC4-specific files in src/libcamera/pipeline/rpi/vc4/.

For the IPA, the common code files now live in
src/ipa/rpi/{cam_helper,controller}/
and the vc4 specific files in src/ipa/rpi/vc4/. With this change, the
camera tuning files are now installed under share/libcamera/ipa/rpi/vc4/.

To build the pipeline and IPA, the meson configuration options have now
changed from "raspberrypi" to "rpi/vc4":

meson setup build -Dipas=rpi/vc4 -Dpipelines=rpi/vc4

Signed-off-by: Naushir Patuck <[email protected]>
Reviewed-by: Jacopo Mondi <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
  • Loading branch information
naushir authored and pinchartl committed May 4, 2023
1 parent 46aefed commit 726e927
Show file tree
Hide file tree
Showing 121 changed files with 172 additions and 109 deletions.
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Files: Documentation/theme/static/search.png
Copyright: 2022 Fonticons, Inc.
License: CC-BY-4.0

Files: src/ipa/raspberrypi/data/*.json
Files: src/ipa/rpi/vc4/data/*.json
utils/raspberrypi/ctt/ctt_config_example.json
utils/raspberrypi/ctt/ctt_ref.pgm
Copyright: 2019-2020 Raspberry Pi Ltd
Expand Down
4 changes: 2 additions & 2 deletions Documentation/environment_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ LIBCAMERA_IPA_MODULE_PATH
LIBCAMERA_RPI_CONFIG_FILE
Define a custom configuration file to use in the Raspberry Pi pipeline handler.

Example value: ``/usr/local/share/libcamera/pipeline/raspberrypi/minimal_mem.yaml``
Example value: ``/usr/local/share/libcamera/pipeline/rpi/vc4/minimal_mem.yaml``

Further details
---------------
Expand Down Expand Up @@ -143,7 +143,7 @@ contain tuning parameters for the algorithms, in JSON format.
The ``LIBCAMERA_IPA_CONFIG_PATH`` variable can be used to specify custom
storage locations to search for those configuration files.

`Examples <https://git.libcamera.org/libcamera/libcamera.git/tree/src/ipa/raspberrypi/data>`__
`Examples <https://git.libcamera.org/libcamera/libcamera.git/tree/src/ipa/rpi/vc4/data>`__

IPA module
~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ with dedicated pipeline handlers:

- Intel IPU3 (ipu3)
- Rockchip RK3399 (rkisp1)
- RaspberryPi 3 and 4 (raspberrypi)
- RaspberryPi 3 and 4 (rpi/vc4)

Furthermore, generic platform support is provided for the following:

Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides/pipeline-handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ to the libcamera build options in the top level ``meson_options.txt``.
option('pipelines',
type : 'array',
choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'vivid'],
choices : ['ipu3', 'rkisp1', 'rpi/vc4', 'simple', 'uvcvideo', 'vimc', 'vivid'],
description : 'Select which pipeline handlers to include')
Expand Down
2 changes: 1 addition & 1 deletion include/libcamera/ipa/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
pipeline_ipa_mojom_mapping = {
'ipu3': 'ipu3.mojom',
'rkisp1': 'rkisp1.mojom',
'raspberrypi': 'raspberrypi.mojom',
'rpi/vc4': 'raspberrypi.mojom',
'vimc': 'vimc.mojom',
}

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ arch_x86 = ['x86', 'x86_64']
pipelines_support = {
'imx8-isi': arch_arm,
'ipu3': arch_x86,
'raspberrypi': arch_arm,
'rkisp1': arch_arm,
'rpi/vc4': arch_arm,
'simple': arch_arm,
'uvcvideo': ['any'],
'vimc': ['test'],
Expand Down
4 changes: 2 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ option('gstreamer',

option('ipas',
type : 'array',
choices : ['ipu3', 'raspberrypi', 'rkisp1', 'vimc'],
choices : ['ipu3', 'rkisp1', 'rpi/vc4', 'vimc'],
description : 'Select which IPA modules to build')

option('lc-compliance',
Expand All @@ -43,8 +43,8 @@ option('pipelines',
'auto',
'imx8-isi',
'ipu3',
'raspberrypi',
'rkisp1',
'rpi/vc4',
'simple',
'uvcvideo',
'vimc'
Expand Down
68 changes: 0 additions & 68 deletions src/ipa/raspberrypi/meson.build

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <libcamera/base/span.h>
#include <libcamera/base/utils.h>

#include "camera_mode.h"
#include "controller/camera_mode.h"
#include "controller/controller.h"
#include "controller/metadata.h"
#include "md_parser.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions src/ipa/rpi/cam_helper/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-License-Identifier: CC0-1.0

rpi_ipa_cam_helper_sources = files([
'cam_helper.cpp',
'cam_helper_ov5647.cpp',
'cam_helper_imx219.cpp',
'cam_helper_imx290.cpp',
'cam_helper_imx296.cpp',
'cam_helper_imx477.cpp',
'cam_helper_imx519.cpp',
'cam_helper_imx708.cpp',
'cam_helper_ov9281.cpp',
'md_parser_smia.cpp',
])

rpi_ipa_cam_helper_includes = [
include_directories('..'),
]

rpi_ipa_cam_helper_deps = [
libcamera_private,
]

rpi_ipa_cam_helper_lib = static_library('rpi_ipa_cam_helper', rpi_ipa_cam_helper_sources,
include_directories : rpi_ipa_cam_helper_includes,
dependencies : rpi_ipa_cam_helper_deps)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions src/ipa/rpi/controller/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: CC0-1.0

rpi_ipa_controller_sources = files([
'algorithm.cpp',
'controller.cpp',
'device_status.cpp',
'histogram.cpp',
'pwl.cpp',
'rpi/af.cpp',
'rpi/agc.cpp',
'rpi/alsc.cpp',
'rpi/awb.cpp',
'rpi/black_level.cpp',
'rpi/ccm.cpp',
'rpi/contrast.cpp',
'rpi/dpc.cpp',
'rpi/geq.cpp',
'rpi/lux.cpp',
'rpi/noise.cpp',
'rpi/sdn.cpp',
'rpi/sharpen.cpp',
])

rpi_ipa_controller_deps = [
libcamera_private,
]

rpi_ipa_controller_lib = static_library('rpi_ipa_controller', rpi_ipa_controller_sources,
dependencies : rpi_ipa_controller_deps)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions src/ipa/rpi/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: CC0-1.0

subdir('cam_helper')
subdir('controller')

foreach pipeline : pipelines
pipeline = pipeline.split('/')
if pipeline.length() < 2 or pipeline[0] != 'rpi'
continue
endif

subdir(pipeline[1])
endforeach
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ conf_files = files([
])

install_data(conf_files,
install_dir : ipa_data_dir / 'raspberrypi')
install_dir : ipa_data_dir / 'rpi' / 'vc4')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions src/ipa/rpi/vc4/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: CC0-1.0

ipa_name = 'ipa_rpi_vc4'

vc4_ipa_deps = [
libcamera_private,
libatomic,
]

vc4_ipa_libs = [
rpi_ipa_cam_helper_lib,
rpi_ipa_controller_lib
]

vc4_ipa_includes = [
ipa_includes,
libipa_includes,
]

vc4_ipa_sources = files([
'raspberrypi.cpp',
])

vc4_ipa_includes += include_directories('..')

mod = shared_module(ipa_name,
[vc4_ipa_sources, libcamera_generated_ipa_headers],
name_prefix : '',
include_directories : vc4_ipa_includes,
dependencies : vc4_ipa_deps,
link_with : libipa,
link_whole : vc4_ipa_libs,
install : true,
install_dir : ipa_install_dir)

if ipa_sign_module
custom_target(ipa_name + '.so.sign',
input : mod,
output : ipa_name + '.so.sign',
command : [ipa_sign, ipa_priv_key, '@INPUT@', '@OUTPUT@'],
install : false,
build_by_default : true)
endif

subdir('data')

ipa_names += ipa_name
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@

#include "libcamera/internal/mapped_framebuffer.h"

#include "af_algorithm.h"
#include "af_status.h"
#include "agc_algorithm.h"
#include "agc_status.h"
#include "alsc_status.h"
#include "awb_algorithm.h"
#include "awb_status.h"
#include "black_level_status.h"
#include "cam_helper.h"
#include "ccm_algorithm.h"
#include "ccm_status.h"
#include "contrast_algorithm.h"
#include "contrast_status.h"
#include "controller.h"
#include "denoise_algorithm.h"
#include "denoise_status.h"
#include "dpc_status.h"
#include "geq_status.h"
#include "lux_status.h"
#include "metadata.h"
#include "sharpen_algorithm.h"
#include "sharpen_status.h"
#include "statistics.h"
#include "cam_helper/cam_helper.h"
#include "controller/af_algorithm.h"
#include "controller/af_status.h"
#include "controller/agc_algorithm.h"
#include "controller/agc_status.h"
#include "controller/alsc_status.h"
#include "controller/awb_algorithm.h"
#include "controller/awb_status.h"
#include "controller/black_level_status.h"
#include "controller/ccm_algorithm.h"
#include "controller/ccm_status.h"
#include "controller/contrast_algorithm.h"
#include "controller/contrast_status.h"
#include "controller/controller.h"
#include "controller/denoise_algorithm.h"
#include "controller/denoise_status.h"
#include "controller/dpc_status.h"
#include "controller/geq_status.h"
#include "controller/lux_status.h"
#include "controller/metadata.h"
#include "controller/sharpen_algorithm.h"
#include "controller/sharpen_status.h"
#include "controller/statistics.h"

namespace libcamera {

Expand Down Expand Up @@ -1840,7 +1840,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION,
1,
"PipelineHandlerRPi",
"raspberrypi",
"rpi/vc4",
};

IPAInterface *ipaCreate()
Expand Down
6 changes: 6 additions & 0 deletions src/libcamera/pipeline/rpi/common/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: CC0-1.0

libcamera_sources += files([
'delayed_controls.cpp',
'rpi_stream.cpp',
])
12 changes: 12 additions & 0 deletions src/libcamera/pipeline/rpi/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: CC0-1.0

subdir('common')

foreach pipeline : pipelines
pipeline = pipeline.split('/')
if pipeline.length() < 2 or pipeline[0] != 'rpi'
continue
endif

subdir(pipeline[1])
endforeach
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ conf_files = files([
])

install_data(conf_files,
install_dir : pipeline_data_dir / 'raspberrypi')
install_dir : pipeline_data_dir / 'rpi' / 'vc4')
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# SPDX-License-Identifier: CC0-1.0

libcamera_sources += files([
'delayed_controls.cpp',
'dma_heaps.cpp',
'raspberrypi.cpp',
'rpi_stream.cpp',
])

subdir('data')
Loading

0 comments on commit 726e927

Please sign in to comment.