r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / plugins / blur / blur.h
blobdd8a334aadb2f1c7ae12f717e00d1f0cbde74776
1 #ifndef BLUR_H
2 #define BLUR_H
4 class BlurMain;
5 class BlurEngine;
7 #define MAXRADIUS 100
9 #include "blurwindow.inc"
10 #include "defaults.inc"
11 #include "mutex.h"
12 #include "pluginvclient.h"
13 #include "thread.h"
14 #include "vframe.inc"
16 typedef struct
18 float r;
19 float g;
20 float b;
21 float a;
22 } pixel_f;
24 class BlurConfig
26 public:
27 BlurConfig();
29 int equivalent(BlurConfig &that);
30 void copy_from(BlurConfig &that);
31 void interpolate(BlurConfig &prev,
32 BlurConfig &next,
33 int64_t prev_frame,
34 int64_t next_frame,
35 int64_t current_frame);
37 int vertical;
38 int horizontal;
39 int radius;
40 int a, r ,g ,b;
43 class BlurMain : public PluginVClient
45 public:
46 BlurMain(PluginServer *server);
47 ~BlurMain();
49 // required for all realtime plugins
50 int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
51 int is_realtime();
52 int load_defaults();
53 int save_defaults();
54 void save_data(KeyFrame *keyframe);
55 void read_data(KeyFrame *keyframe);
56 void update_gui();
58 PLUGIN_CLASS_MEMBERS(BlurConfig, BlurThread)
60 int need_reconfigure;
62 // a thread for the GUI
63 VFrame *temp, *input, *output;
65 private:
66 BlurEngine **engine;
70 class BlurEngine : public Thread
72 public:
73 BlurEngine(BlurMain *plugin, int start_y, int end_y);
74 ~BlurEngine();
76 void run();
77 int start_process_frame(VFrame *output, VFrame *input);
78 int wait_process_frame();
80 // parameters needed for blur
81 int get_constants();
82 int reconfigure();
83 int transfer_pixels(pixel_f *src1, pixel_f *src2, pixel_f *dest, int size);
84 int multiply_alpha(pixel_f *row, int size);
85 int separate_alpha(pixel_f *row, int size);
86 int blur_strip3(int &size);
87 int blur_strip4(int &size);
89 int color_model;
90 int vmax;
91 pixel_f *val_p, *val_m, *vp, *vm;
92 pixel_f *sp_p, *sp_m;
93 float n_p[5], n_m[5];
94 float d_p[5], d_m[5];
95 float bd_p[5], bd_m[5];
96 float std_dev;
97 pixel_f *src, *dst;
98 pixel_f initial_p;
99 pixel_f initial_m;
100 int terms;
101 BlurMain *plugin;
102 // A margin is introduced between the input and output to give a seemless transition between blurs
103 int start_in, start_out;
104 int end_in, end_out;
105 VFrame *output, *input;
106 int last_frame;
107 Mutex input_lock, output_lock;
110 #endif