fix mask vframe setup, add unshared vframe constructor
[goodguy/history.git] / cinelerra-5.1 / plugins / yuvshift / yuvshift.C
index b1ab69c315615d80519da05edf99d7117b6e3670..558c4804d42fe351064d97d27f15a1e8270239c7 100644 (file)
@@ -2,21 +2,21 @@
 /*
  * 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"
@@ -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(YUVShiftConfig &src);
        int equivalent(YUVShiftConfig &src);
-       void interpolate(YUVShiftConfig &prev, 
-               YUVShiftConfig &next, 
-               long prev_frame, 
-               long next_frame, 
+       void interpolate(YUVShiftConfig &prev,
+               YUVShiftConfig &next,
+               long prev_frame,
+               long next_frame,
                long current_frame);
 
        int y_dx, y_dy, u_dx, u_dy, v_dx, v_dy;
@@ -120,10 +120,10 @@ int YUVShiftConfig::equivalent(YUVShiftConfig &src)
                EQUIV(y_dy, src.y_dy) && EQUIV(u_dy, src.u_dy) && EQUIV(v_dy, src.v_dy);
 }
 
-void YUVShiftConfig::interpolate(YUVShiftConfig &prev, 
-       YUVShiftConfig &next, 
-       long prev_frame, 
-       long next_frame, 
+void YUVShiftConfig::interpolate(YUVShiftConfig &prev,
+       YUVShiftConfig &next,
+       long prev_frame,
+       long next_frame,
        long current_frame)
 {
        double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
@@ -209,7 +209,7 @@ YUVShiftEffect::~YUVShiftEffect()
 }
 
 const char* YUVShiftEffect::plugin_title() { return _("YUVShift"); }
-int YUVShiftEffect::is_realtime() { return 1; } 
+int YUVShiftEffect::is_realtime() { return 1; }
 
 
 NEW_WINDOW_MACRO(YUVShiftEffect, YUVShiftWindow)
@@ -269,8 +269,6 @@ void YUVShiftEffect::read_data(KeyFrame *keyframe)
 }
 
 
-static YUV yuv_static;
-
 #define YUV_MACRO(type, temp_type, components) \
 { \
        for(int i = 0; i < h; i++) { \
@@ -310,11 +308,11 @@ static YUV yuv_static;
                        temp_type u = up ? up[1] : 0x80; \
                        temp_type v = vp ? vp[2] : 0x80; \
                        if( sizeof(type) == 4 ) \
-                               yuv_static.yuv_to_rgb_f(r, g, b, y/255., (u-128.)/255., (v-128.)/255.); \
+                               YUV::yuv.yuv_to_rgb_f(r, g, b, y/255., (u-128.)/255., (v-128.)/255.); \
                        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; \
                        out_row[2] = b; \
@@ -345,7 +343,7 @@ int YUVShiftEffect::process_realtime(VFrame *input, VFrame *output)
                        delete temp_frame;  temp_frame = 0;
                }
                if( !temp_frame )
-                       temp_frame = new VFrame(w, h, color_model);
+                       temp_frame = new VFrame(w, h, color_model, 0);
                frame = temp_frame;
                if( color_model != input->get_color_model() )
                        BC_CModels::transfer(frame->get_rows(), input->get_rows(),