Debian Codegraph @

src/filter/lightgraffiti/lightgraffiti.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2010-2011 Simon Andreas Eugster ([email protected])
3 * This file is a Frei0r plugin.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 /**
21 LIGHT GRAFFITI / LIGHT PAINTING / LUMASOL
22
23
24 This effect is intended to simulate what happens when you use a shutter speed of
25 e.g. 10 seconds for your camera and paint with light, like lamps, in the air
26 -- just with video. It tries to remember bright spots and keeps them in a mask.
27 Areas that are not very bright (i.e. background) will not sum up.
28
29 Originally I saw this effect in some Ford Kuga commercials on YouTube when a friend
30 shew me those. One of them was [1]. No information about how this effect works is given
31 -- only that a guy from the Dutch PIPS:LAB[2] was involved. The technique seems to be
32 slightly different though; whileas this frei0r effect works in post, the original Lumasol
33 effect is said to work directly in-camera.
34
35 Since the technique is fascinating I started writing this Open-Source effect.[3] The general
36 concept is:
37 1. Extract the light by using thresholding (absolute brightness and brightness change relative to
38 the background image fetched from the first frame)
39 2. Store the color in a light mask, and the estimated density in an alpha map (increased every time
40 that a light source hits a pixel to simulate overexposure)
41 3. Paint the light mask over the video image
42 4. Dim the alpha map, and update the background image (moving average), if desired.
43 5. Repeat for the next frame.
44
45 The second approach (LG_ADV) is based on the observation that colour mixing does not work well
46 with the above one that stores colour values and changes the brightness via an alpha map. Therefore
47 the new approach directly sums up colour values detected in the light source and does not use an
48 alpha map.
49 * Transitions are not very smooth out-of-the-box. This is solved by multiplying the light source's
50 RGB value by (r+g+b)/3 (after normalizing them to [0,1]); Darker lights will then be even darker
51 and the transition to the background looks smoother.
52 * Lights may look a little faint regarding color. Therefore the saturation can be increased by a custom
53 factor. Saturation depends on the brightness of the light map; the darker the light is, the more
54 the saturation is increased. This will, within a sensible range, make the lights look more vital.
55 Dimming works by scaling each color values individually.
56
57 If you write your own Light Graffiti effect (e.g. for After Effects) I'd very much appreciate
58 to hear about it!
59
60 -- Simon (Granjow)
61
62 [1] http://www.youtube.com/watch?v=WVaxuIKPKvU
63 [2] http://www.pipslab.org/bio/keez-duyves/
64 [3] http://kdenlive.org/users/granjow/writing-light-graffiti-effect
65
66 */
67
68 #if defined(_MSC_VER)
69 #define _USE_MATH_DEFINES
70 #endif /* _MSC_VER */
71 #include <cmath>
72
73 #include "frei0r.hpp"cxx . . $ `<file>/include/frei0r.hpp`/
74
75
76 #include <cstdio>
77 #include <climits>
78 #include <algorithm>
79
80 #define LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
81 //#define LG_NO_OVERLAY // Not really working yet
82 //#define LG_DEBUG
83
84 // Macros to extract color components
85 #define GETAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:85:9`!(abgr) (((abgr) >> (3*CHAR_BIT)) & 0xFF)
86 #define GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(abgr) (((abgr) >> (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)
87 #define GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(abgr) (((abgr) >> (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)
88 #define GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(abgr) (((abgr) >> (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)
89
90 // Macro to assemble a color in RGBA8888 format
91 #define RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,a) ( ((r) << (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) | ((g) << (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) | ((b) << (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) | ((a) << (3*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) )
92 // Component-wise maximum
93 #define MAXcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:93:9`!(a,b) ( (((((a) >> (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF) > (((b) >> (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)) ? ((a) & (0xFF << (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!))) : ((b) & (0xFF << (0*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)))) \
94 | (((((a) >> (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF) > (((b) >> (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)) ? ((a) & (0xFF << (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!))) : ((b) & (0xFF << (1*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)))) \
95 | (((((a) >> (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF) > (((b) >> (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)) ? ((a) & (0xFF << (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!))) : ((b) & (0xFF << (2*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)))) \
96 | (((((a) >> (3*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF) > (((b) >> (3*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)) & 0xFF)) ? ((a) & (0xFF << (3*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!))) : ((b) & (0xFF << (3*CHAR_BITcxx . . $ `<external>/2419331716647297546/limits.h:64:9`!)))) )
97
98 #define CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(a) (((a) < 0) ? 0 : (((a) > 255) ? 255 : (a)))
99
100 #define ALPHAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:100:9`!(mask,img) \
101 ( ( ((uint32_t) ( ((((mask) >> (0*CHAR_BIT)) & 0xFF)/255.0) * ( ((mask) >> (0*CHAR_BIT)) & 0xFF) \
102 + (1 - (( ((mask) >> (0*CHAR_BIT)) & 0xFF)/255.0)) * ( ((img) >> (0*CHAR_BIT)) & 0xFF) )) << (0*CHAR_BIT)) \
103 | ( ((uint32_t) ( ((((mask) >> (1*CHAR_BIT)) & 0xFF)/255.0) * ( ((mask) >> (1*CHAR_BIT)) & 0xFF) \
104 + (1 - (( ((mask) >> (1*CHAR_BIT)) & 0xFF)/255.0)) * ( ((img) >> (1*CHAR_BIT)) & 0xFF) )) << (1*CHAR_BIT)) \
105 | ( ((uint32_t) ( ((((mask) >> (2*CHAR_BIT)) & 0xFF)/255.0) * ( ((mask) >> (2*CHAR_BIT)) & 0xFF) \
106 + (1 - (( ((mask) >> (2*CHAR_BIT)) & 0xFF)/255.0)) * ( ((img) >> (2*CHAR_BIT)) & 0xFF) )) << (2*CHAR_BIT)) \
107 | ( ((uint32_t) ( ((((mask) >> (3*CHAR_BIT)) & 0xFF)/255.0) * ( ((mask) >> (3*CHAR_BIT)) & 0xFF) \
108 + (1 - (( ((mask) >> (3*CHAR_BIT)) & 0xFF)/255.0)) * ( ((img) >> (3*CHAR_BIT)) & 0xFF) )) << (3*CHAR_BIT)) )
109
110 // Screen layer mode
111 #define SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(mask,img) ((uint8_t) (255-(255.0-(mask))*(255.0-(img))/255.0))
112
113 // Luma calculation. Refer to the SOP/Sat filter.
114 #define REC709Ycxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:114:9`!(r,g,b) (.2126*(r) + .7152*(g) + .0722*(b))
115
116 struct RGBFloatcxx . . $ RGBFloat# {
117 float rcxx . . $ RGBFloat#r.;
118 float gcxx . . $ RGBFloat#g.;
119 float bcxx . . $ RGBFloat#b.;
120 };
121
122 class LightGraffiticxx . . $ LightGraffiti# : public frei0rcxx . . $ frei0r/::filtercxx . . $ frei0r/filter#
123 {
124
125 public:
126
127 LightGraffiticxx . . $ LightGraffiti#LightGraffiti(b4d55b1286ff73e8).(unsigned int width, unsigned int height) :
128 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.(width*height, 0),
129 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.(4*width*height, 0),
130 m_meanInitializedcxx . . $ LightGraffiti#m_meanInitialized.(false)
131
132 {
133 m_modecxx . . $ LightGraffiti#m_mode. = Graffiti_LongAvgAlphaCumCcxx . . $ LightGraffiti#Graffiti_LongAvgAlphaCumC.;
134 m_dimModecxx . . $ LightGraffiti#m_dimMode. = Dim_Multcxx . . $ LightGraffiti#Dim_Mult.;
135
136 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
137 RGBFloatcxx . . $ RGBFloat# rgb0;
138 rgb0.rcxx . . $ RGBFloat#r. = 0;
139 rgb0.gcxx . . $ RGBFloat#g. = 0;
140 rgb0.bcxx . . $ RGBFloat#b. = 0;
141 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask. =cxx . . $ std/vector#`operator=`(27b3db0518c64371). stdcxx . . $ std/vector#vector(229e4d6bd205de31).::vectorcxx . . $ std/vector#<RGBFloatcxx . . $ RGBFloat#>(width*height, rgb0);
142
143 #ifdef LG_DEBUG
144 for (int i = 0; i < width*height; i++) {
145 if (m_rgbLightMask[i].r != 0 || m_rgbLightMask[i].g != 0 || m_rgbLightMask[i].b != 0) {
146 std::cout << "ERROR: " << m_rgbLightMask[i].r;
147 }
148 }
149 #endif
150 #endif
151
152 #ifdef LG_NO_OVERLAY
153 m_prevMask = std::vector<RGBFloat>(width*height, rgb0);
154 #endif
155
156 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pSensitivitycxx . . $ LightGraffiti#m_pSensitivity., "sensitivity"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Sensitivity of the effect for light (higher sensitivity will lead to brighter lights)"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
157 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pBackgroundWeightcxx . . $ LightGraffiti#m_pBackgroundWeight., "backgroundWeight"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Describes how strong the (accumulated) background should shine through"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
158 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pThresholdBrightnesscxx . . $ LightGraffiti#m_pThresholdBrightness., "thresholdBrightness"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Brightness threshold to distinguish between foreground and background"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
159 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pThresholdDifferencecxx . . $ LightGraffiti#m_pThresholdDifference., "thresholdDifference"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Threshold: Difference to background to distinguish between fore- and background"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
160 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pThresholdDiffSumcxx . . $ LightGraffiti#m_pThresholdDiffSum., "thresholdDiffSum"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Threshold for sum of differences. Can in most cases be ignored (set to 0)."cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
161 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pDimcxx . . $ LightGraffiti#m_pDim., "dim"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Dimming of the light mask"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
162 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pSaturationcxx . . $ LightGraffiti#m_pSaturation., "saturation"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Saturation of lights"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
163 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pLowerOverexposurecxx . . $ LightGraffiti#m_pLowerOverexposure., "lowerOverexposure"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Prevents some overexposure if the light source stays steady too long (varying speed)"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
164 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness., "statsBrightness"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Display the brightness and threshold, for adjusting the brightness threshold parameter"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
165 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff., "statsDifference"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Display the background difference and threshold"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
166 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pStatsDiffSumcxx . . $ LightGraffiti#m_pStatsDiffSum., "statsDiffSum"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Display the sum of the background difference and the threshold"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
167 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pResetcxx . . $ LightGraffiti#m_pReset., "reset"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Reset filter masks"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
168 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pTransparentBackgroundcxx . . $ LightGraffiti#m_pTransparentBackground., "transparentBackground"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Make the background transparent"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
169 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pBlackReferencecxx . . $ LightGraffiti#m_pBlackReference., "blackReference"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Uses black as background image instead of the first frame."cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
170 register_paramcxx . . $ frei0r/fx#register_param(acfd1d4411be0164).(m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha., "longAlpha"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Alpha value for moving average"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
171 register_paramcxx . . $ frei0r/fx#register_param(f12007cc47cdd2c7).(m_pNonlinearDimcxx . . $ LightGraffiti#m_pNonlinearDim., "nonlinearDim"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., "Nonlinear dimming (may look more natural)"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
172 m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. = 1/128.0;
173 m_pSensitivitycxx . . $ LightGraffiti#m_pSensitivity. = 1 / 5.;
174 m_pBackgroundWeightcxx . . $ LightGraffiti#m_pBackgroundWeight. = 0;
175 m_pThresholdBrightnesscxx . . $ LightGraffiti#m_pThresholdBrightness. = 450 / 765.;
176 m_pThresholdDifferencecxx . . $ LightGraffiti#m_pThresholdDifference. = 0;
177 m_pThresholdDiffSumcxx . . $ LightGraffiti#m_pThresholdDiffSum. = 0;
178 m_pDimcxx . . $ LightGraffiti#m_pDim. = 0;
179 m_pSaturationcxx . . $ LightGraffiti#m_pSaturation. = 1 / 4.;
180 m_pLowerOverexposurecxx . . $ LightGraffiti#m_pLowerOverexposure. = 0;
181 m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness. = false;
182 m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff. = false;
183 m_pStatsDiffSumcxx . . $ LightGraffiti#m_pStatsDiffSum. = false;
184 m_pResetcxx . . $ LightGraffiti#m_pReset. = false;
185 m_pTransparentBackgroundcxx . . $ LightGraffiti#m_pTransparentBackground. = false;
186 m_pBlackReferencecxx . . $ LightGraffiti#m_pBlackReference. = false;
187 m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. = 0;
188 m_pNonlinearDimcxx . . $ LightGraffiti#m_pNonlinearDim. = 0;
189
190 }
191
192 ~cxx . . $ LightGraffiti#`~LightGraffiti`(49f6e7a06ebc5aa8).LightGraffiticxx . . $ LightGraffiti#()
193 {
194 // I was told that a std::vector does not need to be deleted --
195 // therefore nothing to do here!
196 }
197
198 enum GraffitiModecxx . . $ LightGraffiti#GraffitiMode# { Graffiti_maxcxx . . $ LightGraffiti#Graffiti_max., Graffiti_max_sumcxx . . $ LightGraffiti#Graffiti_max_sum., Graffiti_Ycxx . . $ LightGraffiti#Graffiti_Y., Graffiti_Avgcxx . . $ LightGraffiti#Graffiti_Avg., Graffiti_Avg2cxx . . $ LightGraffiti#Graffiti_Avg2.,
199 Graffiti_Avg_Statcxx . . $ LightGraffiti#Graffiti_Avg_Stat., Graffiti_AvgTresh_Statcxx . . $ LightGraffiti#Graffiti_AvgTresh_Stat., Graffiti_Max_Statcxx . . $ LightGraffiti#Graffiti_Max_Stat., Graffiti_Y_Statcxx . . $ LightGraffiti#Graffiti_Y_Stat., Graffiti_S_Statcxx . . $ LightGraffiti#Graffiti_S_Stat.,
200 Graffiti_STresh_Statcxx . . $ LightGraffiti#Graffiti_STresh_Stat., Graffiti_SDiff_Statcxx . . $ LightGraffiti#Graffiti_SDiff_Stat., Graffiti_SDiffTresh_Statcxx . . $ LightGraffiti#Graffiti_SDiffTresh_Stat.,
201 Graffiti_SSqrt_Statcxx . . $ LightGraffiti#Graffiti_SSqrt_Stat.,
202 Graffiti_LongAvgcxx . . $ LightGraffiti#Graffiti_LongAvg., Graffiti_LongAvg_Statcxx . . $ LightGraffiti#Graffiti_LongAvg_Stat., Graffiti_LongAvgAlphacxx . . $ LightGraffiti#Graffiti_LongAvgAlpha., Graffiti_LongAvgAlpha_Statcxx . . $ LightGraffiti#Graffiti_LongAvgAlpha_Stat.,
203 Graffiti_LongAvgAlphaCumCcxx . . $ LightGraffiti#Graffiti_LongAvgAlphaCumC. };
204 enum DimModecxx . . $ LightGraffiti#DimMode# { Dim_Multcxx . . $ LightGraffiti#Dim_Mult., Dim_Sincxx . . $ LightGraffiti#Dim_Sin. };
205
206
207
208
209
210 virtual void updatecxx . . $ LightGraffiti#update(da7b4a17ceb4e697).(double time,
211 uint32_t* out,
212 const uint32_t* in)
213 {
214 double sensitivity = m_pSensitivitycxx . . $ LightGraffiti#m_pSensitivity. * 5;
215 double thresholdBrightness = m_pThresholdBrightnesscxx . . $ LightGraffiti#m_pThresholdBrightness. * 765;
216 double thresholdDifference = m_pThresholdDifferencecxx . . $ LightGraffiti#m_pThresholdDifference. * 255;
217 double thresholdDiffSum = m_pThresholdDiffSumcxx . . $ LightGraffiti#m_pThresholdDiffSum. * 765;
218 double saturation = m_pSaturationcxx . . $ LightGraffiti#m_pSaturation. * 4;
219 double lowerOverexposure = m_pLowerOverexposurecxx . . $ LightGraffiti#m_pLowerOverexposure. * 10;
220
221 // Copy everything to the output image.
222 // Most of the image will very likely not change at all.
223 stdcxx . . $ std/::copycxx . . $ std/copy(88304b602929f6f4).(in, in + widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height., out);
224
225 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
226 RGBFloatcxx . . $ RGBFloat# rgb0;
227 rgb0.rcxx . . $ RGBFloat#r. = 0;
228 rgb0.gcxx . . $ RGBFloat#g. = 0;
229 rgb0.bcxx . . $ RGBFloat#b. = 0;
230 #endif
231
232 if (m_pNonlinearDimcxx . . $ LightGraffiti#m_pNonlinearDim.) {
233 m_dimModecxx . . $ LightGraffiti#m_dimMode. = Dim_Sincxx . . $ LightGraffiti#Dim_Sin.;
234 } else {
235 m_dimModecxx . . $ LightGraffiti#m_dimMode. = Dim_Multcxx . . $ LightGraffiti#Dim_Mult.;
236 }
237
238
239 /*
240 Refresh the background image
241 */
242 if (!m_meanInitializedcxx . . $ LightGraffiti#m_meanInitialized. || m_pResetcxx . . $ LightGraffiti#m_pReset.) {
243 if (m_pBlackReferencecxx . . $ LightGraffiti#m_pBlackReference.) {
244 // Do not use the first frame from the movie as background image but plain black
245 // to calculate the added light. Useful e.g. when dealing with still images.
246 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage. =cxx . . $ std/vector#`operator=`(27b3db0518c64371). stdcxx . . $ std/vector#vector(229e4d6bd205de31).::vectorcxx . . $ std/vector#<float>(widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.*3, 0);
247 } else {
248 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage. =cxx . . $ std/vector#`operator=`(27b3db0518c64371). stdcxx . . $ std/::vectorcxx . . $ std/vector#<float>(widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.*3);
249 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
250 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0] = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(in[pixel]);
251 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(in[pixel]);
252 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(in[pixel]);
253 }
254 }
255 m_meanInitializedcxx . . $ LightGraffiti#m_meanInitialized. = true;
256 } else {
257 // Calculate the mean image to estimate the background. If alpha is set > 0, bright light sources
258 // moving into the image and standing still will eventually be treated as background.
259 if (m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. > 0) {
260 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
261 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0] = (1-m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha.) * m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0] + m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. * GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(in[pixel]);
262 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] = (1-m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha.) * m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] + m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. * GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(in[pixel]);
263 m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] = (1-m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha.) * m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] + m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha. * GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(in[pixel]);
264 }
265 }
266 }
267
268
269 /*
270 Light mask dimming
271 */
272 if (m_pDimcxx . . $ LightGraffiti#m_pDim. > 0) {
273 // Dims the light mask. Lights will leave fainting trails.
274
275 float factor = 1-m_pDimcxx . . $ LightGraffiti#m_pDim.;
276
277 /* Gnu Octave:
278 range=linspace(0,1,100);
279 % Sin
280 plot(range,sin(range*pi/2).^.5)
281 plot(range,sin(range*pi/2).^.25)
282 */
283
284 switch (m_dimModecxx . . $ LightGraffiti#m_dimMode.) {
285
286 case Dim_Multcxx . . $ LightGraffiti#Dim_Mult.:
287 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
288 for (size_t i = 0; i < m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) {
289 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. *= factor;
290 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. *= factor;
291 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. *= factor;
292 }
293 #else
294 for (unsigned int i = 0; i < width*height; i++) {
295 m_alphaMap[4*i + 0] *= factor;
296 m_alphaMap[4*i + 1] *= factor;
297 m_alphaMap[4*i + 2] *= factor;
298 m_alphaMap[4*i + 3] *= factor;
299 }
300 #endif
301 break;
302
303
304 case Dim_Sincxx . . $ LightGraffiti#Dim_Sin.:
305 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
306 for (size_t i = 0; i < m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask..sizecxx . . $ std/vector#size(fe4d2d262d4164a8).(); i++) {
307 // Red
308 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. < 1) {
309 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. *= pow(sin(m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1289:10`!/2), m_pDimcxx . . $ LightGraffiti#m_pDim.) - .01;
310 } else {
311 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. *= factor;
312 }
313 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. < 0) { m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].rcxx . . $ RGBFloat#r. = 0; }
314
315 // Green
316 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. < 1) {
317 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. *= pow(sin(m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1289:10`!/2), m_pDimcxx . . $ LightGraffiti#m_pDim.) - .01;
318 } else {
319 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. *= factor;
320 }
321 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. < 0) { m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].gcxx . . $ RGBFloat#g. = 0; }
322
323 // Blue
324 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. < 1) {
325 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. *= pow(sin(m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. * M_PIcxx . . $ `<external>/11263917310783833665/math.h:1289:10`!/2), m_pDimcxx . . $ LightGraffiti#m_pDim.) - .01;
326 } else {
327 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. *= factor;
328 }
329 if (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. < 0) { m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).i].bcxx . . $ RGBFloat#b. = 0; }
330 }
331 #else
332 // Attention: Since Graffiti_LongAvgAlphaCumC only makes use of the first alpha channel
333 // the other channels are not calculated here due to efficiency reasons.
334 // May have to be adjusted if required.
335 for (int i = 0; i < width*height; i++) {
336 if (m_alphaMap[4*i + 0] < 1) {
337 m_alphaMap[4*i + 0] *= pow(sin(m_alphaMap[4*i + 0] * M_PI/2), m_pDim) - .01;
338 } else {
339 m_alphaMap[4*i + 0] *= factor;
340 }
341 if (m_alphaMap[4*i + 0] < 0) { m_alphaMap[4*i + 0] = 0; }
342 }
343 #endif
344 break;
345 }
346
347 }
348
349
350
351 /*
352 Reset all masks if desired
353 (mainly for parameter adjustments when working in the NLE)
354 */
355 if (m_pResetcxx . . $ LightGraffiti#m_pReset.) {
356 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
357 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask. =cxx . . $ std/vector#`operator=`(27b3db0518c64371). stdcxx . . $ std/vector#vector(229e4d6bd205de31).::vectorcxx . . $ std/vector#<RGBFloatcxx . . $ RGBFloat#>(widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height., rgb0);
358 #else
359 std::fill(&m_lightMask[0], &m_lightMask[width*height - 1], 0);
360 std::fill(&m_alphaMap[0], &m_alphaMap[width*height*4 - 1], 0);
361 #endif
362 // m_longMeanImage has been handled above already (set to the current image).
363 }
364
365
366 int r, g, b;
367 int maxDiff, temp, sum;
368 unsigned int min;
369 unsigned int max;
370 float f;
371 float fr, fg, fb, sr, sg, sb, fy, fsat;
372
373 #ifdef LG_DEBUG
374 int deCount = 0;
375 #endif
376
377
378 switch (m_modecxx . . $ LightGraffiti#m_mode.) {
379 /*
380 Lots of testing modes here!
381 */
382 case Graffiti_maxcxx . . $ LightGraffiti#Graffiti_max.:
383 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
384
385 if (
386 (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) == 0xFF
387 || GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) == 0xFF
388 || GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) == 0xFF)
389 ){
390 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] |= out[pixel];
391 }
392 if (m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] != 0) {
393 out[pixel] = m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel];
394 }
395 }
396 break;
397 case Graffiti_max_sumcxx . . $ LightGraffiti#Graffiti_max_sum.:
398 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
399
400 if (
401 (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) == 0xFF
402 || GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) == 0xFF
403 || GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) == 0xFF)
404 &&
405 (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])
406 + GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])
407 + GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])
408 > 0xFF + 0xCC + 0xCC)
409 ){
410 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] |= out[pixel];
411 }
412 if (m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] != 0) {
413 out[pixel] = m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel];
414 }
415 }
416 break;
417
418 case Graffiti_Ycxx . . $ LightGraffiti#Graffiti_Y.:
419 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
420 if (
421 .299*GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])/255.0
422 + .587 * GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])/255.0
423 + .114 * GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])/255.0
424 >= .85
425 ){
426 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] |= out[pixel];
427 }
428 if (m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] != 0) {
429 out[pixel] = m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel];
430 }
431 }
432 break;
433
434 case Graffiti_Max_Statcxx . . $ LightGraffiti#Graffiti_Max_Stat.:
435 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
436 if (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) == 0xFF || GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) == 0xFF || GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) == 0xFF) {
437 out[pixel] = 0xFFFFFFFF;
438 } else {
439 out[pixel] = 0;
440 }
441 }
442 break;
443 case Graffiti_Y_Statcxx . . $ LightGraffiti#Graffiti_Y_Stat.:
444 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
445 temp = .299*GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) + .587 * GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) + .114 * GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
446 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
447 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
448 }
449 break;
450 case Graffiti_S_Statcxx . . $ LightGraffiti#Graffiti_S_Stat.:
451 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
452 min = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
453 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
454 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) < min) min = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
455 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) > max) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
456 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) < min) min = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
457 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) > max) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
458 if (min == 0) { out[pixel] = 0; }
459 else {
460 temp = 255.0*(max-min)/(float)max;
461 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
462 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
463 }
464 }
465 break;
466 case Graffiti_STresh_Statcxx . . $ LightGraffiti#Graffiti_STresh_Stat.:
467 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
468 min = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
469 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
470 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) < min) min = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
471 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) > max) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
472 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) < min) min = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
473 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) > max) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
474 if (min == 0 || max < 0x80) { out[pixel] = 0; }
475 else {
476 temp = 255.0*((float)max-min)/max;
477 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
478 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
479 }
480 }
481 break;
482 case Graffiti_SDiff_Statcxx . . $ LightGraffiti#Graffiti_SDiff_Stat.:
483 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
484 min = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
485 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
486 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) < min) min = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
487 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) > max) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
488 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) < min) min = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
489 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) > max) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
490 int sat;
491 if (min == 0) { sat = 0; }
492 else {
493 temp = 255.0*(max-min)/(float)max;
494 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
495 sat = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
496 }
497 min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0];
498 max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0];
499 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] < min) min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1];
500 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] > max) max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1];
501 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] < min) min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2];
502 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] > max) max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2];
503 if (min == 0) { out[pixel] = 0; }
504 else {
505 temp = 255.0*(max-min)/(float)max;
506 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
507 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
508 }
509 temp = 0x7f + GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(sat);
510 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
511 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
512 }
513 break;
514 case Graffiti_SDiffTresh_Statcxx . . $ LightGraffiti#Graffiti_SDiffTresh_Stat.:
515 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
516 min = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
517 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
518 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) < min) min = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
519 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) > max) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
520 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) < min) min = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
521 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) > max) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
522 int sat;
523 if (min == 0) { sat = 0; }
524 else {
525 temp = 255.0*(max-min)/(float)max;
526 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
527 sat = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
528 }
529 if (max < 0x80) {
530 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(0,0,0,0xFF);
531 } else {
532 min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0];
533 max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0];
534 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] < min) min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1];
535 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1] > max) max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1];
536 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] < min) min = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2];
537 if (m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2] > max) max = m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2];
538 if (min == 0) { out[pixel] = 0; }
539 else {
540 temp = 255.0*(max-min)/(float)max;
541 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
542 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
543 }
544 temp = 0x7f + GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(sat);
545 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
546 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
547 }
548 }
549 break;
550 case Graffiti_SSqrt_Statcxx . . $ LightGraffiti#Graffiti_SSqrt_Stat.:
551 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
552 min = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
553 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
554 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) < min) min = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
555 if (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) > max) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
556 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) < min) min = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
557 if (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) > max) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
558 if (min == 0) { out[pixel] = 0; }
559 else {
560 temp = 255.0*(max-min)/(float)max/(256.0-max);
561 temp = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp);
562 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(temp, temp, temp, 0xFF);
563 }
564 }
565 break;
566 case Graffiti_LongAvg_Statcxx . . $ LightGraffiti#Graffiti_LongAvg_Stat.:
567 maxDiff = 0;
568 temp = 0;
569 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
570 r = 0x7f + (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0])/2;
571 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
572 g = 0x7f + (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1])/2;
573 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
574 b = 0x7f + (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2])/2;
575 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
576
577 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
578 }
579 break;
580 case Graffiti_LongAvgcxx . . $ LightGraffiti#Graffiti_LongAvg.:
581 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
582
583 r = 0x7f + (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
584 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
585 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
586 maxDiff = r;
587 temp = r;
588
589 g = 0x7f + (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
590 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
591 if (maxDiff < g) maxDiff = g;
592 if (max < GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
593 temp += g;
594
595 b = 0x7f + (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
596 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
597 if (maxDiff < b) maxDiff = b;
598 if (max < GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
599 temp += b;
600
601 if (maxDiff > 0xe0 && temp > 0xe0 + 0xd0 + 0x80) {
602 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] = MAXcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:93:9`!(m_lightMask[pixel], out[pixel]);
603
604 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0] = 2*(GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
605 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0] = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(m_alphaMap[4*pixel+0])/255.0;
606
607 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1] = 2*(GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
608 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1] = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(m_alphaMap[4*pixel+1])/255.0;
609
610 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2] = 2*(GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
611 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2] = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(m_alphaMap[4*pixel+2])/255.0;
612
613 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+3] = 1;
614 }
615
616 if (m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] != 0) {
617 r = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]), GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(m_lightMask[pixel]));
618 g = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]), GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(m_lightMask[pixel]));
619 b = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]), GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(m_lightMask[pixel]));
620 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
621 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
622 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
623 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
624 }
625 }
626 break;
627 case Graffiti_LongAvgAlpha_Statcxx . . $ LightGraffiti#Graffiti_LongAvgAlpha_Stat.:
628 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
629
630 r = 0x7f + (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
631 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
632 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
633 maxDiff = r;
634 temp = r;
635
636 g = 0x7f + (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
637 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
638 if (maxDiff < g) maxDiff = g;
639 if (max < GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
640 temp += g;
641
642 b = 0x7f + (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
643 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
644 if (maxDiff < b) maxDiff = b;
645 if (max < GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
646 temp += b;
647
648 if (maxDiff > 0xe0 && temp > 0xe0 + 0xd0 + 0x80) {
649 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] = MAXcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:93:9`!(m_lightMask[pixel], out[pixel]);
650
651 f = 2*(GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
652 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
653 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0] = f;
654
655 f = 2*(GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
656 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
657 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1] = f;
658
659 f = 2*(GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
660 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
661 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2] = f;
662
663 m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+3] = 1;
664 }
665 r = 255.0*m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0];
666 g = 255*m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1];
667 b = 255*m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2];
668 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
669 }
670 break;
671 case Graffiti_LongAvgAlphacxx . . $ LightGraffiti#Graffiti_LongAvgAlpha.:
672 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
673
674 r = 0x7f + (GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
675 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
676 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
677 maxDiff = r;
678 temp = r;
679
680 g = 0x7f + (GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
681 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
682 if (maxDiff < g) maxDiff = g;
683 if (max < GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])) max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
684 temp += g;
685
686 b = 0x7f + (GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
687 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
688 if (maxDiff < b) maxDiff = b;
689 if (max < GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])) max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
690 temp += b;
691
692 if (maxDiff > 0xe0 && temp > 0xe0 + 0xd0 + 0x80) {
693 m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] = MAXcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:93:9`!(m_lightMask[pixel], out[pixel]);
694
695 f = 2*(GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0]);
696 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
697 f *= f;
698 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+0] = f;
699
700 f = 2*(GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1]);
701 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
702 f *= f;
703 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+1] = f;
704
705 f = 2*(GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])-m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2]);
706 f = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(f)/255.0;
707 f *= f;
708 if (f > m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2]) m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).4*pixel+2] = f;
709 }
710 if (m_lightMaskcxx . . $ LightGraffiti#m_lightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel] != 0) {
711 r = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]), m_alphaMap[4*pixel+0]*GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(m_lightMask[pixel]));
712 g = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]), m_alphaMap[4*pixel+1]*GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(m_lightMask[pixel]));
713 b = SCREEN1cxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:111:9`!(GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]), m_alphaMap[4*pixel+2]*GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(m_lightMask[pixel]));
714 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
715 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
716 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
717 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
718 }
719 }
720 break;
721 case Graffiti_LongAvgAlphaCumCcxx . . $ LightGraffiti#Graffiti_LongAvgAlphaCumC.:
722
723 /**
724 Ideas (partially considered) to get a realistic look:
725 * Remember Hue if Saturation > 0.1 (below: Close to white, so Hue might be wrong → remember Saturation as well)
726 * Maximize Saturation for low alpha (opacity)
727 * Make alpha depend on the light source's brightness
728 * If alpha > 1: Simulate overexposure by going towards white
729 * If pixel is bright in another frame: Sum up alpha values (longer exposure)
730 Maybe: Logarithmic scale? → Overexposure becomes harder
731 log(alpha/factor + 1) or sqrt(alpha/factor)
732 */
733 for (unsigned int pixel = 0; pixel < widthcxx . . $ frei0r/fx#width.*heightcxx . . $ frei0r/fx#height.; pixel++) {
734
735 /*
736 Light detection
737 */
738
739 // maxDiff: Maximum difference to the mean image
740 // {-255,...,255}
741 // max: Maximum pixel value
742 // {0,...,255}
743 // temp: Sum of all differences
744 // {-3*255,...,3*255}
745 // sum: Sum of all pixel values
746 // {0,...,3*255}
747
748 r = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+0];
749 maxDiff = r;
750 max = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
751 temp = r;
752
753 g = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+1];
754 if (max < GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])) {
755 max = GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
756 }
757 if (maxDiff < g) {
758 maxDiff = g;
759 }
760 temp += g;
761
762 b = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]) - m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).3*pixel+2];
763 if (max < GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])) {
764 max = GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
765 }
766 if (maxDiff < b) {
767 maxDiff = b;
768 }
769 temp += b;
770
771 sum = GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]) + GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]) + GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
772
773 if (
774 maxDiff > thresholdDifference
775 && temp > thresholdDiffSum
776 && sum > thresholdBrightness
777 // If all requirements are met, then this should be a light source.
778 )
779 {
780 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
781 // Just add values as float. Overflows are highly unlikely (3.4E38+ frames ...).
782 fr = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r)/255.0;
783 fg = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g)/255.0;
784 fb = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b)/255.0;
785
786 f = (fr + fg + fb) / 3 * sensitivity;
787 fr *= f;
788 fg *= f;
789 fb *= f;
790
791 #ifdef LG_NO_OVERLAY
792 // std::cout << "fr: " << fr << "; fg: " << fg << "; fb: " << fb << "\n";
793 fr -= m_prevMask[pixel].r;
794 fg -= m_prevMask[pixel].g;
795 fb -= m_prevMask[pixel].b;
796 m_prevMask[pixel].r += fr;
797 m_prevMask[pixel].g += fg;
798 m_prevMask[pixel].b += fb;
799 // std::cout << "fr2: " << fr << "; fg2: " << fg << "; fb2: " << fb << "\n";
800 if (fr < 0) { fr = 0; }
801 if (fg < 0) { fg = 0; }
802 if (fb < 0) { fb = 0; }
803 #endif
804
805 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].rcxx . . $ RGBFloat#r. += fr;
806 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].gcxx . . $ RGBFloat#g. += fg;
807 m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].bcxx . . $ RGBFloat#b. += fb;
808
809 #else
810 // Store the «additional» light delivered by the light source in the light mask.
811 color = RGBA(CLAMP(r), CLAMP(g), CLAMP(b),0xFF);
812 m_lightMask[pixel] = MAX(m_lightMask[pixel], color);
813
814 // Add the brightness of the light source to the brightness map (alpha map)
815 y = REC709Y(CLAMP(r), CLAMP(g), CLAMP(b)) / 255.0;
816 y = y * sensitivity;
817 m_alphaMap[4*pixel] += y;
818 #endif
819 } else {
820 #ifdef LG_NO_OVERLAY
821 m_prevMask[pixel] = rgb0;
822 #endif
823 }
824
825
826
827 /*
828 Background weight
829 */
830 if (m_pBackgroundWeightcxx . . $ LightGraffiti#m_pBackgroundWeight. > 0) {
831 // Use part of the background mean. This allows one to have only lights appearing in the video
832 // if people or other objects walk into the video after the first frame (darker, therefore not in the light mask).
833 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!((int) (m_pBackgroundWeight*m_longMeanImage[3*pixel+0] + (1-m_pBackgroundWeight)*GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel])),
834 (int) (m_pBackgroundWeight*m_longMeanImage[3*pixel+1] + (1-m_pBackgroundWeight)*GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel])),
835 (int) (m_pBackgroundWeight*m_longMeanImage[3*pixel+2] + (1-m_pBackgroundWeight)*GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel])),
836 0xFF);
837 }
838
839
840 /*
841 Adding light mask
842 */
843 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
844 if (
845 (m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].rcxx . . $ RGBFloat#r. != 0 || m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].gcxx . . $ RGBFloat#g. != 0 || m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].bcxx . . $ RGBFloat#b. != 0)
846 && !m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness. && !m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff. && !m_pStatsDiffSumcxx . . $ LightGraffiti#m_pStatsDiffSum.
847 )
848 {
849
850 fr = m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].rcxx . . $ RGBFloat#r.;
851 fg = m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].gcxx . . $ RGBFloat#g.;
852 fb = m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.[cxx . . $ std/vector#`operator[]`(428bb168810b9e52).pixel].bcxx . . $ RGBFloat#b.;
853
854 if (lowerOverexposure > 0) {
855 // Comparison of plots with octave:
856 // clf;hold on;plot([0 1],[0 1],'k');plot(range,ones(length(range),1),'k');plot(range,sqrt(range));plot(range,log(1+range),'k');plot(range,log(1+range),'g');plot(range,(log(1+range)/3).^.5,'r');axis equal
857 fr = pow( log(1+fr)/lowerOverexposure, .5 );
858 fg = pow( log(1+fg)/lowerOverexposure, .5 );
859 fb = pow( log(1+fb)/lowerOverexposure, .5 );
860 }
861
862
863 // Calculate overflow between different colours:
864 // A very bright red light source will eventually overflow into other channels.
865 sr = 0;
866 sg = 0;
867 sb = 0;
868 if (fr > 1) {
869 sr += fr - 1;
870 }
871 if (fg > 1) {
872 sg += fg - 1;
873 }
874 if (fb > 1) {
875 sb += fb - 1;
876 }
877 fr += (sg + sb)/2;
878 fg += (sr + sb)/2;
879 fb += (sg + sb)/2;
880 if (fr > 1) {
881 fr = 1;
882 }
883 if (fg > 1) {
884 fg = 1;
885 }
886 if (fb > 1) {
887 fb = 1;
888 }
889
890 // Increase the saturation if the average brightness is below a certain level
891 // Do not use Rec709 Luma since we want to consider all colours to equal parts.
892 fy = (fr + fg + fb) / 3;
893 if (fy < 1 && saturation > 0) {
894 fsat = 1 + saturation*(1-fy);
895
896 fr = fy + fsat * (fr-fy);
897 fg = fy + fsat * (fg-fy);
898 fb = fy + fsat * (fb-fy);
899 }
900
901 // Paint the light on top of the image using addition
902 // Since brightness is equidistant in sRGB, this works fine.
903 r = 255*fr + GETRcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:88:9`!(out[pixel]);
904 g = 255*fg + GETGcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:87:9`!(out[pixel]);
905 b = 255*fb + GETBcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:86:9`!(out[pixel]);
906 r = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(r);
907 g = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(g);
908 b = CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(b);
909 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
910
911 #ifdef LG_DEBUG
912 deCount++;
913 if (deCount < 10) {
914 std::cout << "r: " << m_rgbLightMask[pixel].r << ", fy: " << fy << ", fr: " << fr << ", sr: " << sr << ", R: " << r << ", inR: " << GETR(in[pixel]) << "\n";
915 }
916 #endif
917
918 } else if (m_pTransparentBackgroundcxx . . $ LightGraffiti#m_pTransparentBackground.) {
919 // Transparent background
920 out[pixel] &= RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(0xFF, 0xFF, 0xFF, 0);
921 }
922 #else
923 if (
924 m_lightMask[pixel] != 0 && m_alphaMap[4*pixel + 0] != 0
925 && !m_pStatsBrightness && !m_pStatsDiff && !m_pStatsDiffSum
926 )
927 {
928
929 f = sqrt(m_alphaMap[4*pixel]);
930
931 r = f * GETR(m_lightMask[pixel]);
932 g = f * GETG(m_lightMask[pixel]);
933 b = f * GETB(m_lightMask[pixel]);
934
935 if (f > 1) {
936 // Simulate overexposure
937 sum = 0;
938 if (r > 255) {
939 sum += r-255;
940 }
941 if (g > 255) {
942 sum += g-255;
943 }
944 if (b > 255) {
945 sum += g-255;
946 }
947
948 if (sum > 0) {
949 sum = sum/10.0;
950 r += sum;
951 g += sum;
952 b += sum;
953 }
954 } else if (f < 1) {
955 // Lower exposure: Stronger colors
956 y = REC709Y(r,g,b);
957 float sat = 2.0;
958
959 r = y + sat * (r-y);
960 g = y + sat * (g-y);
961 b = y + sat * (b-y);
962 }
963
964
965 // Add the light map as additional light to the image
966 r += GETR(out[pixel]);
967 g += GETG(out[pixel]);
968 b += GETB(out[pixel]);
969 r = CLAMP(r);
970 g = CLAMP(g);
971 b = CLAMP(b);
972 out[pixel] = RGBA(r,g,b,0xFF);
973 } else if (m_pTransparentBackground) {
974 // Transparent background
975 out[pixel] &= RGBA(0xFF, 0xFF, 0xFF, 0);
976 }
977 #endif
978
979
980 /*
981 In-video statistics for easier parameter adjustment (thresholds)
982 */
983 if (m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness.) {
984 // Show the image's brightness and highlight the threshold set by the user
985
986 // Limit maximum brightness to 80% for still being able to distinguish
987 // between «bright spot» (light grey) and «over the threshold» (blue)
988 r = .8*sum/3;
989 g = .8*sum/3;
990 b = .8*sum/3;
991 if (sum > thresholdBrightness) {
992 b = 255;
993 }
994 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
995 }
996
997 if (m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff.) {
998 // As above, but for the brightness difference relative to the background.
999 r = .8*CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(maxDiff);
1000 g = r;
1001 if (!m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness.) {
1002 b = r;
1003 }
1004
1005 if (maxDiff > thresholdDifference) {
1006 g = 255;
1007 }
1008 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
1009 }
1010
1011 if (m_pStatsDiffSumcxx . . $ LightGraffiti#m_pStatsDiffSum.) {
1012 // As above, for the sum of the differences in each color channel.
1013 r = .8*CLAMPcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:98:9`!(temp/3.0);
1014 if (!m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff.) {
1015 g = r;
1016 }
1017 if (!m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness.) {
1018 b = r;
1019 }
1020 if (temp > thresholdDiffSum) {
1021 r = 255;
1022 }
1023 out[pixel] = RGBAcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:91:9`!(r,g,b,0xFF);
1024 }
1025 }
1026 break;
1027 default:
1028 break;
1029 }
1030 }
1031
1032 private:
1033 stdcxx . . $ std/::vectorcxx . . $ std/vector#<uint32_t> m_lightMaskcxx . . $ LightGraffiti#m_lightMask.;
1034 stdcxx . . $ std/::vectorcxx . . $ std/vector#<float> m_longMeanImagecxx . . $ LightGraffiti#m_longMeanImage.;
1035 stdcxx . . $ std/::vectorcxx . . $ std/vector#<float> m_alphaMapcxx . . $ LightGraffiti#m_alphaMap.;
1036 bool m_meanInitializedcxx . . $ LightGraffiti#m_meanInitialized.;
1037 GraffitiModecxx . . $ LightGraffiti#GraffitiMode# m_modecxx . . $ LightGraffiti#m_mode.;
1038 DimModecxx . . $ LightGraffiti#DimMode# m_dimModecxx . . $ LightGraffiti#m_dimMode.;
1039
1040 #ifdef LG_ADVcxx . . $ `src/filter/lightgraffiti/lightgraffiti.cpp:80:9`!
1041 stdcxx . . $ std/::vectorcxx . . $ std/vector#<RGBFloatcxx . . $ RGBFloat#> m_rgbLightMaskcxx . . $ LightGraffiti#m_rgbLightMask.;
1042 #endif
1043 #ifdef LG_NO_OVERLAY
1044 std::vector<RGBFloat> m_prevMask;
1045 #endif
1046
1047 double m_pLongAlphacxx . . $ LightGraffiti#m_pLongAlpha.;
1048 double m_pSensitivitycxx . . $ LightGraffiti#m_pSensitivity.;
1049 double m_pBackgroundWeightcxx . . $ LightGraffiti#m_pBackgroundWeight.;
1050 double m_pThresholdBrightnesscxx . . $ LightGraffiti#m_pThresholdBrightness.;
1051 double m_pThresholdDifferencecxx . . $ LightGraffiti#m_pThresholdDifference.;
1052 double m_pThresholdDiffSumcxx . . $ LightGraffiti#m_pThresholdDiffSum.;
1053 double m_pDimcxx . . $ LightGraffiti#m_pDim.;
1054 double m_pSaturationcxx . . $ LightGraffiti#m_pSaturation.;
1055 double m_pLowerOverexposurecxx . . $ LightGraffiti#m_pLowerOverexposure.;
1056 bool m_pStatsBrightnesscxx . . $ LightGraffiti#m_pStatsBrightness.;
1057 bool m_pStatsDiffcxx . . $ LightGraffiti#m_pStatsDiff.;
1058 bool m_pStatsDiffSumcxx . . $ LightGraffiti#m_pStatsDiffSum.;
1059 bool m_pTransparentBackgroundcxx . . $ LightGraffiti#m_pTransparentBackground.;
1060 bool m_pBlackReferencecxx . . $ LightGraffiti#m_pBlackReference.;
1061 bool m_pNonlinearDimcxx . . $ LightGraffiti#m_pNonlinearDim.;
1062 bool m_pResetcxx . . $ LightGraffiti#m_pReset.;
1063
1064 };
1065
1066
1067
1068 frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<LightGraffiticxx . . $ LightGraffiti#> plugincxx . . $ plugin.("Light Graffiti"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
1069 "Creates light graffitis from a video by keeping the brightest spots."cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
1070 "Simon A. Eugster (Granjow)"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
1071 0,3,
1072 F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!);