asset menu size fixups, new picons+prefs, more timecode del, stretch scrollbars,...
[goodguy/history.git] / cinelerra-5.1 / plugins / interpolatevideo / opticflow.C
index 90c472a1b04a6d570a7e6222504f8f590faa824c..bf8a6762f1c50bff78b7e4421e9bf333459939ea 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * CINELERRA
  * Copyright (C) 1997-2011 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
  * 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 "clip.h"
 #include "interpolatevideo.h"
-#include "motionscan.h"
+#include "motionscan-hv.h"
 #include "opticflow.h"
 
 #include <sys/time.h>
@@ -87,8 +87,8 @@ void OpticFlowUnit::process_package(LoadPackage *package)
 {
        OpticFlowPackage *pkg = (OpticFlowPackage*)package;
        InterpolateVideo *plugin = server->plugin;
-       int w = plugin->frames[0]->get_w();
-       int h = plugin->frames[0]->get_h();
+       //int w = plugin->frames[0]->get_w();
+       //int h = plugin->frames[0]->get_h();
        struct timeval start_time;
        gettimeofday(&start_time, 0);
 
@@ -106,12 +106,12 @@ void OpticFlowUnit::process_package(LoadPackage *package)
                motion->scan_frame(plugin->frames[0],
 // Frame after motion
                        plugin->frames[1],
-                       100 * plugin->config.search_radius / w,
-                       100 * plugin->config.search_radius / h,
-                       100 * plugin->config.macroblock_size / w,
-                       100 * plugin->config.macroblock_size / h,
-                       100 * mb->x / w,
-                       100 * mb->y / h,
+                       plugin->config.search_radius,
+                       plugin->config.search_radius,
+                       plugin->config.macroblock_size,
+                       plugin->config.macroblock_size,
+                       mb->x,
+                       mb->y,
                        MotionScan::TRACK_PREVIOUS,
                        MotionScan::CALCULATE,
 // Get it to do the subpixel step
@@ -119,18 +119,14 @@ void OpticFlowUnit::process_package(LoadPackage *package)
                        0,
                        0,
                        0,
-                       MIN(MAX_SEARCH_STEPS, plugin->config.search_radius * plugin->config.search_radius),
                        0,
                        0,
                        0,
+                       0,
+                       1,
+                       0,
+                       0,
                        0);
-// Degrees from center to maximum angle
-//                     0, 
-// Accumulated angle from previous frames
-//                     0,
-// Total number of angles to test in each pass
-//                     0,
-//                     0);
 
 
                mb->dx = motion->dx_result;
@@ -153,11 +149,11 @@ void OpticFlowUnit::process_package(LoadPackage *package)
 
 
 OpticFlow::OpticFlow(InterpolateVideo *plugin,
-       int total_clients, 
+       int total_clients,
        int total_packages)
-// : LoadServer(1, 
+// : LoadServer(1,
 //     total_packages)
- : LoadServer(total_clients, 
+ : LoadServer(total_clients,
        total_packages)
 {
        this->plugin = plugin;
@@ -290,10 +286,10 @@ void WarpUnit::process_package(LoadPackage *package)
 
                        int x_macroblock2 = x_macroblock + 1;
                        int y_macroblock2 = y_macroblock + 1;
-                       
+
                        x_macroblock2 = MIN(x_macroblock2, plugin->x_macroblocks - 1);
                        y_macroblock2 = MIN(y_macroblock2, plugin->y_macroblocks - 1);
-                       
+
                        float x_fraction = (float)(j - x_macroblock * macroblock_size) / macroblock_size;
                        float y_fraction = (float)(i - y_macroblock * macroblock_size) / macroblock_size;
 
@@ -387,9 +383,9 @@ void WarpUnit::process_package(LoadPackage *package)
 
 
 Warp::Warp(InterpolateVideo *plugin,
-       int total_clients, 
+       int total_clients,
        int total_packages)
- : LoadServer(total_clients, 
+ : LoadServer(total_clients,
        total_packages)
 {
        this->plugin = plugin;
@@ -471,9 +467,9 @@ void BlendMacroblockUnit::process_package(LoadPackage *package)
 
 
 BlendMacroblock::BlendMacroblock(InterpolateVideo *plugin,
-       int total_clients, 
+       int total_clients,
        int total_packages)
- : LoadServer(total_clients, 
+ : LoadServer(total_clients,
        total_packages)
 {
        this->plugin = plugin;