00001 #ifndef POLAR_H
00002 #define POLAR_H
00003
00004 #define MAXDEPTH 100
00005 #define MAXANGLE 360
00006
00007 class PolarMain;
00008 class PolarEngine;
00009
00010 #include "bcbase.h"
00011 #include "polarwindow.h"
00012 #include "pluginvclient.h"
00013
00014
00015 class PolarMain : public PluginVClient
00016 {
00017 public:
00018 PolarMain(int argc, char *argv[]);
00019 ~PolarMain();
00020
00021
00022 int process_realtime(long size, VFrame **input_ptr, VFrame **output_ptr);
00023 int plugin_is_realtime();
00024 int plugin_is_multi_channel();
00025 char* plugin_title();
00026 int start_gui();
00027 int stop_gui();
00028 int show_gui();
00029 int hide_gui();
00030 int set_string();
00031 int load_defaults();
00032 int save_defaults();
00033 int save_data(char *text);
00034 int read_data(char *text);
00035
00036
00037 int reconfigure();
00038 int depth;
00039 int angle;
00040 int polar_to_rectangular;
00041 int backwards;
00042 int inverse;
00043 int automated_function;
00044 int reconfigure_flag;
00045 VFrame *temp_frame;
00046
00047
00048 PolarThread *thread;
00049
00050 private:
00051 BC_Hash *defaults;
00052 PolarEngine **engine;
00053 };
00054
00055 class PolarEngine : public Thread
00056 {
00057 public:
00058 PolarEngine(PolarMain *plugin, int start_y, int end_y);
00059 ~PolarEngine();
00060
00061 int start_process_frame(VFrame **output, VFrame **input, int size);
00062 int wait_process_frame();
00063 void run();
00064 void get_pixel(const int &x, const int &y, VPixel *pixel, VPixel **input_rows);
00065 int calc_undistorted_coords(int wx,
00066 int wy,
00067 double &x,
00068 double &y);
00069 inline VWORD bilinear(double &x, double &y, VWORD *values)
00070 {
00071 double m0, m1;
00072 x = fmod(x, 1.0);
00073 y = fmod(y, 1.0);
00074
00075 if(x < 0.0) x += 1.0;
00076 if(y < 0.0) y += 1.0;
00077
00078 m0 = (double)values[0] + x * ((double)values[1] - values[0]);
00079 m1 = (double)values[2] + x * ((double)values[3] - values[2]);
00080 return (VWORD)(m0 + y * (m1 - m0));
00081 }
00082
00083 PolarMain *plugin;
00084 int start_y;
00085 int end_y;
00086 int size;
00087 double cen_x, cen_y;
00088 VFrame **output, **input;
00089 int last_frame;
00090 Mutex input_lock, output_lock;
00091 };
00092
00093
00094 #endif