r945: Revert merge of editing modes
[cinelerra_cv/mob.git] / plugins / ivtc / ivtc.h
blobf2be903dc274c9ab2fb688c414a9889275d92a4c
1 #ifndef IVTC_H
2 #define IVTC_H
4 class IVTCMain;
5 class IVTCEngine;
7 #include "bchash.h"
8 #include "loadbalance.h"
9 #include "mutex.h"
10 #include "pluginvclient.h"
11 #include "ivtcwindow.h"
12 #include <sys/types.h>
14 class IVTCEngine;
16 class IVTCConfig
18 public:
19 IVTCConfig();
20 int frame_offset;
21 // 0 - even 1 - odd
22 int first_field;
23 int automatic;
24 float auto_threshold;
25 int pattern;
26 enum
28 PULLDOWN32,
29 SHIFTFIELD,
30 AUTOMATIC
34 class IVTCMain : public PluginVClient
36 public:
37 IVTCMain(PluginServer *server);
38 ~IVTCMain();
40 // required for all realtime plugins
41 int process_realtime(VFrame *input_ptr, VFrame *output_ptr);
42 int is_realtime();
43 void save_data(KeyFrame *keyframe);
44 void read_data(KeyFrame *keyframe);
45 PLUGIN_CLASS_MEMBERS(IVTCConfig, IVTCThread)
46 void update_gui();
47 void render_stop();
49 int load_defaults();
50 int save_defaults();
52 void compare_fields(VFrame *frame1,
53 VFrame *frame2,
54 int64_t &field1,
55 int64_t &field2);
56 int64_t compare(VFrame *current_avg,
57 VFrame *current_orig,
58 VFrame *previous,
59 int field);
61 void deinterlace_avg(VFrame *output, VFrame *input, int dominance);
64 VFrame *temp_frame[2];
65 VFrame *input, *output;
67 // Automatic IVTC variables
68 // Difference between averaged current even lines and original even lines
69 int64_t even_vs_current;
70 // Difference between averaged current even lines and previous even lines
71 int64_t even_vs_prev;
72 // Difference between averaged current odd lines and original odd lines
73 int64_t odd_vs_current;
74 // Difference between averaged current odd lines and previous odd lines
75 int64_t odd_vs_prev;
77 // Closest combination of fields in previous calculation.
78 // If the lowest current combination is too big and the previous strategy
79 // was direct copy, copy the previous frame.
80 int64_t previous_min;
81 int previous_strategy;
82 IVTCEngine *engine;
86 class IVTCPackage : public LoadPackage
88 public:
89 IVTCPackage();
90 int y1, y2;
93 class IVTCUnit : public LoadClient
95 public:
96 IVTCUnit(IVTCEngine *server, IVTCMain *plugin);
97 void process_package(LoadPackage *package);
98 void clear_totals();
99 IVTCEngine *server;
100 IVTCMain *plugin;
101 int64_t even_vs_current;
102 int64_t even_vs_prev;
103 int64_t odd_vs_current;
104 int64_t odd_vs_prev;
108 class IVTCEngine : public LoadServer
110 public:
111 IVTCEngine(IVTCMain *plugin, int cpus);
112 ~IVTCEngine();
113 void init_packages();
114 LoadClient* new_client();
115 LoadPackage* new_package();
116 IVTCMain *plugin;
119 #endif