x265 update 2.7, findobj upgrade, fix svg init, fix for dragchkbox buttonpress, add...
authorGood Guy <good1.2guy@gmail.com>
Sat, 14 Apr 2018 16:52:19 +0000 (10:52 -0600)
committerGood Guy <good1.2guy@gmail.com>
Sat, 14 Apr 2018 16:52:19 +0000 (10:52 -0600)
18 files changed:
cinelerra-5.1/cinelerra/affine.C
cinelerra-5.1/cinelerra/affine.h
cinelerra-5.1/cinelerra/dragcheckbox.C
cinelerra-5.1/cinelerra/gwindowgui.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
cinelerra-5.1/cinelerra/viewmenu.C
cinelerra-5.1/configure.ac
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/plugins/findobj/findobj.C
cinelerra-5.1/plugins/findobj/findobj.h
cinelerra-5.1/plugins/findobj/findobjwindow.C
cinelerra-5.1/plugins/findobj/findobjwindow.h
cinelerra-5.1/plugins/flowobj/flowobj.h
cinelerra-5.1/plugins/moveobj/moveobj.h
cinelerra-5.1/plugins/svg/svg.C
cinelerra-5.1/thirdparty/src/x265_2.7.tar.xz [new file with mode: 0644]
cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz [deleted file]

index ff9c470907ba353b61680ae638e7c04a106f9110..2842f9909feb81d974801ce87a54e171a7895e40 100644 (file)
@@ -912,6 +912,40 @@ void AffineEngine::set_matrix(AffineMatrix *matrix)
        }
 }
 
        }
 }
 
+//  in x1,y1 - x2,y1   out x1,y1 - x2,y2 clockwise
+//       |       |           |       |
+//     x1,y2 - x2,y2       x4,y4 - x3,y3
+void AffineEngine::set_matrix(
+               double in_x1,  double in_y1,  double in_x2,  double in_y2,
+               double out_x1, double out_y1, double out_x2, double out_y2,
+               double out_x3, double out_y3, double out_x4, double out_y4)
+{
+       AffineMatrix m;
+       double in_w = in_x2 - in_x1, scalex = in_w > 0 ? 1./in_w : 1.0;
+       double in_h = in_y2 - in_y1, scaley = in_h > 0 ? 1./in_h : 1.0;
+       double dx1 = out_x2 - out_x3;
+       double dy1 = out_y2 - out_y3;
+       double dx2 = out_x4 - out_x3;
+       double dy2 = out_y4 - out_y3;
+       double dx3 = out_x1 - out_x2 + out_x3 - out_x4;
+       double dy3 = out_y1 - out_y2 + out_y3 - out_y4;
+       double det = dx1 * dy2 - dy1 * dx2;
+       m.values[2][0] = det ? (dx3 * dy2 - dy3 * dx2) / det : 0;
+       m.values[2][1] = det ? (dx1 * dy3 - dy1 * dx3) / det : 0;
+       m.values[2][2] = 1.0;
+       m.values[0][0] = out_x2 - out_x1 + matrix.values[2][0] * out_x2;
+       m.values[0][1] = out_x4 - out_x1 + matrix.values[2][1] * out_x4;
+       m.values[0][2] = out_x1;
+       m.values[1][0] = out_y2 - out_y1 + matrix.values[2][0] * out_y2;
+       m.values[1][1] = out_y4 - out_y1 + matrix.values[2][1] * out_y4;
+       m.values[1][2] = out_y1;
+       matrix.identity();
+       matrix.translate(-in_x1, -in_y1);
+       matrix.scale(scalex, scaley);
+       m.multiply(&matrix);
+}
+
+
 void AffineEngine::set_in_viewport(int x, int y, int w, int h)
 {
        this->in_x = x;  this->in_y = y;
 void AffineEngine::set_in_viewport(int x, int y, int w, int h)
 {
        this->in_x = x;  this->in_y = y;
index 339c8cbb5c1b931e304a0be656df2b20b9e26bc6..be74d572827a92ec5c54e78dcc9378fdc849519d 100644 (file)
@@ -94,6 +94,14 @@ public:
 // This removes some of the extremely faint artifacts in the trig rotation.
        void rotate(VFrame *output, VFrame *input, float angle);
        void set_matrix(AffineMatrix *matrix);
 // This removes some of the extremely faint artifacts in the trig rotation.
        void rotate(VFrame *output, VFrame *input, float angle);
        void set_matrix(AffineMatrix *matrix);
+// set_matrix:
+//  in x1,y1 - x2,y1   out x1,y1 - x2,y2 clockwise
+//       |       |           |       |
+//     x1,y2 - x2,y2       x4,y4 - x3,y3
+//
+       void set_matrix( double in_x1,  double in_y1,  double in_x2,  double in_y2,
+                        double out_x1, double out_y1, double out_x2, double out_y2,
+                        double out_x3, double out_y3, double out_x4, double out_y4);
 // Set the viewport to transform.  The transform is based on the input viewport.
 // The output viewport clips the transformed output.
        void set_in_viewport(int x, int y, int w, int h);
 // Set the viewport to transform.  The transform is based on the input viewport.
 // The output viewport clips the transformed output.
        void set_in_viewport(int x, int y, int w, int h);
index 559851eb9a90754afef92c06c863f19f24008e53..4db99b919546662e6c6c1346cec29ce4d15b7bf7 100644 (file)
@@ -159,7 +159,9 @@ int DragCheckBox::grab_event(XEvent *event)
                         fabs(drag_dy = cursor_y-y1) < r ) dragging = 8;
                else if( fabs(drag_dx = cursor_x-x1) < r &&  // x1,y1
                         fabs(drag_dy = cursor_y-y1) < r ) dragging = 9;
                         fabs(drag_dy = cursor_y-y1) < r ) dragging = 8;
                else if( fabs(drag_dx = cursor_x-x1) < r &&  // x1,y1
                         fabs(drag_dy = cursor_y-y1) < r ) dragging = 9;
+               else
                        return 0;
                        return 0;
+               return 1;
        }
        int cur_x = cursor_x - drag_dx;
        int cur_y = cursor_y - drag_dy;
        }
        int cur_x = cursor_x - drag_dx;
        int cur_y = cursor_y - drag_dy;
index aaea761e5457cf82678b0efa29dd219875ac4218..d7f639ed35634282db8e33dddaf203437ceed653 100644 (file)
@@ -71,7 +71,7 @@ const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] =
        N_("Assets"),
        N_("Titles"),
        N_("Transitions"),
        N_("Assets"),
        N_("Titles"),
        N_("Transitions"),
-       N_("Plugin Autos")
+       N_("Plugin Keyframes")
 };
 
 const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] =
 };
 
 const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] =
index 9731b4bbcb089d48aec86b183b3bf423c9dd3c9c..202a7687d073b3e4c0202258fe48942ca3e0f3da 100644 (file)
@@ -2263,32 +2263,38 @@ void MWindow::test_plugins(EDL *new_edl, char *path)
 }
 
 
 }
 
 
