done = 1;
output_lock->unlock();
Thread::join();
- delete preferences;
delete_render_engine();
+ delete preferences;
if( audio_cache )
audio_cache->remove_user();
if( video_cache )
void PlaybackEngine::arm_render_engine()
{
+ renderengine_lock->lock("PlaybackEngine::arm_render_engine");
if( render_engine )
render_engine->arm_command(command);
+ renderengine_lock->unlock();
}
void PlaybackEngine::start_render_engine()
{
+ renderengine_lock->lock("PlaybackEngine::start_render_engine");
if( render_engine )
render_engine->start_command();
+ renderengine_lock->unlock();
}
void PlaybackEngine::wait_render_engine()
void PlaybackEngine::perform_change()
{
switch( command->change_type ) {
- case CHANGE_ALL:
- create_cache();
- case CHANGE_EDL:
- create_render_engine();
- break;
- case CHANGE_PARAMS:
- render_engine->get_edl()->synchronize_params(command->get_edl());
- case CHANGE_NONE:
+ case CHANGE_ALL:
+ create_cache();
+ case CHANGE_EDL:
+ create_render_engine();
+ break;
+ case CHANGE_PARAMS: {
+ renderengine_lock->lock("PlaybackEngine::perform_change");
+ EDL *edl = render_engine ? render_engine->get_edl() : 0;
+ if( edl ) edl->add_user();
+ renderengine_lock->unlock();
+ if( !edl ) break;
+ edl->synchronize_params(command->get_edl());
+ edl->remove_user();
+ }
+ case CHANGE_NONE:
break;
}
}
mwindow->reset_android_remote();
int ffmpeg_early_probe = mwindow->preferences->get_file_probe_armed("FFMPEG_Early");
+ mwindow->gui->lock_window("PreferencesThread::apply_settings 6");
mwindow->gui->ffmpeg_toggle->update(ffmpeg_early_probe);
mwindow->gui->ffmpeg_toggle->set_tooltip(ffmpeg_early_probe ?
FFMPEG_EARLY_TIP : FFMPEG_LATE_TIP);
+ mwindow->gui->unlock_window();
mwindow->gui->mainshbtns->load(mwindow->preferences);
mwindow->init_brender();
#include <unistd.h>
#include "bcdisplayinfo.h"
+#include "bchash.h"
+#include "bcprogressbox.h"
#include "bcsignals.h"
#include "clip.h"
-#include "bchash.h"
+#include "edl.h"
#include "filexml.h"
#include "histogram.h"
#include "histogramconfig.h"
#include "keyframe.h"
#include "language.h"
#include "loadbalance.h"
+#include "localsession.h"
+#include "mainsession.h"
+#include "mwindow.h"
#include "playback3d.h"
+#include "pluginserver.h"
#include "bccolors.h"
#include "vframe.h"
#include "workarounds.h"
{
engine = 0;
+ stripe_engine = 0;
for(int i = 0; i < HISTOGRAM_MODES; i++)
{
lookup[i] = 0;
w = 440;
h = 500;
parade = 0;
+ fframe = 0;
+ last_frames = 0;
+ last_position = -1;
}
HistogramMain::~HistogramMain()
delete [] preview_lookup[i];
}
delete engine;
+ delete stripe_engine;
+ delete fframe;
}
const char* HistogramMain::plugin_title() { return N_("Histogram"); }
output.tag.set_property("THRESHOLD", config.threshold);
output.tag.set_property("PLOT", config.plot);
output.tag.set_property("SPLIT", config.split);
+ output.tag.set_property("FRAMES", config.frames);
+ output.tag.set_property("LOG_SLIDER", config.log_slider);
output.tag.set_property("W", w);
output.tag.set_property("H", h);
output.tag.set_property("PARADE", parade);
config.threshold = input.tag.get_property("THRESHOLD", config.threshold);
config.plot = input.tag.get_property("PLOT", config.plot);
config.split = input.tag.get_property("SPLIT", config.split);
+ config.frames = input.tag.get_property("FRAMES", config.frames);
+ config.log_slider = input.tag.get_property("LOG_SLIDER", config.log_slider);
if(is_defaults())
{
double frame_rate)
{
int need_reconfigure = load_configuration();
-
-
-
int use_opengl = calculate_use_opengl();
-//printf("%d\n", use_opengl);
- read_frame(frame,
- 0,
- start_position,
- frame_rate,
- use_opengl);
-
this->input = frame;
this->output = frame;
- if( !engine )
- {
- int cpus = input->get_w() * input->get_h() / 0x80000 + 2;
- int smps = get_project_smp();
- if( cpus > smps ) cpus = smps;
+ int cpus = input->get_w() * input->get_h() / 0x80000 + 2;
+ int smps = get_project_smp();
+ if( cpus > smps ) cpus = smps;
+ if( !engine ) {
engine = new HistogramEngine(this, cpus, cpus);
}
+ int frames = config.frames;
+ MWindow *mwindow = server->mwindow;
+ if( frames > 1 && (!mwindow || // dont scan during SELECT_REGION
+ mwindow->session->current_operation != SELECT_REGION ||
+ mwindow->edl->local_session->get_selectionstart() ==
+ mwindow->edl->local_session->get_selectionend() ) ) {
+ if( !stripe_engine )
+ stripe_engine = new HistStripeEngine(this, cpus, cpus);
+ int fw = frame->get_w(), fh =frame->get_h();
+ new_temp(fw, fh, BC_RGB_FLOAT);
+ MWindow *mwindow = server->mwindow;
+ if( (mwindow && mwindow->session->current_operation == SELECT_REGION) ||
+ ( last_frames == frames && last_position-1 == start_position &&
+ fframe && fframe->get_w() == fw && fframe->get_h() == fh ) ) {
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_FFRM);
+ frame->transfer_from(temp);
+ }
+ else if( last_frames != frames || last_position != start_position ||
+ !fframe || fframe->get_w() != fw || fframe->get_h() != fh ) {
+ last_frames = frames;
+ last_position = start_position;
+ VFrame::get_temp(fframe, fw, fh, BC_RGB_FLOAT);
+ read_frame(fframe, 0, start_position+1, frame_rate, use_opengl);
+ BC_ProgressBox *progress = 0;
+ const char *progress_title = _("Histogram: scanning\n");
+ Timer timer;
+ for( int i=2; i<frames; ++i ) {
+ read_frame(temp, 0, start_position+i, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_TEMP);
+ if( !progress && gui_open() && frames > 2*frame_rate ) {
+ progress = new BC_ProgressBox(-1, -1, progress_title, frames);
+ progress->start();
+ }
+ if( progress && timer.get_difference() > 100 ) {
+ timer.update();
+ progress->update(i, 1);
+ char string[BCTEXTLEN];
+ sprintf(string, "%sframe: %d", progress_title, i);
+ progress->update_title(string, 1);
+ if( progress->is_cancelled() ) break;
+ }
+ if( progress && !gui_open() ) {
+ progress->stop_progress();
+ delete progress; progress = 0;
+ }
+ }
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_FFRMS);
+ frame->transfer_from(temp);
+ if( progress ) {
+ progress->stop_progress();
+ delete progress;
+ }
+ ++last_position;
+ }
+ else {
+ read_frame(temp, 0, start_position+frames-1, frame_rate, use_opengl);
+ stripe_engine->process_packages(ADD_TEMPS);
+ frame->transfer_from(fframe);
+ read_frame(temp, 0, start_position, frame_rate, use_opengl);
+ stripe_engine->process_packages(SUB_TEMPS);
+ ++last_position;
+ }
+ }
+ else
+ read_frame(frame, 0, start_position, frame_rate, use_opengl);
+
// if to plot histogram
if(config.plot) send_render_gui(frame);
}
+HistStripePackage::HistStripePackage()
+ : LoadPackage()
+{
+}
+HistStripeUnit::HistStripeUnit(HistStripeEngine *server, HistogramMain *plugin)
+ : LoadClient(server)
+{
+ this->plugin = plugin;
+ this->server = server;
+}
+void HistStripeUnit::process_package(LoadPackage *package)
+{
+ HistStripePackage *pkg = (HistStripePackage*)package;
+ int frames = plugin->config.frames;
+ float scale = 1. / frames;
+ int iy0 = pkg->y0, iy1 = pkg->y1;
+ int fw = plugin->fframe->get_w();
+ uint8_t **frows = plugin->fframe->get_rows();
+ uint8_t **trows = plugin->temp->get_rows();
+ switch( server->operation ) {
+ case ADD_TEMP: // add temp to fframe
+ for( int iy=iy0; iy<iy1; ++iy ) {
+ float *trow = (float *)trows[iy];
+ float *frow = (float *)frows[iy];
+ for( int ix=0; ix<fw; ++ix ) {
+ *frow++ += *trow++;
+ *frow++ += *trow++;
+ *frow++ += *trow++;
+ }
+ }
+ break;
+ case ADD_FFRM: // add fframe to scaled temp
+ for( int iy=iy0; iy<iy1; ++iy ) {
+ float *trow = (float *)trows[iy];
+ float *frow = (float *)frows[iy];
+ for( int ix=0; ix<fw; ++ix ) {
+ *trow = *trow * scale + *frow++; ++trow;
+ *trow = *trow * scale + *frow++; ++trow;
+ *trow = *trow * scale + *frow++; ++trow;
+ }
+ }
+ break;
+ case ADD_FFRMS: // add fframe to temp, scale temp, scale fframe
+ for( int iy=iy0; iy<iy1; ++iy ) {
+ float *trow = (float *)trows[iy];
+ float *frow = (float *)frows[iy];
+ for( int ix=0; ix<fw; ++ix ) {
+ *trow += *frow; *trow++ *= scale; *frow++ *= scale;
+ *trow += *frow; *trow++ *= scale; *frow++ *= scale;
+ *trow += *frow; *trow++ *= scale; *frow++ *= scale;
+ }
+ }
+ break;
+ case ADD_TEMPS: // add scaled temp to fframe
+ for( int iy=iy0; iy<iy1; ++iy ) {
+ float *trow = (float *)trows[iy];
+ float *frow = (float *)frows[iy];
+ for( int ix=0; ix<fw; ++ix ) {
+ *frow++ += *trow++ * scale;
+ *frow++ += *trow++ * scale;
+ *frow++ += *trow++ * scale;
+ }
+ }
+ break;
+ case SUB_TEMPS: // sub scaled temp from frame
+ for( int iy=iy0; iy<iy1; ++iy ) {
+ float *trow = (float *)trows[iy];
+ float *frow = (float *)frows[iy];
+ for( int ix=0; ix<fw; ++ix ) {
+ *frow++ -= *trow++ * scale;
+ *frow++ -= *trow++ * scale;
+ *frow++ -= *trow++ * scale;
+ }
+ }
+ break;
+ }
+}
+HistStripeEngine::HistStripeEngine(HistogramMain *plugin,
+ int total_clients, int total_packages)
+ : LoadServer(total_clients, total_packages)
+{
+ this->plugin = plugin;
+}
+void HistStripeEngine::init_packages()
+{
+ int ih = plugin->input->get_h(), iy0 = 0;
+ for( int i=0,n=get_total_packages(); i<n; ) {
+ HistStripePackage *pkg = (HistStripePackage*)get_package(i);
+ int iy1 = (ih * ++i) / n;
+ pkg->y0 = iy0; pkg->y1 = iy1;
+ iy0 = iy1;
+ }
+}
+LoadClient* HistStripeEngine::new_client()
+{
+ return new HistStripeUnit(this, plugin);
+}
+LoadPackage* HistStripeEngine::new_package()
+{
+ return new HistStripePackage();
+}
-
+void HistStripeEngine::process_packages(int operation)
+{
+ this->operation = operation;
+ LoadServer::process_packages();
+}
{
}
-
-
-
HistogramUnit::HistogramUnit(HistogramEngine *server,
HistogramMain *plugin)
: LoadClient(server)
VFrame *input, *output;
HistogramEngine *engine;
+ HistStripeEngine *stripe_engine;
+
int *lookup[HISTOGRAM_MODES];
// No value applied to this
int *preview_lookup[HISTOGRAM_MODES];
int point_y_offset;
int w, h;
int parade;
+ VFrame *fframe;
+ int64_t last_position;
+ int last_frames;
+};
+
+enum { ADD_TEMP, ADD_FFRM, ADD_FFRMS, ADD_TEMPS, SUB_TEMPS };
+
+class HistStripePackage : public LoadPackage
+{
+public:
+ HistStripePackage();
+ int y0, y1;
+};
+
+class HistStripeUnit : public LoadClient
+{
+public:
+ HistStripeUnit(HistStripeEngine *server, HistogramMain *plugin);
+ void process_package(LoadPackage *package);
+ HistStripeEngine *server;
+ HistogramMain *plugin;
+};
+
+class HistStripeEngine : public LoadServer
+{
+public:
+ HistStripeEngine(HistogramMain *plugin, int total_clients, int total_packages);
+ void process_packages(int operation);
+ void init_packages();
+ LoadClient *new_client();
+ LoadPackage *new_package();
+ HistogramMain *plugin;
+ int operation;
};
+
class HistogramPackage : public LoadPackage
{
public:
#define BOX_SIZE 10
-class HistogramEngine;
class HistogramMain;
+class HistStripePackage;
+class HistStripeUnit;
+class HistStripeEngine;
+class HistogramPackage;
+class HistogramUnit;
+class HistogramEngine;
#endif
automatic_v = 0;
threshold = 1.0;
}
+
+ frames = 0;
+ log_slider = .5;
}
void HistogramConfig::reset_points(int colors_only)
high_output[i] = Units::quantize(high_output[i], PRECISION);
}
CLAMP(threshold, 0, 1);
+ CLAMP(log_slider, 0, 1);
+ CLAMP(frames, 0, 65535);
}
int HistogramConfig::equivalent(HistogramConfig &that)
threshold != that.threshold) return 0;
if(plot != that.plot ||
- split != that.split) return 0;
+ split != that.split ||
+ frames != that.frames ||
+ log_slider != that.log_slider ) return 0;
return 1;
}
threshold = that.threshold;
plot = that.plot;
split = that.split;
+ frames = that.frames;
+ log_slider = that.log_slider;
}
void HistogramConfig::interpolate(HistogramConfig &prev,
automatic_v = prev.automatic_v;
plot = prev.plot;
split = prev.split;
-
-
+ frames = prev.frames;
+ log_slider = prev.log_slider;
}
{
for(int j = 0; j < HISTOGRAM_MODES; j++)
{
- printf("HistogramConfig::dump mode=%d plot=%d split=%d\n", j, plot, split);
+ printf("HistogramConfig::dump mode=%d plot=%d split=%d frames=%d\n", j, plot, split, frames);
}
}
float threshold;
int plot;
int split;
+ int frames;
+ float log_slider;
};
#include "bcdisplayinfo.h"
#include "bcsignals.h"
#include "cursors.h"
+#include "edl.h"
#include "histogram.h"
#include "histogramconfig.h"
#include "histogramwindow.h"
#include "keys.h"
#include "language.h"
+#include "localsession.h"
+#include "mwindow.h"
+#include "pluginserver.h"
#include "theme.h"
#include <unistd.h>
low_output_carrot->get_w() / 2, y));
y += high_output_carrot->get_h() + margin;
+
// add_subwindow(title = new BC_Title(x, y, _("Output:")));
// x += title->get_w() + margin;
low_output = new HistogramText(plugin, this, x, y);
low_output->create_objects();
+
+ const char *linear_text = _("Linear");
+ int xs = get_w()/2 - xS(50);
+ x = xs - BC_Title::calculate_w(this, linear_text) - margin;
+ add_subwindow(log_title1 = new BC_Title(x, y, linear_text));
+ add_subwindow(log_slider = new HistogramLogSlider(plugin, this, xs, y));
+ xs += log_slider->get_w() + margin;
+ add_subwindow(log_title2 = new BC_Title(xs, y, _("Log")));
+
high_output = new HistogramText(plugin, this,
get_w() - low_output->get_w() - margin, y);
high_output->create_objects();
y += bar->get_h() + margin;
add_subwindow(automatic = new HistogramAuto(plugin, x, y));
-
- //int y1 = y;
- x = xS(200);
- add_subwindow(threshold_title = new BC_Title(x, y, _("Threshold:")));
- x += threshold_title->get_w() + margin;
- threshold = new HistogramText(plugin, this, x, y);
+ int x2 = xS(190);
+ add_subwindow(threshold_title = new BC_Title(x2, y, _("Threshold:")));
+ int x3 = xS(305);
+ threshold = new HistogramText(plugin, this, x3, y);
threshold->create_objects();
+ y += automatic->get_h() + margin;
- x = get_w() / 2;
- add_subwindow(reset = new HistogramReset(plugin,
- x, y + threshold->get_h() + margin));
+ add_subwindow(plot = new HistogramPlot(plugin, x1, y));
+ add_subwindow(select = new HistogramSelect(plugin, this, x2, y));
+ frames = new HistogramFrames(plugin, this, x3, y);
+ frames->create_objects();
+ x = x3 + frames->get_w() + margin;
+ add_subwindow(clear_frames = new HistogramClearFrames(plugin, this, x, y));
+ y += plot->get_h() + margin;
x = x1;
- y += automatic->get_h() + margin;
- add_subwindow(plot = new HistogramPlot(plugin, x, y));
-
- y += plot->get_h() + yS(5);
add_subwindow(split = new HistogramSplit(plugin, x, y));
+ x = xS(340);
+ add_subwindow(reset = new HistogramReset(plugin, x, y + yS(5)));
update(1, 1, 1, 1);
low_output->reposition_window(low_output->get_x(),
low_output->get_y() + ydiff);
+ int xs = (get_w() - log_slider->get_w()) / 2;
+ int margin = plugin->get_theme()->widget_border;
+ log_title1->reposition_window(xs - log_title1->get_w() - margin,
+ log_title1->get_y() + ydiff);
+ log_slider->reposition_window(xs,
+ log_slider->get_y() + ydiff);
+ log_title2->reposition_window(xs + log_slider->get_w() + margin,
+ log_title2->get_y() + ydiff);
high_output->reposition_window(high_output->get_x() + xdiff,
high_output->get_y() + ydiff);
threshold_title->get_y() + ydiff);
threshold->reposition_window(threshold->get_x(),
threshold->get_y() + ydiff);
- reset->reposition_window(reset->get_x(),
- reset->get_y() + ydiff);
-
plot->reposition_window(plot->get_x(),
plot->get_y() + ydiff);
+
split->reposition_window(split->get_x(),
split->get_y() + ydiff);
+ reset->reposition_window(reset->get_x(),
+ reset->get_y() + ydiff);
+
+ frames->reposition_window(frames->get_x(),
+ frames->get_y() + ydiff);
+ select->reposition_window(select->get_x(),
+ select->get_y() + ydiff);
+ clear_frames->reposition_window(clear_frames->get_x(),
+ clear_frames->get_y() + ydiff);
update(1, 1, 1, 1);
mode_b->update(plugin->mode == HISTOGRAM_BLUE ? 1 : 0);
plot->update(plugin->config.plot);
split->update(plugin->config.split);
+ frames->update(plugin->config.frames);
parade_on->update(plugin->parade ? 1 : 0);
parade_off->update(plugin->parade ? 0 : 1);
+ log_slider->update(plugin->config.log_slider);
output->update();
}
void HistogramWindow::draw_canvas_mode(int mode, int color, int y, int h)
{
- int *accum = plugin->accum[mode];
- int accum_per_canvas_i = HISTOGRAM_SLOTS / canvas_w + 1;
- float accum_per_canvas_f = (float)HISTOGRAM_SLOTS / canvas_w;
- int normalize = 0;
- int max = 0;
-
-
// Draw histogram
- for(int i = 0; i < HISTOGRAM_SLOTS; i++)
- {
- if(accum && accum[i] > normalize) normalize = accum[i];
+ int max = 0, *accum = plugin->accum[mode];
+ if( accum ) {
+ for( int i=0; i<HISTOGRAM_SLOTS; ++i ) {
+ int v = accum[i];
+ if( max < v ) max = v;
+ }
}
-
- if(normalize)
- {
- for(int i = 0; i < canvas_w; i++)
- {
- int accum_start = (int)(accum_per_canvas_f * i);
- int accum_end = accum_start + accum_per_canvas_i;
- max = 0;
- for(int j = accum_start; j < accum_end; j++)
- {
- max = MAX(accum[j], max);
+ if( max > 0 ) {
+ double log_slider = plugin->config.log_slider;
+ double lin_slider = 1. - log_slider;
+ double lin_scale = (lin_slider * h) / max;
+ double log_scale = (log_slider * h) / log(max);
+ for( int i=0,x=0; x<canvas_w; ++x ) {
+ int m = 0;
+ int i1 = (HISTOGRAM_SLOTS * (x+1)) / canvas_w;
+ while( i < i1 ) {
+ int v = accum[i++];
+ if( m < v ) m = v;
}
-
-// max = max * h / normalize;
- max = (int)(log(max) / log(normalize) * h);
+ m = m*lin_scale + log(m)*log_scale;
canvas->set_color(BLACK);
- canvas->draw_line(i, y, i, y + h - max);
+ canvas->draw_line(x, y, x, y+h - m);
canvas->set_color(color);
- canvas->draw_line(i, y + h - max, i, y + h);
+ canvas->draw_line(x, y+h - m, x, y+h);
}
}
- else
- {
+ else {
canvas->set_color(BLACK);
canvas->draw_box(0, y, canvas_w, h);
}
int y1 = 0;
// Draw output line
- for(int i = 0; i < canvas_w; i++)
- {
- float input = (float)i /
- canvas_w *
- FLOAT_RANGE +
- HIST_MIN_INPUT;
- float output = plugin->calculate_level(input,
- mode,
- 0);
-
+ for( int x=0; x<canvas_w; ++x ) {
+ float input = (float)x / canvas_w * FLOAT_RANGE + HIST_MIN_INPUT;
+ float output = plugin->calculate_level(input, mode, 0);
int y2 = h - (int)(output * h);
- if(i > 0)
- {
- canvas->draw_line(i - 1, y + y1, i, y + y2);
- }
+ if( x > 0 )
+ canvas->draw_line(x-1, y+y1, x, y+y2);
y1 = y2;
}
canvas->set_line_width(1);
-
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-HistogramReset::HistogramReset(HistogramMain *plugin,
- int x,
- int y)
+HistogramReset::HistogramReset(HistogramMain *plugin, int x, int y)
: BC_GenericButton(x, y, _("Reset"))
{
this->plugin = plugin;
}
+HistogramSelect::HistogramSelect(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y)
+ : BC_GenericButton(x, y, xS(100), _("Frames"))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+ set_tooltip(_("Set frames to selection duration"));
+}
+int HistogramSelect::handle_event()
+{
+ MWindow *mwindow = plugin->server->mwindow;
+ if( mwindow ) {
+ EDL *edl = mwindow->edl;
+ double start = edl->local_session->get_selectionstart();
+ int64_t start_pos = edl->get_frame_rate() * start;
+ double end = edl->local_session->get_selectionend();
+ int64_t end_pos = edl->get_frame_rate() * end;
+ int64_t frames = end_pos - start_pos;
+ gui->frames->update(frames);
+ plugin->config.frames = frames;
+ plugin->send_configure_change();
+ }
+ return 1;
+}
+HistogramClearFrames::HistogramClearFrames(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y)
+ : BC_Button(x, y, plugin->get_theme()->get_image_set("reset_button"))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+ set_tooltip(_("Clear frames"));
+}
+int HistogramClearFrames::handle_event()
+{
+ plugin->config.frames = 0;
+ gui->frames->update(0);
+ plugin->send_configure_change();
+ return 1;
+}
+HistogramLogSlider::HistogramLogSlider(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y)
+: BC_FSlider(x, y, 0, xS(100), xS(100), 0., 1., plugin->config.log_slider)
+{
+ this->plugin = plugin;
+ this->gui = gui;
+}
-HistogramCarrot::HistogramCarrot(HistogramMain *plugin,
- HistogramWindow *gui,
- int x,
- int y)
- : BC_Toggle(x,
- y,
- plugin->get_theme()->get_image_set("histogram_carrot"),
- 0)
+int HistogramLogSlider::handle_event()
+{
+ plugin->config.log_slider = get_value();
+ plugin->send_configure_change();
+ return 1;
+}
+
+HistogramCarrot::HistogramCarrot(HistogramMain *plugin, HistogramWindow *gui, int x, int y)
+ : BC_Toggle(x, y, plugin->get_theme()->get_image_set("histogram_carrot"), 0)
{
this->plugin = plugin;
this->gui = gui;
float* HistogramCarrot::get_value()
{
- if(this == gui->low_input_carrot)
- {
+ if( this == gui->low_input_carrot )
return &plugin->config.low_input[plugin->mode];
- }
- else
- if(this == gui->high_input_carrot)
- {
+ if( this == gui->high_input_carrot )
return &plugin->config.high_input[plugin->mode];
- }
- else
- if(this == gui->gamma_carrot)
- {
+ if( this == gui->gamma_carrot )
return &plugin->config.gamma[plugin->mode];
- }
- else
- if(this == gui->low_output_carrot)
- {
+ if( this == gui->low_output_carrot )
return &plugin->config.low_output[plugin->mode];
- }
- else
- if(this == gui->high_output_carrot)
- {
+ if( this == gui->high_output_carrot )
return &plugin->config.high_output[plugin->mode];
- }
return 0;
}
}
-
HistogramMode::HistogramMode(HistogramMain *plugin,
int x,
int y,
}
+HistogramFrames::HistogramFrames(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y)
+ : BC_TumbleTextBox(gui, 0, 0, 65535, x, y, xS(80))
+{
+ this->plugin = plugin;
+ this->gui = gui;
+}
+int HistogramFrames::handle_event()
+{
+ plugin->config.frames = atoi(get_text());
+ plugin->send_configure_change();
+ return 1;
+}
-
-
-
-
+void HistogramFrames::update(int frames)
+{
+ BC_TumbleTextBox::update((int64_t)frames);
+}
HistogramText::HistogramText(HistogramMain *plugin,
HistogramWindow *gui, int x, int y, float hist_min, float hist_max)
- : BC_TumbleTextBox(gui, 0.0, hist_min, hist_max, x, y, xS(70))
+ : BC_TumbleTextBox(gui, 0.0, hist_min, hist_max, x, y, xS(80))
{
this->plugin = plugin;
this->gui = gui;
float* HistogramText::get_value()
{
- if(this == gui->low_input)
- {
+ if( this == gui->low_input )
return &plugin->config.low_input[plugin->mode];
- }
- else
- if(this == gui->high_input)
- {
+ if( this == gui->high_input )
return &plugin->config.high_input[plugin->mode];
- }
- else
- if(this == gui->gamma)
- {
+ if( this == gui->gamma )
return &plugin->config.gamma[plugin->mode];
- }
- else
- if(this == gui->low_output)
- {
+ if( this == gui->low_output )
return &plugin->config.low_output[plugin->mode];
- }
- else
- if(this == gui->high_output)
- {
+ if( this == gui->high_output )
return &plugin->config.high_output[plugin->mode];
- }
- else
- if(this == gui->threshold)
- {
+ if( this == gui->threshold )
return &plugin->config.threshold;
- }
-
return 0;
}
int HistogramText::handle_event()
{
float *output = get_value();
- if(output)
- {
+ if( output )
*output = atof(get_text());
- }
gui->update(1, 1, 0, 0);
plugin->send_configure_change();
void HistogramText::update()
{
float *output = get_value();
- if(output)
- {
+ if( output )
BC_TumbleTextBox::update(*output);
- }
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class HistogramCarrot : public BC_Toggle
{
public:
- HistogramCarrot(HistogramMain *plugin,
- HistogramWindow *gui,
- int x,
- int y);
+ HistogramCarrot(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
virtual ~HistogramCarrot();
void update();
class HistogramAuto : public BC_CheckBox
{
public:
- HistogramAuto(HistogramMain *plugin,
- int x,
- int y);
+ HistogramAuto(HistogramMain *plugin, int x, int y);
int handle_event();
HistogramMain *plugin;
};
class HistogramPlot : public BC_CheckBox
{
public:
- HistogramPlot(HistogramMain *plugin,
- int x,
- int y);
+ HistogramPlot(HistogramMain *plugin, int x, int y);
int handle_event();
HistogramMain *plugin;
};
class HistogramSplit : public BC_CheckBox
{
public:
- HistogramSplit(HistogramMain *plugin,
- int x,
- int y);
+ HistogramSplit(HistogramMain *plugin, int x, int y);
int handle_event();
HistogramMain *plugin;
};
class HistogramMode : public BC_Radial
{
public:
- HistogramMode(HistogramMain *plugin,
- int x,
- int y,
- int value,
+ HistogramMode(HistogramMain *plugin, int x, int y, int value,
char *text);
int handle_event();
HistogramMain *plugin;
class HistogramReset : public BC_GenericButton
{
public:
- HistogramReset(HistogramMain *plugin,
- int x,
- int y);
+ HistogramReset(HistogramMain *plugin, int x, int y);
+ int handle_event();
+ HistogramMain *plugin;
+};
+
+class HistogramSelect : public BC_GenericButton
+{
+public:
+ HistogramSelect(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
+ int handle_event();
+ HistogramMain *plugin;
+ HistogramWindow *gui;
+};
+
+class HistogramClearFrames : public BC_Button
+{
+public:
+ HistogramClearFrames(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
int handle_event();
HistogramMain *plugin;
+ HistogramWindow *gui;
+};
+
+class HistogramLogSlider : public BC_FSlider
+{
+public:
+ HistogramLogSlider(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
+ int handle_event();
+ HistogramMain *plugin;
+ HistogramWindow *gui;
+};
+
+class HistogramFrames : public BC_TumbleTextBox
+{
+public:
+ HistogramFrames(HistogramMain *plugin, HistogramWindow *gui, int x, int y);
+ int handle_event();
+ void update(int frames);
+
+ HistogramMain *plugin;
+ HistogramWindow *gui;
};
class HistogramText : public BC_TumbleTextBox
class HistogramCanvas : public BC_SubWindow
{
public:
- HistogramCanvas(HistogramMain *plugin,
- HistogramWindow *gui,
- int x,
- int y,
- int w,
- int h);
+ HistogramCanvas(HistogramMain *plugin, HistogramWindow *gui,
+ int x, int y, int w, int h);
int button_press_event();
int cursor_motion_event();
int button_release_event();
~HistogramWindow();
void create_objects();
- void update(int do_canvases,
- int do_carrots,
- int do_text,
- int do_toggles);
+ void update(int do_canvases, int do_carrots, int do_text, int do_toggles);
void draw_canvas_mode(int mode, int color, int y, int h);
void update_canvas();
int keypress_event();
int resize_event(int w, int h);
void get_point_extents(HistogramPoint *current,
- int *x1,
- int *y1,
- int *x2,
- int *y2,
- int *x,
- int *y);
+ int *x1, int *y1, int *x2, int *y2, int *x, int *y);
HistogramSlider *output;
HistogramAuto *automatic;
HistogramText *low_input;
HistogramText *high_input;
HistogramText *gamma;
+ HistogramFrames *frames;
HistogramCanvas *canvas;
HistogramCarrot *low_input_carrot;
HistogramCarrot *gamma_carrot;
BC_Title *canvas_title2;
BC_Title *threshold_title;
BC_Bar *bar;
+ HistogramSelect *select;
+ HistogramClearFrames *clear_frames;
+ HistogramLogSlider *log_slider;
+ BC_Title *log_title1;
+ BC_Title *log_title2;
// Value to change with keypresses
float *active_value;
HistogramSplit *split;
};
-
-
-
-
-
-
#endif
#ifndef HISTOGRAMWINDOW_INC
#define HISTOGRAMWINDOW_INC
+class HistogramSlider;
+class HistogramParade;
+class HistogramCarrot;
+class HistogramAuto;
+class HistogramPlot;
+class HistogramSplit;
+class HistogramMode;
+class HistogramReset;
+class HistogramSelect;
+class HistogramLogSlider;
+class HistogramFrames;
+class HistogramText;
+class HistogramCanvas;
class HistogramWindow;
-class HistogramThread;
#endif