7 #include "colorpicker.h"
9 #include "loadbalance.h"
10 #include "pluginvclient.h"
15 class ChromaKeyWindow
;
18 CHROMAKEY_POSTPROCESS_NONE
,
19 CHROMAKEY_POSTPROCESS_BLUR
,
20 CHROMAKEY_POSTPROCESS_DILATE
28 void copy_from(ChromaKeyConfig
&src
);
29 int equivalent(ChromaKeyConfig
&src
);
30 void interpolate(ChromaKeyConfig
&prev
,
31 ChromaKeyConfig
&next
,
34 int64_t current_frame
);
39 // Key color definition
43 // Key shade definition
53 // Spill light compensation
54 float spill_threshold
;
58 class ChromaKeyColor
: public BC_GenericButton
61 ChromaKeyColor(ChromaKeyHSV
*plugin
,
73 class ChromaKeyMinBrightness
: public BC_FSlider
76 ChromaKeyMinBrightness(ChromaKeyHSV
*plugin
, int x
, int y
);
81 class ChromaKeyMaxBrightness
: public BC_FSlider
84 ChromaKeyMaxBrightness(ChromaKeyHSV
*plugin
, int x
, int y
);
89 class ChromaKeySaturation
: public BC_FSlider
92 ChromaKeySaturation(ChromaKeyHSV
*plugin
, int x
, int y
);
97 class ChromaKeyMinSaturation
: public BC_FSlider
100 ChromaKeyMinSaturation(ChromaKeyHSV
*plugin
, int x
, int y
);
102 ChromaKeyHSV
*plugin
;
107 class ChromaKeyTolerance
: public BC_FSlider
110 ChromaKeyTolerance(ChromaKeyHSV
*plugin
, int x
, int y
);
112 ChromaKeyHSV
*plugin
;
115 class ChromaKeyInSlope
: public BC_FSlider
118 ChromaKeyInSlope(ChromaKeyHSV
*plugin
, int x
, int y
);
120 ChromaKeyHSV
*plugin
;
123 class ChromaKeyOutSlope
: public BC_FSlider
126 ChromaKeyOutSlope(ChromaKeyHSV
*plugin
, int x
, int y
);
128 ChromaKeyHSV
*plugin
;
131 class ChromaKeyAlphaOffset
: public BC_FSlider
134 ChromaKeyAlphaOffset(ChromaKeyHSV
*plugin
, int x
, int y
);
136 ChromaKeyHSV
*plugin
;
139 class ChromaKeySpillThreshold
: public BC_FSlider
142 ChromaKeySpillThreshold(ChromaKeyHSV
*plugin
, int x
, int y
);
144 ChromaKeyHSV
*plugin
;
146 class ChromaKeySpillAmount
: public BC_FSlider
149 ChromaKeySpillAmount(ChromaKeyHSV
*plugin
, int x
, int y
);
151 ChromaKeyHSV
*plugin
;
154 class ChromaKeyUseColorPicker
: public BC_GenericButton
157 ChromaKeyUseColorPicker(ChromaKeyHSV
*plugin
, ChromaKeyWindow
*gui
, int x
, int y
);
159 ChromaKeyHSV
*plugin
;
160 ChromaKeyWindow
*gui
;
164 class ChromaKeyColorThread
: public ColorThread
167 ChromaKeyColorThread(ChromaKeyHSV
*plugin
, ChromaKeyWindow
*gui
);
168 int handle_new_color(int output
, int alpha
);
169 ChromaKeyHSV
*plugin
;
170 ChromaKeyWindow
*gui
;
173 class ChromaKeyShowMask
: public BC_CheckBox
176 ChromaKeyShowMask(ChromaKeyHSV
*plugin
, int x
, int y
);
178 ChromaKeyHSV
*plugin
;
183 class ChromaKeyWindow
: public BC_Window
186 ChromaKeyWindow(ChromaKeyHSV
*plugin
, int x
, int y
);
189 void create_objects();
191 void update_sample();
193 ChromaKeyColor
*color
;
194 ChromaKeyUseColorPicker
*use_colorpicker
;
195 ChromaKeyMinBrightness
*min_brightness
;
196 ChromaKeyMaxBrightness
*max_brightness
;
197 ChromaKeySaturation
*saturation
;
198 ChromaKeyMinSaturation
*min_saturation
;
199 ChromaKeyTolerance
*tolerance
;
200 ChromaKeyInSlope
*in_slope
;
201 ChromaKeyOutSlope
*out_slope
;
202 ChromaKeyAlphaOffset
*alpha_offset
;
203 ChromaKeySpillThreshold
*spill_threshold
;
204 ChromaKeySpillAmount
*spill_amount
;
205 ChromaKeyShowMask
*show_mask
;
206 BC_SubWindow
*sample
;
207 ChromaKeyHSV
*plugin
;
208 ChromaKeyColorThread
*color_thread
;
215 PLUGIN_THREAD_HEADER(ChromaKeyHSV
, ChromaKeyThread
, ChromaKeyWindow
)
218 class ChromaKeyServer
: public LoadServer
221 ChromaKeyServer(ChromaKeyHSV
*plugin
);
222 void init_packages();
223 LoadClient
* new_client();
224 LoadPackage
* new_package();
225 ChromaKeyHSV
*plugin
;
228 class ChromaKeyPackage
: public LoadPackage
235 class ChromaKeyUnit
: public LoadClient
238 ChromaKeyUnit(ChromaKeyHSV
*plugin
, ChromaKeyServer
*server
);
239 void process_package(LoadPackage
*package
);
240 template <typename component_type
> void process_chromakey(int components
, component_type max
, bool use_yuv
, ChromaKeyPackage
*pkg
);
241 bool is_same_color(float r
, float g
, float b
, float rk
,float bk
,float gk
, float color_threshold
, float light_threshold
, int key_main_component
);
243 ChromaKeyHSV
*plugin
;
250 class ChromaKeyHSV
: public PluginVClient
253 ChromaKeyHSV(PluginServer
*server
);
256 int process_buffer(VFrame
*frame
,
257 int64_t start_position
,
261 char* plugin_title();
263 int load_configuration();
266 void save_data(KeyFrame
*keyframe
);
267 void read_data(KeyFrame
*keyframe
);
273 ChromaKeyConfig config
;
274 VFrame
*input
, *output
;
275 ChromaKeyServer
*engine
;
276 ChromaKeyThread
*thread
;