-void MWindow::init_shm()
+void MWindow::init_shm(const char *pfn, int64_t min)
 {
 {
+       int64_t result = 0;
 // Fix shared memory
 // Fix shared memory
-       FILE *fd = fopen("/proc/sys/kernel/shmmax", "w");
-       if(fd) {
-               fprintf(fd, "0x7fffffff");
+       FILE *fd = fopen(pfn, "r");
+       if( fd ) {
+               fscanf(fd, "%jd", &result);
                fclose(fd);
                fclose(fd);
+               if( result >= min ) return;
        }
        }
-       fd = 0;
 
 
-       fd = fopen("/proc/sys/kernel/shmmax", "r");
-       if(!fd) {
-               MainError::show_error("MWindow::init_shm: couldn't open /proc/sys/kernel/shmmax for reading.\n");
+       fd = fopen(pfn, "w");
+       if( fd ) {
+               fprintf(fd, "0x%jx", min);
+               fclose(fd);
+       }
+
+       fd = fopen(pfn, "r");
+       if( !fd ) {
+               eprintf(_("MWindow::init_shm: couldn't open %s for reading.\n"), pfn);
                return;
        }
 
                return;
        }
 
-       int64_t result = 0;
        fscanf(fd, "%jd", &result);
        fclose(fd);
        fscanf(fd, "%jd", &result);
        fclose(fd);
-       fd = 0;
-       if(result < 0x7fffffff) {
-               eprintf(_("MWindow::init_shm: /proc/sys/kernel/shmmax is %p.\n"
+       if( result < min ) {
+               eprintf(_("MWindow::init_shm: %s is %p.\n"
                        "you probably need to be root, or:\n"
                        "you probably need to be root, or:\n"
-                       "as root, run: echo 0x7fffffff > /proc/sys/kernel/shmmax\n"
+                       "as root, run: echo 0x%jx > %s\n"
                        "before trying to start cinelerra.\n"
                        "before trying to start cinelerra.\n"
-                       "It should be at least 0x7fffffff for Cinelerra.\n"), (void *)result);
+                       "It should be at least 0x%jx for Cinelerra.\n"),
+                       pfn, (void *)result, min, pfn, min);
        }
 }
 
        }
 }
 
@@ -2473,7 +2479,8 @@ void MWindow::create_objects(int want_gui,
                &MWindowGUI::keyboard_listener);
 
        hide_splash();
                &MWindowGUI::keyboard_listener);
 
        hide_splash();
-       init_shm();
+       init_shm("/proc/sys/kernel/shmmax", 0x7fffffff);
+       init_shm("/proc/sys/kernel/shmmni", 0x4000);
        if(debug) PRINT_TRACE
 
        BC_WindowBase::get_resources()->vframe_shm = 1;
        if(debug) PRINT_TRACE
 
        BC_WindowBase::get_resources()->vframe_shm = 1;
index 895314a2f6a97ad185e0f6b8d80b94d6bda25409..24210e41e9d776aceae95ff96bbad291891a50ac 100644 (file)
@@ -635,7 +635,7 @@ public:
        Mutex *brender_lock;
 
 // Initialize shared memory
        Mutex *brender_lock;
 
 // Initialize shared memory
-       void init_shm();
+       void init_shm(const char *pfn, int64_t min);
 
 // Initialize channel DB's for playback
        void init_channeldb();
 
 // Initialize channel DB's for playback
        void init_channeldb();
index b3d33d69aa458f2b3d8825c73b63342ad8b23882..2478136ef1d4677520b0a70d6f71f37fbb54b8aa 100644 (file)
@@ -138,7 +138,7 @@ void ShowAutomation::update_toggle()
 
 
 PluginAutomation::PluginAutomation(MWindow *mwindow, const char *hotkey)
 
 
 PluginAutomation::PluginAutomation(MWindow *mwindow, const char *hotkey)
- : BC_MenuItem(_("Plugin Autos"), hotkey, hotkey[0])
+ : BC_MenuItem(_("Plugin Keyframes"), hotkey, hotkey[0])
 {
        this->mwindow = mwindow;
 }
 {
        this->mwindow = mwindow;
 }
index 9159b78de203d116489d900b1be209668bba7865..9e98a90fd63cf3ccc66777a9bfb41f22110fb9f5 100644 (file)
@@ -314,7 +314,7 @@ PKG_3RD([x264],[auto],
   [ . ])
 
 PKG_3RD([x265],[auto],
   [ . ])
 
 PKG_3RD([x265],[auto],
-  [x265_v2.6],
+  [x265_2.7],
   [ libx265.a ],
   [ . source ])
 
   [ libx265.a ],
   [ . source ])
 
index 44671608f7302953b6d29fccad9a503d9aca60b6..8ffafb8169990717fac71831c4cd1457f9fba3a1 100644 (file)
@@ -561,10 +561,11 @@ void BC_FileBox::create_objects()
        if(!want_directory)
        {
                filter_list.append(new BC_ListBoxItem("*"));
        if(!want_directory)
        {
                filter_list.append(new BC_ListBoxItem("*"));
-               filter_list.append(new BC_ListBoxItem("[*.mkv]"));
+               filter_list.append(new BC_ListBoxItem("[*.mkv][*.webm]"));
                filter_list.append(new BC_ListBoxItem("[*.mp4]"));
                filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]"));
                filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]"));
                filter_list.append(new BC_ListBoxItem("[*.mp4]"));
                filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]"));
                filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]"));
+               filter_list.append(new BC_ListBoxItem("[*.jpg][*.png][*.gif][*.tiff]"));
                filter_list.append(new BC_ListBoxItem("*.xml"));
                fs->set_filter(get_resources()->filebox_filter);
        }
                filter_list.append(new BC_ListBoxItem("*.xml"));
                fs->set_filter(get_resources()->filebox_filter);
        }
index bc9f4f20b8ea41fee0e564074629ec72b8f6e7a2..7909170a3941a0cc1f3d8746eba2d2b329ff2c72 100644 (file)
 REGISTER_PLUGIN(FindObjMain)
 
 FindObjConfig::FindObjConfig()
 REGISTER_PLUGIN(FindObjMain)
 
 FindObjConfig::FindObjConfig()
