From c7754a695f7750177de8645709f5d30487a4ac45 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 8 Oct 2020 19:06:33 -0600 Subject: [PATCH] histogram rework to add sum_frames, update suv/cakewalk autorange icons, add new timeblur plugin, fix segv ViewPopup on vicon render fail, fix shutdown with transcode active, recordmonitor hide_window for video toggle, improve transition file position clamps --- cinelerra-5.1/cinelerra/convert.C | 16 +- cinelerra-5.1/cinelerra/convert.h | 3 +- cinelerra-5.1/cinelerra/recordgui.C | 10 + cinelerra-5.1/cinelerra/vmodule.C | 19 +- cinelerra-5.1/guicast/vicon.C | 15 +- cinelerra-5.1/plugin_defs | 1 + cinelerra-5.1/plugins/Makefile | 1 + cinelerra-5.1/plugins/histogram/histogram.C | 362 ++++-------------- cinelerra-5.1/plugins/histogram/histogram.h | 44 +-- cinelerra-5.1/plugins/histogram/histogram.inc | 10 +- .../plugins/histogram/histogramconfig.C | 57 ++- .../plugins/histogram/histogramconfig.h | 3 +- .../plugins/histogram/histogramwindow.C | 272 ++++--------- .../plugins/histogram/histogramwindow.h | 60 +-- .../plugins/histogram/histogramwindow.inc | 3 +- .../theme_cakewalk/data/autorange_bottom.png | Bin 295 -> 241 bytes .../theme_cakewalk/data/autorange_hi.png | Bin 418 -> 245 bytes .../theme_cakewalk/data/autorange_top.png | Bin 299 -> 254 bytes .../theme_cakewalk/data/autorange_up.png | Bin 413 -> 234 bytes .../theme_suv/data/autorange_bottom.png | Bin 154 -> 237 bytes .../plugins/theme_suv/data/autorange_hi..png | Bin 503 -> 0 bytes .../plugins/theme_suv/data/autorange_hi.png | Bin 503 -> 239 bytes .../plugins/theme_suv/data/autorange_top.png | Bin 158 -> 252 bytes .../plugins/theme_suv/data/autorange_up.png | Bin 152 -> 229 bytes cinelerra-5.1/plugins/timeblur/Makefile | 12 + cinelerra-5.1/plugins/timeblur/timeblur.C | 313 +++++++++++++++ cinelerra-5.1/plugins/timeblur/timeblur.h | 102 +++++ .../plugins/timeblur/timeblurwindow.C | 123 ++++++ .../plugins/timeblur/timeblurwindow.h | 74 ++++ 29 files changed, 870 insertions(+), 630 deletions(-) delete mode 100644 cinelerra-5.1/plugins/theme_suv/data/autorange_hi..png create mode 100644 cinelerra-5.1/plugins/timeblur/Makefile create mode 100644 cinelerra-5.1/plugins/timeblur/timeblur.C create mode 100644 cinelerra-5.1/plugins/timeblur/timeblur.h create mode 100644 cinelerra-5.1/plugins/timeblur/timeblurwindow.C create mode 100644 cinelerra-5.1/plugins/timeblur/timeblurwindow.h diff --git a/cinelerra-5.1/cinelerra/convert.C b/cinelerra-5.1/cinelerra/convert.C index c6ecb043..45fff292 100644 --- a/cinelerra-5.1/cinelerra/convert.C +++ b/cinelerra-5.1/cinelerra/convert.C @@ -71,10 +71,19 @@ ConvertRender::ConvertRender(MWindow *mwindow) result = 0; beep = 0; to_proxy = 0; + renderer = 0; } ConvertRender::~ConvertRender() { + if( running() ) { + canceled = 1; + if( renderer ) + renderer->set_result(1); + cancel(); + join(); + } + delete renderer; delete [] suffix; delete progress; delete counter_lock; @@ -515,19 +524,20 @@ void ConvertRender::create_copy(int i) Asset *needed_copy = needed_copies[i]; EDL *edl = convert_edl(mwindow->edl, orig_idxbl); double length = get_length(orig_idxbl); - ConvertPackageRenderer renderer(this); - renderer.initialize(mwindow, edl, mwindow->preferences, needed_copy); + renderer = new ConvertPackageRenderer(this); + renderer->initialize(mwindow, edl, mwindow->preferences, needed_copy); PackageDispatcher dispatcher; dispatcher.create_packages(mwindow, edl, mwindow->preferences, SINGLE_PASS, needed_copy, 0, length, 0); RenderPackage *package = dispatcher.get_package(0); - if( !renderer.render_package(package) ) { + if( !renderer->render_package(package) ) { Asset *asset = mwindow->edl->assets->update(needed_copy); mwindow->mainindexes->add_indexable(asset); mwindow->mainindexes->start_build(); } else failed = 1; + delete renderer; renderer = 0; edl->remove_user(); } diff --git a/cinelerra-5.1/cinelerra/convert.h b/cinelerra-5.1/cinelerra/convert.h index dde071d4..41c125c9 100644 --- a/cinelerra-5.1/cinelerra/convert.h +++ b/cinelerra-5.1/cinelerra/convert.h @@ -74,6 +74,7 @@ public: MainProgressBar *progress; ConvertProgress *convert_progress; Timer *progress_timer; + ConvertPackageRenderer *renderer; Mutex *counter_lock; int total_rendered, remove_originals; @@ -151,7 +152,7 @@ class ConvertPackageRenderer : public PackageRenderer { public: ConvertPackageRenderer(ConvertRender *render); - ~ConvertPackageRenderer(); + virtual ~ConvertPackageRenderer(); int get_master(); int get_result(); diff --git a/cinelerra-5.1/cinelerra/recordgui.C b/cinelerra-5.1/cinelerra/recordgui.C index c2fbe0ec..d425dbce 100644 --- a/cinelerra-5.1/cinelerra/recordgui.C +++ b/cinelerra-5.1/cinelerra/recordgui.C @@ -809,6 +809,16 @@ int RecordGUIMonitorVideo::handle_event() lock_window("RecordGUIMonitorVideo::handle_event"); record->video_window_open = 1; } + else { + unlock_window(); + BC_Window *window = record->record_monitor->window; + window->lock_window("RecordGUIMonitorVideo::handle_event"); + window->hide_window(); + window->flush(); + window->unlock_window(); + lock_window("RecordGUIMonitorVideo::handle_event"); + record->video_window_open = 0; + } return 1; } diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index ce7ecadc..e2a2f7f6 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -237,23 +237,18 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, // Make positions based on requested frame rate. int64_t position = Units::to_int64((double)pos * frame_rate / edl_rate); - int64_t max_position; + int64_t video_length; int asset_w, asset_h; if( file ) { asset_w = current_edit->asset->width; asset_h = current_edit->asset->height; - max_position = Units::to_int64((double)file->get_video_length() * - frame_rate / current_edit->asset->frame_rate - 1); + video_length = file->get_video_length(); } else { asset_w = nested_edl->session->output_w; asset_h = nested_edl->session->output_h; - max_position = Units::to_int64(nested_edl->tracks->total_length() * - frame_rate - 1); + video_length = nested_edl->tracks->total_length(); } - if( max_position < 0 ) max_position = 0; -// if we hit the end of stream, freeze at last frame - CLAMP(position, 0, max_position); VFrame *&input = commonrender ? ((VRender*)commonrender)->input_temp : // Realtime playback @@ -302,6 +297,10 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, curr_pos += current_edit->startsource; int64_t norm_pos = Units::to_int64((double)curr_pos * current_edit->asset->frame_rate / edl_rate); + if( norm_pos < 0 || video_length < 0 ) + norm_pos = 0; + else if( norm_pos >= video_length ) + norm_pos = video_length-1; if( first_frame ) { if( file->get_cache_frame(input, norm_pos) ) break; // if inside a cache run @@ -318,6 +317,10 @@ int VModule::import_frame(VFrame *output, VEdit *current_edit, int64_t normalized_position = Units::to_int64((double)position * current_edit->asset->frame_rate / frame_rate); + if( normalized_position < 0 || video_length < 0 ) + normalized_position = 0; + else if( normalized_position >= video_length ) + normalized_position = video_length-1; //printf("VModule::import_frame %d %lld %lld\n", __LINE__, position, normalized_position); file->set_layer(current_edit->channel); file->set_video_position(normalized_position, 0); diff --git a/cinelerra-5.1/guicast/vicon.C b/cinelerra-5.1/guicast/vicon.C index 9d6b94e0..84c675ef 100644 --- a/cinelerra-5.1/guicast/vicon.C +++ b/cinelerra-5.1/guicast/vicon.C @@ -279,9 +279,10 @@ update_view(int do_audio) { if( viewing ) viewing->stop_audio(); delete view_win; view_win = 0; - if( (viewing=vicon) != 0 ) { + VFrame *vfrm; + if( (viewing=vicon) != 0 && (vfrm=viewing->frame()) != 0 ) { view_win = new_view_window(0); - view_win->draw_vframe(viewing->frame()); + view_win->draw_vframe(vfrm); view_win->flash(0); view_win->show_window(); if( do_audio ) vicon->start_audio(); @@ -292,14 +293,15 @@ update_view(int do_audio) int VIconThread::zoom_scale(int dir) { - if( !viewing || !view_win ) return 0; + VFrame *vfrm; + if( !viewing || !view_win || !(vfrm=viewing->frame()) ) return 0; int view_h = this->view_h; view_h += dir*view_h/10 + dir; bclamp(view_h, 16,512); this->view_h = view_h; this->view_w = view_h * vw/vh; new_view_window(view_win); - view_win->draw_vframe(viewing->frame()); + view_win->draw_vframe(vfrm); view_win->flash(1); return 1; } @@ -328,13 +330,14 @@ draw(VIcon *vicon) int draw_img = visible(vicon, x, y); int draw_win = view_win && viewing == vicon ? 1 : 0; if( !draw_img && !draw_win ) return 0; - if( !vicon->frame() ) return 0; + VFrame *vfrm = vicon->frame(); + if( !vfrm ) return 0; if( draw_img ) { vicon->draw_vframe(this, wdw, x, y); img_dirty = 1; } if( draw_win ) { - view_win->draw_vframe(vicon->frame()); + view_win->draw_vframe(vfrm); win_dirty = 1; } return 1; diff --git a/cinelerra-5.1/plugin_defs b/cinelerra-5.1/plugin_defs index 9376d5db..137c49f4 100644 --- a/cinelerra-5.1/plugin_defs +++ b/cinelerra-5.1/plugin_defs @@ -112,6 +112,7 @@ video := \ swapframes \ threshold \ timeavg \ + timeblur \ timefront \ titler \ tracer \ diff --git a/cinelerra-5.1/plugins/Makefile b/cinelerra-5.1/plugins/Makefile index 178e0ef2..39230250 100644 --- a/cinelerra-5.1/plugins/Makefile +++ b/cinelerra-5.1/plugins/Makefile @@ -140,6 +140,7 @@ DIRS = $(OPENCV_OBJS) \ synthesizer \ threshold \ timeavg \ + timeblur \ timefront \ timestretch \ timestretchrt \ diff --git a/cinelerra-5.1/plugins/histogram/histogram.C b/cinelerra-5.1/plugins/histogram/histogram.C index a2cf0c98..c78c3c7c 100644 --- a/cinelerra-5.1/plugins/histogram/histogram.C +++ b/cinelerra-5.1/plugins/histogram/histogram.C @@ -62,23 +62,24 @@ HistogramMain::HistogramMain(PluginServer *server) : PluginVClient(server) { engine = 0; - stripe_engine = 0; for( int i=0; iwindow)->lock_window("HistogramMain::render_gui 1"); - tabulate_curve(HISTOGRAM_RED, 0); - tabulate_curve(HISTOGRAM_GREEN, 0); - tabulate_curve(HISTOGRAM_BLUE, 0); - tabulate_curve(preview_lookup, HISTOGRAM_RED, 0x10000, 0); - tabulate_curve(preview_lookup, HISTOGRAM_GREEN, 0x10000, 0); - tabulate_curve(preview_lookup, HISTOGRAM_BLUE, 0x10000, 0); - ((HistogramWindow*)thread->window)->unlock_window(); - } - - calculate_histogram(input, !config.automatic); - - if( config.automatic ) { - calculate_automatic(input); -// Generate curves for value histogram -// Lock out changes to curves - ((HistogramWindow*)thread->window)->lock_window("HistogramMain::render_gui 1"); - tabulate_curve(HISTOGRAM_RED, 0); - tabulate_curve(HISTOGRAM_GREEN, 0); - tabulate_curve(HISTOGRAM_BLUE, 0); - tabulate_curve(preview_lookup, HISTOGRAM_RED, 0x10000, 0); - tabulate_curve(preview_lookup, HISTOGRAM_GREEN, 0x10000, 0); - tabulate_curve(preview_lookup, HISTOGRAM_BLUE, 0x10000, 0); - ((HistogramWindow*)thread->window)->unlock_window(); -// Need a second pass to get the luminance values. - calculate_histogram(input, 1); - } - - ((HistogramWindow*)thread->window)->lock_window("HistogramMain::render_gui 2"); -// Always draw the histogram but don't update widgets if automatic - ((HistogramWindow*)thread->window)->update(1, - config.automatic && mode != HISTOGRAM_VALUE, - config.automatic && mode != HISTOGRAM_VALUE, - 0); - - ((HistogramWindow*)thread->window)->unlock_window(); + if( !thread ) return; + HistogramWindow *window = (HistogramWindow*)thread->window; + HistogramMain *plugin = (HistogramMain*)data; +//update gui client instance, needed for drawing + for( int i=0; iconfig.low_input[i]; + config.high_input[i] = plugin->config.high_input[i]; + memcpy(accum[i], plugin->accum[i], HISTOGRAM_SLOTS*sizeof(*accum)); } + window->lock_window("HistogramMain::render_gui 2"); +// draw all if reconfigure + int reconfig = plugin->need_reconfigure; +// Always draw the histogram but don't update widgets if automatic + int auto_rgb = reconfig ? 1 : config.automatic && mode != HISTOGRAM_VALUE ? 1 : 0; + window->update(1, auto_rgb, auto_rgb, reconfig); + window->unlock_window(); } void HistogramMain::update_gui() @@ -166,7 +137,6 @@ void HistogramMain::update_gui() void HistogramMain::save_data(KeyFrame *keyframe) { FileXML output; - // cause data to be stored directly in text output.set_shared_output(keyframe->xbuf); output.tag.set_title("HISTOGRAM"); @@ -176,8 +146,8 @@ void HistogramMain::save_data(KeyFrame *keyframe) output.tag.set_property("AUTOMATIC", config.automatic); output.tag.set_property("THRESHOLD", config.threshold); output.tag.set_property("PLOT", config.plot); + output.tag.set_property("SUM_FRAMES", config.sum_frames); 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); @@ -216,8 +186,8 @@ void HistogramMain::read_data(KeyFrame *keyframe) config.automatic = input.tag.get_property("AUTOMATIC", config.automatic); config.threshold = input.tag.get_property("THRESHOLD", config.threshold); config.plot = input.tag.get_property("PLOT", config.plot); + config.sum_frames = input.tag.get_property("SUM_FRAMES", config.sum_frames); 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() ) { @@ -289,21 +259,22 @@ void HistogramMain::calculate_histogram(VFrame *data, int do_value) if( cpus > smps ) cpus = smps; engine = new HistogramEngine(this, cpus, cpus); } - if( !accum[0] ) { - for( int i=0; iprocess_packages(HistogramEngine::HISTOGRAM, data, do_value); + int k = 0; HistogramUnit *unit = (HistogramUnit*)engine->get_client(0); - for( int i=0; iaccum[i], sizeof(int)*HISTOGRAM_SLOTS); + if( !sum_frames ) { + frames = 0; + for( int i=0; iaccum[i], sizeof(int64_t)*HISTOGRAM_SLOTS); + k = 1; + } - for( int i=1,n=engine->get_total_clients(); iget_total_clients(); iget_client(i); for( int j=0; jaccum[j], *out = accum[j]; + int64_t *in = unit->accum[j], *out = accum[j]; for( int k=HISTOGRAM_SLOTS; --k>=0; ) *out++ += *in++; } } @@ -314,6 +285,7 @@ void HistogramMain::calculate_histogram(VFrame *data, int do_value) accum[i][0] = 0; accum[i][HISTOGRAM_SLOTS - 1] = 0; } + ++frames; } @@ -324,14 +296,16 @@ void HistogramMain::calculate_automatic(VFrame *data) // Do each channel for( int i=0; i<3; ++i ) { - int *accum = this->accum[i]; - int pixels = data->get_w() * data->get_h(); + int64_t *accum = this->accum[i]; + int64_t sz = data->get_w() * data->get_h(); + int64_t pixels = sz * frames; float white_fraction = 1.0 - (1.0 - config.threshold) / 2; int threshold = (int)(white_fraction * pixels); float min_level = 0.0, max_level = 1.0; // Get histogram slot above threshold of pixels - for( int j=0, total=0; j= threshold ) { max_level = (float)j / HISTOGRAM_SLOTS * FLOAT_RANGE + HIST_MIN_INPUT; @@ -339,8 +313,9 @@ void HistogramMain::calculate_automatic(VFrame *data) } } -// Get slot below 99% of pixels - for( int j=HISTOGRAM_SLOTS, total=0; --j> 0; ) { +// Get histogram slot below threshold of pixels + total = 0; + for( int j=HISTOGRAM_SLOTS; --j> 0; ) { total += accum[j]; if( total >= threshold ) { min_level = (float)j / HISTOGRAM_SLOTS * FLOAT_RANGE + HIST_MIN_INPUT; @@ -368,100 +343,34 @@ int HistogramMain::process_buffer(VFrame *frame, int64_t start_position, double frame_rate) { - int need_reconfigure = load_configuration(); + need_reconfigure = load_configuration(); int use_opengl = calculate_use_opengl(); - + sum_frames = last_position == start_position ? config.sum_frames : 0; + last_position = get_direction() == PLAY_FORWARD ? + start_position+1 : start_position-1; this->input = frame; this->output = frame; int cpus = input->get_w() * input->get_h() / 0x80000 + 2; int smps = get_project_smp(); if( cpus > smps ) cpus = smps; - if( !engine ) { + if( !engine ) engine = new HistogramEngine(this, cpus, cpus); + read_frame(frame, 0, start_position, frame_rate, use_opengl); + if( config.automatic ) + calculate_automatic(frame); + if( config.plot ) { +// Generate curves for value histogram + tabulate_curve(lookup, 0); + tabulate_curve(preview_lookup, 0, 0x10000); +// Need to get the luminance values. + calculate_histogram(input, 1); + send_render_gui(this); } - 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; iprocess_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); - -// Generate tables here. The same table is used by many packages to render -// each horizontal stripe. Need to cover the entire output range in each -// table to avoid green borders - - - if( need_reconfigure || !lookup[0] || config.automatic ) { + if( need_reconfigure || config.automatic || config.plot ) { // Calculate new curves - if( config.automatic ) - calculate_automatic(input); // Generate transfer tables with value function for integer colormodels. - for( int i=0; i<3; ++i ) - tabulate_curve(i, 1); + tabulate_curve(lookup, 1); } // Apply histogram in hardware @@ -473,24 +382,26 @@ int HistogramMain::process_buffer(VFrame *frame, return 0; } -void HistogramMain::tabulate_curve(int **table, int idx, int len, int use_value) +void HistogramMain::tabulate_curve(int **table, int idx, int use_value, int len) { - if( !table[idx] ) // must use max demand here - table[idx] = new int[0x10000]; - int *curve = table[idx], len1 = len-1; + int len1 = len - 1; + int *curve = table[idx]; for( int i=0; iget_color_model(); - int lookup_len = color_model == BC_RGB888 || - color_model == BC_RGBA8888 ? 0x100 : 0x10000; - tabulate_curve(lookup, idx, lookup_len, use_value); + if( len < 0 ) { + int color_model = input->get_color_model(); + len = color_model == BC_RGB888 || color_model == BC_RGBA8888 ? + 0x100 : 0x10000; + } + for( int i=0; i<3; ++i ) + tabulate_curve(table, i, use_value, len); } int HistogramMain::handle_opengl() @@ -750,121 +661,6 @@ int HistogramMain::handle_opengl() } -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; iyplugin = plugin; -} -void HistStripeEngine::init_packages() -{ - int ih = plugin->input->get_h(), iy0 = 0; - for( int i=0,n=get_total_packages(); iy0 = 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(); -} - - - HistogramPackage::HistogramPackage() : LoadPackage() { @@ -877,7 +673,7 @@ HistogramUnit::HistogramUnit(HistogramEngine *server, this->plugin = plugin; this->server = server; for(int i = 0; i < HISTOGRAM_MODES; i++) - accum[i] = new int[HISTOGRAM_SLOTS]; + accum[i] = new int64_t[HISTOGRAM_SLOTS]; } HistogramUnit::~HistogramUnit() @@ -908,7 +704,7 @@ void HistogramUnit::process_package(LoadPackage *package) b_out = preview_b[bclip(b, 0, 0xffff)]; \ /* v = (r * 76 + g * 150 + b * 29) >> 8; */ \ /* Value takes the maximum of the output RGB values */ \ - v = MAX(r_out, g_out); v = MAX(v, b_out); \ + int v = MAX(r_out, g_out); v = MAX(v, b_out); \ ++accum_v[bclip(v -= hmin, 0, slots1)]; \ } \ \ @@ -923,10 +719,10 @@ void HistogramUnit::process_package(LoadPackage *package) VFrame *data = server->data; int w = data->get_w(); //int h = data->get_h(); - int *accum_r = accum[HISTOGRAM_RED]; - int *accum_g = accum[HISTOGRAM_GREEN]; - int *accum_b = accum[HISTOGRAM_BLUE]; - int *accum_v = accum[HISTOGRAM_VALUE]; + int64_t *accum_r = accum[HISTOGRAM_RED]; + int64_t *accum_g = accum[HISTOGRAM_GREEN]; + int64_t *accum_b = accum[HISTOGRAM_BLUE]; + int64_t *accum_v = accum[HISTOGRAM_VALUE]; int32_t r, g, b, y, u, v; int r_out, g_out, b_out; int *preview_r = plugin->preview_lookup[HISTOGRAM_RED]; @@ -1159,7 +955,7 @@ void HistogramEngine::init_packages() for( int i=0,n=get_total_clients(); iaccum[j], sizeof(int) * HISTOGRAM_SLOTS); + bzero(unit->accum[j], sizeof(int64_t) * HISTOGRAM_SLOTS); } } diff --git a/cinelerra-5.1/plugins/histogram/histogram.h b/cinelerra-5.1/plugins/histogram/histogram.h index 00512438..b26fafab 100644 --- a/cinelerra-5.1/plugins/histogram/histogram.h +++ b/cinelerra-5.1/plugins/histogram/histogram.h @@ -45,6 +45,7 @@ public: void read_data(KeyFrame *keyframe); void update_gui(); void render_gui(void *data); + void do_render_gui(HistogramWindow *gui); int calculate_use_opengl(); int handle_opengl(); @@ -60,18 +61,18 @@ public: // Value is only calculated for preview. void calculate_histogram(VFrame *data, int do_value); // Calculate the linear, smoothed, lookup curves - void tabulate_curve(int **table, int idx, int len, int use_value); - void tabulate_curve(int idx, int use_value); + void tabulate_curve(int **table, int idx, int use_value, int len); + void tabulate_curve(int **table, int use_value, int len=-1); VFrame *input, *output; HistogramEngine *engine; - HistStripeEngine *stripe_engine; + int need_reconfigure; int *lookup[HISTOGRAM_MODES]; // No value applied to this int *preview_lookup[HISTOGRAM_MODES]; - int *accum[HISTOGRAM_MODES]; + int64_t *accum[HISTOGRAM_MODES]; // Input point being dragged or edited int current_point; // Current channel being viewed @@ -81,39 +82,8 @@ public: 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; + int sum_frames, frames; }; @@ -132,7 +102,7 @@ public: void process_package(LoadPackage *package); HistogramEngine *server; HistogramMain *plugin; - int *accum[5]; + int64_t *accum[HISTOGRAM_MODES]; }; class HistogramEngine : public LoadServer diff --git a/cinelerra-5.1/plugins/histogram/histogram.inc b/cinelerra-5.1/plugins/histogram/histogram.inc index 0608165d..38d47aab 100644 --- a/cinelerra-5.1/plugins/histogram/histogram.inc +++ b/cinelerra-5.1/plugins/histogram/histogram.inc @@ -22,16 +22,12 @@ #ifndef HISTOGRAM_INC #define HISTOGRAM_INC - - - - // modes -#define HISTOGRAM_MODES 4 #define HISTOGRAM_RED 0 #define HISTOGRAM_GREEN 1 #define HISTOGRAM_BLUE 2 #define HISTOGRAM_VALUE 3 +#define HISTOGRAM_MODES 4 // Number of divisions in histogram. // 65536 + min and max range to speed up the tabulation @@ -55,10 +51,6 @@ class HistogramMain; -class HistStripePackage; -class HistStripeUnit; -class HistStripeEngine; - class HistogramPackage; class HistogramUnit; class HistogramEngine; diff --git a/cinelerra-5.1/plugins/histogram/histogramconfig.C b/cinelerra-5.1/plugins/histogram/histogramconfig.C index fc138ba7..20bc6ba3 100644 --- a/cinelerra-5.1/plugins/histogram/histogramconfig.C +++ b/cinelerra-5.1/plugins/histogram/histogramconfig.C @@ -31,7 +31,7 @@ HistogramConfig::HistogramConfig() { plot = 1; split = 0; - + sum_frames = 0; reset(1); } @@ -49,11 +49,9 @@ void HistogramConfig::reset(int do_mode) if(do_mode) { automatic = 0; - automatic_v = 0; - threshold = 1.0; + threshold = 0.97; } - frames = 0; log_slider = .5; } @@ -84,34 +82,31 @@ void HistogramConfig::boundaries() } CLAMP(threshold, 0, 1); CLAMP(log_slider, 0, 1); - CLAMP(frames, 0, 65535); } int HistogramConfig::equivalent(HistogramConfig &that) { // EQUIV isn't precise enough to detect changes in points - for(int i = 0; i < HISTOGRAM_MODES; i++) - { + for(int i = 0; i < HISTOGRAM_MODES; i++) { // if(!EQUIV(low_input[i], that.low_input[i]) || // !EQUIV(high_input[i], that.high_input[i]) || // !EQUIV(gamma[i], that.gamma[i]) || // !EQUIV(low_output[i], that.low_output[i]) || // !EQUIV(high_output[i], that.high_output[i])) return 0; - if(low_input[i] != that.low_input[i] || - high_input[i] != that.high_input[i] || - gamma[i] != that.gamma[i] || - low_output[i] != that.low_output[i] || - high_output[i] != that.high_output[i]) return 0; + if( low_input[i] != that.low_input[i] || + high_input[i] != that.high_input[i] || + gamma[i] != that.gamma[i] || + low_output[i] != that.low_output[i] || + high_output[i] != that.high_output[i] ) return 0; } - if(automatic != that.automatic || - automatic_v != that.automatic_v || - threshold != that.threshold) return 0; + if( automatic != that.automatic || + threshold != that.threshold ) return 0; - if(plot != that.plot || - split != that.split || - frames != that.frames || - log_slider != that.log_slider ) return 0; + if( plot != that.plot || + split != that.split || + sum_frames != that.sum_frames || + log_slider != that.log_slider ) return 0; return 1; } @@ -128,25 +123,20 @@ void HistogramConfig::copy_from(HistogramConfig &that) } automatic = that.automatic; - automatic_v = that.automatic_v; threshold = that.threshold; plot = that.plot; split = that.split; - frames = that.frames; + sum_frames = that.sum_frames; log_slider = that.log_slider; } -void HistogramConfig::interpolate(HistogramConfig &prev, - HistogramConfig &next, - int64_t prev_frame, - int64_t next_frame, - int64_t current_frame) +void HistogramConfig::interpolate(HistogramConfig &prev, HistogramConfig &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); double prev_scale = 1.0 - next_scale; - for(int i = 0; i < HISTOGRAM_MODES; i++) - { + for( int i=0; icreate_objects(); y += automatic->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)); + add_subwindow(plot= new HistogramPlot(plugin, x, y)); + add_subwindow(sum_frames = new HistogramSumFrames(plugin, x2, y)); y += plot->get_h() + margin; x = x1; @@ -284,19 +280,14 @@ int HistogramWindow::resize_event(int w, int h) threshold->get_y() + ydiff); plot->reposition_window(plot->get_x(), plot->get_y() + ydiff); + sum_frames->reposition_window(sum_frames->get_x(), + sum_frames->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); plugin->w = w; @@ -342,34 +333,28 @@ int HistogramWindow::keypress_event() return result; } -void HistogramWindow::update(int do_canvases, - int do_carrots, - int do_text, - int do_toggles) +void HistogramWindow::update(int do_canvases, int do_carrots, int do_text, int do_toggles) { - if(do_toggles) - { + if(do_toggles) { automatic->update(plugin->config.automatic); mode_v->update(plugin->mode == HISTOGRAM_VALUE ? 1 : 0); mode_r->update(plugin->mode == HISTOGRAM_RED ? 1 : 0); mode_g->update(plugin->mode == HISTOGRAM_GREEN ? 1 : 0); mode_b->update(plugin->mode == HISTOGRAM_BLUE ? 1 : 0); plot->update(plugin->config.plot); + sum_frames->update(plugin->config.sum_frames); 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(); } - if(do_canvases) - { + if(do_canvases) { update_canvas(); } - if(do_carrots) - { + if(do_carrots) { low_input_carrot->update(); high_input_carrot->update(); gamma_carrot->update(); @@ -377,8 +362,7 @@ void HistogramWindow::update(int do_canvases, high_output_carrot->update(); } - if(do_text) - { + if(do_text) { low_input->update(); gamma->update(); high_input->update(); @@ -386,40 +370,45 @@ void HistogramWindow::update(int do_canvases, high_output->update(); threshold->update(); } - - } void HistogramWindow::draw_canvas_mode(int mode, int color, int y, int h) { // Draw histogram - int max = 0, *accum = plugin->accum[mode]; - if( accum ) { - for( int i=0,x=0; xaccum[mode]; + for( int k0=0,x=0; x 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 0 && i1 > i0 ? (double)m : 0; - m = v > 0 ? v*lin_scale + log(v)*log_scale : 0; - + double lin_max = (lin_slider * h) / max; + double log_max = (log_slider * h) / log(max); + for( int k0=0,x=0; x 0 ? (double)m : 0; + m = vv > 0 ? vv*lin_max + log(vv)*log_max : 0; canvas->set_color(BLACK); - canvas->draw_line(x, y, x, y+h - m); + int y0 = y1 - m; + canvas->draw_line(x, y, x, y0); canvas->set_color(color); - canvas->draw_line(x, y+h - m, x, y+h); + canvas->draw_line(x, y0, x, y1); + k0 = k1; } } else { @@ -463,28 +452,16 @@ void HistogramWindow::update_canvas() // Draw 0 and 100% lines. canvas->set_color(RED); int x = (int)(canvas_w * -HIST_MIN_INPUT / FLOAT_RANGE); - canvas->draw_line(x, - 0, - x, - canvas_h); + canvas->draw_line(x, 0, x, canvas_h); x = (int)(canvas_w * (1.0 - HIST_MIN_INPUT) / FLOAT_RANGE); - canvas->draw_line(x, - 0, - x, - canvas_h); + canvas->draw_line(x, 0, x, canvas_h); canvas->flash(); } - - -HistogramParade::HistogramParade(HistogramMain *plugin, - HistogramWindow *gui, - int x, - int y, - int value) - : BC_Toggle(x, - y, +HistogramParade::HistogramParade(HistogramMain *plugin, HistogramWindow *gui, + int x, int y, int value) + : BC_Toggle(x, y, value ? plugin->get_theme()->get_image_set("histogram_rgb_toggle") : plugin->get_theme()->get_image_set("histogram_toggle"), 0) @@ -502,30 +479,13 @@ int HistogramParade::handle_event() { update(1); plugin->parade = value; - gui->update(1, - 0, - 0, - 1); + gui->update(1, 0, 0, 1); return 1; } - - - - - - -HistogramCanvas::HistogramCanvas(HistogramMain *plugin, - HistogramWindow *gui, - int x, - int y, - int w, - int h) - : BC_SubWindow(x, - y, - w, - h, - BLACK) +HistogramCanvas::HistogramCanvas(HistogramMain *plugin, HistogramWindow *gui, + int x, int y, int w, int h) + : BC_SubWindow(x, y, w, h, BLACK) { this->plugin = plugin; this->gui = gui; @@ -573,48 +533,6 @@ int HistogramReset::handle_event() } -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) @@ -782,18 +700,8 @@ int HistogramCarrot::cursor_motion_event() - - - - - -HistogramSlider::HistogramSlider(HistogramMain *plugin, - HistogramWindow *gui, - int x, - int y, - int w, - int h, - int is_input) +HistogramSlider::HistogramSlider(HistogramMain *plugin, HistogramWindow *gui, + int x, int y, int w, int h, int is_input) : BC_SubWindow(x, y, w, h) { this->plugin = plugin; @@ -820,44 +728,30 @@ void HistogramSlider::update() clear_box(0, 0, w, h); - switch(mode) - { - case HISTOGRAM_RED: - g = b = 0x00; - break; - case HISTOGRAM_GREEN: - r = b = 0x00; - break; - case HISTOGRAM_BLUE: - r = g = 0x00; - break; + switch(mode) { + case HISTOGRAM_RED: + g = b = 0x00; + break; + case HISTOGRAM_GREEN: + r = b = 0x00; + break; + case HISTOGRAM_BLUE: + r = g = 0x00; + break; } - for(int i = 0; i < w; i++) - { + for( int i = 0; i < w; i++ ) { int color = (int)(i * 0xff / w); set_color(((r * color / 0xff) << 16) | ((g * color / 0xff) << 8) | (b * color / 0xff)); - draw_line(i, 0, i, h); } - - flash(); } - - - - - - - -HistogramAuto::HistogramAuto(HistogramMain *plugin, - int x, - int y) +HistogramAuto::HistogramAuto(HistogramMain *plugin, int x, int y) : BC_CheckBox(x, y, plugin->config.automatic, _("Automatic")) { this->plugin = plugin; @@ -871,11 +765,7 @@ int HistogramAuto::handle_event() } - - -HistogramPlot::HistogramPlot(HistogramMain *plugin, - int x, - int y) +HistogramPlot::HistogramPlot(HistogramMain *plugin, int x, int y) : BC_CheckBox(x, y, plugin->config.plot, _("Plot histogram")) { this->plugin = plugin; @@ -889,11 +779,21 @@ int HistogramPlot::handle_event() } +HistogramSumFrames::HistogramSumFrames(HistogramMain *plugin, int x, int y) + : BC_CheckBox(x, y, plugin->config.sum_frames, _("Sum frames")) +{ + this->plugin = plugin; +} + +int HistogramSumFrames::handle_event() +{ + plugin->config.sum_frames = get_value(); + plugin->send_configure_change(); + return 1; +} -HistogramSplit::HistogramSplit(HistogramMain *plugin, - int x, - int y) +HistogramSplit::HistogramSplit(HistogramMain *plugin, int x, int y) : BC_CheckBox(x, y, plugin->config.split, _("Split output")) { this->plugin = plugin; @@ -908,10 +808,7 @@ int HistogramSplit::handle_event() HistogramMode::HistogramMode(HistogramMain *plugin, - int x, - int y, - int value, - char *text) + int x, int y, int value, char *text) : BC_Radial(x, y, plugin->mode == value, text) { this->plugin = plugin; @@ -934,27 +831,6 @@ int HistogramMode::handle_event() } -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(80)) diff --git a/cinelerra-5.1/plugins/histogram/histogramwindow.h b/cinelerra-5.1/plugins/histogram/histogramwindow.h index fb2b01e7..44cf8d99 100644 --- a/cinelerra-5.1/plugins/histogram/histogramwindow.h +++ b/cinelerra-5.1/plugins/histogram/histogramwindow.h @@ -33,20 +33,14 @@ class HistogramSlider : public BC_SubWindow { public: - HistogramSlider(HistogramMain *plugin, - HistogramWindow *gui, - int x, - int y, - int w, - int h, - int is_input); + HistogramSlider(HistogramMain *plugin, HistogramWindow *gui, + int x, int y, int w, int h, int is_input); void update(); int input_to_pixel(float input); int operation; - enum - { + enum { NONE, DRAG_INPUT, DRAG_MIN_OUTPUT, @@ -60,11 +54,8 @@ public: class HistogramParade : public BC_Toggle { public: - HistogramParade(HistogramMain *plugin, - HistogramWindow *gui, - int x, - int y, - int value); + HistogramParade(HistogramMain *plugin, HistogramWindow *gui, + int x, int y, int value); int handle_event(); HistogramMain *plugin; HistogramWindow *gui; @@ -108,6 +99,14 @@ public: HistogramMain *plugin; }; +class HistogramSumFrames : public BC_CheckBox +{ +public: + HistogramSumFrames(HistogramMain *plugin, int x, int y); + int handle_event(); + HistogramMain *plugin; +}; + class HistogramSplit : public BC_CheckBox { public: @@ -134,24 +133,6 @@ public: 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: @@ -161,17 +142,6 @@ public: 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 { public: @@ -226,7 +196,6 @@ public: HistogramText *low_input; HistogramText *high_input; HistogramText *gamma; - HistogramFrames *frames; HistogramCanvas *canvas; HistogramCarrot *low_input_carrot; HistogramCarrot *gamma_carrot; @@ -238,8 +207,6 @@ public: 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; @@ -254,6 +221,7 @@ public: int title3_x; int title4_x; HistogramPlot *plot; + HistogramSumFrames *sum_frames; HistogramSplit *split; }; diff --git a/cinelerra-5.1/plugins/histogram/histogramwindow.inc b/cinelerra-5.1/plugins/histogram/histogramwindow.inc index 35cd2f97..8b755c72 100644 --- a/cinelerra-5.1/plugins/histogram/histogramwindow.inc +++ b/cinelerra-5.1/plugins/histogram/histogramwindow.inc @@ -27,12 +27,11 @@ class HistogramParade; class HistogramCarrot; class HistogramAuto; class HistogramPlot; +class HistogramSumFrames; class HistogramSplit; class HistogramMode; class HistogramReset; -class HistogramSelect; class HistogramLogSlider; -class HistogramFrames; class HistogramText; class HistogramCanvas; class HistogramWindow; diff --git a/cinelerra-5.1/plugins/theme_cakewalk/data/autorange_bottom.png b/cinelerra-5.1/plugins/theme_cakewalk/data/autorange_bottom.png index 22787e155529478db6ec317fbd6bbb48989736b3..e26fd9e48154865751b0a14997d9b03c0c6da059 100644 GIT binary patch literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1U@JY5_^ zEP9g@Bv=Cu{CIQn?tc?Q$t(lMn3yU5|G#{^oA=19lP<#7jSLKW44UWL?))tu{^atR zqdFOS2UdA_xy@wsy<4ACqbZr{HbbH|rsthe48t>{9KBY?Upr=mG@M;(U|@0iV}pdx e?xbRo13>qGHPK|{alHbxnZeW5&t;ucLK6T2N>UpD literal 295 zcmV+?0oeYDP)bVvz)F z+1^)O}Q z;yLZj+JnNl8G0`EGU~={4Fr>+=Y02zCUKkC^x&1Vof%D2fU%6};X9*VbF2WnT5@~z z#!2^^wut~P2U!rT03SaFJZ1fGpaJ(j34#`TxU?|n+G2-5w|+`n)crMFp~1l4=zb^A twOOHl-l_LOljSm{RTtYZL`4tFe*l$oS4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1TwJY5_^ zEP9g@Bv=Cu{CIQn?*A;OXk;vd$@?2>=VQQCX zF-yZh6bJDCCBY<3D>iLh9Hih-5sK&{;vl#=I*5aaD1IjgJ9HDjL%~TDx4NiHE#hKA z1Z$d$HaQ1LqQqR2{HNsd`0?Og9$DSqdlnllADoP-D*%9`r~$9e@ApJWY_xoN>v*15 z2yi%wegq!2Q+-2Iq0w1Wq1e@J5U_k;h;39p65rO! z4)$y5sE`K>v!ab~P`4qG31Aj1%yMaj!@8M3g(6s(C6(gHurNi~U$6)kW>Il*GHXI6 zK@4tA4+~*o7Gw|W6(olovUWR$_eb>!5%Z9W7W`eOB1ka0!#h%d`8eQb=*2yE(`#qv@QY= zoZC8P#CY4>Qw7(KmWpvf004nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1U5JzX3_ zEP9g@Bv=Cu{CIQn?*A{0^*i_0GyBz!g}6^k5TWQf0}d`c^}TNLOF22WQ%mvv4FO#tc=Ty6jW literal 299 zcmV+`0o4A9P)KeUqc&BIvA^yql4m797OazoQjCxJNQfm-@(zofs0$V${mE%7_`Sh5Ji&9 z4fo6+KhA~2)%5h@S!hVd7}n%>_sBe*tVzBx+wTg6N|``(ccyYcz!b?R@-#uDG$t$?_lC8w5Dsthw2JVJM3O0vx4p-0m$I zX&nayI2gTiKCa?{iz?&cbsPs=R2g$u{2b9B2Dbinl1YCoXYRKDV7)hN!+L>TSn!jd x>XgSSYsG>=_p#w^62lsy()VMV44J2sHDB00Siir#_I3aO002ovPDHLkV1hg%g_QsR diff --git a/cinelerra-5.1/plugins/theme_cakewalk/data/autorange_up.png b/cinelerra-5.1/plugins/theme_cakewalk/data/autorange_up.png index 45264a67c4dc666e00079a3482adf3abb875a9cf..dd10afd8cb03275dbce93ff3f8ac88eb0e4ee1bc 100644 GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1UjJzX3_ zEP9g@Bv=CuMBKmpd%l{QaCU)ndA>6cGjB{Y3Vfnvlh7jh=grBx|Ig36b5zRRq}Y&q z7xxCuNs|K8jx6Up<{suQFTQv;k9fn%!_R^w7W8*}vi_*Cu(8bg=d#Wzp$P!Hq)mVT literal 413 zcmV;O0b>4%P)X zOG^S#7zW_?bEdLgx(oUPSuNTGA>M`|NesP+q9IH+FEDM zX_I3z&5X{wIy1aHbC`4ZXmiW^3D5#e!oi13QAiNyM2p@)1ZW=MD==?9wKWzY@*XwI*E9`fNd;n0_v_*U<2m)F4IQZZP4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1UDJY5_^ zEPCHgapXFnz{7I=QvXx+O0W8D{@(h}gp_jmH?~?maO6DPptRwI$)vEPcaKglUFG&^ z$Ll*@S&V;td@i|7j}P0^-c;h@BJfP-cDKjp&6YmdKI;Vst04yk14*&oF literal 154 zcmeAS@N?(olHy`uVBq!ia0vp^qChOn!3HGj{oJ~NRHCPgV~EA+r&D%|HW=_Qi|RhT zYSXm6O>V)~pbY!D;PlaDgTz{}4 z!-`j1zetp{F8>+2@whQ}m_-=(%sE$+(oX*RUcZYuYn>YFtt`noK+70BUHx3vIVCg! E0MYe0q5uE@ diff --git a/cinelerra-5.1/plugins/theme_suv/data/autorange_hi..png b/cinelerra-5.1/plugins/theme_suv/data/autorange_hi..png deleted file mode 100644 index fe59edba7fd85e76a2e658b5783e39fd2a25dc79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 503 zcmVckB1x% z2agRALZavL-ba5E{~L@D0!nEFd+*_#OTb%jz64TAK`8}e43tuEo}O!rfpZSlS~%z8 zA)C+uWQ>7x4k1MJJW{Q7v@r$%R$#h>a?T;8M4so^?RHQ~p{{Gxb&aa3&@>J5JcpDL zobx0-2{h!7F$N(7vMfVU6gZtu01%=3{T=|IltPwe5JG@4wtCP6N-2d90#ZsGkH@&E zs;cN9r4)n^G15)wJeMKDpt3AcmL-a!NXDC{0p~nMyUJ;RE2UN?BBhL8>TWH>y<3(`yPGYV;F{H{P}#s7z1nVy7{P diff --git a/cinelerra-5.1/plugins/theme_suv/data/autorange_hi.png b/cinelerra-5.1/plugins/theme_suv/data/autorange_hi.png index fe59edba7fd85e76a2e658b5783e39fd2a25dc79..efd513d3d5386212713a423a1e499b3e0e2b1fb3 100644 GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1TYJY5_^ zEPCHg3FK-}5Mf#VLE&CXzuvtgv#($EL#M<-4AQd7t|S?Y;L_~d7ge$RNFT$6VGc+5GIOUHj`EtRh;KE7VW e+ckB1x% z2agRALZavL-ba5E{~L@D0!nEFd+*_#OTb%jz64TAK`8}e43tuEo}O!rfpZSlS~%z8 zA)C+uWQ>7x4k1MJJW{Q7v@r$%R$#h>a?T;8M4so^?RHQ~p{{Gxb&aa3&@>J5JcpDL zobx0-2{h!7F$N(7vMfVU6gZtu01%=3{T=|IltPwe5JG@4wtCP6N-2d90#ZsGkH@&E zs;cN9r4)n^G15)wJeMKDpt3AcmL-a!NXDC{0p~nMyUJ;RE2UN?BBhL8>TWH>y<3(`yPGYV;F{H{P}#s7z1nVy7{P diff --git a/cinelerra-5.1/plugins/theme_suv/data/autorange_top.png b/cinelerra-5.1/plugins/theme_suv/data/autorange_top.png index cbb034d9b0efd361e02e79e716d37544b866ea1e..00f119860b6fc67eabbd22e0131d7989e127f4e0 100644 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fEX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1SlJzX3_ zEPCHgImp|fAiyH-%q>zfHB&R-q}Y?_{l5fFSzH${=sfpcZ~9pqGxk3|8k3y+5_lPu z76rAd%)YmC*Jd-xERT@ucOTX0+?ZhSgTe~DWM4fHd9(o literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^qChOn!3HGj{oJ~NRH~#tb&a1wsr#<;Nd*Q5`fnw~Z+I|R_C|z@^R)}WEYUh!Ve5}*|hHrjJMe!8t zznrh$eOl`N;PelziY4sYAteF4K5~+e*C<>OoO$(1{r}5sje2UVsSWc^0WD4nJ z@ErkR#;MwT(m+AU64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq=1T&JY5_^ zEP9g@Bv=Cu+_-Sz!+bS0;p_rt5rJ$qVb^tsnB8U^{Qdp?|NZs<>(&&y7>jRSu$y7F zlDoURTg|J4nv~Kng@(IM7ckDS%F%0O{Iz37NW=N|W@B0Yj)PmY&D7FdmHU>{uKbLh*2~7Z8gG%lI literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^qChOn!3HGj{oJ~NRJ^B)V~EA+w^zLR7zB7&0-go! zjq1M;y;*H#-3GzCp6T;iT~rr^@$sK(t>h4$_|&o|tASOStLoc{hA_U!f~m*(R(xff zGBfzaoo3OFrdQ6DiMs6>2RFMf%ZQEmf4#iMYF?nq+yhE${{yXJ@O1TaS?83{1OUrO BHlP3i diff --git a/cinelerra-5.1/plugins/timeblur/Makefile b/cinelerra-5.1/plugins/timeblur/Makefile new file mode 100644 index 00000000..0e203e9a --- /dev/null +++ b/cinelerra-5.1/plugins/timeblur/Makefile @@ -0,0 +1,12 @@ +include ../../plugin_defs + +OBJS = \ + $(OBJDIR)/timeblur.o \ + $(OBJDIR)/timeblurwindow.o + +PLUGIN = timeblur + +include ../../plugin_config + +$(OBJDIR)/timeblur.o: timeblur.C +$(OBJDIR)/timeblurwindow.o: timeblurwindow.C diff --git a/cinelerra-5.1/plugins/timeblur/timeblur.C b/cinelerra-5.1/plugins/timeblur/timeblur.C new file mode 100644 index 00000000..9306fe8d --- /dev/null +++ b/cinelerra-5.1/plugins/timeblur/timeblur.C @@ -0,0 +1,313 @@ + +/* + * CINELERRA + * Copyright (C) 2008-2012 Adam Williams + * + * 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 +#include +#include +#include + +#include "bcprogressbox.h" +#include "edl.h" +#include "filexml.h" +#include "language.h" +#include "loadbalance.h" +#include "localsession.h" +#include "mainsession.h" +#include "mwindow.h" +#include "pluginserver.h" +#include "timeblur.h" +#include "timeblurwindow.h" +#include "vframe.h" + +REGISTER_PLUGIN(TimeBlurMain) + + +TimeBlurConfig::TimeBlurConfig() +{ + frames = 0; +} + +int TimeBlurConfig::equivalent(TimeBlurConfig &that) +{ + return frames != that.frames ? 0 : 1; +} + +void TimeBlurConfig::copy_from(TimeBlurConfig &that) +{ + frames = that.frames; +} + +void TimeBlurConfig::interpolate(TimeBlurConfig &prev, TimeBlurConfig &next, + int64_t prev_frame, int64_t next_frame, int64_t current_frame) +{ + frames = prev.frames; +} + + +TimeBlurMain::TimeBlurMain(PluginServer *server) + : PluginVClient(server) +{ + stripe_engine = 0; + input = 0; + fframe = 0; + last_frames = 0; + last_position = -1; +} + +TimeBlurMain::~TimeBlurMain() +{ + + delete stripe_engine; + delete fframe; +} + +const char* TimeBlurMain::plugin_title() { return N_("TimeBlur"); } +int TimeBlurMain::is_realtime() { return 1; } + + + +NEW_WINDOW_MACRO(TimeBlurMain, TimeBlurWindow) + +LOAD_CONFIGURATION_MACRO(TimeBlurMain, TimeBlurConfig) + + +void TimeBlurMain::save_data(KeyFrame *keyframe) +{ + FileXML output; + +// cause data to be stored directly in text + output.set_shared_output(keyframe->xbuf); + output.tag.set_title("TIMEBLUR"); + + output.tag.set_property("FRAMES", config.frames); + output.append_tag(); + output.tag.set_title("/TIMEBLUR"); + output.append_tag(); + output.append_newline(); + output.terminate_string(); +} + +void TimeBlurMain::read_data(KeyFrame *keyframe) +{ + FileXML input; + + input.set_shared_input(keyframe->xbuf); + + int result = 0; + while( !(result = input.read_tag()) ) { + if( input.tag.title_is("TIMEBLUR") ) { + config.frames = input.tag.get_property("FRAMES", config.frames); + } + } +} + +int TimeBlurMain::process_buffer(VFrame *frame, int64_t start_position, double frame_rate) +{ + load_configuration(); + this->input = frame; + int cpus = input->get_w() * input->get_h() / 0x80000 + 2; + int smps = get_project_smp(); + if( cpus > smps ) cpus = smps; + int frames = config.frames; + int use_opengl = 0; + 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 TimeBlurStripeEngine(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 = _("TimeBlur: scanning\n"); + Timer timer; + for( int i=2; iprocess_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); + return 0; +} + + +TimeBlurStripePackage::TimeBlurStripePackage() + : LoadPackage() +{ +} + +TimeBlurStripeUnit::TimeBlurStripeUnit(TimeBlurStripeEngine *server, TimeBlurMain *plugin) + : LoadClient(server) +{ + this->plugin = plugin; + this->server = server; +} + +void TimeBlurStripeUnit::process_package(LoadPackage *package) +{ + TimeBlurStripePackage *pkg = (TimeBlurStripePackage*)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; iyplugin = plugin; +} +void TimeBlurStripeEngine::init_packages() +{ + int ih = plugin->input->get_h(), iy0 = 0; + for( int i=0,n=get_total_packages(); iy0 = iy0; pkg->y1 = iy1; + iy0 = iy1; + } +} + +LoadClient* TimeBlurStripeEngine::new_client() +{ + return new TimeBlurStripeUnit(this, plugin); +} + +LoadPackage* TimeBlurStripeEngine::new_package() +{ + return new TimeBlurStripePackage(); +} + +void TimeBlurStripeEngine::process_packages(int operation) +{ + this->operation = operation; + LoadServer::process_packages(); +} + diff --git a/cinelerra-5.1/plugins/timeblur/timeblur.h b/cinelerra-5.1/plugins/timeblur/timeblur.h new file mode 100644 index 00000000..f2204a12 --- /dev/null +++ b/cinelerra-5.1/plugins/timeblur/timeblur.h @@ -0,0 +1,102 @@ + +/* + * CINELERRA + * Copyright (C) 1997-2011 Adam Williams + * + * 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 + * + */ + +#ifndef TIMEBLUR_H +#define TIMEBLUR_H + +#include "loadbalance.h" +#include "pluginvclient.h" +#include "linklist.h" +#include + +class TimeBlurConfig; +class TimeBlurMain; +class TimeBlurStripePackage; +class TimeBlurStripeUnit; +class TimeBlurStripeEngine; + +class TimeBlurConfig +{ +public: + TimeBlurConfig(); + int equivalent(TimeBlurConfig &that); + void copy_from(TimeBlurConfig &that); + void interpolate(TimeBlurConfig &prev, TimeBlurConfig &next, + int64_t prev_frame, int64_t next_frame, int64_t current_frame); + + int frames; +}; + +class TimeBlurMain : public PluginVClient +{ +public: + TimeBlurMain(PluginServer *server); + ~TimeBlurMain(); + + int process_buffer(VFrame *frame, + int64_t start_position, + double frame_rate); + int is_realtime(); + void save_data(KeyFrame *keyframe); + void read_data(KeyFrame *keyframe); + + PLUGIN_CLASS_MEMBERS(TimeBlurConfig) + + VFrame *input; + TimeBlurStripeEngine *stripe_engine; + + int w, h; + VFrame *fframe; + int64_t last_position; + int last_frames; +}; + +enum { ADD_TEMP, ADD_FFRM, ADD_FFRMS, ADD_TEMPS, SUB_TEMPS }; + +class TimeBlurStripePackage : public LoadPackage +{ +public: + TimeBlurStripePackage(); + int y0, y1; +}; + +class TimeBlurStripeUnit : public LoadClient +{ +public: + TimeBlurStripeUnit(TimeBlurStripeEngine *server, TimeBlurMain *plugin); + void process_package(LoadPackage *package); + TimeBlurStripeEngine *server; + TimeBlurMain *plugin; +}; + +class TimeBlurStripeEngine : public LoadServer +{ +public: + TimeBlurStripeEngine(TimeBlurMain *plugin, int total_clients, int total_packages); + void process_packages(int operation); + void init_packages(); + LoadClient *new_client(); + LoadPackage *new_package(); + TimeBlurMain *plugin; + int operation; +}; + +#endif diff --git a/cinelerra-5.1/plugins/timeblur/timeblurwindow.C b/cinelerra-5.1/plugins/timeblur/timeblurwindow.C new file mode 100644 index 00000000..3f447b05 --- /dev/null +++ b/cinelerra-5.1/plugins/timeblur/timeblurwindow.C @@ -0,0 +1,123 @@ + +/* + * CINELERRA + * Copyright (C) 1997-2011 Adam Williams + * + * 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 "bcdisplayinfo.h" +#include "bcsignals.h" +#include "cursors.h" +#include "edl.h" +#include "timeblur.h" +#include "timeblurwindow.h" +#include "language.h" +#include "localsession.h" +#include "mwindow.h" +#include "pluginserver.h" +#include "theme.h" + +#include + + +TimeBlurWindow::TimeBlurWindow(TimeBlurMain *plugin) + : PluginClientWindow(plugin, xS(250), yS(50), xS(250), yS(50), 0) +{ + this->plugin = plugin; +} + +TimeBlurWindow::~TimeBlurWindow() +{ +} + +void TimeBlurWindow::create_objects() +{ + int margin = plugin->get_theme()->widget_border; + int x = margin, y = margin; + int x1 = x; + add_subwindow(select = new TimeBlurSelect(plugin, this, x1, y)); + x1 += select->get_w() + margin; + frames = new TimeBlurFrames(plugin, this, x1, y); + frames->create_objects(); + x1 += frames->get_w() + 3*margin; + add_subwindow(clear_frames = new TimeBlurClearFrames(plugin, this, x1, y)); + show_window(); +} + + +TimeBlurSelect::TimeBlurSelect(TimeBlurMain *plugin, TimeBlurWindow *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 TimeBlurSelect::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; +} + +TimeBlurClearFrames::TimeBlurClearFrames(TimeBlurMain *plugin, TimeBlurWindow *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 TimeBlurClearFrames::handle_event() +{ + plugin->config.frames = 0; + gui->frames->update(0); + plugin->send_configure_change(); + return 1; +} + +TimeBlurFrames::TimeBlurFrames(TimeBlurMain *plugin, TimeBlurWindow *gui, + int x, int y) + : BC_TumbleTextBox(gui, 0, 0, 65535, x, y, xS(80)) +{ + this->plugin = plugin; + this->gui = gui; +} + +int TimeBlurFrames::handle_event() +{ + plugin->config.frames = atoi(get_text()); + plugin->send_configure_change(); + return 1; +} + +void TimeBlurFrames::update(int frames) +{ + BC_TumbleTextBox::update((int64_t)frames); +} + diff --git a/cinelerra-5.1/plugins/timeblur/timeblurwindow.h b/cinelerra-5.1/plugins/timeblur/timeblurwindow.h new file mode 100644 index 00000000..5e88fcda --- /dev/null +++ b/cinelerra-5.1/plugins/timeblur/timeblurwindow.h @@ -0,0 +1,74 @@ + +/* + * CINELERRA + * Copyright (C) 1997-2011 Adam Williams + * + * 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 + * + */ + +#ifndef TIMEBLURWINDOW_H +#define TIMEBLURWINDOW_H + +#include "timeblur.h" + +class TimeBlurSelect; +class TimeBlurClearFrames; +class TimeBlurFrames; +class TimeBlurWindow; + +class TimeBlurSelect : public BC_GenericButton +{ +public: + TimeBlurSelect(TimeBlurMain *plugin, TimeBlurWindow *gui, int x, int y); + int handle_event(); + TimeBlurMain *plugin; + TimeBlurWindow *gui; +}; + +class TimeBlurClearFrames : public BC_Button +{ +public: + TimeBlurClearFrames(TimeBlurMain *plugin, TimeBlurWindow *gui, int x, int y); + int handle_event(); + TimeBlurMain *plugin; + TimeBlurWindow *gui; +}; + +class TimeBlurFrames : public BC_TumbleTextBox +{ +public: + TimeBlurFrames(TimeBlurMain *plugin, TimeBlurWindow *gui, int x, int y); + int handle_event(); + void update(int frames); + + TimeBlurMain *plugin; + TimeBlurWindow *gui; +}; + +class TimeBlurWindow : public PluginClientWindow +{ +public: + TimeBlurWindow(TimeBlurMain *plugin); + ~TimeBlurWindow(); + + void create_objects(); + TimeBlurMain *plugin; + TimeBlurSelect *select; + TimeBlurFrames *frames; + TimeBlurClearFrames *clear_frames; +}; + +#endif -- 2.26.2