projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git]
/
cinelerra-5.1
/
plugins
/
motionblur
/
motionblur.C
diff --git
a/cinelerra-5.1/plugins/motionblur/motionblur.C
b/cinelerra-5.1/plugins/motionblur/motionblur.C
index 4f1661425207149a7be1fd11e9b34e9b6d059f37..aac86d25da461cbc02152e33c1077741321e0e43 100644
(file)
--- a/
cinelerra-5.1/plugins/motionblur/motionblur.C
+++ b/
cinelerra-5.1/plugins/motionblur/motionblur.C
@@
-2,21
+2,21
@@
/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
/*
* 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 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.
* 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
* 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 <math.h>
*/
#include <math.h>
@@
-48,10
+48,10
@@
public:
int equivalent(MotionBlurConfig &that);
void copy_from(MotionBlurConfig &that);
int equivalent(MotionBlurConfig &that);
void copy_from(MotionBlurConfig &that);
- void interpolate(MotionBlurConfig &prev,
- MotionBlurConfig &next,
- long prev_frame,
- long next_frame,
+ void interpolate(MotionBlurConfig &prev,
+ MotionBlurConfig &next,
+ long prev_frame,
+ long next_frame,
long current_frame);
int radius;
long current_frame);
int radius;
@@
-67,9
+67,9
@@
public:
class MotionBlurSize : public BC_ISlider
{
public:
class MotionBlurSize : public BC_ISlider
{
public:
- MotionBlurSize(MotionBlurMain *plugin,
- int x,
- int y,
+ MotionBlurSize(MotionBlurMain *plugin,
+ int x,
+ int y,
int *output,
int min,
int max);
int *output,
int min,
int max);
@@
-139,8
+139,8
@@
public:
class MotionBlurEngine : public LoadServer
{
public:
class MotionBlurEngine : public LoadServer
{
public:
- MotionBlurEngine(MotionBlurMain *plugin,
- int total_clients,
+ MotionBlurEngine(MotionBlurMain *plugin,
+ int total_clients,
int total_packages);
void init_packages();
LoadClient* new_client();
int total_packages);
void init_packages();
LoadClient* new_client();
@@
-182,7
+182,7
@@
MotionBlurConfig::MotionBlurConfig()
int MotionBlurConfig::equivalent(MotionBlurConfig &that)
{
int MotionBlurConfig::equivalent(MotionBlurConfig &that)
{
- return
+ return
radius == that.radius &&
steps == that.steps &&
r == that.r &&
radius == that.radius &&
steps == that.steps &&
r == that.r &&
@@
-201,10
+201,10
@@
void MotionBlurConfig::copy_from(MotionBlurConfig &that)
a = that.a;
}
a = that.a;
}
-void MotionBlurConfig::interpolate(MotionBlurConfig &prev,
- MotionBlurConfig &next,
- long prev_frame,
- long next_frame,
+void MotionBlurConfig::interpolate(MotionBlurConfig &prev,
+ MotionBlurConfig &next,
+ long prev_frame,
+ long next_frame,
long current_frame)
{
double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
long current_frame)
{
double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
@@
-231,13
+231,13
@@
void MotionBlurConfig::interpolate(MotionBlurConfig &prev,
MotionBlurWindow::MotionBlurWindow(MotionBlurMain *plugin)
: PluginClientWindow(plugin,
MotionBlurWindow::MotionBlurWindow(MotionBlurMain *plugin)
: PluginClientWindow(plugin,
- 260,
- 120,
- 260,
- 120,
+ 260,
+ 120,
+ 260,
+ 120,
0)
{
0)
{
- this->plugin = plugin;
+ this->plugin = plugin;
}
MotionBlurWindow::~MotionBlurWindow()
}
MotionBlurWindow::~MotionBlurWindow()
@@
-264,9
+264,9
@@
void MotionBlurWindow::create_objects()
-MotionBlurSize::MotionBlurSize(MotionBlurMain *plugin,
- int x,
- int y,
+MotionBlurSize::MotionBlurSize(MotionBlurMain *plugin,
+ int x,
+ int y,
int *output,
int min,
int max)
int *output,
int min,
int max)
@@
-294,7
+294,7
@@
int MotionBlurSize::handle_event()
MotionBlurMain::MotionBlurMain(PluginServer *server)
: PluginVClient(server)
{
MotionBlurMain::MotionBlurMain(PluginServer *server)
: PluginVClient(server)
{
-
+
engine = 0;
scale_x_table = 0;
scale_y_table = 0;
engine = 0;
scale_x_table = 0;
scale_y_table = 0;
@@
-305,14
+305,14
@@
MotionBlurMain::MotionBlurMain(PluginServer *server)
MotionBlurMain::~MotionBlurMain()
{
MotionBlurMain::~MotionBlurMain()
{
-
+
if(engine) delete engine;
delete_tables();
if(accum) delete [] accum;
if(temp) delete temp;
}
if(engine) delete engine;
delete_tables();
if(accum) delete [] accum;
if(temp) delete temp;
}
-const char* MotionBlurMain::plugin_title() { return _("Motion Blur"); }
+const char* MotionBlurMain::plugin_title() { return
N
_("Motion Blur"); }
int MotionBlurMain::is_realtime() { return 1; }
int MotionBlurMain::is_realtime() { return 1; }
@@
-343,7
+343,7
@@
void MotionBlurMain::delete_tables()
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
float xa,ya,za,xb,yb,zb,xd,yd,zd;
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
float xa,ya,za,xb,yb,zb,xd,yd,zd;
- if (get_source_position() == 0)
+ if (get_source_position() == 0)
get_camera(&xa, &ya, &za, get_source_position());
else
get_camera(&xa, &ya, &za, get_source_position()-1);
get_camera(&xa, &ya, &za, get_source_position());
else
get_camera(&xa, &ya, &za, get_source_position()-1);
@@
-352,7
+352,7
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
xd = xb - xa;
yd = yb - ya;
zd = zb - za;
xd = xb - xa;
yd = yb - ya;
zd = zb - za;
-
+
//printf("Camera automation deltas: %.2f %.2f %.2f\n", xd, yd, zd);
load_configuration();
//printf("Camera automation deltas: %.2f %.2f %.2f\n", xd, yd, zd);
load_configuration();
@@
-360,7
+360,7
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
if(!engine) engine = new MotionBlurEngine(this,
get_project_smp() + 1,
get_project_smp() + 1);
if(!engine) engine = new MotionBlurEngine(this,
get_project_smp() + 1,
get_project_smp() + 1);
- if(!accum) accum = new unsigned char[input_ptr->get_w() *
+ if(!accum) accum = new unsigned char[input_ptr->get_w() *
input_ptr->get_h() *
BC_CModels::components(input_ptr->get_color_model()) *
MAX(sizeof(int), sizeof(float))];
input_ptr->get_h() *
BC_CModels::components(input_ptr->get_color_model()) *
MAX(sizeof(int), sizeof(float))];
@@
-371,12
+371,8
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
if(input_ptr->get_rows()[0] == output_ptr->get_rows()[0])
{
if(input_ptr->get_rows()[0] == output_ptr->get_rows()[0])
{
- if(!temp) temp = new VFrame(0,
- -1,
- input_ptr->get_w(),
- input_ptr->get_h(),
- input_ptr->get_color_model(),
- -1);
+ if(!temp) temp = new VFrame(input_ptr->get_w(), input_ptr->get_h(),
+ input_ptr->get_color_model(), 0);
temp->copy_from(input_ptr);
this->input = temp;
}
temp->copy_from(input_ptr);
this->input = temp;
}
@@
-416,7
+412,7
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
max_y1 = 0;
max_x2 = w;
max_y2 = h;
max_y1 = 0;
max_x2 = w;
max_y2 = h;
-
+
delete_tables();
scale_x_table = new int*[config.steps];
scale_y_table = new int*[config.steps];
delete_tables();
scale_x_table = new int*[config.steps];
scale_y_table = new int*[config.steps];
@@
-426,7
+422,7
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
float fraction = (float)(i - config.steps / 2) / config.steps;
float inv_fraction = 1.0 - fraction;
{
float fraction = (float)(i - config.steps / 2) / config.steps;
float inv_fraction = 1.0 - fraction;
-
+
int x = (int)(fraction * x_offset);
int y = (int)(fraction * y_offset);
float out_x1 = min_x1 * fraction + max_x1 * inv_fraction;
int x = (int)(fraction * x_offset);
int y = (int)(fraction * y_offset);
float out_x1 = min_x1 * fraction + max_x1 * inv_fraction;
@@
-444,7
+440,7
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
int *y_table;
scale_y_table[i] = y_table = new int[(int)(h + 1)];
scale_x_table[i] = x_table = new int[(int)(w + 1)];
int *y_table;
scale_y_table[i] = y_table = new int[(int)(h + 1)];
scale_x_table[i] = x_table = new int[(int)(w + 1)];
-
+
for(int j = 0; j < h; j++)
{
y_table[j] = (int)((j - out_y1) * scale_y) + y;
for(int j = 0; j < h; j++)
{
y_table[j] = (int)((j - out_y1) * scale_y) + y;
@@
-455,10
+451,10
@@
int MotionBlurMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
}
}
}
}
- bzero(accum,
- input_ptr->get_w() *
- input_ptr->get_h() *
- BC_CModels::components(input_ptr->get_color_model()) *
+ bzero(accum,
+ input_ptr->get_w() *
+ input_ptr->get_h() *
+ BC_CModels::components(input_ptr->get_color_model()) *
MAX(sizeof(int), sizeof(float)));
engine->process_packages();
return 0;
MAX(sizeof(int), sizeof(float)));
engine->process_packages();
return 0;
@@
-486,7
+482,7
@@
void MotionBlurMain::save_data(KeyFrame *keyframe)
FileXML output;
// cause data to be stored directly in text
FileXML output;
// cause data to be stored directly in text
- output.set_shared_output(keyframe->
get_data(), MESSAGESIZE
);
+ output.set_shared_output(keyframe->
xbuf
);
output.tag.set_title("MOTIONBLUR");
output.tag.set_property("RADIUS", config.radius);
output.tag.set_title("MOTIONBLUR");
output.tag.set_property("RADIUS", config.radius);
@@
-502,7
+498,7
@@
void MotionBlurMain::read_data(KeyFrame *keyframe)
{
FileXML input;
{
FileXML input;
- input.set_shared_input(keyframe->
get_data(), strlen(keyframe->get_data())
);
+ input.set_shared_input(keyframe->
xbuf
);
int result = 0;
int result = 0;
@@
-534,7
+530,7
@@
MotionBlurPackage::MotionBlurPackage()
-MotionBlurUnit::MotionBlurUnit(MotionBlurEngine *server,
+MotionBlurUnit::MotionBlurUnit(MotionBlurEngine *server,
MotionBlurMain *plugin)
: LoadClient(server)
{
MotionBlurMain *plugin)
: LoadClient(server)
{
@@
-698,8
+694,8
@@
void MotionBlurUnit::process_package(LoadPackage *package)
-MotionBlurEngine::MotionBlurEngine(MotionBlurMain *plugin,
- int total_clients,
+MotionBlurEngine::MotionBlurEngine(MotionBlurMain *plugin,
+ int total_clients,
int total_packages)
: LoadServer(total_clients, total_packages)
{
int total_packages)
: LoadServer(total_clients, total_packages)
{