1 #include "bcdisplayinfo.h"
3 #include "seltempavgwindow.h"
5 PLUGIN_THREAD_OBJECT(SelTempAvgMain, SelTempAvgThread, SelTempAvgWindow)
8 #define MAX_FRAMES 1024
11 SelTempAvgWindow::SelTempAvgWindow(SelTempAvgMain *client, int x, int y)
12 : BC_Window(client->gui_string,
23 this->client = client;
26 SelTempAvgWindow::~SelTempAvgWindow()
30 int SelTempAvgWindow::create_objects()
32 int x1 = 10, x2 = 40, x3 = 80, x4 = 175, x5 = 260, y = 10;
34 add_tool(new BC_Title(x1, y, _("Frames to average")));
36 add_tool(total_frames = new SelTempAvgSlider(client, x1, y));
39 add_tool(new BC_Title(x1, y, _("Use Method:")));
42 add_tool(method_none = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_NONE, _("None ")));
45 add_tool(method_seltempavg = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_SELTEMPAVG, _("Selective Temporal Averaging: ")));
48 add_tool(new BC_Title(x3, y, _("Av. Thres.")));
49 add_tool(new BC_Title(x4, y, _("S.D. Thres.")));
50 add_tool(new BC_Title(x5, y, _("Mask")));
53 add_tool(new BC_Title(x2, y, _("R / Y")));
54 add_tool(avg_threshold_RY = new SelTempAvgThreshSlider(client, x3, y, AVG_RY,client->config.avg_threshold_RY));
55 add_tool(std_threshold_RY = new SelTempAvgThreshSlider(client, x4, y, STD_RY,client->config.std_threshold_RY));
56 add_tool(mask_RY = new SelTempAvgMask(client, x5, y, MASK_RY, client->config.mask_RY));
59 add_tool(new BC_Title(x2, y, _("G / U")));
60 add_tool(avg_threshold_GU = new SelTempAvgThreshSlider(client, x3, y, AVG_GU,client->config.avg_threshold_GU));
61 add_tool(std_threshold_GU = new SelTempAvgThreshSlider(client, x4, y, STD_GU,client->config.std_threshold_GU));
62 add_tool(mask_GU = new SelTempAvgMask(client, x5, y, MASK_GU,client->config.mask_GU));
65 add_tool(new BC_Title(x2, y, _("B / V")));
66 add_tool(avg_threshold_BV = new SelTempAvgThreshSlider(client, x3, y, AVG_BV,client->config.avg_threshold_BV));
67 add_tool(std_threshold_BV = new SelTempAvgThreshSlider(client, x4, y, STD_BV,client->config.std_threshold_BV));
68 add_tool(mask_BV = new SelTempAvgMask(client, x5, y, MASK_BV,client->config.mask_BV));
71 add_tool(method_average = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_AVERAGE, _("Average")));
73 add_tool(method_stddev = new SelTempAvgMethodRadial(client, this, x1, y, SelTempAvgConfig::METHOD_STDDEV, _("Standard Deviation")));
76 add_tool(new BC_Title(x1, y, _("First frame in average:")));
78 add_tool(offset_fixed = new SelTempAvgOffsetRadial(client, this, x1, y, SelTempAvgConfig::OFFSETMODE_FIXED, _("Fixed offset: ")));
79 add_tool(offset_fixed_value = new SelTempAvgOffsetValue(client, x4, y));
82 add_tool(offset_restartmarker = new SelTempAvgOffsetRadial(client, this, x1, y, SelTempAvgConfig::OFFSETMODE_RESTARTMARKERSYS, _("Restart marker system:")));
83 add_tool(offset_restartmarker_pos = new BC_TextBox(x4+20, y, 100, 1, ""));
84 offset_restartmarker_pos->disable();
86 add_tool(offset_restartmarker_keyframe = new SelTempAvgStartKeyframe(client, x2 + 10, y));
90 add_tool(new BC_Title(x1, y, _("Other Options:")));
92 add_tool(paranoid = new SelTempAvgParanoid(client, x1, y));
94 add_tool(no_subtract = new SelTempAvgNoSubtract(client, x1, y));
96 add_tool(new BC_Title(x2, y, _("Gain:")));
97 add_tool(gain = new SelTempAvgGainValue(client, x3, y));
104 WINDOW_CLOSE_EVENT(SelTempAvgWindow)
109 SelTempAvgThreshSlider::SelTempAvgThreshSlider(SelTempAvgMain *client, int x, int y, int id, float currentval)
110 : BC_TextBox(x,y, 80, 1, currentval, 1, MEDIUMFONT, 8)
115 this->client = client;
117 SelTempAvgThreshSlider::~SelTempAvgThreshSlider()
120 int SelTempAvgThreshSlider::handle_event()
122 float val = atof(get_text());
128 client->config.avg_threshold_RY = val;
131 client->config.avg_threshold_GU = val;
134 client->config.avg_threshold_BV = val;
137 client->config.std_threshold_RY = val;
140 client->config.std_threshold_GU = val;
143 client->config.std_threshold_BV = val;
147 client->send_configure_change();
152 SelTempAvgOffsetValue::SelTempAvgOffsetValue(SelTempAvgMain *client, int x, int y)
153 : BC_TextBox(x,y, 80, 1, client->config.offset_fixed_value)
155 this->client = client;
157 SelTempAvgOffsetValue::~SelTempAvgOffsetValue()
160 int SelTempAvgOffsetValue::handle_event()
162 int val = atoi(get_text());
164 client->config.offset_fixed_value = val;
165 client->send_configure_change();
170 SelTempAvgGainValue::SelTempAvgGainValue(SelTempAvgMain *client, int x, int y)
171 : BC_TextBox(x,y, 80, 1, client->config.gain)
173 this->client = client;
175 SelTempAvgGainValue::~SelTempAvgGainValue()
178 int SelTempAvgGainValue::handle_event()
180 float val = atof(get_text());
183 client->config.gain = val;
184 client->send_configure_change();
192 SelTempAvgSlider::SelTempAvgSlider(SelTempAvgMain *client, int x, int y)
200 client->config.frames)
202 this->client = client;
204 SelTempAvgSlider::~SelTempAvgSlider()
207 int SelTempAvgSlider::handle_event()
209 int result = get_value();
210 if(result < 1) result = 1;
211 client->config.frames = result;
212 client->send_configure_change();
218 SelTempAvgOffsetRadial::SelTempAvgOffsetRadial(SelTempAvgMain *client, SelTempAvgWindow *gui, int x, int y, int type, char *caption)
221 client->config.offsetmode == type,
224 this->client = client;
228 int SelTempAvgOffsetRadial::handle_event()
230 int result = get_value();
231 client->config.offsetmode = type;
233 gui->offset_fixed->update(client->config.offsetmode == SelTempAvgConfig::OFFSETMODE_FIXED);
234 gui->offset_restartmarker->update(client->config.offsetmode == SelTempAvgConfig::OFFSETMODE_RESTARTMARKERSYS);
236 client->send_configure_change();
242 SelTempAvgMethodRadial::SelTempAvgMethodRadial(SelTempAvgMain *client, SelTempAvgWindow *gui, int x, int y, int type, char *caption)
245 client->config.method == type,
248 this->client = client;
252 int SelTempAvgMethodRadial::handle_event()
254 int result = get_value();
255 client->config.method = type;
257 gui->method_none->update(client->config.method == SelTempAvgConfig::METHOD_NONE);
258 gui->method_seltempavg->update(client->config.method == SelTempAvgConfig::METHOD_SELTEMPAVG);
259 gui->method_average->update(client->config.method == SelTempAvgConfig::METHOD_AVERAGE);
260 gui->method_stddev->update(client->config.method == SelTempAvgConfig::METHOD_STDDEV);
262 client->send_configure_change();
267 SelTempAvgParanoid::SelTempAvgParanoid(SelTempAvgMain *client, int x, int y)
270 client->config.paranoid,
271 _("Reprocess frame again"))
273 this->client = client;
275 int SelTempAvgParanoid::handle_event()
277 int result = get_value();
278 client->config.paranoid = result;
279 client->send_configure_change();
284 SelTempAvgNoSubtract::SelTempAvgNoSubtract(SelTempAvgMain *client, int x, int y)
287 client->config.nosubtract,
288 _("Disable subtraction"))
290 this->client = client;
292 int SelTempAvgNoSubtract::handle_event()
294 int result = get_value();
295 client->config.nosubtract = result;
296 client->send_configure_change();
300 SelTempAvgMask::SelTempAvgMask(SelTempAvgMain *client, int x, int y, int type, int val)
306 this->client = client;
309 int SelTempAvgMask::handle_event()
311 int result = get_value();
314 client->config.mask_RY = result;
317 client->config.mask_GU = result;
320 client->config.mask_BV = result;
323 client->send_configure_change();
329 SelTempAvgStartKeyframe::SelTempAvgStartKeyframe(SelTempAvgMain *client, int x, int y)
332 client->config.nosubtract,
333 _("This Frame is a start of a section"))
335 this->client = client;
337 int SelTempAvgStartKeyframe::handle_event()
339 int result = get_value();
340 client->config.offset_restartmarker_keyframe = result;
341 client->send_configure_change();