/*
* CINELERRA
* Copyright (C) 2010 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
* 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
- *
+ *
*/
#include "filexml.h"
int BlurConfig::equivalent(BlurConfig &that)
{
- return (vertical == that.vertical &&
- horizontal == that.horizontal &&
+ return (vertical == that.vertical &&
+ horizontal == that.horizontal &&
radius == that.radius &&
a_key == that.a_key &&
a == that.a &&
b = that.b;
}
-void BlurConfig::interpolate(BlurConfig &prev,
- BlurConfig &next,
- int64_t prev_frame,
- int64_t next_frame,
+void BlurConfig::interpolate(BlurConfig &prev,
+ BlurConfig &next,
+ int64_t prev_frame,
+ int64_t next_frame,
int64_t current_frame)
{
double next_scale = (double)(current_frame - prev_frame) / (next_frame - prev_frame);
if(overlayer) delete overlayer;
}
-const char* BlurMain::plugin_title() { return _("Blur"); }
+const char* BlurMain::plugin_title() { return N_("Blur"); }
int BlurMain::is_realtime() { return 1; }
need_reconfigure |= load_configuration();
- read_frame(frame,
- 0,
- start_position,
+ read_frame(frame,
+ 0,
+ start_position,
frame_rate,
0);
overlayer = new OverlayFrame(PluginClient::get_project_smp() + 1);
}
- overlayer->overlay(PluginVClient::get_temp(),
- frame,
- 0,
- 0,
- frame->get_w(),
- frame->get_h(),
- 0,
- 0,
- PluginVClient::get_temp()->get_w(),
- PluginVClient::get_temp()->get_h(),
+ overlayer->overlay(PluginVClient::get_temp(),
+ frame,
+ 0,
+ 0,
+ frame->get_w(),
+ frame->get_h(),
+ 0,
+ 0,
+ PluginVClient::get_temp()->get_w(),
+ PluginVClient::get_temp()->get_h(),
1, // 0 - 1
TRANSFER_REPLACE,
NEAREST_NEIGHBOR);
}
- if(config.radius < MIN_RADIUS ||
+ if(config.radius < MIN_RADIUS ||
(!config.vertical && !config.horizontal))
{
// Data never processed
else
{
// Process blur
-// Need to blur vertically to a temp and
+// Need to blur vertically to a temp and
// horizontally to the output in 2 discrete passes.
for(i = 0; i < get_project_smp() + 1; i++)
{
engine[i]->set_range(
- input_frame->get_h() * i / (get_project_smp() + 1),
+ input_frame->get_h() * i / (get_project_smp() + 1),
input_frame->get_h() * (i + 1) / (get_project_smp() + 1),
input_frame->get_w() * i / (get_project_smp() + 1),
input_frame->get_w() * (i + 1) / (get_project_smp() + 1));
// Downsample
if(config.a_key)
{
- overlayer->overlay(frame,
- PluginVClient::get_temp(),
- 0,
- 0,
- PluginVClient::get_temp()->get_w(),
- PluginVClient::get_temp()->get_h(),
- 0,
- 0,
- frame->get_w(),
- frame->get_h(),
+ overlayer->overlay(frame,
+ PluginVClient::get_temp(),
+ 0,
+ 0,
+ PluginVClient::get_temp()->get_w(),
+ PluginVClient::get_temp()->get_h(),
+ 0,
+ 0,
+ frame->get_w(),
+ frame->get_h(),
1, // 0 - 1
TRANSFER_REPLACE,
NEAREST_NEIGHBOR);
if(thread)
{
int reconfigure = load_configuration();
- if(reconfigure)
+ if(reconfigure)
{
((BlurWindow*)thread->window)->lock_window("BlurMain::update_gui");
((BlurWindow*)thread->window)->horizontal->update(config.horizontal);
last_frame = 0;
// Strip size
- int size = plugin->get_input()->get_w() > plugin->get_input()->get_h() ?
+ int size = plugin->get_input()->get_w() > plugin->get_input()->get_h() ?
plugin->get_input()->get_w() : plugin->get_input()->get_h();
// Prepare for oversampling
size *= 2;
delete [] radius;
}
-void BlurEngine::set_range(int start_y,
+void BlurEngine::set_range(int start_y,
int end_y,
int start_x,
int end_x)
{
// Blurring an oversampled temp
if(plugin->config.a_key) radius *= 2;
- double std_dev = sqrt(-(double)(radius * radius) /
+ double std_dev = sqrt(-(double)(radius * radius) /
(2 * log (1.0 / 255.0)));
get_constants(constants, std_dev);
return 0;
(2 * constants[6] + constants[4]) * cos(constants[2]));
ptr->n_p[2] = 2 * exp(constants[0] + constants[1]) *
- ((constants[4] + constants[6]) * cos(constants[3]) *
- cos(constants[2]) - constants[5] *
+ ((constants[4] + constants[6]) * cos(constants[3]) *
+ cos(constants[2]) - constants[5] *
cos(constants[3]) * sin(constants[2]) -
constants[7] * cos(constants[2]) * sin(constants[3])) +
constants[6] * exp(2 * constants[0]) +
constants[4] * exp(2 * constants[1]);
ptr->n_p[3] = exp(constants[1] + 2 * constants[0]) *
- (constants[7] * sin(constants[3]) -
+ (constants[7] * sin(constants[3]) -
constants[6] * cos(constants[3])) +
exp(constants[0] + 2 * constants[1]) *
- (constants[5] * sin(constants[2]) - constants[4] *
+ (constants[5] * sin(constants[2]) - constants[4] *
cos(constants[2]));
ptr->n_p[4] = 0.0;
ptr->d_p[1] = -2 * exp(constants[1]) * cos(constants[3]) -
2 * exp(constants[0]) * cos(constants[2]);
- ptr->d_p[2] = 4 * cos(constants[3]) * cos(constants[2]) *
+ ptr->d_p[2] = 4 * cos(constants[3]) * cos(constants[2]) *
exp(constants[0] + constants[1]) +
exp(2 * constants[1]) + exp (2 * constants[0]);
#define BOUNDARY(x) if((x) > vmax) (x) = vmax; else if((x) < 0) (x) = 0;
-int BlurEngine::transfer_pixels(pixel_f *src1,
- pixel_f *src2,
+int BlurEngine::transfer_pixels(pixel_f *src1,
+ pixel_f *src2,
pixel_f *src,
double *radius,
- pixel_f *dest,
+ pixel_f *dest,
int size)
{
int i;
double sum;
-// printf("BlurEngine::transfer_pixels %d %d %d %d\n",
-// plugin->config.r,
-// plugin->config.g,
-// plugin->config.b,
+// printf("BlurEngine::transfer_pixels %d %d %d %d\n",
+// plugin->config.r,
+// plugin->config.g,
+// plugin->config.b,
// plugin->config.a);
for(i = 0; i < size; i++)
int BlurEngine::multiply_alpha(pixel_f *row, int size)
{
-// register int i;
-// register double alpha;
+// int i;
+// double alpha;
// for(i = 0; i < size; i++)
// {
int BlurEngine::separate_alpha(pixel_f *row, int size)
{
-// register int i;
-// register double alpha;
-// register double result;
-
+// int i;
+// double alpha;
+// double result;
+
// for(i = 0; i < size; i++)
// {
// if(row[i].a > 0 && row[i].a < vmax)
int BlurEngine::blur_strip4(int &size)
{
-
+
// multiply_alpha(src, size);
pixel_f *sp_p = src;
for(int k = 0; k < size; k++)
{
terms = (k < 4) ? k : 4;
-
+
if(plugin->config.a_key)
{
if(radius[k] != prev_forward_radius)