Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / cinelerra / maskengine.h
blobc85e9d55ad502b41c73bf57153d88de7b86489df
1 #ifndef MASKENGINE_H
2 #define MASKENGINE_H
5 #include "condition.inc"
6 #include "loadbalance.h"
7 #include "maskautos.inc"
8 #include "maskauto.inc"
9 #include "mutex.h"
10 #include "vframe.inc"
13 #define OVERSAMPLE 8
14 #define NUM_SPANS 4 /* starting number of spans to be allocated for */
16 class MaskEngine;
19 enum
21 RECALCULATE_PART,
22 APPLY_PART
26 class MaskPackage : public LoadPackage
28 public:
29 MaskPackage();
30 ~MaskPackage();
32 int row1, row2;
35 class MaskUnit : public LoadClient
37 public:
38 MaskUnit(MaskEngine *engine);
39 ~MaskUnit();
41 void process_package(LoadPackage *package);
42 private:
43 void draw_line_clamped(int x1, int y1, int x2, int y2, int w, int h, int hoffset);
44 void do_feather(VFrame *output,
45 VFrame *input,
46 float feather,
47 int start_out,
48 int end_out);
49 int do_feather_2(VFrame *output,
50 VFrame *input,
51 float feather,
52 int start_out,
53 int end_out);
54 template<class T>
55 void blur_strip(float *val_p,
56 float *val_m,
57 float *dst,
58 float *src,
59 int size,
60 T max);
62 float n_p[5], n_m[5];
63 float d_p[5], d_m[5];
64 float bd_p[5], bd_m[5];
65 MaskEngine *engine;
66 short **row_spans;
67 short row_spans_h;
71 class MaskEngine : public LoadServer
73 public:
74 MaskEngine(int cpus);
75 ~MaskEngine();
78 void do_mask(VFrame *output,
79 int64_t start_position,
80 double frame_rate,
81 double project_frame_rate,
82 MaskAutos *keyframe_set,
83 int direction,
84 int before_plugins);
85 int points_equivalent(ArrayList<MaskPoint*> *new_points,
86 ArrayList<MaskPoint*> *points);
88 void delete_packages();
89 void init_packages();
90 LoadClient* new_client();
91 LoadPackage* new_package();
93 VFrame *output;
94 // State of last mask
95 VFrame *mask;
96 // Temporary for feathering
97 VFrame *temp_mask;
98 ArrayList<ArrayList<MaskPoint*>*> point_sets;
99 int mode;
100 float feather; // gui feather
101 float realfeather; // real feather
102 int recalculate;
103 int value;
104 pthread_mutex_t stage1_finished_mutex;
105 pthread_cond_t stage1_finished_cond;
106 int stage1_finished_count;
107 Mutex protect_data; // protects the following members
108 int first_nonempty_rowspan;
109 int last_nonempty_rowspan;
114 #endif
116 // Local Variables:
117 // mode: C++
118 // c-file-style: "linux"
119 // End: