hard edges rework, add hard edge in gwdw, config.ac nv/cuda tweaks, message log warn...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / crikey / crikey.C
index 46d2402f2f58e0f630328bad62876d2b3a3b9083..2cfa5dc4029df825e2052c90aa8897dd9aadc9aa 100644 (file)
@@ -27,6 +27,7 @@
 #include "bccmodels.h"
 #include "bccolors.h"
 #include "clip.h"
+#include "edl.h"
 #include "edlsession.h"
 #include "filexml.h"
 #include "crikey.h"
@@ -212,7 +213,7 @@ void FillRegion::run()
                                if( edge_pixel(lofs) ) break;
                        }
                        int rofs = ofs;
-                       for( int i=rt; ++i< w; rt=i,msk[rofs]=0 ) {
+                       for( int i=rt; ++i< w; ) {
                                if( !msk[++rofs] ) break;
                                msk[rofs] = 0;  rt = i;
                                if( edge_pixel(rofs) ) break;
@@ -263,7 +264,7 @@ LOAD_CONFIGURATION_MACRO(CriKey, CriKeyConfig)
 
 int CriKey::new_point()
 {
-       EDLSession *session = get_edlsession();
+       EDLSession *session = get_edl()->session;
        float x = !session ? 0.f : session->output_w / 2.f;
        float y = !session ? 0.f : session->output_h / 2.f;
        return config.add_point(-1, 0, x, y, 0.5f);
@@ -570,14 +571,6 @@ void CriKey::draw_point(VFrame *src, CriKeyPoint *pt)
 }
 
 
-static void get_vframe(VFrame *&vfrm, int w, int h, int color_model)
-{
-       if( vfrm && ( vfrm->get_w() != w || vfrm->get_h() != h ) ) {
-               delete vfrm;  vfrm = 0;
-       }
-       if( !vfrm ) vfrm = new VFrame(w, h, color_model, 0);
-}
-
 static void fill_edge(VFrame *vfrm, int w, int h)
 {
        int w1 = w-1, h1 = h-1;
@@ -599,14 +592,14 @@ int CriKey::process_buffer(VFrame *frame, int64_t start_position, double frame_r
        if( comp > 3 ) comp = 3;
 
        read_frame(src, 0, start_position, frame_rate, 0);
-       get_vframe(edg, w, h, BC_A_FLOAT);
+       VFrame::get_temp(edg, w, h, BC_A_FLOAT);
 
        if( !engine )
                engine = new CriKeyEngine(this,
                        PluginClient::get_project_smp() + 1,
                        PluginClient::get_project_smp() + 1);
 
-       get_vframe(msk, w, h, BC_A8);
+       VFrame::get_temp(msk, w, h, BC_A8);
        memset(msk->get_data(), 0xff, msk->get_data_size());
 
        for( int i=0, n=config.points.size(); i<n; ++i ) {