+{
+       reset();
+}
+
+void FindObjConfig::reset()
 {
        algorithm = NO_ALGORITHM;
        use_flann = 1;
 {
        algorithm = NO_ALGORITHM;
        use_flann = 1;
@@ -45,11 +50,16 @@ FindObjConfig::FindObjConfig()
        draw_scene_border = 0;
        replace_object = 0;
        draw_object_border = 0;
        draw_scene_border = 0;
        replace_object = 0;
        draw_object_border = 0;
+       draw_replace_border = 0;
        object_x = 50;  object_y = 50;
        object_w = 100; object_h = 100;
        drag_object = 0;
        scene_x = 50;   scene_y = 50;
        scene_w = 100;  scene_h = 100;
        object_x = 50;  object_y = 50;
        object_w = 100; object_h = 100;
        drag_object = 0;
        scene_x = 50;   scene_y = 50;
        scene_w = 100;  scene_h = 100;
+       drag_replace = 0;
+       replace_x = 50;   replace_y = 50;
+       replace_w = 100;  replace_h = 100;
+       replace_dx = 0;   replace_dy = 0;
        drag_scene = 0;
        scene_layer = 0;
        object_layer = 1;
        drag_scene = 0;
        scene_layer = 0;
        object_layer = 1;
@@ -59,7 +69,6 @@ FindObjConfig::FindObjConfig()
 
 void FindObjConfig::boundaries()
 {
 
 void FindObjConfig::boundaries()
 {
-       bclamp(drag_object, 0, 1); bclamp(drag_scene, 0, 1);
        bclamp(object_x, 0, 100);  bclamp(object_y, 0, 100);
        bclamp(object_w, 0, 100);  bclamp(object_h, 0, 100);
        bclamp(scene_x, 0, 100);   bclamp(scene_y, 0, 100);
        bclamp(object_x, 0, 100);  bclamp(object_y, 0, 100);
        bclamp(object_w, 0, 100);  bclamp(object_h, 0, 100);
        bclamp(scene_x, 0, 100);   bclamp(scene_y, 0, 100);
@@ -79,12 +88,17 @@ int FindObjConfig::equivalent(FindObjConfig &that)
                draw_scene_border == that.draw_scene_border &&
                replace_object == that.replace_object &&
                draw_object_border == that.draw_object_border &&
                draw_scene_border == that.draw_scene_border &&
                replace_object == that.replace_object &&
                draw_object_border == that.draw_object_border &&
+               draw_replace_border == that.draw_replace_border &&
                object_x == that.object_x && object_y == that.object_y &&
                object_w == that.object_w && object_h == that.object_h &&
                drag_object == that.drag_object &&
                scene_x == that.scene_x && scene_y == that.scene_y &&
                scene_w == that.scene_w && scene_h == that.scene_h &&
                drag_scene == that.drag_scene &&
                object_x == that.object_x && object_y == that.object_y &&
                object_w == that.object_w && object_h == that.object_h &&
                drag_object == that.drag_object &&
                scene_x == that.scene_x && scene_y == that.scene_y &&
                scene_w == that.scene_w && scene_h == that.scene_h &&
                drag_scene == that.drag_scene &&
+               replace_x == that.replace_x && replace_y == that.replace_y &&
+               replace_w == that.replace_w && replace_h == that.replace_h &&
+               replace_dx == that.replace_dx && replace_dy == that.replace_dy &&
+               drag_replace == that.drag_replace &&
                object_layer == that.object_layer &&
                replace_layer == that.replace_layer &&
                scene_layer == that.scene_layer &&
                object_layer == that.object_layer &&
                replace_layer == that.replace_layer &&
                scene_layer == that.scene_layer &&
@@ -100,12 +114,17 @@ void FindObjConfig::copy_from(FindObjConfig &that)
        draw_scene_border = that.draw_scene_border;
        replace_object = that.replace_object;
        draw_object_border = that.draw_object_border;
        draw_scene_border = that.draw_scene_border;
        replace_object = that.replace_object;
        draw_object_border = that.draw_object_border;
+       draw_replace_border = that.draw_replace_border;
        object_x = that.object_x;  object_y = that.object_y;
        object_w = that.object_w;  object_h = that.object_h;
        drag_object = that.drag_object;
        scene_x = that.scene_x;    scene_y = that.scene_y;
        scene_w = that.scene_w;    scene_h = that.scene_h;
        drag_scene = that.drag_scene;
        object_x = that.object_x;  object_y = that.object_y;
        object_w = that.object_w;  object_h = that.object_h;
        drag_object = that.drag_object;
        scene_x = that.scene_x;    scene_y = that.scene_y;
        scene_w = that.scene_w;    scene_h = that.scene_h;
        drag_scene = that.drag_scene;
+       replace_x = that.replace_x;   replace_y = that.replace_y;
+       replace_w = that.replace_w;   replace_h = that.replace_h;
+       replace_dx = that.replace_dx; replace_dy = that.replace_dy;
+       drag_replace = that.drag_replace;
        object_layer = that.object_layer;
        replace_layer = that.replace_layer;
        scene_layer = that.scene_layer;
        object_layer = that.object_layer;
        replace_layer = that.replace_layer;
        scene_layer = that.scene_layer;
@@ -168,34 +187,7 @@ void FindObjMain::update_gui()
        if( !load_configuration() ) return;
        FindObjWindow *window = (FindObjWindow*)thread->window;
        window->lock_window("FindObjMain::update_gui");
        if( !load_configuration() ) return;
        FindObjWindow *window = (FindObjWindow*)thread->window;
        window->lock_window("FindObjMain::update_gui");
-       window->algorithm->set_text(FindObjAlgorithm::to_text(config.algorithm));
-       window->use_flann->update(config.use_flann);
-       window->drag_object->update(config.drag_object);
-       window->object_x->update(config.object_x);
-       window->object_x_text->update((float)config.object_x);
-       window->object_y->update(config.object_y);
-       window->object_y_text->update((float)config.object_y);
-       window->object_w->update(config.object_w);
-       window->object_w_text->update((float)config.object_w);
-       window->object_h->update(config.object_h);
-       window->object_h_text->update((float)config.object_h);
-       window->drag_scene->update(config.drag_scene);
-       window->scene_x->update(config.scene_x);
-       window->scene_x_text->update((float)config.scene_x);
-       window->scene_y->update(config.scene_y);
-       window->scene_y_text->update((float)config.scene_y);
-       window->scene_w->update(config.scene_w);
-       window->scene_w_text->update((float)config.scene_w);
-       window->scene_h->update(config.scene_h);
-       window->scene_h_text->update((float)config.scene_h);
-       window->draw_keypoints->update(config.draw_keypoints);
-       window->draw_scene_border->update(config.draw_scene_border);
-       window->replace_object->update(config.replace_object);
-       window->draw_object_border->update(config.draw_object_border);
-       window->object_layer->update( (int64_t)config.object_layer);
-       window->replace_layer->update( (int64_t)config.replace_layer);
-       window->scene_layer->update( (int64_t)config.scene_layer);
-       window->blend->update( (int64_t)config.blend);
+       window->update_gui();
        window->flush();
        window->unlock_window();
 }
        window->flush();
        window->unlock_window();
 }
@@ -219,10 +211,18 @@ void FindObjMain::save_data(KeyFrame *keyframe)
        output.tag.set_property("SCENE_Y", config.scene_y);
        output.tag.set_property("SCENE_W", config.scene_w);
        output.tag.set_property("SCENE_H", config.scene_h);
        output.tag.set_property("SCENE_Y", config.scene_y);
        output.tag.set_property("SCENE_W", config.scene_w);
        output.tag.set_property("SCENE_H", config.scene_h);
+       output.tag.set_property("DRAG_REPLACE", config.drag_replace);
+       output.tag.set_property("REPLACE_X", config.replace_x);
+       output.tag.set_property("REPLACE_Y", config.replace_y);
+       output.tag.set_property("REPLACE_W", config.replace_w);
+       output.tag.set_property("REPLACE_H", config.replace_h);
+       output.tag.set_property("REPLACE_DX", config.replace_dx);
+       output.tag.set_property("REPLACE_DY", config.replace_dy);
        output.tag.set_property("DRAW_KEYPOINTS", config.draw_keypoints);
        output.tag.set_property("DRAW_SCENE_BORDER", config.draw_scene_border);
        output.tag.set_property("REPLACE_OBJECT", config.replace_object);
        output.tag.set_property("DRAW_OBJECT_BORDER", config.draw_object_border);
        output.tag.set_property("DRAW_KEYPOINTS", config.draw_keypoints);
        output.tag.set_property("DRAW_SCENE_BORDER", config.draw_scene_border);
        output.tag.set_property("REPLACE_OBJECT", config.replace_object);
        output.tag.set_property("DRAW_OBJECT_BORDER", config.draw_object_border);
+       output.tag.set_property("DRAW_REPLACE_BORDER", config.draw_replace_border);
        output.tag.set_property("OBJECT_LAYER", config.object_layer);
        output.tag.set_property("REPLACE_LAYER", config.replace_layer);
        output.tag.set_property("SCENE_LAYER", config.scene_layer);
        output.tag.set_property("OBJECT_LAYER", config.object_layer);
        output.tag.set_property("REPLACE_LAYER", config.replace_layer);
        output.tag.set_property("SCENE_LAYER", config.scene_layer);
@@ -256,10 +256,18 @@ void FindObjMain::read_data(KeyFrame *keyframe)
                        config.scene_w = input.tag.get_property("SCENE_W", config.scene_w);
                        config.scene_h = input.tag.get_property("SCENE_H", config.scene_h);
                        config.drag_scene = input.tag.get_property("DRAG_SCENE", config.drag_scene);
                        config.scene_w = input.tag.get_property("SCENE_W", config.scene_w);
                        config.scene_h = input.tag.get_property("SCENE_H", config.scene_h);
                        config.drag_scene = input.tag.get_property("DRAG_SCENE", config.drag_scene);
+                       config.replace_x = input.tag.get_property("REPLACE_X", config.replace_x);
+                       config.replace_y = input.tag.get_property("REPLACE_Y", config.replace_y);
+                       config.replace_w = input.tag.get_property("REPLACE_W", config.replace_w);
+                       config.replace_h = input.tag.get_property("REPLACE_H", config.replace_h);
+                       config.replace_dx = input.tag.get_property("REPLACE_DX", config.replace_dx);
+                       config.replace_dy = input.tag.get_property("REPLACE_DY", config.replace_dy);
+                       config.drag_replace = input.tag.get_property("DRAG_REPLACE", config.drag_replace);
                        config.draw_keypoints = input.tag.get_property("DRAW_KEYPOINTS", config.draw_keypoints);
                        config.draw_scene_border = input.tag.get_property("DRAW_SCENE_BORDER", config.draw_scene_border);
                        config.replace_object = input.tag.get_property("REPLACE_OBJECT", config.replace_object);
                        config.draw_object_border = input.tag.get_property("DRAW_OBJECT_BORDER", config.draw_object_border);
                        config.draw_keypoints = input.tag.get_property("DRAW_KEYPOINTS", config.draw_keypoints);
                        config.draw_scene_border = input.tag.get_property("DRAW_SCENE_BORDER", config.draw_scene_border);
                        config.replace_object = input.tag.get_property("REPLACE_OBJECT", config.replace_object);
                        config.draw_object_border = input.tag.get_property("DRAW_OBJECT_BORDER", config.draw_object_border);
+                       config.draw_replace_border = input.tag.get_property("DRAW_REPLACE_BORDER", config.draw_replace_border);
                        config.object_layer = input.tag.get_property("OBJECT_LAYER", config.object_layer);
                        config.replace_layer = input.tag.get_property("REPLACE_LAYER", config.replace_layer);
                        config.scene_layer = input.tag.get_property("SCENE_LAYER", config.scene_layer);
                        config.object_layer = input.tag.get_property("OBJECT_LAYER", config.object_layer);
                        config.replace_layer = input.tag.get_property("REPLACE_LAYER", config.replace_layer);
                        config.scene_layer = input.tag.get_property("SCENE_LAYER", config.scene_layer);
@@ -474,10 +482,12 @@ void FindObjMain::process_match()
        src.push_back(Point2f(obj_x1,obj_y2));
        perspectiveTransform(src, dst, H);
 
        src.push_back(Point2f(obj_x1,obj_y2));
        perspectiveTransform(src, dst, H);
 
-       border_x1 = dst[0].x + scene_x;  border_y1 = dst[0].y + scene_y;
-       border_x2 = dst[1].x + scene_x;  border_y2 = dst[1].y + scene_y;
-       border_x3 = dst[2].x + scene_x;  border_y3 = dst[2].y + scene_y;
-       border_x4 = dst[3].x + scene_x;  border_y4 = dst[3].y + scene_y;
+       float dx = scene_x + replace_dx;
+       float dy = scene_y + replace_dy;
+       border_x1 = dst[0].x + dx;  border_y1 = dst[0].y + dy;
+       border_x2 = dst[1].x + dx;  border_y2 = dst[1].y + dy;
+       border_x3 = dst[2].x + dx;  border_y3 = dst[2].y + dy;
+       border_x4 = dst[3].x + dx;  border_y4 = dst[3].y + dy;
 //printf("src %f,%f  %f,%f  %f,%f  %f,%f\n",
 // src[0].x,src[0].y, src[1].x,src[1].y, src[2].x,src[2].y, src[3].x,src[3].y);
 //printf("dst %f,%f  %f,%f  %f,%f  %f,%f\n",
 //printf("src %f,%f  %f,%f  %f,%f  %f,%f\n",
 // src[0].x,src[0].y, src[1].x,src[1].y, src[2].x,src[2].y, src[3].x,src[3].y);
 //printf("dst %f,%f  %f,%f  %f,%f  %f,%f\n",
@@ -532,6 +542,22 @@ int FindObjMain::process_buffer(VFrame **frame, int64_t start_position, double f
        bclamp(cfg_x2, 0, w);  scene_w = cfg_x2 - cfg_x1;
        bclamp(cfg_y2, 0, h);  scene_h = cfg_y2 - cfg_y1;
 
        bclamp(cfg_x2, 0, w);  scene_w = cfg_x2 - cfg_x1;
        bclamp(cfg_y2, 0, h);  scene_h = cfg_y2 - cfg_y1;
 
+       cfg_w = (int)(w * config.replace_w / 100.);
+       cfg_h = (int)(h * config.replace_h / 100.);
+       cfg_x1 = (int)(w * config.replace_x / 100. - cfg_w / 2);
+       cfg_y1 = (int)(h * config.replace_y / 100. - cfg_h / 2);
+       cfg_x2 = cfg_x1 + cfg_w;
+       cfg_y2 = cfg_y1 + cfg_h;
+       bclamp(cfg_x1, 0, w);  replace_x = cfg_x1;
+       bclamp(cfg_y1, 0, h);  replace_y = cfg_y1;
+       bclamp(cfg_x2, 0, w);  replace_w = cfg_x2 - cfg_x1;
+       bclamp(cfg_y2, 0, h);  replace_h = cfg_y2 - cfg_y1;
+
+       int cfg_dx = (int)(w * config.replace_dx / 100.);
+       int cfg_dy = (int)(h * config.replace_dy / 100.);
+       bclamp(cfg_dx, -h, h);  replace_dx = cfg_dx;
+       bclamp(cfg_dy, -w, w);  replace_dy = cfg_dy;
+
 // Read in the input frames
        for( int i = 0; i < PluginClient::get_total_buffers(); i++ ) {
                read_frame(frame[i], i, start_position, frame_rate, 0);
 // Read in the input frames
        for( int i = 0; i < PluginClient::get_total_buffers(); i++ ) {
                read_frame(frame[i], i, start_position, frame_rate, 0);
@@ -563,16 +589,18 @@ int FindObjMain::process_buffer(VFrame **frame, int64_t start_position, double f
                        affine = new AffineEngine(cpus1, cpus1);
                if( !overlayer )
                        overlayer = new OverlayFrame(cpus1);
                        affine = new AffineEngine(cpus1, cpus1);
                if( !overlayer )
                        overlayer = new OverlayFrame(cpus1);
-
-               VFrame *temp = new_temp(scene->get_w(), scene->get_h(), scene->get_color_model());
+               VFrame *temp = new_temp(w, h, scene->get_color_model());
                temp->clear_frame();
                temp->clear_frame();
-               float sx = 100./w, sy = 100./h;
-               float x1 = sx * obj_x1, y1 = sy * obj_y1;
-               float x2 = sx * obj_x2, y2 = sy * obj_y2;
-               float x3 = sx * obj_x3, y3 = sy * obj_y3;
-               float x4 = sx * obj_x4, y4 = sy * obj_y4;
-               affine->process(temp, replace, 0, AffineEngine::PERSPECTIVE,
-                       x1,y1, x2,y2, x3,y3, x4,y4, 1);
+               affine->set_in_viewport(replace_x, replace_y, replace_w, replace_h);
+               int x1 = obj_x1, x2 = obj_x2, x3 = obj_x3, x4 = obj_x4;
+               int y1 = obj_y1, y2 = obj_y2, y3 = obj_y3, y4 = obj_y4;
+               bclamp(x1, 0, w);  bclamp(x2, 0, w);  bclamp(x3, 0, w);  bclamp(x4, 0, w);
+               bclamp(y1, 0, h);  bclamp(y2, 0, h);  bclamp(y3, 0, h);  bclamp(y4, 0, h);
+               affine->set_matrix(
+                       replace_x, replace_y, replace_x+replace_w, replace_y+replace_h,
+                       x1,y1, x2,y2, x3,y3, x4,y4);
+               affine->process(temp, replace, 0,
+                       AffineEngine::TRANSFORM, 0,0, 100,0, 100,100, 0,100, 1);
                overlayer->overlay(scene, temp,  0,0, w,h,  0,0, w,h,
                        1, TRANSFER_NORMAL, NEAREST_NEIGHBOR);
 
                overlayer->overlay(scene, temp,  0,0, w,h,  0,0, w,h,
                        1, TRANSFER_NORMAL, NEAREST_NEIGHBOR);
 
@@ -588,6 +616,11 @@ int FindObjMain::process_buffer(VFrame **frame, int64_t start_position, double f
                scene->set_pixel_color(YELLOW);  scene->set_stiple(ss*3);
                draw_rect(scene, object_x, object_y, object_x+object_w, object_y+object_h);
        }
                scene->set_pixel_color(YELLOW);  scene->set_stiple(ss*3);
                draw_rect(scene, object_x, object_y, object_x+object_w, object_y+object_h);
        }
+       if( config.draw_replace_border ) {
+               int wh = (w+h)>>8, ss = 1; while( wh>>=1 ) ss<<=1;
+               scene->set_pixel_color(GREEN);  scene->set_stiple(ss*3);
+               draw_rect(scene, replace_x, replace_y, replace_x+replace_w, replace_y+replace_h);
+       }
        if( config.draw_keypoints ) {
                scene->set_pixel_color(RED);  scene->set_stiple(0);
                for( int i=0,n=scn_keypts.size(); i<n; ++i ) {
        if( config.draw_keypoints ) {
                scene->set_pixel_color(RED);  scene->set_stiple(0);
                for( int i=0,n=scn_keypts.size(); i<n; ++i ) {
@@ -607,6 +640,10 @@ int FindObjMain::process_buffer(VFrame **frame, int64_t start_position, double f
                        scene->set_pixel_color(YELLOW);
                        DragCheckBox::draw_boundary(scene, object_x, object_y, object_w, object_h);
                }
                        scene->set_pixel_color(YELLOW);
                        DragCheckBox::draw_boundary(scene, object_x, object_y, object_w, object_h);
                }
+               if( config.drag_replace ) {
+                       scene->set_pixel_color(GREEN);
+                       DragCheckBox::draw_boundary(scene, replace_x, replace_y, replace_w, replace_h);
+               }
        }
 
        scene->set_pixel_color(BLACK);
        }
 
        scene->set_pixel_color(BLACK);
index 4a29b3c98c6689f5296ce4ede9452954b06e5c54..03b4fa8802bd287190341ce8c20e605d7fa7526d 100644 (file)
@@ -95,6 +95,7 @@ class FindObjConfig
 public:
        FindObjConfig();
 
 public:
        FindObjConfig();
 
+       void reset();
        int equivalent(FindObjConfig &that);
        void copy_from(FindObjConfig &that);
        void interpolate(FindObjConfig &prev, FindObjConfig &next,
        int equivalent(FindObjConfig &that);
        void copy_from(FindObjConfig &that);
        void interpolate(FindObjConfig &prev, FindObjConfig &next,
@@ -102,14 +103,17 @@ public:
        void boundaries();
 
        int algorithm, use_flann;
        void boundaries();
 
        int algorithm, use_flann;
-       int drag_object, drag_scene;
+       int drag_object, drag_scene, drag_replace;
        float object_x, object_y, object_w, object_h;
        float scene_x, scene_y, scene_w, scene_h;
        float object_x, object_y, object_w, object_h;
        float scene_x, scene_y, scene_w, scene_h;
+       float replace_x, replace_y, replace_w, replace_h;
+       float replace_dx, replace_dy;
 
        int draw_keypoints;
        int draw_scene_border;
        int replace_object;
        int draw_object_border;
 
        int draw_keypoints;
        int draw_scene_border;
        int replace_object;
        int draw_object_border;
+       int draw_replace_border;
 
        int object_layer;
        int replace_layer;
 
        int object_layer;
        int replace_layer;
@@ -160,6 +164,8 @@ public:
 
        int object_x, object_y, object_w, object_h;
        int scene_x, scene_y, scene_w, scene_h;
 
        int object_x, object_y, object_w, object_h;
        int scene_x, scene_y, scene_w, scene_h;
+       int replace_x, replace_y, replace_w, replace_h;
+       int replace_dx, replace_dy;
 
        int w, h;
        int object_layer;
 
        int w, h;
        int object_layer;
index 1c11878c84655f1c4a449c63b5fbb480900100f7..5ccec7689c18474c033ba3d5f4e7a0b90dc51140 100644 (file)
@@ -32,7 +32,7 @@
 
 
 FindObjWindow::FindObjWindow(FindObjMain *plugin)
 
 
 FindObjWindow::FindObjWindow(FindObjMain *plugin)
- : PluginClientWindow(plugin, 340, 660, 340, 660, 0)
+ : PluginClientWindow(plugin, 500, 660, 500, 660, 0)
 {
        this->plugin = plugin;
 }
 {
        this->plugin = plugin;
 }
@@ -43,7 +43,7 @@ FindObjWindow::~FindObjWindow()
 
 void FindObjWindow::create_objects()
 {
 
 void FindObjWindow::create_objects()
 {
-       int x = 10, y = 10, x1 = x, x2 = get_w()/2;
+       int x = 10, y = 10, x1 = x, x2 = get_w()*1/3, x3 = get_w()*2/3;
        plugin->load_configuration();
 
        BC_Title *title;
        plugin->load_configuration();
 
        BC_Title *title;
@@ -51,6 +51,7 @@ void FindObjWindow::create_objects()
        add_subwindow(algorithm = new FindObjAlgorithm(plugin, this,
                x1 + title->get_w() + 10, y));
        algorithm->create_objects();
        add_subwindow(algorithm = new FindObjAlgorithm(plugin, this,
                x1 + title->get_w() + 10, y));
        algorithm->create_objects();
+       add_subwindow(reset = new FindObjReset(plugin, this, get_w() - 15, y));
        y += algorithm->get_h() + plugin->get_theme()->widget_border;
 
        add_subwindow(use_flann = new FindObjUseFlann(plugin, this, x, y));
        y += algorithm->get_h() + plugin->get_theme()->widget_border;
 
        add_subwindow(use_flann = new FindObjUseFlann(plugin, this, x, y));
@@ -182,15 +183,89 @@ void FindObjWindow::create_objects()
        object_h->center_text = object_h_text;
        object_h_text->center = object_h;
 
        object_h->center_text = object_h_text;
        object_h_text->center = object_h;
 
-       y += 40 + 15;
+       y = y1;
+       add_subwindow(replace_object = new FindObjReplace(plugin, this,
+                       x3, y - title->get_h() - 15));
+
+       add_subwindow(title = new BC_Title(x3, y + 10, _("Replace X:")));
+       drag_w = trk_w * plugin->config.replace_w / 100.;
+       drag_h = trk_h * plugin->config.replace_h / 100.;
+       ctr_x  = trk_w * plugin->config.replace_x / 100.,
+       ctr_y  = trk_h * plugin->config.replace_y / 100.;
+       drag_x = ctr_x - drag_w/2;  drag_y = ctr_y - drag_h/2;
+       drag_replace = new FindObjDragReplace(plugin, this, x3+title->get_w()+10, y+5,
+               drag_x, drag_y, drag_w, drag_h);
+       add_subwindow(drag_replace);
+       drag_replace->create_objects();
+       y += title->get_h() + 15;
+
+       add_subwindow(replace_x = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_x));
+       add_subwindow(replace_x_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_x->get_w() + 10, y + 10, &plugin->config.replace_x));
+       replace_x->center_text = replace_x_text;
+       replace_x_text->center = replace_x;
+
+       y += 40;
+       add_subwindow(title = new BC_Title(x3, y + 10, _("Replace Y:")));
+       y += title->get_h() + 15;
+       add_subwindow(replace_y = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_y));
+       add_subwindow(replace_y_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_y->get_w() + 10, y + 10, &plugin->config.replace_y));
+       replace_y->center_text = replace_y_text;
+       replace_y_text->center = replace_y;
+
+       y += 40;
+       add_subwindow(new BC_Title(x3, y + 10, _("Replace W:")));
+       y += title->get_h() + 15;
+       add_subwindow(replace_w = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_w));
+       add_subwindow(replace_w_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_w->get_w() + 10, y + 10, &plugin->config.replace_w));
+       replace_w->center_text = replace_w_text;
+       replace_w_text->center = replace_w;
+
+       y += 40;
+       add_subwindow(title = new BC_Title(x3, y + 10, _("Replace H:")));
+       y += title->get_h() + 15;
+       add_subwindow(replace_h = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_h));
+       add_subwindow(replace_h_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_h->get_w() + 10, y + 10,
+               &plugin->config.replace_h));
+       replace_h->center_text = replace_h_text;
+       replace_h_text->center = replace_h;
+
+       y += 40;  int y2 = y;
+       add_subwindow(title = new BC_Title(x3, y + 10, _("Replace DX:")));
+       y += title->get_h() + 15;
+       add_subwindow(replace_dx = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_dx, -100.f, 100.f));
+       add_subwindow(replace_dx_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_dx->get_w() + 10, y + 10, &plugin->config.replace_dx));
+       replace_dx->center_text = replace_dx_text;
+       replace_dx_text->center = replace_dx;
+
+       y += 40;
+       add_subwindow(title = new BC_Title(x3, y + 10, _("Replace DY:")));
+       y += title->get_h() + 15;
+       add_subwindow(replace_dy = new FindObjScanFloat(plugin, this,
+               x3, y, &plugin->config.replace_dy, -100.f, 100.f));
+       add_subwindow(replace_dy_text = new FindObjScanFloatText(plugin, this,
+               x3 + replace_dy->get_w() + 10, y + 10, &plugin->config.replace_dy));
+       replace_dy->center_text = replace_dy_text;
+       replace_dy_text->center = replace_dy;
+
+       y = y2 + 15;
        add_subwindow(draw_keypoints = new FindObjDrawKeypoints(plugin, this, x, y));
        y += draw_keypoints->get_h() + plugin->get_theme()->widget_border;
        add_subwindow(draw_keypoints = new FindObjDrawKeypoints(plugin, this, x, y));
        y += draw_keypoints->get_h() + plugin->get_theme()->widget_border;
