Go to the documentation of this file.
34 #error This header is intended only for Weed plugins
37 #ifndef __WEED_PLUGIN__
38 #error weed-plugin.h should be included first
41 #ifndef __WEED_PLUGIN_UTILS_H__
42 #define __WEED_PLUGIN_UTILS_H__
49 #ifndef NEED_LOCAL_WEED
60 #if defined _WIN32 || defined __CYGWIN__ || defined IS_MINGW
63 #define EXPORTED __attribute__ ((dllexport))
65 #define EXPORTED __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
69 #define EXPORTED __attribute__ ((dllimport))
71 #define EXPORTED __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
78 #define EXPORTED __attribute__ ((visibility ("default")))
79 #define NOT_EXPORTED __attribute__ ((visibility ("hidden")))
87 #define FN_DECL static
92 int32_t weed_abi_min_version, int32_t weed_abi_max_version,
93 int32_t filter_api_min_version, int32_t weed_filter_api_max_version)
ALLOW_UNUSED;
190 #ifdef __WEED_UTILS_H__
208 #ifdef __WEED_UTILS_H__
231 #define ABS(a) (((a) < 0) ? -(a) : (a))
237 FN_DECL uint64_t fastrand(uint64_t notused);
238 FN_DECL double fastrand_dbl(
double range);
239 FN_DECL uint32_t fastrand_int(uint32_t range);
242 #ifdef NEED_ALPHA_SORT // for wrappers, use this to sort filters alphabetically
243 typedef struct dlink_list dlink_list_t;
244 FN_DECL dlink_list_t *add_to_list_sorted(dlink_list_t *list,
weed_plant_t *filter,
const char *name);
248 #ifdef NEED_PALETTE_UTILS
249 #define ALL_RGB_PALETTES {WEED_PALETTE_RGB24, WEED_PALETTE_BGR24, WEED_PALETTE_RGBA32, WEED_PALETTE_BGRA32, \
250 WEED_PALETTE_ARGB32, WEED_PALETTE_END}
252 #define ALL_24BIT_PALETTES {WEED_PALETTE_RGB24, WEED_PALETTE_BGR24, WEED_PALETTE_YUV888, WEED_PALETTE_END}
254 #define ALL_32BIT_PALETTES {WEED_PALETTE_RGBA32, WEED_PALETTE_BGRA32, WEED_PALETTE_ARGB32, WEED_PALETTE_YUVA8888,\
257 #define ALL_ALPHA_PALETTES {WEED_PALETTE_AFLOAT, WEED_PALETTE_A8, WEED_PALETTE_A1, WEED_PALETTE_END}
263 #define ALL_PACKED_PALETTES {WEED_PALETTE_RGB24, WEED_PALETTE_BGR24, WEED_PALETTE_RGBA32, \
264 WEED_PALETTE_BGRA32, WEED_PALETTE_YUV888, WEED_PALETTE_YUVA8888, WEED_PALETTE_END}
266 #define ALL_PACKED_PALETTES_PLUS {WEED_PALETTE_RGB24, WEED_PALETTE_BGR24, WEED_PALETTE_RGBA32, \
267 WEED_PALETTE_BGRA32, WEED_PALETTE_ARGB32, WEED_PALETTE_YUV888, WEED_PALETTE_YUVA8888, WEED_PALETTE_UYVY, \
268 WEED_PALETTE_YUYV, WEED_PALETTE_END}
270 #define ALL_PLANAR_PALETTES {WEED_PALETTE_YUV444P, WEED_PALETTE_YUVA4444P, WEED_PALETTE_YUV422P, \
271 WEED_PALETTE_YUV420P, WEED_PALETTE_YVU420P, WEED_PALETTE_END}
274 #define pixel_size(pal) ((pal == WEED_PALETTE_RGB24 || pal == WEED_PALETTE_BGR24 || pal == WEED_PALETTE_YUV888) ? 3 : \
275 (pal == WEED_PALETTE_RGBA32 || pal == WEED_PALETTE_BGRA32 || pal == WEED_PALETTE_ARGB32 || \
276 pal == WEED_PALETTE_YUVA8888 || pal == WEED_PALETTE_UYVY || pal == WEED_PALETTE_YUYV) ? 4 : 0)
278 #define rgb_offset(pal) (pal == WEED_PALETTE_ARGB32 ? 1 : 0)
280 FN_DECL int weed_palette_is_alpha(
int pal);
281 FN_DECL int weed_palette_is_rgb(
int pal);
282 FN_DECL int weed_palette_is_yuv(
int pal);
283 FN_DECL int weed_palette_get_nplanes(
int pal);
284 FN_DECL int weed_palette_is_valid(
int pal);
285 FN_DECL int weed_palette_is_float(
int pal);
286 FN_DECL int weed_palette_has_alpha_channel(
int pal);
287 FN_DECL double weed_palette_get_plane_ratio_horizontal(
int pal,
int plane);
288 FN_DECL double weed_palette_get_plane_ratio_vertical(
int pal,
int plane);
294 FN_DECL size_t blank_pixel(uint8_t *dst,
int pal,
int yuv_clamping, uint8_t *src);
307 FN_DECL void blank_row(uint8_t **pdst,
int width,
int pal,
int yuv_clamping,
int uvcopy, uint8_t **psrc);
308 FN_DECL void blank_frame(
void **pdata,
int width,
int height,
int *rowstrides,
int pal,
int yuv_clamping);
311 #ifdef NEED_PALETTE_CONVERSIONS
314 FN_DECL uint8_t calc_luma(uint8_t *pixel,
int palette,
int yuv_clamping);
316 FN_DECL uint8_t y_unclamped_to_clamped(uint8_t y);
317 FN_DECL uint8_t y_clamped_to_unclamped(uint8_t y);
318 FN_DECL uint8_t uv_clamped_to_unclamped(uint8_t uv);
321 FN_DECL void alpha_premult(
unsigned char *ptr,
int width,
int height,
int rowstride,
int pal,
int un);
324 #ifdef NEED_FONT_UTILS
327 FN_DECL void weed_parse_font_string(
const char *fontstr,
char **family,
char **fstretch,
char **fweight,
328 char **fstyle,
int *size);
333 #define WEED_SETUP_START(weed_api_version, filter_api_version) extern "C" { EXPORTED weed_plant_t *weed_setup(weed_bootstrap_f weed_boot) { \
334 weed_plant_t *plugin_info = weed_plugin_info_init(weed_boot, weed_api_version, weed_api_version, filter_api_version, filter_api_version); \
335 if (plugin_info == NULL) {return NULL;} {
337 #define WEED_SETUP_START_MINMAX(weed_api_min_version, weed_api_max_version, filter_api_min_version, filter_api_max_version) extern "C" { EXPORTED weed_plant_t *weed_setup(weed_bootstrap_f weed_boot) { \
338 weed_plant_t *plugin_info = weed_plugin_info_init(weed_boot, weed_api_min_version, weed_api_max_version, filter_api_min_Version, filter_api_max_version); \
339 if (plugin_info == NULL) {return NULL;} {
341 #define WEED_SETUP_END } return plugin_info;}}
343 #define WEED_DESETUP_START extern "C" { EXPORTED void weed_desetup(void) {
344 #define WEED_DESETUP_END }}
348 #define WEED_SETUP_START(weed_api_version, filter_api_version) EXPORTED weed_plant_t *weed_setup(weed_bootstrap_f weed_boot) { \
349 weed_plant_t *plugin_info = weed_plugin_info_init(weed_boot, weed_api_version, weed_api_version, filter_api_version, filter_api_version); \
350 if (plugin_info == NULL) {return NULL;} {
352 #define WEED_SETUP_START_MINMAX(weed_api_min_version, weed_api_max_version, filter_api_min_version, filter_api_max_version) EXPORTED weed_plant_t *weed_setup(weed_bootstrap_f weed_boot) { \
353 weed_plant_t *plugin_info = weed_plugin_info_init(weed_boot, weed_api_min_version, weed_api_max_version, filter_api_min_version, filter_api_max_version); \
354 if (plugin_info == NULL) {return NULL;} {
356 #define WEED_SETUP_END } return plugin_info;}
358 #define WEED_DESETUP_START EXPORTED void weed_desetup(void) {
359 #define WEED_DESETUP_END }
FN_DECL weed_plant_t * weed_filter_class_init(const char *name, const char *author, int version, int flags, int *palette_list, weed_init_f init_func, weed_process_f process_func, weed_deinit_f deinit_func, weed_plant_t **in_chantmpls, weed_plant_t **out_chantmpls, weed_plant_t **in_paramtmpls, weed_plant_t **out_paramtmpls) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_get_out_param(weed_plant_t *inst, int idx)
FN_DECL void weed_plugin_set_package_version(weed_plant_t *pi, int v)
FN_DECL weed_plant_t * weed_out_param_integer_init_nominmax(const char *name, int def) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_get_in_param(weed_plant_t *inst, int idx)
weed_plant_t *(* weed_bootstrap_f)(weed_default_getter_f *, int32_t plugin_weed_min_api_version, int32_t plugin_weed_max_api_version, int32_t plugin_filter_min_api_version, int32_t plugin_filter_max_api_version)
Definition: weed-effects.h:152
FN_DECL void weed_filter_set_flags(weed_plant_t *filter, int flags)
FN_DECL weed_plant_t * weed_colRGBi_init(const char *name, const char *label, int red, int green, int blue) ALLOW_UNUSED
FN_DECL void weed_plugin_info_add_filter_class(weed_plant_t *plugin_info, weed_plant_t *filter_class) ALLOW_UNUSED
FN_DECL int weed_get_api_version(weed_plant_t *plugin_info) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_filter_get_gui(weed_plant_t *filter) ALLOW_UNUSED
#define FN_DECL
Definition: weed-plugin-utils.h:87
FN_DECL int weed_param_get_value_boolean(weed_plant_t *param)
FN_DECL weed_plant_t * weed_float_init(const char *name, const char *label, double def, double min, double max) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_channel_template_init(const char *name, int flags) ALLOW_UNUSED
FN_DECL int weed_get_host_verbosity(weed_plant_t *host_info)
FN_DECL weed_plant_t * weed_text_init(const char *name, const char *label, const char *def) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_switch_init(const char *name, const char *label, int def) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_plugin_info_init(weed_bootstrap_f weed_boot, int32_t weed_abi_min_version, int32_t weed_abi_max_version, int32_t filter_api_min_version, int32_t weed_filter_api_max_version) ALLOW_UNUSED
FN_DECL int is_big_endian(void)
FN_DECL weed_plant_t * weed_instance_get_filter(weed_plant_t *inst)
FN_DECL weed_plant_t * weed_radio_init(const char *name, const char *label, int def, int group) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_param_get_template(weed_plant_t *param)
FN_DECL void weed_chantmpl_set_name(weed_plant_t *chantmpl, const char *name)
FN_DECL int weed_host_supports_linear_gamma(weed_plant_t *host_info)
weed_leaf_t weed_plant_t
Definition: weed.h:125
FN_DECL weed_plant_t * weed_out_param_integer_init(const char *name, int def, int min, int max) ALLOW_UNUSED
FN_DECL int weed_chantmpl_get_flags(weed_plant_t *chantmpl)
FN_DECL void weed_chantmpl_set_flags(weed_plant_t *chantmpl, int flags)
FN_DECL weed_plant_t * weed_out_param_colRGBd_init(const char *name, double red, double green, double blue) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_param_get_gui(weed_plant_t *param) ALLOW_UNUSED
FN_DECL int weed_paramtmpl_get_flags(weed_plant_t *paramtmpl)
FN_DECL weed_plant_t * weed_colRGBd_init(const char *name, const char *label, double red, double green, double blue) ALLOW_UNUSED
FN_DECL int64_t weed_param_get_value_int64(weed_plant_t *param)
FN_DECL weed_plant_t * weed_out_param_colRGBi_init(const char *name, int red, int green, int blue) ALLOW_UNUSED
weed_error_t(* weed_init_f)(weed_plant_t *filter_instance)
Definition: weed-effects.h:164
FN_DECL int weed_param_get_value_int(weed_plant_t *param)
FN_DECL void weed_gui_set_flags(weed_plant_t *gui, int flags)
#define ALLOW_UNUSED
Definition: weed-plugin-utils.h:86
FN_DECL void weed_paramtmpl_set_name(weed_plant_t *paramtmpl, const char *name)
FN_DECL weed_plant_t ** weed_clone_plants(weed_plant_t **plants) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_get_host_info(weed_plant_t *plugin_info)
FN_DECL int weed_channel_get_offset(weed_plant_t *channel)
FN_DECL weed_plant_t * weed_out_param_float_init(const char *name, double def, double min, double max) ALLOW_UNUSED
FN_DECL int weed_host_supports_premultiplied_alpha(weed_plant_t *host_info)
FN_DECL weed_plant_t * weed_out_param_text_init(const char *name, const char *def) ALLOW_UNUSED
FN_DECL int weed_instance_get_flags(weed_plant_t *inst)
FN_DECL int weed_channel_get_stride(weed_plant_t *channel)
FN_DECL double weed_param_get_value_double(weed_plant_t *param)
FN_DECL weed_plant_t * weed_instance_get_gui(weed_plant_t *inst)
FN_DECL weed_plant_t * weed_out_param_float_init_nominmax(const char *name, double def) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_paramtmpl_get_gui(weed_plant_t *paramt) ALLOW_UNUSED
FN_DECL int weed_filter_get_version(weed_plant_t *filter)
FN_DECL weed_plant_t * weed_get_in_channel(weed_plant_t *inst, int idx)
weed_error_t(* weed_deinit_f)(weed_plant_t *filter_instance)
Definition: weed-effects.h:165
FN_DECL int weed_is_threading(weed_plant_t *inst)
FN_DECL int weed_filter_get_flags(weed_plant_t *filter)
FN_DECL int weed_channel_get_real_height(weed_plant_t *channel)
FN_DECL void * weed_channel_get_pixel_data(weed_plant_t *channel)
weed_error_t(* weed_process_f)(weed_plant_t *filter_instance, weed_timecode_t timestamp)
Definition: weed-effects.h:163
FN_DECL int weed_channel_get_yuv_clamping(weed_plant_t *channel)
FN_DECL weed_plant_t * weed_integer_init(const char *name, const char *label, int def, int min, int max) ALLOW_UNUSED
FN_DECL weed_plant_t * weed_get_out_channel(weed_plant_t *inst, int idx)
FN_DECL void weed_paramtmpl_declare_transition(weed_plant_t *pt)
FN_DECL weed_plant_t * weed_out_param_switch_init(const char *name, int def) ALLOW_UNUSED
FN_DECL int weed_channel_get_width(weed_plant_t *channel)
FN_DECL int weed_channel_get_palette(weed_plant_t *channel)
FN_DECL char * weed_param_get_value_string(weed_plant_t *param)
FN_DECL int weed_channel_get_height(weed_plant_t *channel)
FN_DECL weed_plant_t * weed_string_list_init(const char *name, const char *label, int def, const char **const list) ALLOW_UNUSED
FN_DECL void weed_filter_set_name(weed_plant_t *filter, const char *name)
FN_DECL void weed_paramtmpl_set_flags(weed_plant_t *paramtmpl, int flags)
FN_DECL int weed_host_get_flags(weed_plant_t *host_info)
FN_DECL int weed_channel_is_disabled(weed_plant_t *channel)