load fn from resources, del kfrm speed update, svg exec cmd/file win fixes, undo...
[goodguy/history.git] / cinelerra-5.1 / plugins / yuv / yuv.C
index 0e84d90b3b9ba563a8016ea36869fed93fff4694..c6b7313444d28c91d465e1bd6f8d80a793c8ccd0 100644 (file)
@@ -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"
 
@@ -206,7 +206,7 @@ YUVEffect::~YUVEffect()
 
 }
 
-const char* YUVEffect::plugin_title() { return _("YUV"); }
+const char* YUVEffect::plugin_title() { return N_("YUV"); }
 int YUVEffect::is_realtime() { return 1; }
 
 
@@ -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; \