/*
* 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 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 <math.h>
#include "keyframe.h"
#include "language.h"
#include "loadbalance.h"
-#include "cicolors.h"
+#include "bccolors.h"
#include "vframe.h"
HistogramMain::HistogramMain(PluginServer *server)
: PluginVClient(server)
{
-
+
engine = 0;
for(int i = 0; i < HISTOGRAM_MODES; i++)
{
HistogramMain::~HistogramMain()
{
-
+
for(int i = 0; i < HISTOGRAM_MODES;i++)
{
delete [] lookup[i];
delete engine;
}
-const char* HistogramMain::plugin_title() { return _("Histogram Bezier"); }
+const char* HistogramMain::plugin_title() { return N_("Histogram Bezier"); }
int HistogramMain::is_realtime() { return 1; }
void HistogramMain::update_gui()
{
- if(thread)
- {
- thread->window->lock_window("HistogramMain::update_gui");
- int reconfigure = load_configuration();
- if(reconfigure)
- {
- HistogramWindow *window = (HistogramWindow *)thread->window;
- window->update(0);
- if(!config.automatic)
- {
- window->update_input();
- }
- }
- thread->window->unlock_window();
+ if( !thread ) return;
+ HistogramWindow *window = (HistogramWindow *)thread->window;
+// points delete in load_configuration,read_data
+ window->lock_window("HistogramMain::update_gui");
+ if( load_configuration() ) {
+ window->update(0);
+ if(!config.automatic)
+ window->update_input();
}
+ window->unlock_window();
}
if(current_input_mode < HISTOGRAM_MODES)
{
HistogramPoints *points = &config.points[current_input_mode];
- while(points->last)
+ while(points->last)
delete points->last;
while(!result)
{
points->insert(
input.tag.get_property("X", 0.0),
input.tag.get_property("Y", 0.0));
- points->last->gradient =
+ points->last->gradient =
input.tag.get_property("GRADIENT", 1.0);
- points->last->xoffset_left =
+ points->last->xoffset_left =
input.tag.get_property("XOFFSET_LEFT", -0.02);
points->last->xoffset_right =
input.tag.get_property("XOFFSET_RIGHT", 0.02);
}
-float HistogramMain::calculate_linear(float input,
+float HistogramMain::calculate_linear(float input,
int subscript,
int use_value)
{
if(!EQUIV(x2 - x1, 0))
- {
+ {
if (config.smoothMode == HISTOGRAM_LINEAR)
output = (input - x1) * (y2 - y1) / (x2 - x1) + y1;
else if (config.smoothMode == HISTOGRAM_POLYNOMINAL)
case BC_RGB888:
case BC_RGBA8888:
for(i = 0; i < 0x100; i++)
- lookup[subscript][i] =
+ lookup[subscript][i] =
(int)(calculate_smooth((float)i / 0xff, subscript) * 0xff);
break;
// All other integer colormodels are converted to 16 bit RGB
default:
for(i = 0; i < 0x10000; i++)
- lookup[subscript][i] =
+ lookup[subscript][i] =
(int)(calculate_smooth((float)i / 0xffff, subscript) * 0xffff);
break;
}
{
}
-HistogramUnit::HistogramUnit(HistogramEngine *server,
+HistogramUnit::HistogramUnit(HistogramEngine *server,
HistogramMain *plugin)
: LoadClient(server)
{
y = (row[0] << 8) | row[0];
u = (row[1] << 8) | row[1];
v = (row[2] << 8) | row[2];
- plugin->yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
HISTOGRAM_TAIL(3)
break;
case BC_RGBA8888:
y = (row[0] << 8) | row[0];
u = (row[1] << 8) | row[1];
v = (row[2] << 8) | row[2];
- plugin->yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
HISTOGRAM_TAIL(4)
break;
case BC_RGB161616:
y = row[0];
u = row[1];
v = row[2];
- plugin->yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
HISTOGRAM_TAIL(3)
break;
case BC_RGBA16161616:
y = row[0];
u = row[1];
v = row[2];
- plugin->yuv.yuv_to_rgb_16(r, g, b, y, u, v);
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v);
HISTOGRAM_TAIL(4)
break;
}
v = row[2]; \
} \
\
- plugin->yuv.yuv_to_rgb_16(r, g, b, y, u, v); \
+ YUV::yuv.yuv_to_rgb_16(r, g, b, y, u, v); \
\
/* Look up in RGB domain */ \
r = lookup_r[r]; \
b = lookup_b[b]; \
\
/* Convert to 16 bit YUV */ \
- plugin->yuv.rgb_to_yuv_16(r, g, b, y, u, v); \
+ YUV::yuv.rgb_to_yuv_16(r, g, b, y, u, v); \
\
if(max == 0xff) \
{ \
-HistogramEngine::HistogramEngine(HistogramMain *plugin,
- int total_clients,
+HistogramEngine::HistogramEngine(HistogramMain *plugin,
+ int total_clients,
int total_packages)
: LoadServer(total_clients, total_packages)
{