Debian Codegraph @

src/mixer2/addition/addition.cpp

raw symbols SCIP
1 /* addition.cpp
2 * Copyright (C) 2006 Jean-Sebastien Senecal ([email protected])
3 * This file is a Frei0r plugin.
4 * The code is a modified version of code from the Gimp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "frei0r.hpp"cxx . . $ `<file>/include/frei0r.hpp`/
22 #include "frei0r/math.h"cxx . . $ `<file>/include/frei0r/math.h`/
23
24 #define NBYTEScxx . . $ `src/mixer2/addition/addition.cpp:24:9`! 4
25 #define ALPHAcxx . . $ `src/mixer2/addition/addition.cpp:25:9`! 3
26
27 class additioncxx . . $ addition# : public frei0rcxx . . $ frei0r/::mixer2cxx . . $ frei0r/mixer2#
28 {
29 public:
30 additioncxx . . $ addition#addition(b4d55b1286ff73e8).(unsigned int width, unsigned int height)
31 {
32 // initialize look-up table
33 for (int i = 0; i < 256; i++)
34 add_lutcxx . . $ addition#add_lut.[i] = i;
35 for (int i = 256; i <= 510; i++)
36 add_lutcxx . . $ addition#add_lut.[i] = 255;
37 }
38
39 /**
40 *
41 * Perform an RGB[A] addition operation of the pixel sources in1
42 * and in2.
43 *
44 **/
45 void updatecxx . . $ addition#update(aea6c563decfb03a).(double time,
46 uint32_t* out,
47 const uint32_t* in1,
48 const uint32_t* in2)
49 {
50 const uint8_t *A = reinterpret_cast<const uint8_t*>(in1);
51 const uint8_t *B = reinterpret_cast<const uint8_t*>(in2);
52 uint8_t *D = reinterpret_cast<uint8_t*>(out);
53 uint32_t sizeCounter = sizecxx . . $ frei0r/fx#size.;
54
55 uint32_t b;
56
57 while (sizeCounter--)
58 {
59 for (b = 0; b < ALPHAcxx . . $ `src/mixer2/addition/addition.cpp:25:9`!; b++)
60 D[b] = add_lutcxx . . $ addition#add_lut.[A[b] + B[b]];
61
62 D[ALPHAcxx . . $ `src/mixer2/addition/addition.cpp:25:9`!] = MINcxx . . $ `include/frei0r/math.h:67:9`!(A[ALPHAcxx . . $ `src/mixer2/addition/addition.cpp:25:9`!], B[ALPHAcxx . . $ `src/mixer2/addition/addition.cpp:25:9`!]);
63 A += NBYTEScxx . . $ `src/mixer2/addition/addition.cpp:24:9`!;
64 B += NBYTEScxx . . $ `src/mixer2/addition/addition.cpp:24:9`!;
65 D += NBYTEScxx . . $ `src/mixer2/addition/addition.cpp:24:9`!;
66 }
67 }
68
69 private:
70 static uint8_t add_lutcxx . . $ addition#add_lut.[511]; // look-up table storing values to do a quick MAX of two values when you know you add two unsigned chars
71 };
72
73 uint8_t additioncxx . . $ addition#::add_lutcxx . . $ addition#add_lut.[511];
74
75 frei0rcxx . . $ frei0r/::constructcxx . . $ frei0r/construct#<additioncxx . . $ addition#> plugincxx . . $ plugin.("addition"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
76 "Perform an RGB[A] addition operation of the pixel sources."cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
77 "Jean-Sebastien Senecal"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).,
78 0,2,
79 F0R_COLOR_MODEL_RGBA8888cxx . . $ `include/frei0r.h:308:9`!);
80