Debian Codegraph @

src/filter/keyspillm0pup/keyspillm0pup.c

raw symbols SCIP
1 /*
2 keyspillm0pup.c
3
4 This Frei0r plugin cleans key color residue from composited video
5
6 Version 0.1 mar 2012
7
8 Copyright (C) 2012 Marko Cebokli http://lea.hamradio.si/~s57uuu
9
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
25 */
26
27 //Version 0.2
28
29 //compile: gcc -c -fPIC -Wall keyspillm0pup.c -o keyspillm0pup.o
30 //link: gcc -shared -o keyspillm0pup.so keyspillm0pup.o
31
32 //*******************************************************************
33
34 #include <stdio.h>
35 #include <math.h>
36 #include <frei0r.h>cxx . . $ `<file>/include/frei0r.h`/
37 #include <stdlib.h>
38 #include <math.h>
39 #include <assert.h>
40 #include <string.h>
41
42 double PIcxx . . $ PI.=3.14159265358979;
43
44 typedef structcxx . . $ $anonymous_type_7244e8f29e8fad98_0#
45 {
46 float rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.;
47 float gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.;
48 float bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
49 float acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.;
50 } float_rgbacxx . . $ float_rgba#;
51
52 //----------------------------------------------------
53 void RGBA8888_2_floatcxx . . $ RGBA8888_2_float(c4c7673eaa070985).(const uint32_tcxx . . $ uint32_t#* in, float_rgbacxx . . $ float_rgba# *out, int w, int h)
54 {
55 uint8_tcxx . . $ uint8_t# *cin;
56 int i;
57 float f1;
58
59 cin=(uint8_tcxx . . $ uint8_t# *)in;
60 f1=1.0/255.0;
61 for (i=0;i<w*h;i++)
62 {
63 out[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=f1*(float)*cin++;
64 out[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=f1*(float)*cin++;
65 out[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=f1*(float)*cin++;
66 out[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.=f1*(float)*cin++;
67 }
68 }
69
70 //------------------------------------------------------------------
71 void float_2_RGBA8888cxx . . $ float_2_RGBA8888(183afef498e2ec6d).(const float_rgbacxx . . $ float_rgba# *in, uint32_tcxx . . $ uint32_t#* out, int w, int h)
72 {
73 uint8_tcxx . . $ uint8_t# *cout;
74 int i;
75
76 cout=(uint8_tcxx . . $ uint8_t# *)out;
77
78 for (i=0;i<w*h;i++)
79 {
80 *cout++=(uint8_tcxx . . $ uint8_t#)(in[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.*255.0);
81 *cout++=(uint8_tcxx . . $ uint8_t#)(in[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.*255.0);
82 *cout++=(uint8_tcxx . . $ uint8_t#)(in[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.*255.0);
83 *cout++=(uint8_tcxx . . $ uint8_t#)(in[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.*255.0);
84 }
85 }
86
87 //------------------------------------------------
88 //color coeffs according to rec 601 or rec 701
89 void cocoscxx . . $ cocos(d464601be4169e0c).(int cm, float *kr, float *kg, float *kb)
90 {
91 *kr=0.30; *kg=0.59; *kb=0.11; //da compiler ne jamra
92 switch (cm)
93 {
94 case 0:
95 {
96 *kr=0.30; *kg=0.59; *kb=0.11; //rec 601
97 break;
98 }
99 case 1:
100 {
101 *kr=0.2126; *kg=0.7152; *kb=0.0722; //rec 709
102 break;
103 }
104 default:
105 {
106 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!,"Unknown color model %d\n",cm);
107 break;
108 }
109 }
110 }
111
112 //-------------------------------------------------
113 //premakne barvo radialno stran od key
114 //sorazmerno maski
115 //*mask=float maska [0...1]
116 //k=key
117 //am=amount [0...1]
118 void clean_rad_mcxx . . $ clean_rad_m(505a5ebf35bc72b5).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float_rgbacxx . . $ float_rgba# k, float *mask, float am)
119 {
120 int i;
121 float aa,min;
122 min=0.5; //min aa = max color change
123
124 for (i=0;i<w*h;i++)
125 {
126 if (mask[i]==0.0) continue;
127 aa=1.0-am*(1.0-min)*mask[i];
128 s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=(s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-(1.0-aa)*k.rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.)/aa;
129 s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=(s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-(1.0-aa)*k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.)/aa;
130 s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=(s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.-(1.0-aa)*k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.)/aa;
131 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.<0.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=0.0;
132 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.<0.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=0.0;
133 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.<0.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=0.0;
134 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.>1.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=1.0;
135 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.>1.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=1.0;
136 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.>1.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=1.0;
137 }
138 }
139
140 //-------------------------------------------------
141 //premakne barvo proti target
142 //sorazmerno maski
143 //*mask=float maska [0...1]
144 //k=key
145 //am=amount [0...1]
146 void clean_tgt_mcxx . . $ clean_tgt_m(68622837b9d133b6).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float_rgbacxx . . $ float_rgba# k, float *mask, float am, float_rgbacxx . . $ float_rgba# tgt)
147 {
148 int i;
149 float a,aa,min;
150
151 min=0.5; //min aa = max color change
152
153 for (i=0;i<w*h;i++)
154 {
155 if (mask[i]==0.0) continue;
156
157 a=mask[i];
158 aa=a*am;
159 s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.+(tgt.rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.)*aa;
160 s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.+(tgt.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.)*aa;
161 s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.+(tgt.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.-s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.)*aa;
162 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.<0.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=0.0;
163 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.<0.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=0.0;
164 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.<0.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=0.0;
165 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.>1.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=1.0;
166 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.>1.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=1.0;
167 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.>1.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=1.0;
168 }
169 }
170
171 //----------------------------------------------------------
172 //desaturate colors according to mask
173 void desat_mcxx . . $ desat_m(75fb4e912007139a).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float des, int cm)
174 {
175 float a,y,cr,cb,kr,kg,kb,ikg;
176 int i;
177 float ds;
178
179 cocoscxx . . $ cocos(d464601be4169e0c).(cm,&kr,&kg,&kb);
180 ikg=1.0/kg;
181
182 for (i=0;i<w*h;i++)
183 {
184 if (mask[i]==0.0) continue;
185
186 a=mask[i];
187 //separate luma/chroma
188 y=kr*s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.+kg*s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.+kb*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
189 cr=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-y; // +-
190 cb=s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.-y; // +-
191 //desaturate
192 ds=1.0-des*a;
193 ds=ds*ds;
194 cr=cr*ds; cb=cb*ds;
195 //back to RGB
196 s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=cr+y;
197 s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=cb+y;
198 s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=(y-kr*s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-kb*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.)*ikg;
199
200 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.<0.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=0.0;
201 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.<0.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=0.0;
202 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.<0.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=0.0;
203 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.>1.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=1.0;
204 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.>1.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=1.0;
205 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.>1.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=1.0;
206 }
207 }
208
209 //----------------------------------------------------------
210 //adjust luma according to mask
211 void luma_mcxx . . $ luma_m(75fb4e912007139a).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float lad, int cm)
212 {
213 float a,m,mm,y,cr,cb,kr,kg,kb,ikg;
214 int i;
215
216 cocoscxx . . $ cocos(d464601be4169e0c).(cm,&kr,&kg,&kb);
217 ikg=1.0/kg;
218 m=2.0*lad;
219
220 for (i=0;i<w*h;i++)
221 {
222 if (mask[i]==0.0) continue;
223
224 a=mask[i];
225 //separate luma/chroma
226 y=kr*s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.+kg*s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.+kb*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
227 cr=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-y; // +-
228 cb=s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.-y; // +-
229 //adjust luma
230 mm=(m-1.0)*a+1.0;
231 if (m>=1.0) y=mm-1.0+y*(2.0-mm); else y=mm*y;
232 //back to RGB
233 s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=cr+y;
234 s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=cb+y;
235 s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=(y-kr*s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-kb*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.)*ikg;
236
237 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.<0.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=0.0;
238 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.<0.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=0.0;
239 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.<0.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=0.0;
240 if (s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.>1.0) s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=1.0;
241 if (s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.>1.0) s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=1.0;
242 if (s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.>1.0) s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=1.0;
243 }
244 }
245
246 //---------------------------------------------------------
247 //do the blur for edge mask
248 //This is the fibe1o_8 function from the IIRblur plugin
249 //converted to scalar float (for planar color)
250 // 1-tap IIR v 4 smereh
251 //optimized for speed
252 //loops rearanged for more locality (better cache hit ratio)
253 //outer (vertical) loop 2x unroll to break dependency chain
254 //simplified indexes
255 void fibe1o_fcxx . . $ fibe1o_f(85721ea48d376135).(float *s, int w, int h, float a, int ec)
256 {
257 int i,j;
258 float b,g,g4,avg,avg1,cr,g4a,g4b;
259 int p,pw,pj,pwj,pww,pmw;
260
261 avg=8; //koliko vzorcev za povprecje pri edge comp
262 avg1=1.0/avg;
263
264 g=1.0/(1.0-a);
265 g4=1.0/g/g/g/g;
266
267 //predpostavimo, da je "zunaj" crnina (nicle)
268 b=1.0/(1.0-a)/(1.0+a);
269
270 //prvih avg vrstic
271 for (i=0;i<avg;i++)
272 {
273 p=i*w;pw=p+w;
274 if (ec!=0)
275 {
276 cr=0.0;
277 for (j=0;j<avg;j++)
278 cr=cr+s[p+j];
279 cr=cr*avg1;
280 s[p]=cr*g+b*(s[p]-cr);
281 }
282
283 for (j=1;j<w;j++) //tja
284 s[p+j]=s[p+j]+a*s[p+j-1];
285
286 if (ec!=0)
287 {
288 cr=0.0;
289 for (j=w-avg;j<w;j++)
290 cr=cr+s[p+j];
291 cr=cr*avg1;
292 s[pw-1]=cr*g+b*(s[pw-1]-cr);
293 }
294 else
295 s[pw-1]=b*s[pw-1];
296
297 for (j=w-2;j>=0;j--) //nazaj
298 s[p+j]=a*s[p+j+1]+s[p+j];
299 }
300
301 //prvih avg vrstic samo navzdol (nazaj so ze)
302 for (i=0;i<w;i++)
303 {
304 if (ec!=0)
305 {
306 cr=0.0;
307 for (j=0;j<avg;j++)
308 cr=cr+s[i+w*j];
309 cr=cr*avg1;
310 s[i]=cr*g+b*(s[i]-cr);
311 }
312 for (j=1;j<avg;j++) //dol
313 s[i+j*w]=s[i+j*w]+a*s[i+w*(j-1)];
314 }
315
316 for (i=avg;i<h-1;i=i+2) //po vrsticah navzdol
317 {
318 p=i*w; pw=p+w; pww=pw+w; pmw=p-w;
319 if (ec!=0)
320 {
321 cr=0.0;
322 for (j=0;j<avg;j++)
323 cr=cr+s[p+j];
324 cr=cr*avg1;
325 s[p]=cr*g+b*(s[p]-cr);
326 cr=0.0;
327 for (j=0;j<avg;j++)
328 cr=cr+s[pw+j];
329 cr=cr*avg1;
330 s[pw]=cr*g+b*(s[pw]-cr);
331 }
332 for (j=1;j<w;j++) //tja
333 {
334 pj=p+j;pwj=pw+j;
335 s[pj]=s[pj]+a*s[pj-1];
336 s[pwj]=s[pwj]+a*s[pwj-1];
337 }
338
339 if (ec!=0)
340 {
341 cr=0.0;
342 for (j=w-avg;j<w;j++)
343 cr=cr+s[p+j];
344 cr=cr*avg1;
345 s[pw-1]=cr*g+b*(s[pw-1]-cr);
346 cr=0.0;
347 for (j=w-avg;j<w;j++)
348 cr=cr+s[pw+j];
349 cr=cr*avg1;
350 s[pww-1]=cr*g+b*(s[pww-1]-cr);
351 }
352 else
353 {
354 s[pw-1]=b*s[pw-1]; //rep H
355 s[pww-1]=b*s[pww-1];
356 }
357
358 //zacetek na desni
359 s[pw-2]=s[pw-2]+a*s[pw-1]; //nazaj
360 s[pw-1]=s[pw-1]+a*s[p-1]; //dol
361
362 for (j=w-2;j>=1;j--) //nazaj
363 {
364 pj=p+j;pwj=pw+j;
365 s[pj-1]=a*s[pj]+s[pj-1];
366 s[pwj]=a*s[pwj+1]+s[pwj];
367 //zdaj naredi se en piksel vertikalno dol, za vse stolpce
368 //dva nazaj, da ne vpliva na H nazaj
369 s[pj]=s[pj]+a*s[pmw+j];
370 s[pwj+1]=s[pwj+1]+a*s[pj+1];
371 }
372 //konec levo
373 s[pw]=s[pw]+a*s[pw+1]; //nazaj
374 s[p]=s[p]+a*s[pmw]; //dol
375 s[pw+1]=s[pw+1]+a*s[p+1]; //dol
376 s[pw]=s[pw]+a*s[p]; //dol
377 }
378
379 //ce je sodo stevilo vrstic, moras zadnjo posebej
380 if (i!=h)
381 {
382 p=i*w; pw=p+w;
383 for (j=1;j<w;j++) //tja
384 s[p+j]=s[p+j]+a*s[p+j-1];
385
386 s[pw-1]=b*s[pw-1]; //rep H
387
388 for (j=w-2;j>=0;j--) //nazaj in dol
389 {
390 s[p+j]=a*s[p+j+1]+s[p+j];
391 //zdaj naredi se en piksel vertikalno dol, za vse stolpce
392 //dva nazaj, da ne vpliva na H nazaj
393 s[p+j+1]=s[p+j+1]+a*s[p-w+j+1];
394 }
395 //levi piksel vert
396 s[p]=s[p]+a*s[p-w];
397 }
398
399 //zadnja vrstica (h-1)
400 g4b=g4*b;
401 g4a=g4/(1.0-a);
402 p=(h-1)*w;
403 if (ec!=0)
404 {
405 for (i=0;i<w;i++) //po stolpcih
406 {
407 cr=0.0;
408 for (j=h-avg;j<h;j++)
409 cr=cr+s[i+w*j];
410 cr=cr*avg1;
411 s[i+p]=g4a*cr+g4b*(s[i+p]-cr);
412 }
413 }
414 else
415 {
416 for (j=0;j<w;j++) //po stolpcih
417 s[j+p]=g4b*s[j+p]; //rep V
418 }
419
420 for (i=h-2;i>=0;i--) //po vrsticah navzgor
421 {
422 p=i*w; pw=p+w;
423 for (j=0;j<w;j++) //po stolpcih
424 s[p+j]=a*s[pw+j]+g4*s[p+j];
425 }
426
427 }
428
429 //----------------------------------------------------------
430 //mask based on euclidean RGB distance (alpha independent)
431 //mask values [0...1]
432 //fo=1 foreground only (alpha>0.005)
433 void rgb_maskcxx . . $ rgb_mask(bbe835b5d018494d).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float_rgbacxx . . $ float_rgba# k, float t, float p, int fo)
434 {
435 int i;
436 float dr,dg,db,d,ip,tr,a,de;
437
438 ip = (p>0.000001) ? 1.0/p : 1000000.0;
439 tr=1.0/3.0;
440 for (i=0;i<w*h;i++)
441 {
442 if ((fo==1)&&(s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.<0.005)) {mask[i]=0.0; continue;}
443
444 //euclidean RGB distance
445 dr=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-k.rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.;
446 dg=s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.;
447 db=s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.-k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
448 de=dr*dr+dg*dg+db*db;
449 de=de*tr; //max mozno=1.0
450
451 d=de;
452
453 if (d>(t+p))
454 a=1.0; //notranjost (alfa=1)
455 else
456 a=(d-t)*ip;
457 if (d<t) a=0.0; //blizu key, max efekt
458
459 mask[i]=1.0-a;
460 }
461 }
462
463 //----------------------------------------------------------
464 //mask based on hue difference (alpha independent)
465 //mask values [0...1]
466 //fo=1 foreground only (alpha>0.005)
467 void hue_maskcxx . . $ hue_mask(bbe835b5d018494d).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float_rgbacxx . . $ float_rgba# k, float t, float p, int fo)
468 {
469 int i;
470 float d,ip,tr,a;
471 float ka,k32,kh,kbb,ipi,b,hh;
472 float sa;
473
474 k32=sqrtf(3.0)/2.0;
475 ipi=1.0/PIcxx . . $ PI.;
476 ka=k.rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-0.5*k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-0.5*k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
477 kbb=k32*(k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.);
478 kh=atan2f(kbb,ka)*ipi; // [-1...+1]
479 sa=0.0; //da compiler ne jamra
480 //printf("color mask, key hue = %6.3f\n",kh);
481 //printf("color mask, key = %6.3f %6.3f %6.3f\n",k.r, k.g, k.b);
482 //printf("color mask, key a.b = %6.3f %6.3f\n",ka,kbb);
483
484 ip = (p>0.000001) ? 1.0/p : 1000000.0;
485 tr=1.0/3.0;
486 for (i=0;i<w*h;i++)
487 {
488 if ((fo==1)&&(s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.<0.005)) {mask[i]=0.0; continue;}
489
490 //difference of hue 2.6X pocasneje kot RGB...
491 a=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-0.5*s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-0.5*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
492 b=k32*(s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.);
493 hh=atan2f(b,a)*ipi; // [-1...1]
494 d = (hh>kh) ? hh-kh : kh-hh; // [0...2]
495 d = (d>1.0) ? 2.0-d : d; // [0...1] cir
496 // sa=hypotf(b,a)/(s[i].r+s[i].g+s[i].b+1.0E-6)*3.0;
497
498 if (d>(t+p))
499 a=1.0; //notranjost (alfa=1)
500 else
501 a=(d-t)*ip;
502 if (d<t) a=0.0; //blizu key, max efekt
503
504 mask[i]=1.0-a;
505 // mask[i]=hh; //debug
506 }
507 }
508
509 //----------------------------------------------------------
510 //mask values [0...1]
511 void edge_maskcxx . . $ edge_mask(75fb4e912007139a).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float wd, int io)
512 {
513 int i;
514 float a;
515 float lim;
516
517 lim=0.05; //clear mask below this value (good for speed)
518
519 //fully opaque areas
520 for (i=0;i<w*h;i++)
521 if (s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.>0.996) mask[i]=1.0; else mask[i]=0.0;
522
523 //blur mask
524 a=expf(logf(lim)/wd);
525 fibe1o_fcxx . . $ fibe1o_f(85721ea48d376135).(mask, w, h, a, 1);
526
527 //select edge
528 if (io==-1) //inside
529 for (i=0;i<w*h;i++)
530 {
531 if (mask[i]>0.5) mask[i]=2.0*(1.0-mask[i]); else mask[i]=0.0; //inside only
532 if (mask[i]<lim) mask[i]=0.0;
533 }
534
535 if (io==1) //outside
536 for (i=0;i<w*h;i++)
537 {
538 if (mask[i]<0.5) mask[i]=2.0*mask[i]; else mask[i]=0.0; //outside only AURA
539 if (mask[i]<lim) mask[i]=0.0;
540 }
541
542 }
543
544 //----------------------------------------------------------
545 //mask values [0...1]
546 //partially transparent areas
547 //useful as additional clean after key or edge
548 //amp=amplify mask for lower transparencies [0...1]
549 void trans_maskcxx . . $ trans_mask(6b1223c5a3c56519).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float amp)
550 {
551 int i;
552 float ia;
553 //partially transparent areas
554 ia=1.0-amp;
555 for (i=0;i<w*h;i++)
556 if ((s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.<0.996)&&(s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.>0.004))
557 mask[i]=1.0-ia*s[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.;
558 else
559 mask[i]=0.0;
560 }
561
562 //------------------------------------------------
563 //gate the mask based on similarity of hue to key
564 void hue_gatecxx . . $ hue_gate(ec0ae8375b82c6c).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float_rgbacxx . . $ float_rgba# k, float t, float p)
565 {
566 float k32,ka,kb,kh,ipi2,a,b,hh,d,aa,ip;
567 int i;
568
569 k32=sqrtf(3.0)/2.0;
570 ipi2=0.5/PIcxx . . $ PI.;
571 ip = (p>0.000001) ? 1.0/p : 1000000.0;
572
573 ka=k.rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-0.5*k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-0.5*k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
574 kb=k32*(k.gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-k.bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.);
575 kh=atan2f(kb,ka)*ipi2; // +- 1.0
576
577 for (i=0;i<w*h;i++)
578 {
579 if (mask[i]==0.0) continue;
580
581 a=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-0.5*s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-0.5*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
582 b=k32*(s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.);
583 hh=atan2f(b,a)*ipi2;
584
585 d = (hh>kh) ? hh-kh : kh-hh; // [0...2]
586 d = (d>1.0) ? 2.0-d : d;
587
588 if (d>(t+p)) {mask[i]=0.0; continue;}
589 if (d<t) continue;
590
591 aa=1.0-(d-t)*ip;
592 mask[i]=mask[i]*aa;
593 }
594 }
595
596 //------------------------------------------------
597 //reduce the mask based on a saturation threshold
598 //intensity normalized saturation
599 void sat_threscxx . . $ sat_thres(6b1223c5a3c56519).(float_rgbacxx . . $ float_rgba# *s, int w, int h, float *mask, float th)
600 {
601 float k32,ipi2,a,b,ip,sa;
602 float t1,t2;
603 int i;
604 float p=0.1; //sirina prehodnega pasu
605
606 t2=(1.0+p)*th; //above this, no mask change
607 t1=t2-p; //below this, mask=0
608
609 k32=sqrtf(3.0)/2.0;
610 ipi2=0.5/PIcxx . . $ PI.;
611 ip = (p>0.000001) ? 1.0/p : 1000000.0;
612
613 for (i=0;i<w*h;i++)
614 {
615 if (mask[i]==0.0) continue;
616
617 a=s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.-0.5*s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-0.5*s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.;
618 b=k32*(s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.-s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.);
619 sa=hypotf(b,a)/(s[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.+s[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.+s[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.+1.0E-6);
620
621 if (sa>t2) continue;
622 if (sa<t1) {mask[i]=0.0; continue;}
623 mask[i]=mask[i]*(sa-t1)*ip;
624 }
625 }
626
627 //--------------------------------------------------
628 void copy_mask_icxx . . $ copy_mask_i(2f2a4749e5c8044b).(float_rgbacxx . . $ float_rgba# *sl, int w, int h, float *mask)
629 {
630 int i;
631
632 for (i=0;i<w*h;i++)
633 {
634 sl[i].rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=mask[i];
635 sl[i].gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=mask[i];
636 sl[i].bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=mask[i];
637 sl[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.=1.0;
638 }
639 }
640
641 //--------------------------------------------------
642 void copy_mask_acxx . . $ copy_mask_a(2f2a4749e5c8044b).(float_rgbacxx . . $ float_rgba# *sl, int w, int h, float *mask)
643 {
644 int i;
645
646 for (i=0;i<w*h;i++)
647 {
648 sl[i].acxx . . $ $anonymous_type_7244e8f29e8fad98_0#a.=mask[i];
649 }
650 }
651
652 //***********************************************************
653 // FREI0R FUNKCIJE
654
655 //----------------------------------------
656 //struktura za instanco efekta
657 typedef structcxx . . $ $anonymous_type_7244e8f29e8fad98_1#
658 {
659 //status
660 int wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w.,hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h.;
661
662 //parameters
663 f0r_param_color_tcxx . . $ f0r_param_color_t# keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key.;
664 f0r_param_color_tcxx . . $ f0r_param_color_t# tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt.;
665 int maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType.;
666 float tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol.;
667 float slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope.;
668 float Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.;
669 float Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.;
670 int op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1.;
671 float am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.;
672 int op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2.;
673 float am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2.;
674 int showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.;
675 int m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.;
676 int focxx . . $ $anonymous_type_7244e8f29e8fad98_1#fo.; //foreground only (speed)
677 int cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.; //color model 0=rec601 1=rec 709
678
679 //internal variables
680 float_rgbacxx . . $ float_rgba# krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb.;
681 float_rgbacxx . . $ float_rgba# trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb.;
682 char *liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.;
683
684 } instcxx . . $ inst#;
685
686 //-----------------------------------------------------
687 //stretch [0...1] to parameter range [min...max] linear
688 float map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(double v, float min, float max)
689 {
690 return min+(max-min)*v;
691 }
692
693 //-----------------------------------------------------
694 //collapse from parameter range [min...max] to [0...1] linear
695 double map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(float v, float min, float max)
696 {
697 return (v-min)/(max-min);
698 }
699
700 //***********************************************
701 // OBVEZNE FREI0R FUNKCIJE
702
703 //-----------------------------------------------
704 int f0r_initcxx . . $ f0r_init(b126dc7c1de90089).()
705 {
706 return 1;
707 }
708
709 //------------------------------------------------
710 void f0r_deinitcxx . . $ f0r_deinit(49f6e7a06ebc5aa8).()
711 {
712 }
713
714 //-----------------------------------------------
715 void f0r_get_plugin_infocxx . . $ f0r_get_plugin_info(35d753456c0ea59c).(f0r_plugin_info_tcxx . . $ f0r_plugin_info_t#* info)
716 {
717
718 info->namecxx . . $ f0r_plugin_info#name.="keyspillm0pup";
719 info->authorcxx . . $ f0r_plugin_info#author.="Marko Cebokli";
720 info->plugin_typecxx . . $ f0r_plugin_info#plugin_type.=F0R_PLUGIN_TYPE_FILTERcxx . . $ `include/frei0r.h:247:9`!;
721 info->color_modelcxx . . $ f0r_plugin_info#color_model.=F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!;
722 info->frei0r_versioncxx . . $ f0r_plugin_info#frei0r_version.=FREI0R_MAJOR_VERSIONcxx . . $ `include/frei0r.h:217:9`!;
723 info->major_versioncxx . . $ f0r_plugin_info#major_version.=0;
724 info->minor_versioncxx . . $ f0r_plugin_info#minor_version.=3;
725 info->num_paramscxx . . $ f0r_plugin_info#num_params.=13;
726 info->explanationcxx . . $ f0r_plugin_info#explanation.="Reduces the visibility of key color spill in chroma keying";
727 }
728
729 //--------------------------------------------------
730 void f0r_get_param_infocxx . . $ f0r_get_param_info(a9f9aa7954cc4a37).(f0r_param_info_tcxx . . $ f0r_param_info_t#* info, int param_index)
731 {
732 switch(param_index)
733 {
734 case 0:
735 info->namecxx . . $ f0r_param_info#name. = "Key color";
736 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_COLORcxx . . $ `include/frei0r.h:389:9`!;
737 info->explanationcxx . . $ f0r_param_info#explanation. = "Key color that was used for chroma keying";
738 break;
739 case 1:
740 info->namecxx . . $ f0r_param_info#name. = "Target color";
741 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_COLORcxx . . $ `include/frei0r.h:389:9`!;
742 info->explanationcxx . . $ f0r_param_info#explanation. = "Desired color to replace key residue with";
743 break;
744 case 2:
745 info->namecxx . . $ f0r_param_info#name. = "Mask type";
746 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_STRINGcxx . . $ `include/frei0r.h:400:9`!;
747 info->explanationcxx . . $ f0r_param_info#explanation. = "Which mask to apply [0,1,2,3]";
748 break;
749 case 3:
750 info->namecxx . . $ f0r_param_info#name. = "Tolerance";
751 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
752 info->explanationcxx . . $ f0r_param_info#explanation. = "Range of colors around the key, where effect is full strength";
753 break;
754 case 4:
755 info->namecxx . . $ f0r_param_info#name. = "Slope";
756 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
757 info->explanationcxx . . $ f0r_param_info#explanation. = "Range of colors around the key where effect gradually decreases";
758 break;
759 case 5:
760 info->namecxx . . $ f0r_param_info#name. = "Hue gate";
761 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
762 info->explanationcxx . . $ f0r_param_info#explanation. = "Restrict mask to hues close to key";
763 break;
764 case 6:
765 info->namecxx . . $ f0r_param_info#name. = "Saturation threshold";
766 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
767 info->explanationcxx . . $ f0r_param_info#explanation. = "Restrict mask to saturated colors";
768 break;
769 case 7:
770 info->namecxx . . $ f0r_param_info#name. = "Operation 1";
771 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_STRINGcxx . . $ `include/frei0r.h:400:9`!;
772 info->explanationcxx . . $ f0r_param_info#explanation. = "First operation 1 [0,1,2]";
773 break;
774 case 8:
775 info->namecxx . . $ f0r_param_info#name. = "Amount 1";
776 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
777 info->explanationcxx . . $ f0r_param_info#explanation. = "";
778 break;
779 case 9:
780 info->namecxx . . $ f0r_param_info#name. = "Operation 2";
781 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_STRINGcxx . . $ `include/frei0r.h:400:9`!;
782 info->explanationcxx . . $ f0r_param_info#explanation. = "Second operation 2 [0,1,2]";
783 break;
784 case 10:
785 info->namecxx . . $ f0r_param_info#name. = "Amount 2";
786 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_DOUBLEcxx . . $ `include/frei0r.h:383:9`!;
787 info->explanationcxx . . $ f0r_param_info#explanation. = "";
788 break;
789 case 11:
790 info->namecxx . . $ f0r_param_info#name. = "Show mask";
791 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!;
792 info->explanationcxx . . $ f0r_param_info#explanation. = "Replace image with the mask";
793 break;
794 case 12:
795 info->namecxx . . $ f0r_param_info#name. = "Mask to Alpha";
796 info->typecxx . . $ f0r_param_info#type. = F0R_PARAM_BOOLcxx . . $ `include/frei0r.h:377:9`!;
797 info->explanationcxx . . $ f0r_param_info#explanation. = "Replace alpha channel with the mask";
798 break;
799 }
800 }
801
802 //----------------------------------------------
803 f0r_instance_tcxx . . $ f0r_instance_t# f0r_constructcxx . . $ f0r_construct(da3f471cd007a696).(unsigned int width, unsigned int height)
804 {
805 instcxx . . $ inst# *in;
806
807 in=calloccxx . . $ calloc(63a7bf2941bfcd7a).(1,sizeof(instcxx . . $ inst#));
808 in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w.=width;
809 in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h.=height;
810
811 //defaults
812 in->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..rcxx . . $ f0r_param_color#r. = 0.1;
813 in->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..gcxx . . $ f0r_param_color#g. = 0.8;
814 in->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..bcxx . . $ f0r_param_color#b. = 0.1;
815 in->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..rcxx . . $ f0r_param_color#r. = 0.78;
816 in->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..gcxx . . $ f0r_param_color#g. = 0.5;
817 in->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..bcxx . . $ f0r_param_color#b. = 0.4;
818 in->maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType.=0;
819 in->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol.=0.12;
820 in->slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope.=0.2;
821 in->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.=0.25;
822 in->Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.=0.15;
823 in->op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1.=1;
824 in->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.=0.55;
825 in->op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2.=0;
826 in->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2.=0.0;
827 in->showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.=0;
828 in->m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.=0;
829 in->focxx . . $ $anonymous_type_7244e8f29e8fad98_1#fo.=1;
830 in->cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.=1;
831
832 const char* sval = "0";
833 in->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr. = (char*)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).( strlencxx . . $ strlen(751346f8406fd082).(sval) + 1 );
834 strcpycxx . . $ strcpy(b7b3a83273496486).( in->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., sval );
835
836 return (f0r_instance_tcxx . . $ f0r_instance_t#)in;
837 }
838
839 //---------------------------------------------------
840 void f0r_destructcxx . . $ f0r_destruct(5d22bdacc48458e8).(f0r_instance_tcxx . . $ f0r_instance_t# instance)
841 {
842 instcxx . . $ inst#* in = (instcxx . . $ inst#*)instance;
843 freecxx . . $ free(5d22bdacc48458e8).(in->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.);
844 freecxx . . $ free(5d22bdacc48458e8).(instance);
845 }
846
847 //-----------------------------------------------------
848 void f0r_set_param_valuecxx . . $ f0r_set_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# parm, int param_index)
849 {
850 instcxx . . $ inst# *p;
851 double tmpf;
852 int chg,tmpi,nc;
853 f0r_param_color_tcxx . . $ f0r_param_color_t# tmpc;
854 char *tmpch;
855
856 p=(instcxx . . $ inst#*)instance;
857
858 chg=0;
859 switch(param_index)
860 {
861 case 0: //key color
862 tmpc=*(f0r_param_color_tcxx . . $ f0r_param_color_t#*)parm;
863 if ((tmpc.rcxx . . $ f0r_param_color#r.!=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..rcxx . . $ f0r_param_color#r.) || (tmpc.gcxx . . $ f0r_param_color#g.!=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..gcxx . . $ f0r_param_color#g.) || (tmpc.bcxx . . $ f0r_param_color#b.!=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..bcxx . . $ f0r_param_color#b.))
864 chg=1;
865 p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key.=tmpc;
866 p->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb..rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..rcxx . . $ f0r_param_color#r.;
867 p->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb..gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..gcxx . . $ f0r_param_color#g.;
868 p->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb..bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key..bcxx . . $ f0r_param_color#b.;
869 break;
870 case 1: //target color
871 tmpc=*(f0r_param_color_tcxx . . $ f0r_param_color_t#*)parm;
872 if ((tmpc.rcxx . . $ f0r_param_color#r.!=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..rcxx . . $ f0r_param_color#r.) || (tmpc.gcxx . . $ f0r_param_color#g.!=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..gcxx . . $ f0r_param_color#g.) || (tmpc.bcxx . . $ f0r_param_color#b.!=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..bcxx . . $ f0r_param_color#b.))
873 chg=1;
874 p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt.=tmpc;
875 p->trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb..rcxx . . $ $anonymous_type_7244e8f29e8fad98_0#r.=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..rcxx . . $ f0r_param_color#r.;
876 p->trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb..gcxx . . $ $anonymous_type_7244e8f29e8fad98_0#g.=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..gcxx . . $ f0r_param_color#g.;
877 p->trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb..bcxx . . $ $anonymous_type_7244e8f29e8fad98_0#b.=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt..bcxx . . $ f0r_param_color#b.;
878 break;
879 case 2: //Mask type (list)
880 tmpch = (*(f0r_param_stringcxx . . $ f0r_param_string#*)parm);
881 if (tmpch && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch)) {
882 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr. = realloccxx . . $ realloc(417ab160f6baadc6).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., strlencxx . . $ strlen(751346f8406fd082).(tmpch) + 1 );
883 strcpycxx . . $ strcpy(b7b3a83273496486).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch );
884 }
885 nc=sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",&tmpi);
886 // if ((nc<=0)||(tmpi<0)||(tmpi>3)) tmpi=1;
887 if ((nc<=0)||(tmpi<0)||(tmpi>3)) break;
888 if (p->maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType. != tmpi) chg=1;
889 p->maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType. = tmpi;
890 break;
891 case 3: //tolerance
892 tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 0.5);
893 if (p->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol. != tmpf) chg=1;
894 p->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol. = tmpf;
895 break;
896 case 4: //slope
897 tmpf=map_value_forwardcxx . . $ map_value_forward(1935fda23fc189b2).(*((double*)parm), 0.0, 0.5);
898 if (p->slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope. != tmpf) chg=1;
899 p->slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope. = tmpf;
900 break;
901 case 5: //Hue gate
902 tmpf=*(double*)parm;
903 if (tmpf!=p->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.) chg=1;
904 p->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.=tmpf;
905 break;
906 case 6: //Saturation threshold
907 tmpf=*(double*)parm;
908 if (tmpf!=p->Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.) chg=1;
909 p->Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.=tmpf;
910 break;
911 case 7: //Operation 1 (list)
912 tmpch = (*(f0r_param_stringcxx . . $ f0r_param_string#*)parm);
913 if (tmpch && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch)) {
914 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr. = realloccxx . . $ realloc(417ab160f6baadc6).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., strlencxx . . $ strlen(751346f8406fd082).(tmpch) + 1 );
915 strcpycxx . . $ strcpy(b7b3a83273496486).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch );
916 }
917 nc=sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",&tmpi);
918 // if ((nc<=0)||(tmpi<0)||(tmpi>4)) tmpi=0;
919 if ((nc<=0)||(tmpi<0)||(tmpi>4)) break;
920 if (p->op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1. != tmpi) chg=1;
921 p->op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1. = tmpi;
922 break;
923 case 8: //Amount 1
924 tmpf=*(double*)parm;
925 if (tmpf!=p->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.) chg=1;
926 p->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.=tmpf;
927 break;
928 case 9: //Operation 2 (list)
929 tmpch = (*(f0r_param_stringcxx . . $ f0r_param_string#*)parm);
930 if (tmpch && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch)) {
931 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr. = realloccxx . . $ realloc(417ab160f6baadc6).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., strlencxx . . $ strlen(751346f8406fd082).(tmpch) + 1 );
932 strcpycxx . . $ strcpy(b7b3a83273496486).( p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr., tmpch );
933 }
934 nc=sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",&tmpi);
935 // if ((nc<=0)||(tmpi<0)||(tmpi>4)) tmpi=0;
936 if ((nc<=0)||(tmpi<0)||(tmpi>4)) break;
937 if (p->op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2. != tmpi) chg=1;
938 p->op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2. = tmpi;
939 break;
940 case 10: //Amount 2
941 tmpf=*(double*)parm;
942 if (p->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2. != tmpf) chg=1;
943 p->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2. = tmpf;
944 break;
945 case 11: //Show mask (bool)
946 tmpf=*(double*)parm;
947 tmpi=roundf(tmpf);
948 if (tmpi!=p->showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.) chg=1;
949 p->showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.=tmpi;
950 break;
951 case 12: //Mask to Alpha (bool)
952 tmpf=*(double*)parm;
953 tmpi=roundf(tmpf);
954 if (tmpi!=p->m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.) chg=1;
955 p->m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.=tmpi;
956 break;
957 }
958
959 if (chg==0) return;
960
961 }
962
963 //--------------------------------------------------
964 void f0r_get_param_valuecxx . . $ f0r_get_param_value(5be095a8278d2bf5).(f0r_instance_tcxx . . $ f0r_instance_t# instance, f0r_param_tcxx . . $ f0r_param_t# param, int param_index)
965 {
966 instcxx . . $ inst# *p;
967
968 p=(instcxx . . $ inst#*)instance;
969
970 switch(param_index)
971 {
972 case 0: //key color
973 *((f0r_param_color_tcxx . . $ f0r_param_color_t#*)param)=p->keycxx . . $ $anonymous_type_7244e8f29e8fad98_1#key.;
974 break;
975 case 1: //target color
976 *((f0r_param_color_tcxx . . $ f0r_param_color_t#*)param)=p->tgtcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tgt.;
977 break;
978 case 2: //Mask type (list)
979 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.=realloccxx . . $ realloc(417ab160f6baadc6).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,16);
980 sprintfcxx . . $ sprintf(26c8642d26409d6d).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",p->maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType.);
981 *((char**)param) = p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.;
982 break;
983 case 3: //tolerance
984 *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol., 0.0, 0.5);
985 break;
986 case 4: //slope
987 *((double*)param)=map_value_backwardcxx . . $ map_value_backward(937b104db0ceee62).(p->slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope., 0.0, 0.5);
988 break;
989 case 5: //Hue gate
990 *((double*)param)=p->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.;
991 break;
992 case 6: //Saturation threshold
993 *((double*)param)=p->Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.;
994 break;
995 case 7: //Operation 1 (list)
996 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.=realloccxx . . $ realloc(417ab160f6baadc6).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,16);
997 sprintfcxx . . $ sprintf(26c8642d26409d6d).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",p->op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1.);
998 *((char**)param) = p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.;
999 break;
1000 case 8: //Amount 1
1001 *((double*)param)=p->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.;
1002 break;
1003 case 9: //Operation 2 (list)
1004 p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.=realloccxx . . $ realloc(417ab160f6baadc6).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,16);
1005 sprintfcxx . . $ sprintf(26c8642d26409d6d).(p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.,"%d",p->op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2.);
1006 *((char**)param) = p->liststrcxx . . $ $anonymous_type_7244e8f29e8fad98_1#liststr.;
1007 break;
1008 case 10: //Amount 2
1009 *((double*)param)=p->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2.;
1010 break;
1011 case 11: //Show mask (bool)
1012 *((double*)param)=(double)p->showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.;
1013 break;
1014 case 12: //Mask 2 Alpha (bool)
1015 *((double*)param)=(double)p->m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.;
1016 break;
1017 }
1018 }
1019
1020 //==============================================================
1021 void f0r_updatecxx . . $ f0r_update(96cd7b27f2fca8a7).(f0r_instance_tcxx . . $ f0r_instance_t# instance, double time, const uint32_tcxx . . $ uint32_t#* inframe, uint32_tcxx . . $ uint32_t#* outframe)
1022 {
1023 instcxx . . $ inst# *in;
1024 //video buffers
1025 float *mask;
1026 float_rgbacxx . . $ float_rgba# *sl;
1027
1028 assertcxx . . $ `<external>/4398592474888995393/assert.h:77:11`!(instance);
1029 in=(instcxx . . $ inst#*)instance;
1030
1031 sl = calloccxx . . $ calloc(63a7bf2941bfcd7a).(in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w. * in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., sizeof(float_rgbacxx . . $ float_rgba#));
1032 mask = calloccxx . . $ calloc(63a7bf2941bfcd7a).(in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w. * in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., sizeof(float));
1033
1034 RGBA8888_2_floatcxx . . $ RGBA8888_2_float(c4c7673eaa070985).(inframe, sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h.);
1035
1036 switch(in->maskTypecxx . . $ $anonymous_type_7244e8f29e8fad98_1#maskType.) //GENERATE MASK
1037 {
1038 case 0: //Color distance based mask
1039 {
1040 rgb_maskcxx . . $ rgb_mask(bbe835b5d018494d).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., in->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol., in->slopecxx . . $ $anonymous_type_7244e8f29e8fad98_1#slope., in->focxx . . $ $anonymous_type_7244e8f29e8fad98_1#fo.);
1041 break;
1042 }
1043 case 1: //Transparency based mask
1044 {
1045 trans_maskcxx . . $ trans_mask(6b1223c5a3c56519).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol.);
1046 break;
1047 }
1048 case 2: //Edge based mask inwards
1049 {
1050 edge_maskcxx . . $ edge_mask(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol.*200.0, -1);
1051 break;
1052 }
1053 case 3: //Edge based mask outwards
1054 {
1055 edge_maskcxx . . $ edge_mask(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->tolcxx . . $ $anonymous_type_7244e8f29e8fad98_1#tol.*200.0, 1);
1056 break;
1057 }
1058 }
1059
1060 hue_gatecxx . . $ hue_gate(ec0ae8375b82c6c).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., in->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate., 0.5*in->Hgatecxx . . $ $anonymous_type_7244e8f29e8fad98_1#Hgate.);
1061 sat_threscxx . . $ sat_thres(6b1223c5a3c56519).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->Sthreshcxx . . $ $anonymous_type_7244e8f29e8fad98_1#Sthresh.);
1062
1063 switch(in->op1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op1.) //OPERATION 1
1064 {
1065 case 0: break;
1066 case 1: //De-Key
1067 {
1068 clean_rad_mcxx . . $ clean_rad_m(505a5ebf35bc72b5).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., mask, in->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1.);
1069 break;
1070 }
1071 case 2: //Target
1072 {
1073 clean_tgt_mcxx . . $ clean_tgt_m(68622837b9d133b6).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., mask, in->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1., in->trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb.);
1074 break;
1075 }
1076 case 3: //Desaturate
1077 {
1078 desat_mcxx . . $ desat_m(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1., in->cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.);
1079 break;
1080 }
1081 case 4: //Luma adjust
1082 {
1083 luma_mcxx . . $ luma_m(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->am1cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am1., in->cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.);
1084 break;
1085 }
1086 }
1087
1088 switch(in->op2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#op2.) //OPERATION 2
1089 {
1090 case 0: break;
1091 case 1: //De-Key
1092 {
1093 clean_rad_mcxx . . $ clean_rad_m(505a5ebf35bc72b5).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., mask, in->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2.);
1094 break;
1095 }
1096 case 2: //Target
1097 {
1098 clean_tgt_mcxx . . $ clean_tgt_m(68622837b9d133b6).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., in->krgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#krgb., mask, in->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2., in->trgbcxx . . $ $anonymous_type_7244e8f29e8fad98_1#trgb.);
1099 break;
1100 }
1101 case 3: //Desaturate
1102 {
1103 desat_mcxx . . $ desat_m(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2., in->cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.);
1104 break;
1105 }
1106 case 4: //Luma adjust
1107 {
1108 luma_mcxx . . $ luma_m(75fb4e912007139a).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask, in->am2cxx . . $ $anonymous_type_7244e8f29e8fad98_1#am2., in->cmcxx . . $ $anonymous_type_7244e8f29e8fad98_1#cm.);
1109 break;
1110 }
1111 }
1112
1113 if (in->showmaskcxx . . $ $anonymous_type_7244e8f29e8fad98_1#showmask.) //REPLACE IMAGE WITH THE MASK
1114 {
1115 copy_mask_icxx . . $ copy_mask_i(2f2a4749e5c8044b).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask);
1116 }
1117
1118 if (in->m2acxx . . $ $anonymous_type_7244e8f29e8fad98_1#m2a.) //REPLACE ALPHA WITH THE MASK
1119 {
1120 copy_mask_acxx . . $ copy_mask_a(2f2a4749e5c8044b).(sl, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h., mask);
1121 }
1122
1123
1124 float_2_RGBA8888cxx . . $ float_2_RGBA8888(183afef498e2ec6d).(sl, outframe, in->wcxx . . $ $anonymous_type_7244e8f29e8fad98_1#w., in->hcxx . . $ $anonymous_type_7244e8f29e8fad98_1#h.);
1125 freecxx . . $ free(5d22bdacc48458e8).(mask);
1126 freecxx . . $ free(5d22bdacc48458e8).(sl);
1127 }