remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / color3way / color3way.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef COLOR3WAY_H
23 #define COLOR3WAY_H
24
25 class Color3WayMain;
26 class Color3WayEngine;
27
28 #define SHADOWS 0
29 #define MIDTONES 1
30 #define HIGHLIGHTS 2
31 #define SECTIONS 3
32 #define MAX_COLOR 1.0
33 #define ROOT_2 1.414214
34
35 #include "color3waywindow.h"
36 #include "condition.h"
37 #include "cicolors.h"
38 #include "guicast.h"
39 #include "loadbalance.h"
40 #include "pluginvclient.h"
41 #include "thread.h"
42
43
44 class Color3WayConfig
45 {
46 public:
47         Color3WayConfig();
48
49         int equivalent(Color3WayConfig &that);
50         void copy_from(Color3WayConfig &that);
51         void interpolate(Color3WayConfig &prev,
52                 Color3WayConfig &next,
53                 int64_t prev_frame,
54                 int64_t next_frame,
55                 int64_t current_frame);
56         void boundaries();
57         void copy_to_all(int section);
58
59         float hue_x[SECTIONS];
60         float hue_y[SECTIONS];
61         float value[SECTIONS];
62         float saturation[SECTIONS];
63 };
64
65
66
67
68
69 class Color3WayPackage : public LoadPackage
70 {
71 public:
72         Color3WayPackage();
73         int row1, row2;
74 };
75
76
77 class Color3WayUnit : public LoadClient
78 {
79 public:
80         Color3WayUnit(Color3WayMain *plugin, Color3WayEngine *server);
81         void process_package(LoadPackage *package);
82         Color3WayMain *plugin;
83         YUV yuv;
84 };
85
86 class Color3WayEngine : public LoadServer
87 {
88 public:
89         Color3WayEngine(Color3WayMain *plugin, int cpus);
90         ~Color3WayEngine();
91         void init_packages();
92         LoadClient* new_client();
93         LoadPackage* new_package();
94         Color3WayMain *plugin;
95 };
96
97
98
99
100 class Color3WayMain : public PluginVClient
101 {
102 public:
103         Color3WayMain(PluginServer *server);
104         ~Color3WayMain();
105
106 // required for all realtime plugins
107         PLUGIN_CLASS_MEMBERS2(Color3WayConfig);
108         int process_buffer(VFrame *frame,
109                 int64_t start_position,
110                 double frame_rate);
111         int is_realtime();
112         void update_gui();
113         void save_data(KeyFrame *keyframe);
114         void read_data(KeyFrame *keyframe);
115         int handle_opengl();
116
117         void get_aggregation(int *aggregate_interpolate,
118                 int *aggregate_gamma);
119
120         void calculate_factors(float *r, float *g, float *b, int section);
121         void calculate_factors(float *r, float *g, float *b, float x, float y);
122         void process_pixel(float *r,
123                 float *g,
124                 float *b,
125                 float r_in,
126                 float g_in,
127                 float b_in,
128                 float x,
129                 float y);
130
131 // parameters needed for processor
132         int reconfigure();
133
134         Color3WayEngine *engine;
135         int total_engines;
136
137
138     int r_lookup_8[0x100];
139     int g_lookup_8[0x100];
140     int b_lookup_8[0x100];
141     int r_lookup_16[0x10000];
142     int g_lookup_16[0x10000];
143     int b_lookup_16[0x10000];
144     int redo_buffers;
145         int need_reconfigure;
146         int copy_to_all[SECTIONS];
147         int w, h;
148 };
149
150
151
152 #endif