1c2a2c10119339a80b89b1c202bc5b4f4f7c59cd
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / yuvshift / yuvshift.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 YUVSHIFT_H
23 #define YUVSHIFT_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 "bccolors.h"
32 #include "pluginvclient.h"
33 #include "vframe.h"
34
35 #include <stdint.h>
36 #include <string.h>
37
38 #define RESET_ALL  0
39 #define RESET_Y_DX 1
40 #define RESET_Y_DY 2
41 #define RESET_U_DX 3
42 #define RESET_U_DY 4
43 #define RESET_V_DX 5
44 #define RESET_V_DY 6
45
46 class YUVShiftEffect;
47 class YUVShiftWindow;
48 class YUVShiftReset;
49 class YUVShiftSliderClr;
50
51
52 class YUVShiftConfig
53 {
54 public:
55         YUVShiftConfig();
56
57         void reset(int clear);
58         void copy_from(YUVShiftConfig &src);
59         int equivalent(YUVShiftConfig &src);
60         void interpolate(YUVShiftConfig &prev,
61                 YUVShiftConfig &next,
62                 long prev_frame,
63                 long next_frame,
64                 long current_frame);
65
66         int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy;
67 };
68
69 class YUVShiftLevel : public BC_ISlider
70 {
71 public:
72         YUVShiftLevel(YUVShiftEffect *plugin, int *output, int x, int y);
73         int handle_event();
74         YUVShiftEffect *plugin;
75         int *output;
76 };
77
78 class YUVShiftReset : public BC_GenericButton
79 {
80 public:
81         YUVShiftReset(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y);
82         ~YUVShiftReset();
83         int handle_event();
84         YUVShiftEffect *plugin;
85         YUVShiftWindow *window;
86 };
87
88 class YUVShiftSliderClr : public BC_GenericButton
89 {
90 public:
91         YUVShiftSliderClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int w, int clear);
92         ~YUVShiftSliderClr();
93         int handle_event();
94         YUVShiftEffect *plugin;
95         YUVShiftWindow *window;
96         int clear;
97 };
98
99 class YUVShiftWindow : public PluginClientWindow
100 {
101 public:
102         YUVShiftWindow(YUVShiftEffect *plugin);
103         void create_objects();
104         void update_gui(int clear);
105         YUVShiftLevel *y_dx, *y_dy, *u_dx, *u_dy, *v_dx, *v_dy;
106         YUVShiftEffect *plugin;
107         YUVShiftReset *reset;
108         YUVShiftSliderClr *y_dxClr, *y_dyClr;
109         YUVShiftSliderClr *u_dxClr, *u_dyClr;
110         YUVShiftSliderClr *v_dxClr, *v_dyClr;
111 };
112
113
114
115 class YUVShiftEffect : public PluginVClient
116 {
117         VFrame *temp_frame;
118 public:
119         YUVShiftEffect(PluginServer *server);
120         ~YUVShiftEffect();
121
122
123         PLUGIN_CLASS_MEMBERS(YUVShiftConfig)
124         int process_realtime(VFrame *input, VFrame *output);
125         int is_realtime();
126         void save_data(KeyFrame *keyframe);
127         void read_data(KeyFrame *keyframe);
128         void update_gui();
129 };
130
131 #endif