merge hv v6, rework trace methods
[goodguy/history.git] / cinelerra-5.1 / plugins / motion / rotatescan.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2016 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22
23
24
25 #ifndef ROTATESCAN_H
26 #define ROTATESCAN_H
27
28
29
30 #include "affine.inc"
31 #include "loadbalance.h"
32 #include "motion.inc"
33 #include "vframe.inc"
34 #include <stdint.h>
35
36 class RotateScan;
37
38
39 class RotateScanPackage : public LoadPackage
40 {
41 public:
42         RotateScanPackage();
43         float angle;
44         int64_t difference;
45 };
46
47 class RotateScanCache
48 {
49 public:
50         RotateScanCache(float angle, int64_t difference);
51         float angle;
52         int64_t difference;
53 };
54
55 class RotateScanUnit : public LoadClient
56 {
57 public:
58         RotateScanUnit(RotateScan *server, MotionMain *plugin);
59         ~RotateScanUnit();
60
61         void process_package(LoadPackage *package);
62
63         RotateScan *server;
64         MotionMain *plugin;
65         AffineEngine *rotater;
66         VFrame *temp;
67 };
68
69 class RotateScan : public LoadServer
70 {
71 public:
72         RotateScan(MotionMain *plugin,
73                 int total_clients,
74                 int total_packages);
75         ~RotateScan();
76
77         friend class RotateScanUnit;
78
79         void init_packages();
80         LoadClient* new_client();
81         LoadPackage* new_package();
82
83 // Invoke the motion engine for a search
84 // Frame before rotation
85         float scan_frame(VFrame *previous_frame,
86 // Frame after rotation
87                 VFrame *current_frame,
88 // Pivot
89                 int block_x,
90                 int block_y);
91         int64_t get_cache(float angle);
92         void put_cache(float angle, int64_t difference);
93
94
95 // Angle result
96         float result;
97
98 private:
99         VFrame *previous_frame;
100 // Frame after motion
101         VFrame *current_frame;
102
103         MotionMain *plugin;
104         int skip;
105
106 // Pivot
107         int block_x;
108         int block_y;
109 // Block to rotate
110         int block_x1;
111         int block_x2;
112         int block_y1;
113         int block_y2;
114 // Area to compare
115         int scan_x;
116         int scan_y;
117         int scan_w;
118         int scan_h;
119 // Range of angles to compare
120         float scan_angle1, scan_angle2;
121         int total_steps;
122
123         ArrayList<RotateScanCache*> cache;
124         Mutex *cache_lock;
125 };
126
127
128
129
130
131 #endif
132
133
134
135
136