/*
* CINELERRA
* Copyright (C) 2008-2012 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 "language.h"
#include "loadbalance.h"
#include "playback3d.h"
-#include "cicolors.h"
+#include "bccolors.h"
#include "vframe.h"
#include "workarounds.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];
{
((HistogramWindow*)thread->window)->lock_window("HistogramMain::update_gui");
int reconfigure = load_configuration();
- if(reconfigure)
+ if(reconfigure)
{
((HistogramWindow*)thread->window)->update(1,
1,
}
-float HistogramMain::calculate_level(float input,
+float HistogramMain::calculate_level(float input,
int mode,
int use_value)
{
{
output = input;
}
-
+
if(!EQUIV(config.gamma[mode], 0))
{
// glHistogram doesn't work.
int result = get_use_opengl() &&
- !config.automatic &&
+ !config.automatic &&
(!config.plot || !gui_open());
return result;
}
int use_opengl = calculate_use_opengl();
//printf("%d\n", use_opengl);
- read_frame(frame,
- 0,
- start_position,
+ read_frame(frame,
+ 0,
+ start_position,
frame_rate,
use_opengl);
// table to avoid green borders
- if(need_reconfigure ||
- !lookup[0] ||
+ if(need_reconfigure ||
+ !lookup[0] ||
config.automatic)
{
// Calculate new curves
tabulate_curve(i, 1);
}
-// printf("HistogramMain::process_buffer %d %f %f %f %f %f %f %f %f %f\n",
-// __LINE__,
+// printf("HistogramMain::process_buffer %d %f %f %f %f %f %f %f %f %f\n",
+// __LINE__,
// config.low_input[HISTOGRAM_RED],
// config.gamma[HISTOGRAM_RED],
// config.high_input[HISTOGRAM_RED],
case BC_RGBA8888:
for(i = 0; i < 0x100; i++)
{
- lookup[subscript][i] =
- (int)(calculate_level((float)i / 0xff, subscript, use_value) *
+ lookup[subscript][i] =
+ (int)(calculate_level((float)i / 0xff, subscript, use_value) *
0xff);
CLAMP(lookup[subscript][i], 0, 0xff);
}
default:
for(i = 0; i < 0x10000; i++)
{
- lookup[subscript][i] =
- (int)(calculate_level((float)i / 0xffff, subscript, use_value) *
+ lookup[subscript][i] =
+ (int)(calculate_level((float)i / 0xffff, subscript, use_value) *
0xffff);
CLAMP(lookup[subscript][i], 0, 0xffff);
}
{
for(i = 0; i < 0x10000; i++)
{
- preview_lookup[subscript][i] =
- (int)(calculate_level((float)i / 0xffff, subscript, use_value) *
+ preview_lookup[subscript][i] =
+ (int)(calculate_level((float)i / 0xffff, subscript, use_value) *
0xffff);
CLAMP(preview_lookup[subscript][i], 0, 0xffff);
}
" return texture2D(tex, gl_TexCoord[0].st);\n"
"}\n";
- static const char *head_frag =
+ static const char *head_frag =
"uniform vec4 low_input;\n"
"uniform vec4 high_input;\n"
"uniform vec4 gamma;\n"
- static const char *apply_histogram_frag =
+ static const char *apply_histogram_frag =
APPLY_INPUT_CURVE("pixel.r", "low_input.r", "high_input.r", "gamma.r")
APPLY_INPUT_CURVE("pixel.g", "low_input.g", "high_input.g", "gamma.g")
APPLY_INPUT_CURVE("pixel.b", "low_input.b", "high_input.b", "gamma.b")
// The order of processing is fixed by this sequence
if(aggregate_interpolation)
- INTERPOLATE_COMPILE(shader_stack,
+ INTERPOLATE_COMPILE(shader_stack,
current_shader)
if(aggregate_gamma)
- GAMMA_COMPILE(shader_stack,
- current_shader,
+ GAMMA_COMPILE(shader_stack,
+ current_shader,
aggregate_interpolation)
if(aggregate_colorbalance)
- COLORBALANCE_COMPILE(shader_stack,
- current_shader,
+ COLORBALANCE_COMPILE(shader_stack,
+ current_shader,
aggregate_interpolation || aggregate_gamma)
shader_stack[15],
0);
-// printf("HistogramMain::handle_opengl %d %d %d %d shader=%d\n",
-// aggregate_interpolation,
+// printf("HistogramMain::handle_opengl %d %d %d %d shader=%d\n",
+// aggregate_interpolation,
// aggregate_gamma,
// aggregate_colorbalance,
// current_shader,
glBegin(GL_TRIANGLES);
glNormal3f(0, 0, 1.0);
- glTexCoord2f(0.0 / get_output()->get_texture_w(),
+ glTexCoord2f(0.0 / get_output()->get_texture_w(),
0.0 / get_output()->get_texture_h());
glVertex3f(0.0, -(float)get_output()->get_h(), 0);
- glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
+ glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
(float)get_output()->get_h() / get_output()->get_texture_h());
glVertex3f((float)get_output()->get_w(), -0.0, 0);
- glTexCoord2f(0.0 / get_output()->get_texture_w(),
+ glTexCoord2f(0.0 / get_output()->get_texture_w(),
(float)get_output()->get_h() / get_output()->get_texture_h());
glVertex3f(0.0, -0.0, 0);
glNormal3f(0, 0, 1.0);
- glTexCoord2f(0.0 / get_output()->get_texture_w(),
+ glTexCoord2f(0.0 / get_output()->get_texture_w(),
0.0 / get_output()->get_texture_h());
glVertex3f(0.0, -(float)get_output()->get_h(), 0);
- glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
+ glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
0.0 / get_output()->get_texture_h());
- glVertex3f((float)get_output()->get_w(),
+ glVertex3f((float)get_output()->get_w(),
-(float)get_output()->get_h(), 0);
- glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
+ glTexCoord2f((float)get_output()->get_w() / get_output()->get_texture_w(),
(float)get_output()->get_h() / get_output()->get_texture_h());
glVertex3f((float)get_output()->get_w(), -0.0, 0);
-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)
{