/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include "bcdisplayinfo.h"
#include "filexml.h"
#include "guicast.h"
#include "language.h"
-#include "cicolors.h"
+#include "bccolors.h"
#include "pluginvclient.h"
#include "vframe.h"
void copy_from(YUVConfig &src);
int equivalent(YUVConfig &src);
- void interpolate(YUVConfig &prev,
- YUVConfig &next,
- long prev_frame,
- long next_frame,
+ void interpolate(YUVConfig &prev,
+ YUVConfig &next,
+ long prev_frame,
+ long next_frame,
long current_frame);
float y, u, v;
return EQUIV(y, src.y) && EQUIV(u, src.u) && EQUIV(v, src.v);
}
-void YUVConfig::interpolate(YUVConfig &prev,
- YUVConfig &next,
- long prev_frame,
- long next_frame,
+void YUVConfig::interpolate(YUVConfig &prev,
+ YUVConfig &next,
+ long prev_frame,
+ long next_frame,
long current_frame)
{
double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
#define MAXVALUE 100
YUVLevel::YUVLevel(YUVEffect *plugin, float *output, int x, int y)
- : BC_FSlider(x,
+ : BC_FSlider(x,
y,
0,
- 200,
- 200,
- -MAXVALUE,
- MAXVALUE,
+ 200,
+ 200,
+ -MAXVALUE,
+ MAXVALUE,
*output)
{
this->plugin = plugin;
YUVWindow::YUVWindow(YUVEffect *plugin)
- : PluginClientWindow(plugin,
- 260,
- 100,
- 260,
- 100,
+ : PluginClientWindow(plugin,
+ 260,
+ 100,
+ 260,
+ 100,
0)
{
this->plugin = plugin;
YUVEffect::YUVEffect(PluginServer *server)
: PluginVClient(server)
{
-
+
}
YUVEffect::~YUVEffect()
{
-
+
}
-const char* YUVEffect::plugin_title() { return _("YUV"); }
-int YUVEffect::is_realtime() { return 1; }
+const char* YUVEffect::plugin_title() { return N_("YUV"); }
+int YUVEffect::is_realtime() { return 1; }
NEW_WINDOW_MACRO(YUVEffect, YUVWindow)
}
-static YUV yuv_static;
-
#define YUV_MACRO(type, temp_type, max, components, use_yuv) \
{ \
for(int i = 0; i < input->get_h(); i++) \
temp_type y, u, v, r, g, b; \
if(sizeof(type) == 4) \
{ \
- yuv_static.rgb_to_yuv_f(in_row[0], in_row[1], in_row[2], y, u, v); \
+ YUV::yuv.rgb_to_yuv_f(in_row[0], in_row[1], in_row[2], y, u, v); \
} \
else \
if(sizeof(type) == 2) \
{ \
- yuv_static.rgb_to_yuv_16(in_row[0], in_row[1], in_row[2], y, u, v); \
+ YUV::yuv.rgb_to_yuv_16(in_row[0], in_row[1], in_row[2], y, u, v); \
} \
else \
{ \
- yuv_static.rgb_to_yuv_8(in_row[0], in_row[1], in_row[2], y, u, v); \
+ YUV::yuv.rgb_to_yuv_8(in_row[0], in_row[1], in_row[2], y, u, v); \
} \
\
if(sizeof(type) < 4) \
y = temp_type((float)y * y_scale + round); \
u = temp_type((float)(u - (max / 2 + 1)) * u_scale + round) + (max / 2 + 1); \
v = temp_type((float)(v - (max / 2 + 1)) * v_scale + round) + (max / 2 + 1); \
+ \
+ CLAMP(y, 0, max); \
+ CLAMP(u, 0, max); \
+ CLAMP(v, 0, max); \
} \
else \
{ \
} \
\
if(sizeof(type) == 4) \
- yuv_static.yuv_to_rgb_f(r, g, b, y, u, v); \
+ YUV::yuv.yuv_to_rgb_f(r, g, b, y, u, v); \
else \
if(sizeof(type) == 2) \
- yuv_static.yuv_to_rgb_16(r, g, b, y, u, v); \
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); \
else \
- yuv_static.yuv_to_rgb_8(r, g, b, y, u, v); \
+ YUV::yuv.yuv_to_rgb_8(r, g, b, y, u, v); \
\
out_row[0] = r; \
out_row[1] = g; \
int YUVEffect::process_realtime(VFrame *input, VFrame *output)
{
load_configuration();
-
+
if(EQUIV(config.y, 0) && EQUIV(config.u, 0) && EQUIV(config.v, 0))
{
if(input->get_rows()[0] != output->get_rows()[0])