-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Developer's guide
Some useful ressources to jump into digital color management, editing pipeline, calibrations, view transform, etc. :
- https://www.visualeffectssociety.com/sites/default/files/files/cinematic_color_ves.pdf
- https://acescentral.com/
- http://last.hit.bme.hu/download/firtha/video/Colorimetry/Fairchild_M._Color_appearance_models__2005.pdf
Pixels are essentially 4D RGBA vectors. Since 2004, processors have got special abilities to process vectors and apply Single Instructions on Multiple Data (SIMD). This allows to speed-up the computations by processing 1 pixel (SSE2) to 4 pixels (AVX-512) at the same time, saving a lot of CPU cycles.
darktable has 3 version of its IOPs : pure C (scalar), SSE2 (vectorized for 4 floats) and OpenCL (vectorized on GPU). That triggers some redundancy in the code. However, modern compilers and the OpenMP library have auto-vectorization options that could optimize pure C, provided the code is written in a vectorizable way and uses some pragmas to give hints to the compiler.
Write vectorizable code : https://info.ornl.gov/sites/publications/files/Pub69214.pdf
Modules are the interfaces for IOPs, i.e. image-processing filters stacked in the pixelpipe. IOPs can be found in src/iop and the IOP API can be found in the header src/iop/iop_api.h.
Most IOP have 3 variant of their pixel-filtering part:
- a pure C implementation, in
process()
- a C optimized version, with SSE2 intrinsics, in
process_sse2()
- an OpenCL version, offloading the computation to the GPU, in
process_opencl()
.
An example of a dummy IOP can be found in src/iop/useless.c and used as a boilerplate.
If you add a new IOP, be sure to add the C file in src/iop/CMakeLists.txt#L69 and deal with its priority in the pixelpipe by adding a new node in tools/iop_dependencies.py
darktable wiki is licensed under the Creative Commons BY-SA 4.0 terms.