1 #ifndef __DESCRATCH_H__
2 #define __DESCRATCH_H__
6 #include "bcmenuitem.h"
7 #include "bcpopupmenu.h"
12 #include "overlayframe.h"
13 #include "pluginvclient.h"
15 // so that write_pgm can create grey images of inf
17 #define SD_EXTREM 0x80
18 #define SD_TESTED 0x40
20 #define SD_REJECT 0x10
27 class DeScratchConfig;
29 class DeScratchWindow;
30 class DeScratchModeItem;
32 class DeScratchISlider;
33 class DeScratchFSlider;
35 class DeScratchEdgeOnly;
45 int equivalent(DeScratchConfig &that);
46 void copy_from(DeScratchConfig &that);
47 void interpolate(DeScratchConfig &prev, DeScratchConfig &next,
48 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
68 class DeScratchMain : public PluginVClient
71 DeScratchMain(PluginServer *server);
74 PLUGIN_CLASS_MEMBERS(DeScratchConfig)
75 uint8_t *inf; int sz_inf;
79 OverlayFrame *overlay_frame;
82 void save_data(KeyFrame *keyframe);
83 void read_data(KeyFrame *keyframe);
85 void set_extrems_plane(int width, int comp, int thresh);
87 void test_scratches();
88 void mark_scratches_plane();
89 void remove_scratches_plane(int comp);
92 void pass(int comp, int thresh);
93 void plane_pass(int comp, int mode);
94 void plane_proc(int comp, int mode);
95 int process_realtime(VFrame *input, VFrame *output);
99 class DeScratchWindow : public PluginClientWindow
102 DeScratchWindow(DeScratchMain *plugin);
105 void create_objects();
107 DeScratchMain *plugin;
108 DeScratchMode *y_mode, *u_mode, *v_mode;
109 DeScratchISlider *threshold;
110 DeScratchFSlider *asymmetry;
111 DeScratchISlider *min_width, *max_width;
112 DeScratchFSlider *min_len, *max_len;
113 DeScratchISlider *blur_len;
114 DeScratchFSlider *gap_len;
115 DeScratchFSlider *max_angle;
116 DeScratchISlider *border;
118 DeScratchEdgeOnly *edge_only;
119 DeScratchFSlider *ffade;
120 DeScratchReset *reset;
123 class DeScratchModeItem : public BC_MenuItem
126 DeScratchModeItem(DeScratchMode *popup, int type, const char *text);
127 ~DeScratchModeItem();
130 DeScratchMode *popup;
134 class DeScratchMode : public BC_PopupMenu
137 DeScratchMode(DeScratchWindow *win, int x, int y, int *value);
139 void create_objects();
142 void set_value(int v);
144 DeScratchWindow *win;
148 class DeScratchISlider : public BC_ISlider
151 DeScratchISlider(DeScratchWindow *win,
152 int x, int y, int w, int min, int max, int *output);
156 DeScratchWindow *win;
160 class DeScratchFSlider : public BC_FSlider
163 DeScratchFSlider(DeScratchWindow *win,
164 int x, int y, int w, float min, float max, float *output);
168 DeScratchWindow *win;
172 class DeScratchMark : public BC_CheckBox
175 DeScratchMark(DeScratchWindow *win, int x, int y);
179 DeScratchWindow *win;
182 class DeScratchEdgeOnly : public BC_CheckBox
185 DeScratchEdgeOnly(DeScratchWindow *win, int x, int y);
186 ~DeScratchEdgeOnly();
189 DeScratchWindow *win;
192 class DeScratchReset : public BC_GenericButton
195 DeScratchReset(DeScratchWindow *win, int x, int y);
198 DeScratchWindow *win;