-       add_subwindow(replace_object = new FindObjReplace(plugin, this, x, y));
-       y += replace_object->get_h() + plugin->get_theme()->widget_border;
        add_subwindow(draw_scene_border = new FindObjDrawSceneBorder(plugin, this, x, y));
        y += draw_scene_border->get_h() + plugin->get_theme()->widget_border;
        add_subwindow(draw_object_border = new FindObjDrawObjectBorder(plugin, this, x, y));
        y += draw_object_border->get_h() + plugin->get_theme()->widget_border;
        add_subwindow(draw_scene_border = new FindObjDrawSceneBorder(plugin, this, x, y));
        y += draw_scene_border->get_h() + plugin->get_theme()->widget_border;
        add_subwindow(draw_object_border = new FindObjDrawObjectBorder(plugin, this, x, y));
        y += draw_object_border->get_h() + plugin->get_theme()->widget_border;
+       add_subwindow(draw_replace_border = new FindObjDrawReplaceBorder(plugin, this, x, y));
+       y += draw_object_border->get_h() + plugin->get_theme()->widget_border;
 
        add_subwindow(title = new BC_Title(x, y + 10, _("Object blend amount:")));
        add_subwindow(blend = new FindObjBlend(plugin,
 
        add_subwindow(title = new BC_Title(x, y + 10, _("Object blend amount:")));
        add_subwindow(blend = new FindObjBlend(plugin,
@@ -201,6 +276,24 @@ void FindObjWindow::create_objects()
        show_window(1);
 }
 
        show_window(1);
 }
 
+FindObjReset::FindObjReset(FindObjMain *plugin, FindObjWindow *gui, int x, int y)
+ : BC_GenericButton(x - BC_GenericButton::calculate_w(gui, _("Reset")), y, _("Reset"))
+{
+       this->plugin = plugin;
+       this->gui = gui;
+}
+
+int FindObjReset::handle_event()
+{
+       plugin->config.reset();
+       gui->drag_scene->drag_deactivate();
+       gui->drag_object->drag_deactivate();
+       gui->drag_replace->drag_deactivate();
+       gui->update_gui();
+       plugin->send_configure_change();
+       return 1;
+}
+
 void FindObjWindow::update_drag()
 {
        Track *track = drag_scene->get_drag_track();
 void FindObjWindow::update_drag()
 {
        Track *track = drag_scene->get_drag_track();
@@ -215,12 +308,65 @@ void FindObjWindow::update_drag()
        drag_object->drag_h = trk_h * plugin->config.object_h/100.;
        drag_object->drag_x = trk_w * plugin->config.object_x/100. - drag_object->drag_w/2;
        drag_object->drag_y = trk_h * plugin->config.object_y/100. - drag_object->drag_h/2;
        drag_object->drag_h = trk_h * plugin->config.object_h/100.;
        drag_object->drag_x = trk_w * plugin->config.object_x/100. - drag_object->drag_w/2;
        drag_object->drag_y = trk_h * plugin->config.object_y/100. - drag_object->drag_h/2;
-       plugin->send_configure_change();
+       track = drag_replace->get_drag_track();
+       trk_w = track->track_w, trk_h = track->track_h;
+       drag_replace->drag_w = trk_w * plugin->config.replace_w/100.;
+       drag_replace->drag_h = trk_h * plugin->config.replace_h/100.;
+       drag_replace->drag_x = trk_w * plugin->config.replace_x/100. - drag_replace->drag_w/2;
+       drag_replace->drag_y = trk_h * plugin->config.replace_y/100. - drag_replace->drag_h/2;
+}
+
+void FindObjWindow::update_gui()
+{
+       update_drag();
+       FindObjConfig &conf = plugin->config;
+       algorithm->update(conf.algorithm);
+       use_flann->update(conf.use_flann);
+       drag_object->update(conf.drag_object);
+       object_x->update(conf.object_x);
+       object_x_text->update((float)conf.object_x);
+       object_y->update(conf.object_y);
+       object_y_text->update((float)conf.object_y);
+       object_w->update(conf.object_w);
+       object_w_text->update((float)conf.object_w);
+       object_h->update(conf.object_h);
+       object_h_text->update((float)conf.object_h);
+       drag_scene->update(conf.drag_scene);
+       scene_x->update(conf.scene_x);
+       scene_x_text->update((float)conf.scene_x);
+       scene_y->update(conf.scene_y);
+       scene_y_text->update((float)conf.scene_y);
+       scene_w->update(conf.scene_w);
+       scene_w_text->update((float)conf.scene_w);
+       scene_h->update(conf.scene_h);
+       scene_h_text->update((float)conf.scene_h);
+       drag_replace->update(conf.drag_replace);
+       replace_x->update(conf.replace_x);
+       replace_x_text->update((float)conf.replace_x);
+       replace_y->update(conf.replace_y);
+       replace_y_text->update((float)conf.replace_y);
+       replace_w->update(conf.replace_w);
+       replace_w_text->update((float)conf.replace_w);
+       replace_h->update(conf.replace_h);
+       replace_h_text->update((float)conf.replace_h);
+       replace_dx->update(conf.replace_dx);
+       replace_dx_text->update((float)conf.replace_dx);
+       replace_dx->update(conf.replace_dx);
+       replace_dx_text->update((float)conf.replace_dx);
+       draw_keypoints->update(conf.draw_keypoints);
+       draw_scene_border->update(conf.draw_scene_border);
+       replace_object->update(conf.replace_object);
+       draw_object_border->update(conf.draw_object_border);
+       draw_replace_border->update(conf.draw_replace_border);
+       object_layer->update( (int64_t)conf.object_layer);
+       replace_layer->update( (int64_t)conf.replace_layer);
+       scene_layer->update( (int64_t)conf.scene_layer);
+       blend->update( (int64_t)conf.blend);
 }
 
 FindObjScanFloat::FindObjScanFloat(FindObjMain *plugin, FindObjWindow *gui,
 }
 
 FindObjScanFloat::FindObjScanFloat(FindObjMain *plugin, FindObjWindow *gui,
-       int x, int y, float *value)
- : BC_FPot(x, y, *value, (float)0, (float)100)
+       int x, int y, float *value, float min, float max)
+ : BC_FPot(x, y, *value, min, max)
 {
        this->plugin = plugin;
        this->gui = gui;
 {
        this->plugin = plugin;
        this->gui = gui;
@@ -234,6 +380,7 @@ int FindObjScanFloat::handle_event()
        *value = get_value();
        center_text->update(*value);
        gui->update_drag();
        *value = get_value();
        center_text->update(*value);
        gui->update_drag();
+       plugin->send_configure_change();
        return 1;
 }
 
        return 1;
 }
 
@@ -261,6 +408,7 @@ int FindObjScanFloatText::handle_event()
        *value = atof(get_text());
        center->update(*value);
        gui->update_drag();
        *value = atof(get_text());
        center->update(*value);
        gui->update_drag();
+       plugin->send_configure_change();
        return 1;
 }
 
        return 1;
 }
 
