r419: various fixes, memory allocations, etc.
[cinelerra_cv/mob.git] / guicast / rotateframe.h
blob1fa630b21f6005b0637484c42b7c7f20746660d0
1 #ifndef ROTATEFRAME_H
2 #define ROTATEFRAME_H
4 #include "condition.inc"
5 #include "thread.h"
6 #include "vframe.inc"
8 class RotateEngine;
10 typedef struct
12 float x, y;
13 } SourceCoord;
15 class RotateFrame
17 public:
18 RotateFrame(int cpus, int width, int height);
19 ~RotateFrame();
21 void rotate(VFrame *output, VFrame *input, double angle, int interpolate);
22 int rotate_rightangle(VFrame *input,
23 VFrame *output,
24 int angle);
25 int rotate_obliqueangle(VFrame *input,
26 VFrame *output,
27 double angle,
28 int interpolate);
29 int get_rightdimensions(VFrame *frame,
30 int &diameter,
31 int &in_x1,
32 int &in_y1,
33 int &in_x2,
34 int &in_y2,
35 int &out_x1,
36 int &out_y1,
37 int &out_x2,
38 int &out_y2);
40 int cpus;
41 RotateEngine **engine;
42 // Matrix of source pixel offsets
43 int *int_matrix, **int_rows;
44 // Interpolation uses input coordinates for each output coordinate.
45 SourceCoord *float_matrix, **float_rows;
46 VFrame *output, *input;
47 int interpolate;
48 int last_interpolate;
49 // Compare new angle with old angle
50 double last_angle;
51 double angle;
55 class RotateEngine : public Thread
57 public:
58 RotateEngine(RotateFrame *plugin, int row1, int row2);
59 ~RotateEngine();
61 int generate_matrix(int interpolate);
62 int perform_rotation(VFrame *input,
63 VFrame *output,
64 int interpolate);
65 int wait_completion();
66 int create_matrix();
67 int coords_to_pixel(int &input_y, int &input_x);
68 int coords_to_pixel(SourceCoord &float_pixel, float &input_y, float &input_x);
69 int perform_rotation();
70 void run();
72 int row1, row2;
73 int interpolate;
74 int do_matrix, do_rotation;
75 int done;
76 RotateFrame *plugin;
77 Condition *input_lock;
78 Condition *output_lock;
79 VFrame *output;
80 VFrame *input;
83 #endif