4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __COLORSPACE_H__
23 #define __COLORSPACE_H__
29 #include "loadbalance.h"
30 #include "pluginvclient.h"
31 #include "colorspacewindow.h"
32 #include <sys/types.h>
34 class ColorSpaceConfig;
36 class ColorSpacePackage;
38 class ColorSpaceEngine;
43 enum lut_typ { yuv2yuv, rgb2yuv, yuv2rgb, rgb2rgb };
47 int init_yuv2yuv(double iKr, double iKb, double oKr, double oKb);
48 int init_rgb2yuv(double Kr, double Kb);
49 int init_yuv2rgb(double Kr, double Kb);
50 int init_rgb2rgb(double iKr, double iKb, double oKr, double oKb);
52 void init(int len, int inv,
53 int inp_model, int inp_space, int inp_range,
54 int out_model, int out_space, int out_range);
55 void alloc_lut(int len);
56 void create_table(lut_t **lut, int len, float *vars);
57 void create_tables(int len);
59 void process(VFrame *inp, VFrame *out, int row1, int row2);
62 int inp_model, inp_space, inp_range;
63 int out_model, out_space, out_range;
65 lut_t imin[3], omin[3], imax[3], omax[3];
66 lut_t izro[3], ozro[3], irng[3], orng[3];
67 float izrf[3], ozrf[3], omnf[3], omxf[3];
96 class ColorSpaceConfig
101 int inp_colorspace, inp_colorrange;
102 int out_colorspace, out_colorrange;
105 class ColorSpacePackage : public LoadPackage
112 class ColorSpaceUnit : public LoadClient
115 ColorSpaceUnit(ColorSpaceMain *plugin, ColorSpaceEngine *engine);
116 void process_package(LoadPackage *package);
117 ColorSpaceEngine *engine;
118 ColorSpaceMain *plugin;
122 class ColorSpaceEngine : public LoadServer
125 ColorSpaceEngine(ColorSpaceMain *plugin, int cpus);
126 void init_packages();
127 LoadClient* new_client();
128 LoadPackage* new_package();
129 ColorSpaceMain *plugin;
133 class ColorSpaceMain : public PluginVClient
136 ColorSpaceMain(PluginServer *server);
139 PLUGIN_CLASS_MEMBERS(ColorSpaceConfig);
140 int process_realtime(VFrame *input, VFrame *output);
143 void save_data(KeyFrame *keyframe);
144 void read_data(KeyFrame *keyframe);
148 int inp_color_space, inp_color_range;
149 int out_color_space, out_color_range;
152 ColorSpaceEngine *engine;