@@ -288,6 +436,28 @@ FindObjDrawObjectBorder::FindObjDrawObjectBorder(FindObjMain *plugin, FindObjWin
        this->plugin = plugin;
 }
 
        this->plugin = plugin;
 }
 
+int FindObjDrawObjectBorder::handle_event()
+{
+       plugin->config.draw_object_border = get_value();
+       plugin->send_configure_change();
+       return 1;
+}
+
+FindObjDrawReplaceBorder::FindObjDrawReplaceBorder(FindObjMain *plugin, FindObjWindow *gui,
+       int x, int y)
+ : BC_CheckBox(x, y, plugin->config.draw_replace_border, _("Draw replace border"))
+{
+       this->gui = gui;
+       this->plugin = plugin;
+}
+
+int FindObjDrawReplaceBorder::handle_event()
+{
+       plugin->config.draw_replace_border = get_value();
+       plugin->send_configure_change();
+       return 1;
+}
+
 
 FindObjDrawKeypoints::FindObjDrawKeypoints(FindObjMain *plugin, FindObjWindow *gui,
        int x, int y)
 
 FindObjDrawKeypoints::FindObjDrawKeypoints(FindObjMain *plugin, FindObjWindow *gui,
        int x, int y)
@@ -321,14 +491,6 @@ int FindObjReplace::handle_event()
 }
 
 
 }
 
 
