no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / histogram / histogram.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 HISTOGRAM_H
23 #define HISTOGRAM_H
24
25
26 #include "histogram.inc"
27 #include "histogramconfig.h"
28 #include "histogramwindow.inc"
29 #include "loadbalance.h"
30 #include "bccolors.h"
31 #include "pluginvclient.h"
32
33
34 class HistogramMain : public PluginVClient
35 {
36 public:
37         HistogramMain(PluginServer *server);
38         ~HistogramMain();
39
40         int process_buffer(VFrame *frame,
41                 int64_t start_position,
42                 double frame_rate);
43         int is_realtime();
44         void save_data(KeyFrame *keyframe);
45         void read_data(KeyFrame *keyframe);
46         void update_gui();
47         void render_gui(void *data);
48         int calculate_use_opengl();
49         int handle_opengl();
50
51         PLUGIN_CLASS_MEMBERS(HistogramConfig)
52
53 // Interpolate quantized transfer table to linear output
54         float calculate_level(float input, int mode, int do_value);
55 // Convert input to smoothed output by looking up in smooth table.
56         float calculate_curve(float input);
57 // Calculate automatic settings
58         void calculate_automatic(VFrame *data);
59 // Calculate histogram.
60 // Value is only calculated for preview.
61         void calculate_histogram(VFrame *data, int do_value);
62 // Calculate the linear, smoothed, lookup curves
63         void tabulate_curve(int **table, int idx, int len, int use_value);
64         void tabulate_curve(int idx, int use_value);
65
66
67         VFrame *input, *output;
68         HistogramEngine *engine;
69         HistStripeEngine *stripe_engine;
70
71         int *lookup[HISTOGRAM_MODES];
72 // No value applied to this
73         int *preview_lookup[HISTOGRAM_MODES];
74         int *accum[HISTOGRAM_MODES];
75 // Input point being dragged or edited
76         int current_point;
77 // Current channel being viewed
78         int mode;
79         int dragging_point;
80         int point_x_offset;
81         int point_y_offset;
82         int w, h;
83         int parade;
84         VFrame *fframe;
85         int64_t last_position;
86         int last_frames;
87 };
88
89 enum { ADD_TEMP, ADD_FFRM, ADD_FFRMS, ADD_TEMPS, SUB_TEMPS };
90
91 class HistStripePackage : public LoadPackage
92 {
93 public:
94         HistStripePackage();
95         int y0, y1;
96 };
97
98 class HistStripeUnit : public LoadClient
99 {
100 public:
101         HistStripeUnit(HistStripeEngine *server, HistogramMain *plugin);
102         void process_package(LoadPackage *package);
103         HistStripeEngine *server;
104         HistogramMain *plugin;
105 };
106
107 class HistStripeEngine : public LoadServer
108 {
109 public:
110         HistStripeEngine(HistogramMain *plugin, int total_clients, int total_packages);
111         void process_packages(int operation);
112         void init_packages();
113         LoadClient *new_client();
114         LoadPackage *new_package();
115         HistogramMain *plugin;
116         int operation;
117 };
118
119
120 class HistogramPackage : public LoadPackage
121 {
122 public:
123         HistogramPackage();
124         int start, end;
125 };
126
127 class HistogramUnit : public LoadClient
128 {
129 public:
130         HistogramUnit(HistogramEngine *server, HistogramMain *plugin);
131         ~HistogramUnit();
132         void process_package(LoadPackage *package);
133         HistogramEngine *server;
134         HistogramMain *plugin;
135         int *accum[5];
136 };
137
138 class HistogramEngine : public LoadServer
139 {
140 public:
141         HistogramEngine(HistogramMain *plugin,
142                 int total_clients,
143                 int total_packages);
144         void process_packages(int operation, VFrame *data, int do_value);
145         void init_packages();
146         LoadClient* new_client();
147         LoadPackage* new_package();
148         HistogramMain *plugin;
149         int total_size;
150
151
152         int operation;
153         enum
154         {
155                 HISTOGRAM,
156                 APPLY
157         };
158         VFrame *data;
159         int do_value;
160 };
161
162
163
164
165
166
167
168
169
170
171
172 #endif