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 0x60
20 #define SD_REJECT 0x10
27 class DeScratchConfig;
29 class DeScratchWindow;
30 class DeScratchModeItem;
32 class DeScratchISlider;
33 class DeScratchFSlider;
44 int equivalent(DeScratchConfig &that);
45 void copy_from(DeScratchConfig &that);
46 void interpolate(DeScratchConfig &prev, DeScratchConfig &next,
47 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
66 class DeScratchMain : public PluginVClient
69 DeScratchMain(PluginServer *server);
72 PLUGIN_CLASS_MEMBERS(DeScratchConfig)
73 uint8_t *inf; int sz_inf;
76 VFrame *tmp_frame, *blurry;
77 OverlayFrame *overlay_frame;
80 void save_data(KeyFrame *keyframe);
81 void read_data(KeyFrame *keyframe);
83 void get_extrems_plane(int comp, int thresh);
84 void remove_min_extrems_plane(int comp, int thresh);
86 void test_scratches();
87 void mark_scratches_plane(int comp, int mask, int value);
88 void remove_scratches_plane(int comp);
89 void pass(int comp, int thresh);
92 void plane_pass(int comp, int mode);
93 int process_realtime(VFrame *input, VFrame *output);
97 class DeScratchWindow : public PluginClientWindow
100 DeScratchWindow(DeScratchMain *plugin);
103 void create_objects();
105 DeScratchMain *plugin;
106 DeScratchMode *y_mode, *u_mode, *v_mode;
107 DeScratchISlider *threshold, *asymmetry;
108 DeScratchISlider *min_width, *max_width;
109 DeScratchFSlider *min_len, *max_len;
110 DeScratchISlider *blur_len;
111 DeScratchFSlider *gap_len;
112 DeScratchFSlider *max_angle;
113 DeScratchISlider *border;
115 DeScratchFSlider *ffade;
116 DeScratchReset *reset;
119 class DeScratchModeItem : public BC_MenuItem
122 DeScratchModeItem(DeScratchMode *popup, int type, const char *text);
123 ~DeScratchModeItem();
126 DeScratchMode *popup;
130 class DeScratchMode : public BC_PopupMenu
133 DeScratchMode(DeScratchWindow *win, int x, int y, int *value);
135 void create_objects();
138 void set_value(int v);
140 DeScratchWindow *win;
144 class DeScratchISlider : public BC_ISlider
147 DeScratchISlider(DeScratchWindow *win,
148 int x, int y, int w, int min, int max, int *output);
152 DeScratchWindow *win;
156 class DeScratchFSlider : public BC_FSlider
159 DeScratchFSlider(DeScratchWindow *win,
160 int x, int y, int w, float min, float max, float *output);
164 DeScratchWindow *win;
168 class DeScratchMark : public BC_CheckBox
171 DeScratchMark(DeScratchWindow *win, int x, int y);
175 DeScratchWindow *win;
178 class DeScratchReset : public BC_GenericButton
181 DeScratchReset(DeScratchWindow *win, int x, int y);
184 DeScratchWindow *win;