r1008: pt_BR translation update
[cinelerra_cv/mob.git] / plugins / whirl / whirl.h
blobe607d61a51b968fbd8e8871f6f58cc4ef5b3cbfa
1 #ifndef WHIRL_H
2 #define WHIRL_H
4 #define MAXANGLE 360
5 #define MAXPINCH 100
6 #define MAXRADIUS 100
8 class WhirlMain;
9 class WhirlEngine;
11 #include "bcbase.h"
12 #include "whirlwindow.h"
13 #include "pluginvclient.h"
16 class WhirlMain : public PluginVClient
18 public:
19 WhirlMain(int argc, char *argv[]);
20 ~WhirlMain();
22 // required for all realtime plugins
23 int process_realtime(long size, VFrame **input_ptr, VFrame **output_ptr);
24 int plugin_is_realtime();
25 int plugin_is_multi_channel();
26 char* plugin_title();
27 int start_realtime();
28 int stop_realtime();
29 int start_gui();
30 int stop_gui();
31 int show_gui();
32 int hide_gui();
33 int set_string();
34 int load_defaults();
35 int save_defaults();
36 int save_data(char *text);
37 int read_data(char *text);
39 // parameters needed
40 int reconfigure(); // Rebuild tables
41 int angle;
42 int pinch;
43 int radius;
44 int automated_function;
45 int reconfigure_flag;
46 VFrame *temp_frame;
48 // a thread for the GUI
49 WhirlThread *thread;
51 private:
52 BC_Hash *defaults;
53 WhirlEngine **engine;
56 class WhirlEngine : public Thread
58 public:
59 WhirlEngine(WhirlMain *plugin, int start_y, int end_y);
60 ~WhirlEngine();
62 int start_process_frame(VFrame **output, VFrame **input, int size);
63 int wait_process_frame();
64 void run();
66 int calc_undistorted_coords(double wx,
67 double wy,
68 double &whirl,
69 double &pinch,
70 double &x,
71 double &y);
72 inline VWORD bilinear(double x, double y, VWORD *values)
74 double m0, m1;
75 x = fmod(x, 1.0);
76 y = fmod(y, 1.0);
78 if(x < 0.0) x += 1.0;
79 if(y < 0.0) y += 1.0;
81 m0 = (double)values[0] + x * ((double)values[1] - values[0]);
82 m1 = (double)values[2] + x * ((double)values[3] - values[2]);
83 return (VWORD)(m0 + y * (m1 - m0));
85 void get_pixel(const int &x, const int &y, VPixel *pixel, VPixel **input_rows);
87 WhirlMain *plugin;
88 int start_y;
89 int end_y;
90 int size;
91 VFrame **output, **input;
92 int last_frame;
93 Mutex input_lock, output_lock;
94 double radius, radius2, radius3, pinch;
95 double scale_x, scale_y;
96 double cen_x, cen_y;
100 #endif