00001 #ifndef ROTATEFRAME_H
00002 #define ROTATEFRAME_H
00003
00004 #include "condition.inc"
00005 #include "thread.h"
00006 #include "vframe.inc"
00007
00008 class RotateEngine;
00009
00010 typedef struct
00011 {
00012 float x, y;
00013 } SourceCoord;
00014
00015 class RotateFrame
00016 {
00017 public:
00018 RotateFrame(int cpus, int width, int height);
00019 ~RotateFrame();
00020
00021
00022 void rotate(VFrame *output,
00023 VFrame *input,
00024 double angle,
00025 int interpolate);
00026 int rotate_rightangle(VFrame *input,
00027 VFrame *output,
00028 int angle);
00029 int rotate_obliqueangle(VFrame *input,
00030 VFrame *output,
00031 double angle,
00032 int interpolate);
00033 int get_rightdimensions(VFrame *frame,
00034 int &diameter,
00035 int &in_x1,
00036 int &in_y1,
00037 int &in_x2,
00038 int &in_y2,
00039 int &out_x1,
00040 int &out_y1,
00041 int &out_x2,
00042 int &out_y2);
00043
00044 int cpus;
00045 RotateEngine **engine;
00046
00047 int *int_matrix, **int_rows;
00048
00049 SourceCoord *float_matrix, **float_rows;
00050 VFrame *output, *input;
00051 int interpolate;
00052 int last_interpolate;
00053
00054 double last_angle;
00055 double angle;
00056 };
00057
00058
00059 class RotateEngine : public Thread
00060 {
00061 public:
00062 RotateEngine(RotateFrame *plugin, int row1, int row2);
00063 ~RotateEngine();
00064
00065 int generate_matrix(int interpolate);
00066 int perform_rotation(VFrame *input,
00067 VFrame *output,
00068 int interpolate);
00069 int wait_completion();
00070 int create_matrix();
00071 int coords_to_pixel(int &input_y, int &input_x);
00072 int coords_to_pixel(SourceCoord &float_pixel, float &input_y, float &input_x);
00073 int perform_rotation();
00074 void run();
00075
00076 int row1, row2;
00077 int interpolate;
00078 int do_matrix, do_rotation;
00079 int done;
00080 RotateFrame *plugin;
00081 Condition *input_lock;
00082 Condition *output_lock;
00083 VFrame *output;
00084 VFrame *input;
00085 };
00086
00087 #endif