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"
51 int equivalent(BlurConfig &that);
52 void copy_from(BlurConfig &that);
53 void interpolate(BlurConfig &prev,
57 int64_t current_frame);
66 class BlurMain : public PluginVClient
69 BlurMain(PluginServer *server);
72 // required for all realtime plugins
73 int process_buffer(VFrame *frame,
74 int64_t start_position,
77 void save_data(KeyFrame *keyframe);
78 void read_data(KeyFrame *keyframe);
81 PLUGIN_CLASS_MEMBERS(BlurConfig)
87 OverlayFrame *overlayer;
95 double n_p[5], n_m[5];
96 double d_p[5], d_m[5];
97 double bd_p[5], bd_m[5];
100 class BlurEngine : public Thread
103 BlurEngine(BlurMain *plugin);
107 void set_range(int start_y,
111 int start_process_frame(VFrame *frame);
112 int wait_process_frame();
114 // parameters needed for blur
115 int get_constants(BlurConstants *ptr, double std_dev);
116 int reconfigure(BlurConstants *constants, double alpha);
117 int transfer_pixels(pixel_f *src1,
123 int multiply_alpha(pixel_f *row, int size);
124 int separate_alpha(pixel_f *row, int size);
125 int blur_strip3(int &size);
126 int blur_strip4(int &size);
130 pixel_f *val_p, *val_m;
132 BlurConstants forward_constants;
133 BlurConstants reverse_constants;
139 // A margin is introduced between the input and output to give a seemless transition between blurs
140 int start_y, start_x;
144 // Detect changes in alpha for alpha radius mode
145 double prev_forward_radius, prev_reverse_radius;
146 Mutex input_lock, output_lock;