Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
inpaint.c
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010 Bruce Guenter.
4 Copyright (C) 2010-2011 Henrik Andersson.
5 Copyright (C) 2010-2014, 2016 johannes hanika.
6 Copyright (C) 2010 Stuart Henderson.
7 Copyright (C) 2011 Antony Dovgal.
8 Copyright (C) 2011 Robert Bieber.
9 Copyright (C) 2011-2014, 2016, 2019 Tobias Ellinghaus.
10 Copyright (C) 2011-2012, 2014, 2016-2017 Ulrich Pegelow.
11 Copyright (C) 2012, 2015 Edouard Gomez.
12 Copyright (C) 2012 Jérémy Rosen.
13 Copyright (C) 2012 Richard Wonka.
14 Copyright (C) 2013, 2020 Aldric Renaudin.
15 Copyright (C) 2014, 2016 Dan Torop.
16 Copyright (C) 2014-2016 Roman Lebedev.
17 Copyright (C) 2015-2016 Pedro Côrte-Real.
18 Copyright (C) 2017 Heiko Bauke.
19 Copyright (C) 2017 luzpaz.
20 Copyright (C) 2018, 2020-2026 Aurélien PIERRE.
21 Copyright (C) 2018 Edgardo Hoszowski.
22 Copyright (C) 2018 Maurizio Paglia.
23 Copyright (C) 2018-2020, 2022 Pascal Obry.
24 Copyright (C) 2018 rawfiner.
25 Copyright (C) 2019 Andreas Schneider.
26 Copyright (C) 2019 Diederik ter Rahe.
27 Copyright (C) 2019-2020, 2022 Hanno Schwalm.
28 Copyright (C) 2020 Chris Elston.
29 Copyright (C) 2020, 2022 Diederik Ter Rahe.
30 Copyright (C) 2020-2021 Ralf Brown.
31 Copyright (C) 2021 Hubert Kowalski.
32 Copyright (C) 2022 Martin Bařinka.
33 Copyright (C) 2022 Philipp Lutz.
34 Copyright (C) 2022 Victor Forsiuk.
35 Copyright (C) 2023 Alynx Zhou.
36 Copyright (C) 2023 Guillaume Stutin.
37 Copyright (C) 2023 Luca Zulberti.
38
39 darktable is free software: you can redistribute it and/or modify
40 it under the terms of the GNU General Public License as published by
41 the Free Software Foundation, either version 3 of the License, or
42 (at your option) any later version.
43
44 darktable is distributed in the hope that it will be useful,
45 but WITHOUT ANY WARRANTY; without even the implied warranty of
46 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 GNU General Public License for more details.
48
49 You should have received a copy of the GNU General Public License
50 along with darktable. If not, see <http://www.gnu.org/licenses/>.
51 */
52
53// Colour-inpainting highlight reconstruction (a1ex's magiclantern idea). (implementation; see inpaint.h
54// for the public API.) The per-line colour interpolators live in the LCh TU (interpolate_color /
55// interpolate_color_xtrans, lch.h); this TU only drives them along the four axis directions.
56
57#include "system/openmp.h"
61#include "iop/highlights/lch.h"
62
64void process_inpaint_bayer(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out,
65 const float clips[4], const uint32_t filters)
66{
67 // left/right directions
69 for(int j = 0; j < roi_out->height; j++)
70 {
71 interpolate_color(ivoid, ovoid, roi_out, 0, 1, j, clips, filters, 0);
72 interpolate_color(ivoid, ovoid, roi_out, 0, -1, j, clips, filters, 1);
73 }
74
75 // up/down directions
77 for(int i = 0; i < roi_out->width; i++)
78 {
79 interpolate_color(ivoid, ovoid, roi_out, 1, 1, i, clips, filters, 2);
80 interpolate_color(ivoid, ovoid, roi_out, 1, -1, i, clips, filters, 3);
81 }
82}
83
85void process_inpaint_xtrans(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in,
86 const dt_iop_roi_t *const roi_out, const float clips[4],
87 const uint8_t (*const xtrans)[6])
88{
89 // left/right directions
91 for(int j = 0; j < roi_out->height; j++)
92 {
93 interpolate_color_xtrans(ivoid, ovoid, roi_in, roi_out, 0, 1, j, clips, xtrans, 0);
94 interpolate_color_xtrans(ivoid, ovoid, roi_in, roi_out, 0, -1, j, clips, xtrans, 1);
95 }
96
97 // up/down directions
99 for(int i = 0; i < roi_out->width; i++)
100 {
101 interpolate_color_xtrans(ivoid, ovoid, roi_in, roi_out, 1, 1, i, clips, xtrans, 2);
102 interpolate_color_xtrans(ivoid, ovoid, roi_in, roi_out, 1, -1, i, clips, xtrans, 3);
103 }
104}
void *const ovoid
__DT_CLONE_TARGETS__ void process_inpaint_bayer(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out, const float clips[4], const uint32_t filters)
Definition inpaint.c:64
__DT_CLONE_TARGETS__ void process_inpaint_xtrans(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, const float clips[4], const uint8_t(*const xtrans)[6])
Definition inpaint.c:85
void interpolate_color(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_out, int dim, int dir, int other, const float *clip, const uint32_t filters, const int pass)
Definition lch.c:206
void interpolate_color_xtrans(const void *const ivoid, void *const ovoid, const dt_iop_roi_t *const roi_in, const dt_iop_roi_t *const roi_out, int dim, int dir, int other, const float *const clip, const uint8_t(*const xtrans)[6], const int pass)
Definition lch.c:90
#define __OMP_PARALLEL_FOR__(...)
Definition openmp.h:60
Region of interest passed through the pixelpipe.
Definition format.h:49
int width
Definition format.h:50
int height
Definition format.h:50
#define __DT_CLONE_TARGETS__