yuv colorspace/range + prefs, ffmpeg colorrange probe, x11 direct force colormodel...
[goodguy/history.git] / cinelerra-5.1 / plugins / histogram_bezier / bistogram.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 "bistogram.inc"
27 #include "bistogramconfig.h"
28 #include "bistogramwindow.inc"
29 #include "loadbalance.h"
30 #include "bccolors.h"
31 #include "pluginvclient.h"
32
33
34 enum
35 {
36   HISTOGRAM_LINEAR,
37   HISTOGRAM_POLYNOMINAL,
38   HISTOGRAM_BEZIER,
39 };
40
41
42 class HistogramMain : public PluginVClient
43 {
44 public:
45         HistogramMain(PluginServer *server);
46         ~HistogramMain();
47
48         int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
49         int is_realtime();
50         void save_data(KeyFrame *keyframe);
51         void read_data(KeyFrame *keyframe);
52         void update_gui();
53         void render_gui(void *data);
54
55         PLUGIN_CLASS_MEMBERS(HistogramConfig)
56
57 // Convert input to linear output
58         float calculate_linear(float input, int mode, int do_value);
59         float calculate_smooth(float input, int subscript);
60 // Convert input to smoothed output by looking up in smooth table.
61         float calculate_curve(float input);
62 // Calculate automatic settings
63         void calculate_automatic(VFrame *data);
64 // Calculate histogram
65         void calculate_histogram(VFrame *data);
66 // Calculate the linear, smoothed, lookup curves
67         void tabulate_curve(int subscript, int use_value);
68
69
70
71         VFrame *input, *output;
72         HistogramEngine *engine;
73         int *lookup[HISTOGRAM_MODES];
74         float *smoothed[HISTOGRAM_MODES];
75         float *linear[HISTOGRAM_MODES];
76         int *accum[HISTOGRAM_MODES];
77 // Input point being dragged or edited
78         int current_point;
79 // Current channel being viewed
80         int mode;
81         int dragging_point;
82         int point_x_offset;
83         int point_y_offset;
84 };
85
86 class HistogramPackage : public LoadPackage
87 {
88 public:
89         HistogramPackage();
90         int start, end;
91 };
92
93 class HistogramUnit : public LoadClient
94 {
95 public:
96         HistogramUnit(HistogramEngine *server, HistogramMain *plugin);
97         ~HistogramUnit();
98         void process_package(LoadPackage *package);
99         HistogramEngine *server;
100         HistogramMain *plugin;
101         int *accum[5];
102 };
103
104 class HistogramEngine : public LoadServer
105 {
106 public:
107         HistogramEngine(HistogramMain *plugin,
108                 int total_clients,
109                 int total_packages);
110         void process_packages(int operation, VFrame *data);
111         void init_packages();
112         LoadClient* new_client();
113         LoadPackage* new_package();
114         HistogramMain *plugin;
115         int total_size;
116
117
118         int operation;
119         enum
120         {
121                 HISTOGRAM,
122                 APPLY
123         };
124         VFrame *data;
125 };
126
127
128
129
130
131
132
133
134
135
136
137 #endif