r878: This is Cinelerra 2.1.
[cinelerra_cv/ct.git] / guicast / rotateframe.h
blobc7329fb738dd6dafe3809fa514e963fe3b96c0d5
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 // angle is 0 - 360
22 void rotate(VFrame *output,
23 VFrame *input,
24 double angle,
25 int interpolate);
26 int rotate_rightangle(VFrame *input,
27 VFrame *output,
28 int angle);
29 int rotate_obliqueangle(VFrame *input,
30 VFrame *output,
31 double angle,
32 int interpolate);
33 int get_rightdimensions(VFrame *frame,
34 int &diameter,
35 int &in_x1,
36 int &in_y1,
37 int &in_x2,
38 int &in_y2,
39 int &out_x1,
40 int &out_y1,
41 int &out_x2,
42 int &out_y2);
44 int cpus;
45 RotateEngine **engine;
46 // Matrix of source pixel offsets
47 int *int_matrix, **int_rows;
48 // Interpolation uses input coordinates for each output coordinate.
49 SourceCoord *float_matrix, **float_rows;
50 VFrame *output, *input;
51 int interpolate;
52 int last_interpolate;
53 // Compare new angle with old angle
54 double last_angle;
55 double angle;
59 class RotateEngine : public Thread
61 public:
62 RotateEngine(RotateFrame *plugin, int row1, int row2);
63 ~RotateEngine();
65 int generate_matrix(int interpolate);
66 int perform_rotation(VFrame *input,
67 VFrame *output,
68 int interpolate);
69 int wait_completion();
70 int create_matrix();
71 int coords_to_pixel(int &input_y, int &input_x);
72 int coords_to_pixel(SourceCoord &float_pixel, float &input_y, float &input_x);
73 int perform_rotation();
74 void run();
76 int row1, row2;
77 int interpolate;
78 int do_matrix, do_rotation;
79 int done;
80 RotateFrame *plugin;
81 Condition *input_lock;
82 Condition *output_lock;
83 VFrame *output;
84 VFrame *input;
87 #endif