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(ChromaKey
*plugin
,
73 class ChromaKeyMinBrightness
: public BC_FSlider
76 ChromaKeyMinBrightness(ChromaKey
*plugin
, int x
, int y
);
81 class ChromaKeyMaxBrightness
: public BC_FSlider
84 ChromaKeyMaxBrightness(ChromaKey
*plugin
, int x
, int y
);
89 class ChromaKeySaturation
: public BC_FSlider
92 ChromaKeySaturation(ChromaKey
*plugin
, int x
, int y
);
97 class ChromaKeyMinSaturation
: public BC_FSlider
100 ChromaKeyMinSaturation(ChromaKey
*plugin
, int x
, int y
);
107 class ChromaKeyTolerance
: public BC_FSlider
110 ChromaKeyTolerance(ChromaKey
*plugin
, int x
, int y
);
115 class ChromaKeyInSlope
: public BC_FSlider
118 ChromaKeyInSlope(ChromaKey
*plugin
, int x
, int y
);
123 class ChromaKeyOutSlope
: public BC_FSlider
126 ChromaKeyOutSlope(ChromaKey
*plugin
, int x
, int y
);
131 class ChromaKeyAlphaOffset
: public BC_FSlider
134 ChromaKeyAlphaOffset(ChromaKey
*plugin
, int x
, int y
);
139 class ChromaKeySpillThreshold
: public BC_FSlider
142 ChromaKeySpillThreshold(ChromaKey
*plugin
, int x
, int y
);
146 class ChromaKeySpillAmount
: public BC_FSlider
149 ChromaKeySpillAmount(ChromaKey
*plugin
, int x
, int y
);
154 class ChromaKeyUseColorPicker
: public BC_GenericButton
157 ChromaKeyUseColorPicker(ChromaKey
*plugin
, ChromaKeyWindow
*gui
, int x
, int y
);
160 ChromaKeyWindow
*gui
;
164 class ChromaKeyColorThread
: public ColorThread
167 ChromaKeyColorThread(ChromaKey
*plugin
, ChromaKeyWindow
*gui
);
168 int handle_new_color(int output
, int alpha
);
170 ChromaKeyWindow
*gui
;
173 class ChromaKeyShowMask
: public BC_CheckBox
176 ChromaKeyShowMask(ChromaKey
*plugin
, int x
, int y
);
183 class ChromaKeyWindow
: public BC_Window
186 ChromaKeyWindow(ChromaKey
*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
;
208 ChromaKeyColorThread
*color_thread
;
213 PLUGIN_THREAD_HEADER(ChromaKey
, ChromaKeyThread
, ChromaKeyWindow
)
216 class ChromaKeyServer
: public LoadServer
219 ChromaKeyServer(ChromaKey
*plugin
);
220 void init_packages();
221 LoadClient
* new_client();
222 LoadPackage
* new_package();
226 class ChromaKeyPackage
: public LoadPackage
233 class ChromaKeyUnit
: public LoadClient
236 ChromaKeyUnit(ChromaKey
*plugin
, ChromaKeyServer
*server
);
237 void process_package(LoadPackage
*package
);
238 template <typename component_type
> void process_chromakey(int components
, component_type max
, bool use_yuv
, ChromaKeyPackage
*pkg
);
239 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
);
248 class ChromaKey
: public PluginVClient
251 ChromaKey(PluginServer
*server
);
254 int process_realtime(VFrame
*input
, VFrame
*output
);
256 char* plugin_title();
258 int load_configuration();
261 void save_data(KeyFrame
*keyframe
);
262 void read_data(KeyFrame
*keyframe
);
268 ChromaKeyConfig config
;
269 VFrame
*input
, *output
;
270 ChromaKeyServer
*engine
;
271 ChromaKeyThread
*thread
;