no longer need ffmpeg patch0 which was for Termux
[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 "theme.h"
34 #include "vframe.h"
35
36 #include <stdint.h>
37 #include <string.h>
38
39 #define MAXVALUE 100
40
41 #define RESET_ALL  0
42 #define RESET_Y_DX 1
43 #define RESET_Y_DY 2
44 #define RESET_U_DX 3
45 #define RESET_U_DY 4
46 #define RESET_V_DX 5
47 #define RESET_V_DY 6
48
49 class YUVShiftEffect;
50 class YUVShiftWindow;
51 class YUVShiftIText;
52 class YUVShiftISlider;
53 class YUVShiftReset;
54 class YUVShiftClr;
55
56
57 class YUVShiftConfig
58 {
59 public:
60         YUVShiftConfig();
61
62         void reset(int clear);
63         void copy_from(YUVShiftConfig &src);
64         int equivalent(YUVShiftConfig &src);
65         void interpolate(YUVShiftConfig &prev,
66                 YUVShiftConfig &next,
67                 long prev_frame,
68                 long next_frame,
69                 long current_frame);
70
71         int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy;
72 };
73
74 class YUVShiftIText : public BC_TumbleTextBox
75 {
76 public:
77         YUVShiftIText(YUVShiftWindow *window, YUVShiftEffect *plugin,
78                 YUVShiftISlider *slider, int *output, int x, int y, int min, int max);
79         ~YUVShiftIText();
80         int handle_event();
81         YUVShiftWindow *window;
82         YUVShiftEffect *plugin;
83         YUVShiftISlider *slider;
84         int *output;
85         int min, max;
86 };
87
88 class YUVShiftISlider : public BC_ISlider
89 {
90 public:
91         YUVShiftISlider(YUVShiftEffect *plugin, YUVShiftIText *text, int *output, int x, int y);
92         int handle_event();
93         YUVShiftEffect *plugin;
94         YUVShiftIText *text;
95         int *output;
96 };
97
98 class YUVShiftReset : public BC_GenericButton
99 {
100 public:
101         YUVShiftReset(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y);
102         ~YUVShiftReset();
103         int handle_event();
104         YUVShiftEffect *plugin;
105         YUVShiftWindow *window;
106 };
107
108 class YUVShiftClr : public BC_Button
109 {
110 public:
111         YUVShiftClr(YUVShiftEffect *plugin, YUVShiftWindow *window, int x, int y, int clear);
112         ~YUVShiftClr();
113         int handle_event();
114         YUVShiftEffect *plugin;
115         YUVShiftWindow *window;
116         int clear;
117 };
118
119 class YUVShiftWindow : public PluginClientWindow
120 {
121 public:
122         YUVShiftWindow(YUVShiftEffect *plugin);
123         void create_objects();
124         void update_gui(int clear);
125
126         YUVShiftIText *y_dx_text;
127         YUVShiftISlider *y_dx_slider;
128         YUVShiftClr *y_dx_Clr;
129         YUVShiftIText *y_dy_text;
130         YUVShiftISlider *y_dy_slider;
131         YUVShiftClr *y_dy_Clr;
132
133         YUVShiftIText *u_dx_text;
134         YUVShiftISlider *u_dx_slider;
135         YUVShiftClr *u_dx_Clr;
136         YUVShiftIText *u_dy_text;
137         YUVShiftISlider *u_dy_slider;
138         YUVShiftClr *u_dy_Clr;
139
140         YUVShiftIText *v_dx_text;
141         YUVShiftISlider *v_dx_slider;
142         YUVShiftClr *v_dx_Clr;
143         YUVShiftIText *v_dy_text;
144         YUVShiftISlider *v_dy_slider;
145         YUVShiftClr *v_dy_Clr;
146
147         YUVShiftEffect *plugin;
148         YUVShiftReset *reset;
149 };
150
151
152
153 class YUVShiftEffect : public PluginVClient
154 {
155         VFrame *temp_frame;
156 public:
157         YUVShiftEffect(PluginServer *server);
158         ~YUVShiftEffect();
159
160
161         PLUGIN_CLASS_MEMBERS(YUVShiftConfig)
162         int process_realtime(VFrame *input, VFrame *output);
163         int is_realtime();
164         void save_data(KeyFrame *keyframe);
165         void read_data(KeyFrame *keyframe);
166         void update_gui();
167 };
168
169 #endif