2 * C41 plugin for Cinelerra
3 * Copyright (C) 2011 Florent Delannoy <florent at plui dot es>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "pluginvclient.h"
27 // C41_FAST_POW increases processing speed more than 10 times
28 // Depending on gcc version, used optimizations and cpu C41_FAST_POW may not work
29 // With gcc versiion >= 4.4 it seems safe to enable C41_FAST_POW
30 // Test some samples after you have enabled it
39 // Shave the image in order to avoid black borders
40 // The min max pixel value difference must be at least 0.05
41 #define C41_SHAVE_TOLERANCE 0.05
42 #define C41_SHAVE_MARGIN 0.1
62 float gamma_g, gamma_b;
64 int shave_min_row, shave_max_row;
65 int shave_min_col, shave_max_col;
73 void copy_from(C41Config &src);
74 int equivalent(C41Config &src);
75 void interpolate(C41Config &prev, C41Config &next,
76 long prev_frame, long next_frame, long current_frame);
78 int active, compute_magic;
79 int postproc, show_box;
80 float fix_min_r, fix_min_g, fix_min_b;
81 float fix_light, fix_gamma_g, fix_gamma_b;
82 float fix_coef1, fix_coef2;
83 int min_col, max_col, min_row, max_row;
84 int window_w, window_h;
87 class C41Enable : public BC_CheckBox
90 C41Enable(C41Effect *plugin, int *output, int x, int y, const char *text);
97 class C41TextBox : public BC_TextBox
100 C41TextBox(C41Effect *plugin, float *value, int x, int y);
107 class C41Button : public BC_GenericButton
110 C41Button(C41Effect *plugin, C41Window *window, int x, int y);
117 class C41BoxButton : public BC_GenericButton
120 C41BoxButton(C41Effect *plugin, C41Window *window, int x, int y);
127 class C41Slider : public BC_ISlider
130 C41Slider(C41Effect *plugin, int *output, int x, int y, int is_row);
140 class C41Window : public PluginClientWindow
143 C41Window(C41Effect *client);
144 void create_objects();
150 C41Enable *compute_magic;
161 BC_Title *box_col_min;
162 BC_Title *box_col_max;
163 BC_Title *box_row_min;
164 BC_Title *box_row_max;
165 C41TextBox *fix_min_r;
166 C41TextBox *fix_min_g;
167 C41TextBox *fix_min_b;
168 C41TextBox *fix_light;
169 C41TextBox *fix_gamma_g;
170 C41TextBox *fix_gamma_b;
171 C41TextBox *fix_coef1;
172 C41TextBox *fix_coef2;
174 C41BoxButton *boxlock;
184 class C41Effect : public PluginVClient
187 C41Effect(PluginServer *server);
190 PLUGIN_CLASS_MEMBERS(C41Config);
194 int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
195 void save_data(KeyFrame *keyframe);
196 void read_data(KeyFrame *keyframe);
197 void render_gui(void* data);
198 #if defined(C41_FAST_POW)
199 float myLog2(float i) __attribute__ ((optimize(0)));
200 float myPow2(float i) __attribute__ ((optimize(0)));
201 float myPow(float a, float b);
203 void pix_fix(float &pix, float min, float gamma);
204 VFrame *frame, *tmp_frame, *blurry_frame;
207 int shave_min_row, shave_max_row, shave_min_col, shave_max_col;
208 int min_col, max_col, min_row, max_row;