00001 #ifndef BLUR_H
00002 #define BLUR_H
00003
00004 class BlurMain;
00005 class BlurEngine;
00006
00007 #define MAXRADIUS 100
00008
00009 #include "blurwindow.inc"
00010 #include "bchash.inc"
00011 #include "mutex.h"
00012 #include "pluginvclient.h"
00013 #include "thread.h"
00014 #include "vframe.inc"
00015
00016 typedef struct
00017 {
00018 float r;
00019 float g;
00020 float b;
00021 float a;
00022 } pixel_f;
00023
00024 class BlurConfig
00025 {
00026 public:
00027 BlurConfig();
00028
00029 int equivalent(BlurConfig &that);
00030 void copy_from(BlurConfig &that);
00031 void interpolate(BlurConfig &prev,
00032 BlurConfig &next,
00033 int64_t prev_frame,
00034 int64_t next_frame,
00035 int64_t current_frame);
00036
00037 int vertical;
00038 int horizontal;
00039 int radius;
00040 int a, r ,g ,b;
00041 };
00042
00043 class BlurMain : public PluginVClient
00044 {
00045 public:
00046 BlurMain(PluginServer *server);
00047 ~BlurMain();
00048
00049
00050 int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
00051 int is_realtime();
00052 int load_defaults();
00053 int save_defaults();
00054 void save_data(KeyFrame *keyframe);
00055 void read_data(KeyFrame *keyframe);
00056 void update_gui();
00057
00058 PLUGIN_CLASS_MEMBERS(BlurConfig, BlurThread)
00059
00060 int need_reconfigure;
00061
00062
00063 VFrame *temp, *input, *output;
00064
00065 private:
00066 BlurEngine **engine;
00067 };
00068
00069
00070 class BlurEngine : public Thread
00071 {
00072 public:
00073 BlurEngine(BlurMain *plugin, int start_y, int end_y);
00074 ~BlurEngine();
00075
00076 void run();
00077 int start_process_frame(VFrame *output, VFrame *input);
00078 int wait_process_frame();
00079
00080
00081 int get_constants();
00082 int reconfigure();
00083 int transfer_pixels(pixel_f *src1, pixel_f *src2, pixel_f *dest, int size);
00084 int multiply_alpha(pixel_f *row, int size);
00085 int separate_alpha(pixel_f *row, int size);
00086 int blur_strip3(int &size);
00087 int blur_strip4(int &size);
00088
00089 int color_model;
00090 float vmax;
00091 pixel_f *val_p, *val_m, *vp, *vm;
00092 pixel_f *sp_p, *sp_m;
00093 float n_p[5], n_m[5];
00094 float d_p[5], d_m[5];
00095 float bd_p[5], bd_m[5];
00096 float std_dev;
00097 pixel_f *src, *dst;
00098 pixel_f initial_p;
00099 pixel_f initial_m;
00100 int terms;
00101 BlurMain *plugin;
00102
00103 int start_in, start_out;
00104 int end_in, end_out;
00105 VFrame *output, *input;
00106 int last_frame;
00107 Mutex input_lock, output_lock;
00108 };
00109
00110 #endif