-int FindObjDrawObjectBorder::handle_event()
-{
-       plugin->config.draw_object_border = get_value();
-       plugin->send_configure_change();
-       return 1;
-}
-
-
 FindObjDragScene::FindObjDragScene(FindObjMain *plugin, FindObjWindow *gui, int x, int y,
                float drag_x, float drag_y, float drag_w, float drag_h)
  : DragCheckBox(plugin->server->mwindow, x, y, _("Drag"), &plugin->config.drag_scene,
 FindObjDragScene::FindObjDragScene(FindObjMain *plugin, FindObjWindow *gui, int x, int y,
                float drag_x, float drag_y, float drag_w, float drag_h)
  : DragCheckBox(plugin->server->mwindow, x, y, _("Drag"), &plugin->config.drag_scene,
@@ -361,7 +523,6 @@ void FindObjDragScene::update_gui()
        Track *track = get_drag_track();
        int trk_w = track->track_w, trk_h = track->track_h;
        float ctr_x = drag_x + drag_w/2, ctr_y = drag_y + drag_h/2;
        Track *track = get_drag_track();
        int trk_w = track->track_w, trk_h = track->track_h;
        float ctr_x = drag_x + drag_w/2, ctr_y = drag_y + drag_h/2;
-printf("scene=%f,%f wxh=%fx%f  ctr=%f,%f\n",drag_x,drag_y,drag_w,drag_h, ctr_x,ctr_y);
        gui->scene_x->update( plugin->config.scene_x = 100. * ctr_x / trk_w );
        gui->scene_y->update( plugin->config.scene_y = 100. * ctr_y / trk_h );
        gui->scene_w->update( plugin->config.scene_w = 100. * drag_w / trk_w );
        gui->scene_x->update( plugin->config.scene_x = 100. * ctr_x / trk_w );
        gui->scene_y->update( plugin->config.scene_y = 100. * ctr_y / trk_h );
        gui->scene_w->update( plugin->config.scene_w = 100. * drag_w / trk_w );
@@ -401,7 +562,6 @@ void FindObjDragObject::update_gui()
        Track *track = get_drag_track();
        int trk_w = track->track_w, trk_h = track->track_h;
        float ctr_x = drag_x + drag_w/2, ctr_y = drag_y + drag_h/2;
        Track *track = get_drag_track();
        int trk_w = track->track_w, trk_h = track->track_h;
        float ctr_x = drag_x + drag_w/2, ctr_y = drag_y + drag_h/2;
-printf("object %f,%f  %fx%f   ctr %f,%f\n", drag_x,drag_y,drag_w,drag_h,ctr_x,ctr_y);
        gui->object_x->update( plugin->config.object_x = 100. * ctr_x / trk_w );
        gui->object_y->update( plugin->config.object_y = 100. * ctr_y / trk_h );
        gui->object_w->update( plugin->config.object_w = 100. * drag_w / trk_w );
        gui->object_x->update( plugin->config.object_x = 100. * ctr_x / trk_w );
        gui->object_y->update( plugin->config.object_y = 100. * ctr_y / trk_h );
        gui->object_w->update( plugin->config.object_w = 100. * drag_w / trk_w );
@@ -409,6 +569,45 @@ printf("object %f,%f  %fx%f   ctr %f,%f\n", drag_x,drag_y,drag_w,drag_h,ctr_x,ct
        plugin->send_configure_change();
 }
 
        plugin->send_configure_change();
 }
 
+FindObjDragReplace::FindObjDragReplace(FindObjMain *plugin, FindObjWindow *gui, int x, int y,
+               float drag_x, float drag_y, float drag_w, float drag_h)
+ : DragCheckBox(plugin->server->mwindow, x, y, _("Drag"), &plugin->config.drag_replace,
+               drag_x, drag_y, drag_w, drag_h)
+{
+       this->plugin = plugin;
+       this->gui = gui;
+}
+
+FindObjDragReplace::~FindObjDragReplace()
+{
+}
+
+int FindObjDragReplace::handle_event()
+{
+       int ret = DragCheckBox::handle_event();
+       plugin->send_configure_change();
+       return ret;
+}
+Track *FindObjDragReplace::get_drag_track()
+{
+       return plugin->server->plugin->track;
+}
+int64_t FindObjDragReplace::get_drag_position()
+{
+       return plugin->get_source_position();
+}
+void FindObjDragReplace::update_gui()
+{
+       Track *track = get_drag_track();
+       int trk_w = track->track_w, trk_h = track->track_h;
+       float ctr_x = drag_x + drag_w/2, ctr_y = drag_y + drag_h/2;
+       gui->replace_x->update( plugin->config.replace_x = 100. * ctr_x / trk_w );
+       gui->replace_y->update( plugin->config.replace_y = 100. * ctr_y / trk_h );
+       gui->replace_w->update( plugin->config.replace_w = 100. * drag_w / trk_w );
+       gui->replace_h->update( plugin->config.replace_h = 100. * drag_h / trk_h );
+       plugin->send_configure_change();
+}
+
 
 
 FindObjAlgorithm::FindObjAlgorithm(FindObjMain *plugin, FindObjWindow *gui, int x, int y)
 
 
 FindObjAlgorithm::FindObjAlgorithm(FindObjMain *plugin, FindObjWindow *gui, int x, int y)
@@ -465,6 +664,11 @@ int FindObjAlgorithm::from_text(char *text)
        return NO_ALGORITHM;
 }
 
        return NO_ALGORITHM;
 }
 
