4 * Copyright (C) 2010 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
30 #include "blurwindow.inc"
33 #include "overlayframe.h"
34 #include "pluginvclient.h"
52 int equivalent(BlurConfig &that);
53 void copy_from(BlurConfig &that);
54 void interpolate(BlurConfig &prev,
58 int64_t current_frame);
67 class BlurMain : public PluginVClient
70 BlurMain(PluginServer *server);
73 // required for all realtime plugins
74 int process_buffer(VFrame *frame,
75 int64_t start_position,
78 void save_data(KeyFrame *keyframe);
79 void read_data(KeyFrame *keyframe);
82 PLUGIN_CLASS_MEMBERS(BlurConfig)
88 OverlayFrame *overlayer;
96 double n_p[5], n_m[5];
97 double d_p[5], d_m[5];
98 double bd_p[5], bd_m[5];
101 class BlurEngine : public Thread
104 BlurEngine(BlurMain *plugin);
108 void set_range(int start_y,
112 int start_process_frame(VFrame *frame);
113 int wait_process_frame();
115 // parameters needed for blur
116 int get_constants(BlurConstants *ptr, double std_dev);
117 int reconfigure(BlurConstants *constants, double alpha);
118 int transfer_pixels(pixel_f *src1,
124 int multiply_alpha(pixel_f *row, int size);
125 int separate_alpha(pixel_f *row, int size);
126 int blur_strip3(int &size);
127 int blur_strip4(int &size);
131 pixel_f *val_p, *val_m;
133 BlurConstants forward_constants;
134 BlurConstants reverse_constants;
140 // A margin is introduced between the input and output to give a seemless transition between blurs
141 int start_y, start_x;
145 // Detect changes in alpha for alpha radius mode
146 double prev_forward_radius, prev_reverse_radius;
147 Mutex input_lock, output_lock;