4bba77e210811a841bd6ac71259a364ea4236b6a
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / shiftinterlace / shiftinterlace.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 SHIFTINTERLACE_H
23 #define SHIFTINTERLACE_H
24
25 #include "bcdisplayinfo.h"
26 #include "clip.h"
27 #include "bchash.h"
28 #include "filexml.h"
29 #include "guicast.h"
30 #include "language.h"
31 #include "pluginvclient.h"
32 #include "vframe.h"
33
34
35
36 #include <stdint.h>
37 #include <string.h>
38
39
40 #define RESET_ALL 0
41 #define RESET_ODD_OFFSET  1
42 #define RESET_EVEN_OFFSET 2
43
44
45 class ShiftInterlaceWindow;
46 class ShiftInterlaceMain;
47
48 class ShiftInterlaceConfig
49 {
50 public:
51         ShiftInterlaceConfig();
52
53         void reset(int clear);
54         int equivalent(ShiftInterlaceConfig &that);
55         void copy_from(ShiftInterlaceConfig &that);
56         void interpolate(ShiftInterlaceConfig &prev,
57                 ShiftInterlaceConfig &next,
58                 long prev_frame,
59                 long next_frame,
60                 long current_frame);
61
62
63         int odd_offset;
64         int even_offset;
65 };
66
67
68 class ShiftInterlaceOdd : public BC_ISlider
69 {
70 public:
71         ShiftInterlaceOdd(ShiftInterlaceMain *plugin, int x, int y);
72         int handle_event();
73         ShiftInterlaceMain *plugin;
74 };
75
76 class ShiftInterlaceEven : public BC_ISlider
77 {
78 public:
79         ShiftInterlaceEven(ShiftInterlaceMain *plugin, int x, int y);
80         int handle_event();
81         ShiftInterlaceMain *plugin;
82 };
83
84 class ShiftInterlaceReset : public BC_GenericButton
85 {
86 public:
87         ShiftInterlaceReset(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y);
88         ~ShiftInterlaceReset();
89         int handle_event();
90         ShiftInterlaceMain *plugin;
91         ShiftInterlaceWindow *gui;
92 };
93
94 class ShiftInterlaceSliderClr : public BC_GenericButton
95 {
96 public:
97         ShiftInterlaceSliderClr(ShiftInterlaceMain *plugin, ShiftInterlaceWindow *gui, int x, int y, int w, int clear);
98         ~ShiftInterlaceSliderClr();
99         int handle_event();
100         ShiftInterlaceMain *plugin;
101         ShiftInterlaceWindow *gui;
102         int clear;
103 };
104
105 class ShiftInterlaceWindow : public PluginClientWindow
106 {
107 public:
108         ShiftInterlaceWindow(ShiftInterlaceMain *plugin);
109
110         void create_objects();
111         void update_gui(int clear);
112
113         ShiftInterlaceOdd *odd_offset;
114         ShiftInterlaceEven *even_offset;
115         ShiftInterlaceMain *plugin;
116         ShiftInterlaceReset *reset;
117         ShiftInterlaceSliderClr *odd_offsetClr, *even_offsetClr;
118 };
119
120
121
122
123
124
125 class ShiftInterlaceMain : public PluginVClient
126 {
127 public:
128         ShiftInterlaceMain(PluginServer *server);
129         ~ShiftInterlaceMain();
130
131 // required for all realtime plugins
132         PLUGIN_CLASS_MEMBERS(ShiftInterlaceConfig)
133         int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
134         int is_realtime();
135         void update_gui();
136         void save_data(KeyFrame *keyframe);
137         void read_data(KeyFrame *keyframe);
138
139
140         void shift_row(VFrame *input_frame,
141                 VFrame *output_frame,
142                 int offset,
143                 int row);
144
145
146 };
147
148 #endif