+void FindObjAlgorithm::update(int mode)
+{
+       set_text(to_text(mode));
+}
+
 char* FindObjAlgorithm::to_text(int mode)
 {
        switch( mode ) {
 char* FindObjAlgorithm::to_text(int mode)
 {
        switch( mode ) {
index 3c2aa634f26786bb40fc77b6a7e4e586a6ba8824..2bc48117c51031b8e7cf0f075c0f2ebbb397b136 100644 (file)
@@ -27,6 +27,7 @@
 #include "findobj.inc"
 #include "guicast.h"
 
 #include "findobj.inc"
 #include "guicast.h"
 
+class FindObjReset;
 class FindObjLayer;
 class FindObjScanFloat;
 class FindObjScanFloatText;
 class FindObjLayer;
 class FindObjScanFloat;
 class FindObjScanFloatText;
@@ -34,12 +35,23 @@ class FindObjDrawSceneBorder;
 class FindObjDrawKeypoints;
 class FindObjReplace;
 class FindObjDrawObjectBorder;
 class FindObjDrawKeypoints;
 class FindObjReplace;
 class FindObjDrawObjectBorder;
+class FindObjDrawReplaceBorder;
 class FindObjDragObject;
 class FindObjDragScene;
 class FindObjDragObject;
 class FindObjDragScene;
+class FindObjDragReplace;
 class FindObjAlgorithm;
 class FindObjBlend;
 class FindObjWindow;
 
 class FindObjAlgorithm;
 class FindObjBlend;
 class FindObjWindow;
 
+class FindObjReset : public BC_GenericButton
+{
+public:
+       FindObjReset(FindObjMain *plugin, FindObjWindow *gui, int x, int y);
+       int handle_event();
+       FindObjMain *plugin;
+       FindObjWindow *gui;
+};
+
 class FindObjLayer : public BC_TumbleTextBox
 {
 public:
 class FindObjLayer : public BC_TumbleTextBox
 {
 public:
@@ -55,7 +67,8 @@ public:
 class FindObjScanFloat : public BC_FPot
 {
 public:
 class FindObjScanFloat : public BC_FPot
 {
 public:
-       FindObjScanFloat(FindObjMain *plugin, FindObjWindow *gui, int x, int y, float *value);
+       FindObjScanFloat(FindObjMain *plugin, FindObjWindow *gui, int x, int y,
+               float *value, float min=0., float max=100.);
        int handle_event();
        void update(float v);
        FindObjMain *plugin;
        int handle_event();
        void update(float v);
        FindObjMain *plugin;
@@ -94,6 +107,15 @@ public:
        FindObjWindow *gui;
 };
 
        FindObjWindow *gui;
 };
 
+class FindObjDrawReplaceBorder : public BC_CheckBox
+{
+public:
+       FindObjDrawReplaceBorder(FindObjMain *plugin, FindObjWindow *gui, int x, int y);
+       int handle_event();
+       FindObjMain *plugin;
+       FindObjWindow *gui;
+};
+
 class FindObjDrawKeypoints : public BC_CheckBox
 {
 public:
 class FindObjDrawKeypoints : public BC_CheckBox
 {
 public:
@@ -144,12 +166,29 @@ public:
        FindObjWindow *gui;
 };
 
        FindObjWindow *gui;
 };
 
+class FindObjDragReplace : public DragCheckBox
+{
+public:
+       FindObjDragReplace(FindObjMain *plugin, FindObjWindow *gui, int x, int y,
+               float drag_x, float drag_y, float drag_w, float drag_h);
+       ~FindObjDragReplace();
+
+       int handle_event();
+       Track *get_drag_track();
+       int64_t get_drag_position();
+       void update_gui();
+
+       FindObjMain *plugin;
+       FindObjWindow *gui;
+};
+
 class FindObjAlgorithm : public BC_PopupMenu
 {
 public:
        FindObjAlgorithm(FindObjMain *plugin, FindObjWindow *gui, int x, int y);
        int handle_event();
        void create_objects();
 class FindObjAlgorithm : public BC_PopupMenu
 {
 public:
        FindObjAlgorithm(FindObjMain *plugin, FindObjWindow *gui, int x, int y);
        int handle_event();
        void create_objects();
+       void update(int mode);
        static int calculate_w(FindObjWindow *gui);
        static int from_text(char *text);
        static char* to_text(int mode);
        static int calculate_w(FindObjWindow *gui);
        static int from_text(char *text);
        static char* to_text(int mode);
@@ -182,19 +221,27 @@ public:
        ~FindObjWindow();
        void create_objects();
        void update_drag();
        ~FindObjWindow();
        void create_objects();
        void update_drag();
+       void update_gui();
 
 
+       FindObjReset *reset;
        FindObjAlgorithm *algorithm;
        FindObjUseFlann *use_flann;
        FindObjScanFloat *object_x, *object_y, *object_w, *object_h;
        FindObjScanFloatText *object_x_text, *object_y_text, *object_w_text, *object_h_text;
        FindObjScanFloat *scene_x, *scene_y, *scene_w, *scene_h;
        FindObjScanFloatText *scene_x_text, *scene_y_text, *scene_w_text, *scene_h_text;
        FindObjAlgorithm *algorithm;
        FindObjUseFlann *use_flann;
        FindObjScanFloat *object_x, *object_y, *object_w, *object_h;
        FindObjScanFloatText *object_x_text, *object_y_text, *object_w_text, *object_h_text;
        FindObjScanFloat *scene_x, *scene_y, *scene_w, *scene_h;
        FindObjScanFloatText *scene_x_text, *scene_y_text, *scene_w_text, *scene_h_text;
+       FindObjScanFloat *replace_x, *replace_y, *replace_w, *replace_h;
+       FindObjScanFloatText *replace_x_text, *replace_y_text, *replace_w_text, *replace_h_text;
+       FindObjScanFloat *replace_dx, *replace_dy;
+       FindObjScanFloatText *replace_dx_text, *replace_dy_text;
        FindObjDrawKeypoints *draw_keypoints;
        FindObjDrawSceneBorder *draw_scene_border;
        FindObjReplace *replace_object;
        FindObjDrawObjectBorder *draw_object_border;
        FindObjDrawKeypoints *draw_keypoints;
        FindObjDrawSceneBorder *draw_scene_border;
        FindObjReplace *replace_object;
        FindObjDrawObjectBorder *draw_object_border;
+       FindObjDrawReplaceBorder *draw_replace_border;
        FindObjDragObject *drag_object;
        FindObjDragScene *drag_scene;
        FindObjDragObject *drag_object;
        FindObjDragScene *drag_scene;
+       FindObjDragReplace *drag_replace;
        FindObjLayer *object_layer;
        FindObjLayer *scene_layer;
        FindObjLayer *replace_layer;
        FindObjLayer *object_layer;
        FindObjLayer *scene_layer;
        FindObjLayer *replace_layer;
index 3e13fa97058a59c98c458dcb554a0d41dbe85807..091e661739f94c64959e37af1f4d60d76fab4df3 100644 (file)
@@ -29,6 +29,9 @@
 #include "opencv2/calib3d.hpp"
 #include "opencv2/video/video.hpp"
 
 #include "opencv2/calib3d.hpp"
 #include "opencv2/video/video.hpp"
 
+#include "opencv2/core/types_c.h"
+#include <opencv2/calib3d/calib3d_c.h>
+
 #include <vector>
 
 using namespace std;
 #include <vector>
 
 using namespace std;
index 4a9214b14fa378cc39ec8ad952b9c92efe01c263..8db73fba3a4469b1b15e061fba12b0e93f8150e5 100644 (file)
@@ -28,6 +28,9 @@
 #include "opencv2/calib3d.hpp"
 #include "opencv2/video/video.hpp"
 
 #include "opencv2/calib3d.hpp"
 #include "opencv2/video/video.hpp"
 
+#include "opencv2/core/types_c.h"
+#include <opencv2/calib3d/calib3d_c.h>
+
 #include <vector>
 
 using namespace std;
 #include <vector>
 
 using namespace std;
index 96288bae32d81c209e7d4ac5667ee5a83482e8ea..9b6007f56f03072b345fcdf1e766696a66cb2824 100644 (file)
@@ -181,7 +181,7 @@ int SvgMain::process_realtime(VFrame *input, VFrame *output)
        strcpy(last_svg_file, config.svg_file);
        int64_t last_ms_time = config.ms_time;
        need_reconfigure = load_configuration();
        strcpy(last_svg_file, config.svg_file);
        int64_t last_ms_time = config.ms_time;
        need_reconfigure = load_configuration();
-       if( last_dpi != config.dpi )
+       if( !ofrm || last_dpi != config.dpi )
                need_export = 1;
        if( strcmp(last_svg_file, config.svg_file) ||
            last_ms_time != config.ms_time )
                need_export = 1;
        if( strcmp(last_svg_file, config.svg_file) ||
            last_ms_time != config.ms_time )
diff --git a/cinelerra-5.1/thirdparty/src/x265_2.7.tar.xz b/cinelerra-5.1/thirdparty/src/x265_2.7.tar.xz
new file mode 100644 (file)
index 0000000..471711b
Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x265_2.7.tar.xz differ
diff --git a/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz b/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz
deleted file mode 100644 (file)
index cc16d1b..0000000
Binary files a/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz and /dev/null differ