4 * Copyright (C) 1997-2011 Adam Williams <broadcast at earthling dot net>
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.
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.
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
26 #include "histogram.inc"
27 #include "histogramconfig.h"
28 #include "histogramwindow.inc"
29 #include "loadbalance.h"
31 #include "pluginvclient.h"
34 class HistogramMain : public PluginVClient
37 HistogramMain(PluginServer *server);
40 int process_buffer(VFrame *frame,
41 int64_t start_position,
44 void save_data(KeyFrame *keyframe);
45 void read_data(KeyFrame *keyframe);
47 void render_gui(void *data);
48 void do_render_gui(HistogramWindow *gui);
49 int calculate_use_opengl();
52 PLUGIN_CLASS_MEMBERS(HistogramConfig)
54 // Interpolate quantized transfer table to linear output
55 float calculate_level(float input, int mode, int do_value);
56 // Convert input to smoothed output by looking up in smooth table.
57 float calculate_curve(float input);
58 // Calculate automatic settings
59 void calculate_automatic(VFrame *data);
60 // Calculate histogram.
61 // Value is only calculated for preview.
62 void calculate_histogram(VFrame *data, int do_value);
63 // Calculate the linear, smoothed, lookup curves
64 void tabulate_curve(int **table, int idx, int use_value, int len);
65 void tabulate_curve(int **table, int use_value, int len=-1);
68 VFrame *input, *output;
69 HistogramEngine *engine;
72 int *lookup[HISTOGRAM_MODES];
73 // No value applied to this
74 int *preview_lookup[HISTOGRAM_MODES];
75 int64_t *accum[HISTOGRAM_MODES];
76 // Input point being dragged or edited
78 // Current channel being viewed
85 int64_t last_position;
86 int sum_frames, frames;
90 class HistogramPackage : public LoadPackage
97 class HistogramUnit : public LoadClient
100 HistogramUnit(HistogramEngine *server, HistogramMain *plugin);
102 void process_package(LoadPackage *package);
103 HistogramEngine *server;
104 HistogramMain *plugin;
105 int64_t *accum[HISTOGRAM_MODES];
108 class HistogramEngine : public LoadServer
111 HistogramEngine(HistogramMain *plugin,
114 void process_packages(int operation, VFrame *data, int do_value);
115 void init_packages();
116 LoadClient* new_client();
117 LoadPackage* new_package();
118 HistogramMain *plugin;