b6d02d5ac2301f87a3144e3d11b8fa72c4d49278
[goodguy/history.git] / cinelerra-5.0 / plugins / interpolate / interpolate.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 #ifndef INTERPOLATEPIXELS_H
23 #define INTERPOLATEPIXELS_H
24
25 class InterpolatePixelsMain;
26
27 #define TOTAL_PATTERNS 2
28
29 #include "bchash.h"
30 #include "loadbalance.h"
31 #include "mutex.h"
32 #include "pluginvclient.h"
33 #include <sys/types.h>
34
35 class InterpolatePixelsConfig
36 {
37 public:
38         InterpolatePixelsConfig();
39     int equivalent(InterpolatePixelsConfig &that);
40     void copy_from(InterpolatePixelsConfig &that);
41     void interpolate(InterpolatePixelsConfig &prev,
42         InterpolatePixelsConfig &next,
43         int64_t prev_position,
44         int64_t next_position,
45         int64_t current_position);
46         int x, y;
47 };
48
49 class InterpolatePixelsThread;
50 class InterpolatePixelsWindow;
51 class InterpolatePixelsEngine;
52
53 class InterpolatePixelsOffset : public BC_ISlider
54 {
55 public:
56         InterpolatePixelsOffset(InterpolatePixelsWindow *window, 
57                 int x, 
58                 int y, 
59                 int *output);
60         ~InterpolatePixelsOffset();
61         
62         int handle_event();
63         InterpolatePixelsWindow *window;
64         int *output;
65 };
66
67 class InterpolatePixelsWindow : public PluginClientWindow
68 {
69 public:
70         InterpolatePixelsWindow(InterpolatePixelsMain *client);
71         ~InterpolatePixelsWindow();
72         
73         void create_objects();
74
75         InterpolatePixelsMain *client;
76         InterpolatePixelsOffset *x_offset;
77         InterpolatePixelsOffset *y_offset;
78 };
79
80
81 class InterpolatePixelsMain : public PluginVClient
82 {
83 public:
84         InterpolatePixelsMain(PluginServer *server);
85         ~InterpolatePixelsMain();
86
87         PLUGIN_CLASS_MEMBERS(InterpolatePixelsConfig);
88
89 // required for all realtime plugins
90         int process_buffer(VFrame *frame,
91                 int64_t start_position,
92                 double frame_rate);
93         int is_realtime();
94         void update_gui();
95         void save_data(KeyFrame *keyframe);
96         void read_data(KeyFrame *keyframe);
97         int handle_opengl();
98         
99         InterpolatePixelsEngine *engine;
100 };
101
102
103 class InterpolatePixelsPackage : public LoadPackage
104 {
105 public:
106         InterpolatePixelsPackage();
107         int y1, y2;
108 };
109
110 class InterpolatePixelsUnit : public LoadClient
111 {
112 public:
113         InterpolatePixelsUnit(InterpolatePixelsEngine *server, InterpolatePixelsMain *plugin);
114         void process_package(LoadPackage *package);
115         InterpolatePixelsEngine *server;
116         InterpolatePixelsMain *plugin;
117 };
118
119 class InterpolatePixelsEngine : public LoadServer
120 {
121 public:
122         InterpolatePixelsEngine(InterpolatePixelsMain *plugin);
123         void init_packages();
124         LoadClient* new_client();
125         LoadPackage* new_package();
126         InterpolatePixelsMain *plugin;
127         float color_matrix[9];
128 };
129
130
131 #endif