3 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "loadbalance.h"
27 #include "pluginvclient.h"
37 enum { PT_E, PT_X, PT_Y, PT_T, PT_TAG, PT_SZ }; // enable, x,y,threshold, tag
45 CriKeyPoint(int tag, int e, float x, float y, float t);
48 class CriKeyPoints : public ArrayList<CriKeyPoint *>
52 ~CriKeyPoints() { remove_all_objects(); }
61 int equivalent(CriKeyConfig &that);
62 void copy_from(CriKeyConfig &that);
63 void interpolate(CriKeyConfig &prev, CriKeyConfig &next,
64 long prev_frame, long next_frame, long current_frame);
68 int add_point(int tag, int e, float x, float y, float t);
70 void del_point(int i);
77 class CriKeyPackage : public LoadPackage
80 CriKeyPackage() : LoadPackage() {}
84 class CriKeyEngine : public LoadServer
87 CriKeyEngine(CriKey *plugin, int total_clients, int total_packages)
88 : LoadServer(total_clients, total_packages) { this->plugin = plugin; }
92 LoadPackage* new_package();
93 LoadClient* new_client();
96 int set_color(int x, int y, float t);
97 float color[3], threshold;
100 class CriKeyUnit : public LoadClient
103 CriKeyUnit(CriKeyEngine *server)
104 : LoadClient(server) { this->server = server; }
107 float edge_detect(float *data, float max, int do_max);
108 void process_package(LoadPackage *package);
109 CriKeyEngine *server;
113 class CriKey : public PluginVClient
116 CriKey(PluginServer *server);
118 // required for all realtime plugins
119 PLUGIN_CLASS_MEMBERS2(CriKeyConfig)
123 int set_target(float *color, int x, int y);
124 void save_data(KeyFrame *keyframe);
125 void read_data(KeyFrame *keyframe);
126 int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
127 void draw_alpha(VFrame *msk);
128 void draw_edge(VFrame *frm);
129 void draw_mask(VFrame *frm);
130 void draw_point(VFrame *msk, CriKeyPoint *pt);
132 CriKeyEngine *engine;
133 VFrame *src, *edg, *msk;
134 int w, h, color_model, bpp, comp;
135 int is_yuv, is_float;