X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fyuv%2Fyuv.C;h=83f7f03c2d26cda46deb1d2b5b6804e7092e44fa;hb=af44bff549c39ac8bb6e42a791e7a211e1013526;hp=4cdad02ab73d2a228df3581d602a633531277d7e;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/plugins/yuv/yuv.C b/cinelerra-5.1/plugins/yuv/yuv.C index 4cdad02a..83f7f03c 100644 --- a/cinelerra-5.1/plugins/yuv/yuv.C +++ b/cinelerra-5.1/plugins/yuv/yuv.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * 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" @@ -25,7 +25,7 @@ #include "filexml.h" #include "guicast.h" #include "language.h" -#include "cicolors.h" +#include "bccolors.h" #include "pluginvclient.h" #include "vframe.h" @@ -43,10 +43,10 @@ public: 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; @@ -118,10 +118,10 @@ int YUVConfig::equivalent(YUVConfig &src) 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); @@ -140,13 +140,13 @@ void YUVConfig::interpolate(YUVConfig &prev, #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; @@ -162,11 +162,11 @@ int YUVLevel::handle_event() YUVWindow::YUVWindow(YUVEffect *plugin) - : PluginClientWindow(plugin, - 260, - 100, - 260, - 100, + : PluginClientWindow(plugin, + 260, + 100, + 260, + 100, 0) { this->plugin = plugin; @@ -199,15 +199,15 @@ void YUVWindow::create_objects() YUVEffect::YUVEffect(PluginServer *server) : PluginVClient(server) { - + } YUVEffect::~YUVEffect() { - + } const char* YUVEffect::plugin_title() { return _("YUV"); } -int YUVEffect::is_realtime() { return 1; } +int YUVEffect::is_realtime() { return 1; } NEW_WINDOW_MACRO(YUVEffect, YUVWindow) @@ -257,8 +257,6 @@ void YUVEffect::read_data(KeyFrame *keyframe) } -static YUV yuv_static; - #define YUV_MACRO(type, temp_type, max, components, use_yuv) \ { \ for(int i = 0; i < input->get_h(); i++) \ @@ -283,16 +281,16 @@ static YUV yuv_static; 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) \ @@ -304,6 +302,10 @@ static YUV yuv_static; 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 \ { \ @@ -313,12 +315,12 @@ static YUV yuv_static; } \ \ 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; \ @@ -334,7 +336,7 @@ static YUV yuv_static; 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])