no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / colorbalance / colorbalance.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 COLORBALANCE_H
23 #define COLORBALANCE_H
24
25 class ColorBalanceMain;
26
27 #include "colorbalancewindow.h"
28 #include "condition.h"
29 #include "bccolors.h"
30 #include "guicast.h"
31 #include "pluginvclient.h"
32 #include "thread.h"
33
34 #define SHADOWS 0
35 #define MIDTONES 1
36 #define HIGHLIGHTS 2
37
38 class ColorBalanceConfig
39 {
40 public:
41         ColorBalanceConfig();
42         void reset(int clear);
43
44         int equivalent(ColorBalanceConfig &that);
45         void copy_from(ColorBalanceConfig &that);
46         void interpolate(ColorBalanceConfig &prev,
47                 ColorBalanceConfig &next,
48                 int64_t prev_frame,
49                 int64_t next_frame,
50                 int64_t current_frame);
51
52 // -1000 - 1000
53         float cyan;
54         float magenta;
55     float yellow;
56     int preserve;
57     int lock_params;
58 };
59
60 class ColorBalanceEngine : public Thread
61 {
62 public:
63         ColorBalanceEngine(ColorBalanceMain *plugin);
64         ~ColorBalanceEngine();
65
66         int start_process_frame(VFrame *output, VFrame *input, int row_start, int row_end);
67         int wait_process_frame();
68         void run();
69
70         ColorBalanceMain *plugin;
71         int row_start, row_end;
72         int last_frame;
73         Condition input_lock, output_lock;
74         VFrame *input, *output;
75         float cyan_f, magenta_f, yellow_f;
76 };
77
78 class ColorBalanceMain : public PluginVClient
79 {
80 public:
81         ColorBalanceMain(PluginServer *server);
82         ~ColorBalanceMain();
83
84 // required for all realtime plugins
85         PLUGIN_CLASS_MEMBERS(ColorBalanceConfig);
86         int process_buffer(VFrame *frame,
87                 int64_t start_position,
88                 double frame_rate);
89         int is_realtime();
90         void update_gui();
91         void save_data(KeyFrame *keyframe);
92         void read_data(KeyFrame *keyframe);
93         int handle_opengl();
94
95         void get_aggregation(int *aggregate_interpolate,
96                 int *aggregate_gamma);
97
98
99         int64_t calculate_slider(float in);
100         float calculate_transfer(float in);
101
102 // parameters needed for processor
103         int reconfigure();
104     int synchronize_params(ColorBalanceSlider *slider, float difference);
105     int test_boundary(float &value);
106
107         ColorBalanceEngine **engine;
108         int total_engines;
109
110
111     int r_lookup_8[0x100];
112     int g_lookup_8[0x100];
113     int b_lookup_8[0x100];
114     int r_lookup_16[0x10000];
115     int g_lookup_16[0x10000];
116     int b_lookup_16[0x10000];
117     int redo_buffers;
118         int need_reconfigure;
119 };
120
121
122
123 #endif