From 2fba7eab40198b35d9edb20c16bcc1b8c262f7a2 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 29 Mar 2020 17:44:55 -0600 Subject: [PATCH] upgrades to scopewindow, add blurbox, bd.sh sed tab test, tweak clk2play over window test, fix loadserver segv is_single, relayout editpanel in c/vwdw, update es.po, add get_cpus for loadclient throttle --- cinelerra-5.1/cinelerra/bdcreate.C | 2 +- cinelerra-5.1/cinelerra/cwindowgui.C | 4 +- cinelerra-5.1/cinelerra/editpanel.C | 23 +- cinelerra-5.1/cinelerra/editpanel.h | 1 + cinelerra-5.1/cinelerra/loadbalance.C | 2 +- cinelerra-5.1/cinelerra/mainsession.C | 12 + cinelerra-5.1/cinelerra/mainsession.h | 3 + cinelerra-5.1/cinelerra/mwindow.C | 10 + cinelerra-5.1/cinelerra/mwindow.h | 1 + cinelerra-5.1/cinelerra/recordscopes.C | 10 + cinelerra-5.1/cinelerra/recordscopes.h | 1 + cinelerra-5.1/cinelerra/scopewindow.C | 465 +++++++++++++----- cinelerra-5.1/cinelerra/scopewindow.h | 69 ++- cinelerra-5.1/cinelerra/scopewindow.inc | 5 + cinelerra-5.1/cinelerra/theme.C | 2 +- .../plugins/theme_cakewalk/cakewalk.C | 4 +- .../plugins/theme_neophyte/neophyte.C | 5 +- cinelerra-5.1/plugins/videoscope/videoscope.C | 394 ++------------- cinelerra-5.1/po/es.po | 44 +- 19 files changed, 529 insertions(+), 528 deletions(-) diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index f02a5905..f13642c8 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -172,7 +172,7 @@ char *BD_BatchRenderJob::create_script(EDL *edl, ArrayList *idxbls) fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n"); fprintf(fp,"PATH=$PATH:%s\n",exec_path); fprintf(fp,"mkdir -p $dir/udfs\n"); - fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ \t].*//'`\n"); + fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ ].*//'`\n"); fprintf(fp,"blks=$((sz/2048 + 4096))\n"); fprintf(fp,"rm -f %s\n", udfs); fprintf(fp,"mkudffs -b 2048 %s $blks\n", udfs); diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 3a6c2db8..beac0f81 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -281,7 +281,7 @@ int CWindowGUI::button_press_event() if( current_operation == CWINDOW_NONE && mwindow->edl != 0 && canvas->get_canvas() && mwindow->edl->session->cwindow_click2play && - canvas->get_canvas()->get_cursor_over_window() ) { + canvas->get_canvas()->cursor_above() ) { switch( get_buttonpress() ) { case LEFT_BUTTON: if( !cwindow->playback_engine->is_playing_back ) { @@ -744,7 +744,7 @@ CWindowEditing::CWindowEditing(MWindow *mwindow, CWindow *cwindow) mwindow->theme->cedit_x, mwindow->theme->cedit_y, mwindow->edl->session->editing_mode, 0, // use_editing_mode - 1, // use_keyframe + 0, // use_keyframe 0, // use_splice 0, // use_overwrite 1, // use_copy diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index 7eca7192..6488be94 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -171,19 +171,16 @@ void EditPanel::update() int EditPanel::calculate_w(MWindow *mwindow, int use_keyframe, int total_buttons) { - int result = 0; - int button_w = mwindow->theme->get_image_set("ibeam")[0]->get_w(); - if( use_keyframe ) { + int button_w = mwindow->theme->get_image_set("meters")[0]->get_w(); + int result = button_w * total_buttons; + if( use_keyframe ) result += 2*(button_w + mwindow->theme->toggle_margin); - } - - result += button_w * total_buttons; return result; } int EditPanel::calculate_h(MWindow *mwindow) { - return mwindow->theme->get_image_set("ibeam")[0]->get_h(); + return mwindow->theme->get_image_set("meters")[0]->get_h(); } void EditPanel::create_buttons() @@ -1167,6 +1164,10 @@ EditPanelScopeDialog::~EditPanelScopeDialog() delete gui_lock; } +void EditPanelScopeDialog::handle_close_event(int result) +{ + scope_gui = 0; +} void EditPanelScopeDialog::handle_done_event(int result) { gui_lock->lock("EditPanelScopeDialog::handle_done_event"); @@ -1202,7 +1203,7 @@ EditPanelScopeGUI::EditPanelScopeGUI(MWindow *mwindow, EditPanelScopeDialog *dia : ScopeGUI(mwindow->theme, mwindow->session->scope_x, mwindow->session->scope_y, mwindow->session->scope_w, mwindow->session->scope_h, - mwindow->preferences->processors) + mwindow->get_cpus()) { this->mwindow = mwindow; this->dialog = dialog; @@ -1220,6 +1221,9 @@ void EditPanelScopeGUI::create_objects() use_vector = session->use_vector; use_hist_parade = session->use_hist_parade; use_wave_parade = session->use_wave_parade; + use_wave_gain = session->use_wave_gain; + use_vect_gain = session->use_vect_gain; + use_smooth = session->use_smooth; ScopeGUI::create_objects(); } @@ -1231,6 +1235,9 @@ void EditPanelScopeGUI::toggle_event() session->use_vector = use_vector; session->use_hist_parade = use_hist_parade; session->use_wave_parade = use_wave_parade; + session->use_wave_gain = use_wave_gain; + session->use_vect_gain = use_vect_gain; + session->use_smooth = use_smooth; } int EditPanelScopeGUI::translation_event() diff --git a/cinelerra-5.1/cinelerra/editpanel.h b/cinelerra-5.1/cinelerra/editpanel.h index c5064dd0..b81d9fed 100644 --- a/cinelerra-5.1/cinelerra/editpanel.h +++ b/cinelerra-5.1/cinelerra/editpanel.h @@ -367,6 +367,7 @@ public: EditPanelScopeDialog(MWindow *mwindow, EditPanel *panel); ~EditPanelScopeDialog(); + void handle_close_event(int result); void handle_done_event(int result); BC_Window* new_gui(); void process(VFrame *output_frame); diff --git a/cinelerra-5.1/cinelerra/loadbalance.C b/cinelerra-5.1/cinelerra/loadbalance.C index 7ea93415..cbfdc29d 100644 --- a/cinelerra-5.1/cinelerra/loadbalance.C +++ b/cinelerra-5.1/cinelerra/loadbalance.C @@ -228,7 +228,7 @@ LoadPackage* LoadServer::get_package(int number) LoadClient* LoadServer::get_client(int number) { - return clients[number]; + return is_single ? single_client : clients[number]; } int LoadServer::get_total_packages() diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index a21297e0..66978fef 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -106,6 +106,9 @@ MainSession::MainSession(MWindow *mwindow) use_vector = 0; use_hist_parade = 0; use_wave_parade = 0; + use_wave_gain = 5; + use_vect_gain = 5; + use_smooth = 0; afolders_w = 0; show_vwindow = show_awindow = show_cwindow = show_gwindow = show_lwindow = 0; plugindialog_w = plugindialog_h = 0; @@ -321,6 +324,9 @@ void MainSession::default_window_positions(int window_config) use_vector = 1; use_hist_parade = 1; use_wave_parade = 1; + use_wave_gain = 5; + use_vect_gain = 5; + use_smooth = 1; if(mwindow->edl) lwindow_w = MeterPanel::get_meters_width(mwindow->theme, @@ -435,6 +441,9 @@ int MainSession::load_defaults(BC_Hash *defaults) use_vector = defaults->get("USE_VECTOR", use_vector); use_hist_parade = defaults->get("USE_HIST_PARADE", use_hist_parade); use_wave_parade = defaults->get("USE_WAVE_PARADE", use_wave_parade); + use_wave_gain = defaults->get("USE_WAVE_GAIN", use_wave_gain); + use_vect_gain = defaults->get("USE_VECT_GAIN", use_vect_gain); + use_smooth = defaults->get("USE_SMOOTH", use_smooth); //printf("MainSession::load_defaults 1\n"); @@ -560,6 +569,9 @@ int MainSession::save_defaults(BC_Hash *defaults) defaults->update("USE_VECTOR", use_vector); defaults->update("USE_HIST_PARADE", use_hist_parade); defaults->update("USE_WAVE_PARADE", use_wave_parade); + defaults->update("USE_WAVE_GAIN", use_wave_gain); + defaults->update("USE_VECT_GAIN", use_vect_gain); + defaults->update("USE_SMOOTH", use_smooth); defaults->update("ABINS_W", afolders_w); diff --git a/cinelerra-5.1/cinelerra/mainsession.h b/cinelerra-5.1/cinelerra/mainsession.h index 6395b809..2757f7e0 100644 --- a/cinelerra-5.1/cinelerra/mainsession.h +++ b/cinelerra-5.1/cinelerra/mainsession.h @@ -172,6 +172,9 @@ public: int use_vector; int use_hist_parade; int use_wave_parade; + int use_wave_gain; + int use_vect_gain; + int use_smooth; int afolders_w; int show_vwindow, show_awindow, show_cwindow, show_gwindow, show_lwindow; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 86e15ad7..93e0a457 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -5085,3 +5085,13 @@ PatchGUI *MWindow::get_patchgui(Track *track) return patchgui; } +int MWindow::get_cpus() +{ + int out_w = edl->session->output_w; + int out_h = edl->session->output_h; + int cpus = out_w*out_h/0x80000 + 1; + if( cpus > preferences->processors ) + cpus = preferences->processors; + return cpus; +} + diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index eccc0a3b..b04acea7 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -797,6 +797,7 @@ public: void speed_before(); int speed_after(int done); int normalize_speed(EDL *old_edl, EDL *new_edl); + int get_cpus(); // void clean_indexes(); // TimeBomb timebomb; diff --git a/cinelerra-5.1/cinelerra/recordscopes.C b/cinelerra-5.1/cinelerra/recordscopes.C index 65f50b1e..c7dfd53d 100644 --- a/cinelerra-5.1/cinelerra/recordscopes.C +++ b/cinelerra-5.1/cinelerra/recordscopes.C @@ -45,6 +45,10 @@ RecordScopeThread::~RecordScopeThread() delete gui_lock; } +void RecordScopeThread::handle_close_event(int result) +{ + scope_gui = 0; +} void RecordScopeThread::handle_done_event(int result) { gui_lock->lock("RecordScopeThread::handle_done_event"); @@ -113,6 +117,9 @@ void RecordScopeGUI::create_objects() use_vector = mwindow->session->use_vector; use_hist_parade = mwindow->session->use_hist_parade; use_wave_parade = mwindow->session->use_wave_parade; + use_wave_gain = mwindow->session->use_wave_gain; + use_vect_gain = mwindow->session->use_vect_gain; + use_smooth = mwindow->session->use_smooth; ScopeGUI::create_objects(); } @@ -124,6 +131,9 @@ void RecordScopeGUI::toggle_event() mwindow->session->use_vector = use_vector; mwindow->session->use_hist_parade = use_hist_parade; mwindow->session->use_wave_parade = use_wave_parade; + mwindow->session->use_wave_gain = use_wave_gain; + mwindow->session->use_vect_gain = use_vect_gain; + mwindow->session->use_smooth = use_smooth; } int RecordScopeGUI::translation_event() diff --git a/cinelerra-5.1/cinelerra/recordscopes.h b/cinelerra-5.1/cinelerra/recordscopes.h index b65c0883..ac9f41bb 100644 --- a/cinelerra-5.1/cinelerra/recordscopes.h +++ b/cinelerra-5.1/cinelerra/recordscopes.h @@ -38,6 +38,7 @@ public: RecordScopeThread(MWindow *mwindow, RecordMonitor *record_monitor); ~RecordScopeThread(); + void handle_close_event(int result); void handle_done_event(int result); BC_Window* new_gui(); void process(VFrame *output_frame); diff --git a/cinelerra-5.1/cinelerra/scopewindow.C b/cinelerra-5.1/cinelerra/scopewindow.C index 36883b68..17bb811c 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.C +++ b/cinelerra-5.1/cinelerra/scopewindow.C @@ -40,25 +40,25 @@ ScopeUnit::ScopeUnit(ScopeGUI *gui, this->gui = gui; } -#define BPP 3 -#define incr_point(rows,h, n, comp) \ -if(iy >= 0 && iy < h) { int v; \ - uint8_t *vp = rows[iy] + ix*BPP + (comp); \ - v = *vp+(n); *vp = v>0xff ? 0xff : v; \ -} -#define incr_points(rows,h, rv, gv, bv) \ -if(iy >= 0 && iy < h) { int v; \ - uint8_t *vp = rows[iy] + ix*BPP; \ - v = *vp+(rv); *vp++ = v>0xff ? 0xff : v; \ + +#define incr_point(rows,h, iv,comp) { \ +if(iy >= 0 && iy < h) { \ + uint8_t *vp = rows[iy] + ix*3 + (comp); \ + int v = *vp+(iv); *vp = v>0xff ? 0xff : v; } \ +} +#define incr_points(rows,h, rv,gv,bv) { \ +if(iy >= 0 && iy < h) { \ + uint8_t *vp = rows[iy] + ix*3; \ + int v = *vp+(rv); *vp++ = v>0xff ? 0xff : v; \ v = *vp+(gv); *vp++ = v>0xff ? 0xff : v; \ - v = *vp+(bv); *vp = v>0xff ? 0xff : v; \ + v = *vp+(bv); *vp = v>0xff ? 0xff : v; } \ } -#define clip_points(rows,h, rv, gv, bv) \ -if(iy >= 0 && iy < h) { int v; \ - uint8_t *vp = rows[iy] + ix*BPP; \ - v = *vp+(rv); *vp++ = v>0xff ? 0xff : v<0 ? 0 : v; \ +#define clip_points(rows,h, rv,gv,bv) { \ +if(iy >= 0 && iy < h) { \ + uint8_t *vp = rows[iy] + ix*3; \ + int v = *vp+(rv); *vp++ = v>0xff ? 0xff : v<0 ? 0 : v; \ v = *vp+(gv); *vp++ = v>0xff ? 0xff : v<0 ? 0 : v; \ - v = *vp+(bv); *vp = v>0xff ? 0xff : v<0 ? 0 : v; \ + v = *vp+(bv); *vp = v>0xff ? 0xff : v<0 ? 0 : v; } \ } #define PROCESS_PIXEL(column) { \ @@ -81,37 +81,37 @@ if(iy >= 0 && iy < h) { int v; \ } \ /* Calculate waveform */ \ if(use_wave || use_wave_parade) { \ - int ix = (column) * wave_w / out_w; \ - if(ix >= 0 && ix < wave_w) { \ + int ix = column * wave_w / dat_w; \ + if(ix >= 0 && ix < wave_w-1) { \ if(use_wave_parade > 0) { \ ix /= 3; \ - int iy = wave_h - (int)((r - FLOAT_MIN) / \ + int iy = wave_h - ((r - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - incr_point(waveform_rows,wave_h, winc, 0); \ + incr_point(waveform_rows,wave_h, winc,0); \ ix += wave_w/3; \ - iy = wave_h - (int)((g - FLOAT_MIN) / \ + iy = wave_h - ((g - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - incr_point(waveform_rows,wave_h, winc, 1); \ + incr_point(waveform_rows,wave_h, winc,1); \ ix += wave_w/3; \ - iy = wave_h - (int)((b - FLOAT_MIN) / \ + iy = wave_h - ((b - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - incr_point(waveform_rows,wave_h, winc, 2); \ + incr_point(waveform_rows,wave_h, winc,2); \ } \ else if(use_wave_parade < 0) { \ - int iy = wave_h - (int)((r - FLOAT_MIN) / \ + int iy = wave_h - ((r - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - clip_points(waveform_rows,wave_h, winc, -winc, -winc); \ - iy = wave_h - (int)((g - FLOAT_MIN) / \ + clip_points(waveform_rows,wave_h, winc,-winc,-winc); \ + iy = wave_h - ((g - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - clip_points(waveform_rows,wave_h, -winc, winc, -winc); \ - iy = wave_h - (int)((b - FLOAT_MIN) / \ + clip_points(waveform_rows,wave_h, -winc,winc,-winc); \ + iy = wave_h - ((b - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ - clip_points(waveform_rows,wave_h, -winc, -winc, winc); \ + clip_points(waveform_rows,wave_h, -winc,-winc,winc); \ } \ - else { int yinc = 3*winc; \ - int rinc = yinc*(r-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ - int ginc = yinc*(g-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ - int binc = yinc*(b-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ + else { float yinc = 3*winc; \ + float rinc = yinc*(r-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ + float ginc = yinc*(g-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ + float binc = yinc*(b-FLOAT_MIN) / (FLOAT_MAX-FLOAT_MIN) + 3; \ int iy = wave_h - ((intensity - FLOAT_MIN) / \ (FLOAT_MAX - FLOAT_MIN) * wave_h); \ incr_points(waveform_rows,wave_h, rinc, ginc, binc); \ @@ -134,23 +134,25 @@ if(iy >= 0 && iy < h) { int v; \ int rv = CLIP(r_f, 0, 1) * vinc + 3; \ int gv = CLIP(g_f, 0, 1) * vinc + 3; \ int bv = CLIP(b_f, 0, 1) * vinc + 3; \ - incr_points(vector_rows,vector_h, rv, gv, bv); \ + incr_points(vector_rows,vector_h, rv,gv,bv); \ } \ } -#define PROCESS_RGB_PIXEL(column, max) { \ - r = (float)*row++ / max; \ - g = (float)*row++ / max; \ - b = (float)*row++ / max; \ +#define PROCESS_RGB_PIXEL(type,max, column) { \ + type *rp = (type *)row; \ + r = (float)rp[0] / max; \ + g = (float)rp[1] / max; \ + b = (float)rp[2] / max; \ HSV::rgb_to_hsv(r, g, b, h, s, v); \ intensity = v; \ PROCESS_PIXEL(column) \ } -#define PROCESS_BGR_PIXEL(column, max) { \ - b = (float)*row++ / max; \ - g = (float)*row++ / max; \ - r = (float)*row++ / max; \ +#define PROCESS_BGR_PIXEL(type,max, column) { \ + type *rp = (type *)row; \ + b = (float)rp[0] / max; \ + g = (float)rp[1] / max; \ + r = (float)rp[2] / max; \ HSV::rgb_to_hsv(r, g, b, h, s, v); \ intensity = v; \ PROCESS_PIXEL(column) \ @@ -181,120 +183,140 @@ void ScopeUnit::process_package(LoadPackage *package) int wave_w = waveform_vframe->get_w(); int vector_h = vector_vframe->get_h(); int vector_w = vector_vframe->get_w(); - int out_w = gui->output_frame->get_w(); - int out_h = gui->output_frame->get_h(); - int winc = (wave_w * wave_h) / (out_w * out_h); + int dat_w = gui->data_frame->get_w(); + int dat_h = gui->data_frame->get_h(); + int winc = (wave_w * wave_h) / (dat_w * dat_h); if( use_wave_parade ) winc *= 3; - winc += 2; winc *= gui->wdial; - int vinc = 3*(vector_w * vector_h) / (out_w * out_h) + 2; - vinc *= gui->vdial; + winc += 2; winc *= gui->use_wave_gain; + int vinc = 3*(vector_w * vector_h) / (dat_w * dat_h) + 2; + vinc *= gui->use_vect_gain; float radius = MIN(gui->vector_w / 2, gui->vector_h / 2); - unsigned char **waveform_rows = waveform_vframe->get_rows(); - unsigned char **vector_rows = vector_vframe->get_rows(); - unsigned char **rows = gui->output_frame->get_rows(); + uint8_t **waveform_rows = waveform_vframe->get_rows(); + uint8_t **vector_rows = vector_vframe->get_rows(); + uint8_t **rows = gui->data_frame->get_rows(); - switch( gui->output_frame->get_color_model() ) { + switch( gui->data_frame->get_color_model() ) { case BC_RGB888: for( int y=pkg->row1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { + uint8_t *row = rows[y]; + for( int x=0; xrow1; yrow2; ++y ) { + uint8_t *row = rows[y]; + for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { float *row = (float*)rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { float *row = (float*)rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xoutput_frame->get_y(); - unsigned char *up = gui->output_frame->get_u(); - unsigned char *vp = gui->output_frame->get_v(); + uint8_t *yp = gui->data_frame->get_y(); + uint8_t *up = gui->data_frame->get_u(); + uint8_t *vp = gui->data_frame->get_v(); for( int y=pkg->row1; yrow2; ++y ) { - unsigned char *y_row = yp + y * out_w; - unsigned char *u_row = up + (y / 2) * (out_w / 2); - unsigned char *v_row = vp + (y / 2) * (out_w / 2); - for( int x=0; xrow1; yrow2; ++y ) { - unsigned char *row = rows[y]; - for( int x=0; xoutput_frame->get_color_model()); + __LINE__, gui->data_frame->get_color_model()); break; } } @@ -313,7 +335,7 @@ ScopeEngine::~ScopeEngine() void ScopeEngine::init_packages() { - int y = 0, h = gui->output_frame->get_h(); + int y = 0, h = gui->data_frame->get_h(); for( int i=0,n=LoadServer::get_total_packages(); irow1 = y; @@ -364,6 +386,7 @@ ScopeGUI::ScopeGUI(Theme *theme, this->y = y; this->w = w; this->h = h; + this->temp_frame = 0; this->theme = theme; this->cpus = cpus; reset(); @@ -376,6 +399,7 @@ ScopeGUI::ScopeGUI(PluginClient *plugin, int w, int h) this->y = get_y(); this->w = w; this->h = h; + this->temp_frame = 0; this->theme = plugin->get_theme(); this->cpus = plugin->PluginClient::smp + 1; reset(); @@ -386,14 +410,22 @@ ScopeGUI::~ScopeGUI() delete waveform_vframe; delete vector_vframe; delete engine; + delete box_blur; + delete temp_frame; } void ScopeGUI::reset() { + output_frame = 0; + data_frame = 0; frame_w = 1; + use_smooth = 1; + use_wave_gain = 5; + use_vect_gain = 5; waveform_vframe = 0; vector_vframe = 0; engine = 0; + box_blur = 0; use_hist = 0; use_wave = 1; use_vector = 1; @@ -402,8 +434,8 @@ void ScopeGUI::reset() waveform = 0; vectorscope = 0; histogram = 0; - wave_w = wave_h = vector_w = vector_h = 0; - wdial = vdial = 5.f; + wave_w = wave_h = 0; + vector_w = vector_h = 0; } @@ -417,12 +449,14 @@ void ScopeGUI::create_objects() lock_window("ScopeGUI::create_objects"); int x = theme->widget_border; - int y = theme->widget_border + - ScopeWaveDial::calculate_h() - ScopeMenu::calculate_h(); + int y = theme->widget_border; + add_subwindow(smooth = new ScopeSmooth(this, x, y)); + y += smooth->get_h() + theme->widget_border; add_subwindow(scope_menu = new ScopeMenu(this, x, y)); scope_menu->create_objects(); x += scope_menu->get_w() + theme->widget_border; add_subwindow(value_text = new BC_Title(x, y, "")); + y += scope_menu->get_h() + theme->widget_border; create_panels(); update_toggles(); @@ -434,46 +468,47 @@ void ScopeGUI::create_objects() void ScopeGUI::create_panels() { calculate_sizes(get_w(), get_h()); + int slider_w = xS(100); if( (use_wave || use_wave_parade) ) { - int px = wave_x + wave_w - ScopeWaveDial::calculate_w() - xS(5); - int py = wave_y - ScopeWaveDial::calculate_h() - yS(5); + int px = wave_x + wave_w - slider_w - xS(5); + int py = wave_y - ScopeWaveSlider::get_span(0) - yS(5); if( !waveform ) { add_subwindow(waveform = new ScopeWaveform(this, wave_x, wave_y, wave_w, wave_h)); waveform->create_objects(); - add_subwindow(wave_dial = new ScopeWaveDial(this, px, py)); + add_subwindow(wave_slider = new ScopeWaveSlider(this, px, py, slider_w)); } else { waveform->reposition_window( wave_x, wave_y, wave_w, wave_h); waveform->clear_box(0, 0, wave_w, wave_h); - wave_dial->reposition_window(px, py); + wave_slider->reposition_window(px, py); } } else if( !(use_wave || use_wave_parade) && waveform ) { - delete waveform; waveform = 0; - delete wave_dial; wave_dial = 0; + delete waveform; waveform = 0; + delete wave_slider; wave_slider = 0; } if( use_vector ) { - int vx = vector_x + vector_w - ScopeVectDial::calculate_w() - xS(5); - int vy = vector_y - ScopeVectDial::calculate_h() - yS(5); + int vx = vector_x + vector_w - slider_w - xS(5); + int vy = vector_y - ScopeVectSlider::get_span(0) - yS(5); if( !vectorscope ) { add_subwindow(vectorscope = new ScopeVectorscope(this, vector_x, vector_y, vector_w, vector_h)); vectorscope->create_objects(); - add_subwindow(vect_dial = new ScopeVectDial(this, vx, vy)); + add_subwindow(vect_slider = new ScopeVectSlider(this, vx, vy, slider_w)); } else { vectorscope->reposition_window( vector_x, vector_y, vector_w, vector_h); vectorscope->clear_box(0, 0, vector_w, vector_h); - vect_dial->reposition_window(vx, vy); + vect_slider->reposition_window(vx, vy); } } else if( !use_vector && vectorscope ) { delete vectorscope; vectorscope = 0; - delete vect_dial; vect_dial = 0; + delete vect_slider; vect_slider = 0; } if( (use_hist || use_hist_parade) ) { @@ -522,7 +557,7 @@ void ScopeGUI::toggle_event() void ScopeGUI::calculate_sizes(int w, int h) { int margin = theme->widget_border; - int menu_h = ScopeWaveDial::calculate_h() + margin * 2; + int menu_h = smooth->get_h() + scope_menu->get_h() + margin * 3; int text_w = get_text_width(SMALLFONT, "000") + margin * 2; int total_panels = ((use_hist || use_hist_parade) ? 1 : 0) + ((use_wave || use_wave_parade) ? 1 : 0) + @@ -593,13 +628,14 @@ int ScopeGUI::resize_event(int w, int h) this->w = w; this->h = h; calculate_sizes(w, h); + int margin = theme->widget_border; if( waveform ) { waveform->reposition_window(wave_x, wave_y, wave_w, wave_h); waveform->clear_box(0, 0, wave_w, wave_h); - int px = wave_x + wave_w - ScopeWaveDial::calculate_w() - xS(5); - int py = wave_y - ScopeWaveDial::calculate_h() - yS(5); - wave_dial->reposition_window(px, py); + int px = wave_x + wave_w - wave_slider->get_w() - margin; + int py = wave_y - wave_slider->get_h() - margin; + wave_slider->reposition_window(px, py); } if( histogram ) { @@ -610,9 +646,9 @@ int ScopeGUI::resize_event(int w, int h) if( vectorscope ) { vectorscope->reposition_window(vector_x, vector_y, vector_w, vector_h); vectorscope->clear_box(0, 0, vector_w, vector_h); - int vx = vector_x + vector_w - ScopeVectDial::calculate_w() - xS(5); - int vy = vector_y - ScopeVectDial::calculate_h() - yS(5); - vect_dial->reposition_window(vx, vy); + int vx = vector_x + vector_w - vect_slider->get_w() - margin; + int vy = vector_y - vect_slider->get_h() - margin; + vect_slider->reposition_window(vx, vy); } allocate_vframes(); @@ -738,7 +774,17 @@ void ScopeGUI::process(VFrame *output_frame) { lock_window("ScopeGUI::process"); this->output_frame = output_frame; - frame_w = output_frame->get_w(); + int ow = output_frame->get_w(), oh = output_frame->get_h(); + if( use_smooth ) { + VFrame::get_temp(temp_frame, ow, oh, BC_RGB161616); + temp_frame->transfer_from(output_frame); + if( !box_blur ) box_blur = new BoxBlur(cpus); + box_blur->blur(temp_frame, temp_frame, 2, 2); + data_frame = temp_frame; + } + else + data_frame = output_frame; + frame_w = data_frame->get_w(); //float radius = MIN(vector_w / 2, vector_h / 2); bzero(waveform_vframe->get_data(), waveform_vframe->get_data_size()); bzero(vector_vframe->get_data(), vector_vframe->get_data_size()); @@ -747,9 +793,9 @@ void ScopeGUI::process(VFrame *output_frame) if( histogram ) histogram->draw(0, 0); if( waveform ) - waveform->draw_vframe(waveform_vframe, 1, 0, 0); + waveform->draw_vframe(waveform_vframe); if( vectorscope ) - vectorscope->draw_vframe(vector_vframe, 1, 0, 0); + vectorscope->draw_vframe(vector_vframe); draw_overlays(1, 0, 1); unlock_window(); @@ -1076,12 +1122,14 @@ void ScopeMenu::create_objects() new ScopeScopesOn(this, _("Histogram"), SCOPE_HISTOGRAM)); add_item(hist_rgb_on = new ScopeScopesOn(this, _("Histogram RGB"), SCOPE_HISTOGRAM_RGB)); + add_item(new BC_MenuItem("-")); add_item(wave_on = new ScopeScopesOn(this, _("Waveform"), SCOPE_WAVEFORM)); add_item(wave_rgb_on = new ScopeScopesOn(this, _("Waveform RGB"), SCOPE_WAVEFORM_RGB)); add_item(wave_ply_on = new ScopeScopesOn(this, _("Waveform ply"), SCOPE_WAVEFORM_PLY)); + add_item(new BC_MenuItem("-")); add_item(vect_on = new ScopeScopesOn(this, _("Vectorscope"), SCOPE_VECTORSCOPE)); } @@ -1096,27 +1144,194 @@ void ScopeMenu::update_toggles() vect_on->set_checked(gui->use_vector); } -ScopeWaveDial::ScopeWaveDial(ScopeGUI *gui, int x, int y) - : BC_FPot(x, y, gui->wdial, 1.f, 9.f) +ScopeWaveSlider::ScopeWaveSlider(ScopeGUI *gui, int x, int y, int w) + : BC_ISlider(x, y, 0, w, w, 1, 9, gui->use_wave_gain) +{ + this->gui = gui; +} +int ScopeWaveSlider::handle_event() +{ + gui->use_wave_gain = get_value(); + gui->update_scope(); + gui->toggle_event(); + return 1; +} + +ScopeVectSlider::ScopeVectSlider(ScopeGUI *gui, int x, int y, int w) + : BC_ISlider(x, y, 0, w, w, 1, 9, gui->use_vect_gain) { this->gui = gui; } -int ScopeWaveDial::handle_event() +int ScopeVectSlider::handle_event() { - gui->wdial = get_value(); + gui->use_vect_gain = get_value(); gui->update_scope(); + gui->toggle_event(); return 1; } -ScopeVectDial::ScopeVectDial(ScopeGUI *gui, int x, int y) - : BC_FPot(x, y, gui->vdial, 1.f, 9.f) +ScopeSmooth::ScopeSmooth(ScopeGUI *gui, int x, int y) + : BC_CheckBox(x, y, gui->use_smooth, _("Smooth")) { this->gui = gui; } -int ScopeVectDial::handle_event() + +int ScopeSmooth::handle_event() { - gui->vdial = get_value(); + gui->use_smooth = get_value(); gui->update_scope(); + gui->toggle_event(); return 1; } +// from ffmpeg vf_boxblur +template static inline +void blurt(dst_t *dst, int dst_step, src_t *src, int src_step, int len, int radius) +{ + const int length = radius*2 + 1; + const int inv = ((1<<16) + length/2)/length; + int x, n, sum = src[radius*src_step]; + + for( x=0; x>16; + } + n = len - radius; + for( ; x>16; + } + + for ( ; x>16; + } +} +template static inline +void blur_power(dst_t *dst, int dst_step, src_t *src, int src_step, + int len, int radius, int power) +{ + dst_t atemp[len], btemp[len]; + dst_t *a = atemp, *b = btemp; + blurt(a, 1, src, src_step, len, radius); + while( power-- > 2 ) { + blurt(b, 1, a, 1, len, radius); + dst_t *t = a; a = b; b = t; + } + if( power > 1 ) + blurt(dst, dst_step, a, 1, len, radius); + else + for( int i = 0; i +void BoxBlurUnit::blurt_package(LoadPackage *package) +{ + BoxBlur *box_blur = (BoxBlur *)server; + src_t *src_data = (src_t *)box_blur->src_data; + dst_t *dst_data = (dst_t *)box_blur->dst_data; + int radius = box_blur->radius; + int power = box_blur->power; + int vlen = box_blur->vlen; + int c0 = box_blur->c0, c1 = box_blur->c1; + int src_ustep = box_blur->src_ustep; + int dst_ustep = box_blur->dst_ustep; + int src_vstep = box_blur->src_vstep; + int dst_vstep = box_blur->dst_vstep; + BoxBlurPackage *pkg = (BoxBlurPackage*)package; + int u1 = pkg->u1, u2 = pkg->u2; + for( int u=u1; u(package); +} + +BoxBlur::BoxBlur(int cpus) + : LoadServer(cpus, cpus) +{ +} +BoxBlur::~BoxBlur() +{ +} + +LoadClient* BoxBlur::new_client() { return new BoxBlurUnit(this); } +LoadPackage* BoxBlur::new_package() { return new BoxBlurPackage(); } + +void BoxBlur::init_packages() +{ + int u = 0; + for( int i=0,n=LoadServer::get_total_packages(); iu1 = u; + pkg->u2 = u = (++i * ulen) / n; + } +} + +//dst can equal src, requires geom(dst)==geom(src) +//uv: 0=hblur, 1=vblur; comp: -1=rgb,0=r,1=g,2=b +void BoxBlur::process(VFrame *dst, VFrame *src, int uv, + int radius, int power, int comp) +{ + this->radius = radius; + this->power = power; + int src_w = src->get_w(), src_h = src->get_h(); + ulen = !uv ? src_h : src_w; + vlen = !uv ? src_w : src_h; + c0 = comp<0 ? 0 : comp; + c1 = comp<0 ? 2 : comp; + src_data = src->get_data(); + dst_data = dst->get_data(); + int src_pixsz = BC_CModels::calculate_pixelsize(src->get_color_model()); + int src_comps = BC_CModels::components(src->get_color_model()); + int src_bpp = src_pixsz / src_comps; + int dst_pixsz = BC_CModels::calculate_pixelsize(dst->get_color_model()); + int dst_comps = BC_CModels::components(dst->get_color_model()); + int dst_bpp = dst_pixsz / dst_comps; + int dst_linsz = dst->get_bytes_per_line() / dst_bpp; + int src_linsz = src->get_bytes_per_line() / src_bpp; + src_ustep = !uv ? src_linsz : src_comps; + dst_ustep = !uv ? dst_linsz: dst_comps; + src_vstep = !uv ? src_comps : src_linsz; + dst_vstep = !uv ? dst_comps : dst_linsz; + + process_packages(); +} + +void BoxBlur::hblur(VFrame *dst, VFrame *src, int radius, int power, int comp) +{ + process(dst, src, 0, radius, power, comp); +} +void BoxBlur::vblur(VFrame *dst, VFrame *src, int radius, int power, int comp) +{ + process(dst, src, 1, radius, power, comp); +} +void BoxBlur::blur(VFrame *dst, VFrame *src, int radius, int power, int comp) +{ + process(dst, src, 0, radius, power, comp); + process(dst, dst, 1, radius, power, comp); +} + diff --git a/cinelerra-5.1/cinelerra/scopewindow.h b/cinelerra-5.1/cinelerra/scopewindow.h index 93ef7a89..74201e46 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.h +++ b/cinelerra-5.1/cinelerra/scopewindow.h @@ -161,22 +161,31 @@ public: ScopeScopesOn *vect_on; }; -class ScopeWaveDial : public BC_FPot +class ScopeWaveSlider : public BC_ISlider { public: - ScopeWaveDial(ScopeGUI *gui, int x, int y); + ScopeWaveSlider(ScopeGUI *gui, int x, int y, int w); int handle_event(); ScopeGUI *gui; }; -class ScopeVectDial : public BC_FPot +class ScopeVectSlider : public BC_ISlider { public: - ScopeVectDial(ScopeGUI *gui, int x, int y); + ScopeVectSlider(ScopeGUI *gui, int x, int y, int w); int handle_event(); ScopeGUI *gui; }; +class ScopeSmooth : public BC_CheckBox +{ +public: + ScopeSmooth(ScopeGUI *gui, int x, int y); + int handle_event(); + ScopeGUI *gui; +}; + + class ScopeGUI : public PluginClientWindow { public: @@ -205,29 +214,73 @@ public: Theme *theme; VFrame *output_frame; + VFrame *data_frame, *temp_frame; ScopeEngine *engine; + BoxBlur *box_blur; VFrame *waveform_vframe; VFrame *vector_vframe; ScopeHistogram *histogram; ScopeWaveform *waveform; ScopeVectorscope *vectorscope; ScopeMenu *scope_menu; - ScopeWaveDial *wave_dial; - ScopeVectDial *vect_dial; + ScopeWaveSlider *wave_slider; + ScopeVectSlider *vect_slider; + ScopeSmooth *smooth; BC_Title *value_text; int x, y, w, h; int vector_x, vector_y, vector_w, vector_h; int wave_x, wave_y, wave_w, wave_h; int hist_x, hist_y, hist_w, hist_h; - float wdial, vdial; int cpus; int use_hist, use_wave, use_vector; int use_hist_parade, use_wave_parade; int bins[HIST_SECTIONS][TOTAL_BINS]; - int frame_w; + int frame_w, use_smooth; + int use_wave_gain, use_vect_gain; +}; + + +class BoxBlurPackage : public LoadPackage +{ +public: + BoxBlurPackage(); + int u1, u2; +}; + +class BoxBlurUnit : public LoadClient +{ +public: + BoxBlurUnit(BoxBlur*server); + template + void blurt_package(LoadPackage *package); + void process_package(LoadPackage *package); +}; + +class BoxBlur : public LoadServer +{ +public: + BoxBlur(int cpus); + virtual ~BoxBlur(); + void init_packages(); + LoadClient* new_client(); + LoadPackage* new_package(); + void process(VFrame *dst, VFrame *src, int uv, + int radius, int power, int comp); + void hblur(VFrame *dst, VFrame *src, + int radius, int power, int comp=-1); + void vblur(VFrame *dst, VFrame *src, + int radius, int power, int comp=-1); + void blur(VFrame *dst, VFrame *src, + int radius, int power, int comp=-1); + const uint8_t *src_data; + uint8_t *dst_data; + int src_ustep, dst_ustep; + int src_vstep, dst_vstep; + int radius, power; + int ulen, vlen, c0, c1; }; #endif diff --git a/cinelerra-5.1/cinelerra/scopewindow.inc b/cinelerra-5.1/cinelerra/scopewindow.inc index 3dff0bef..3da8bd28 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.inc +++ b/cinelerra-5.1/cinelerra/scopewindow.inc @@ -32,8 +32,13 @@ class ScopeScopesOn; class ScopeMenu; class ScopeWaveDial; class ScopeVectDial; +class ScopeSmooth; class ScopeGUI; +class BoxBlurPackage; +class BoxBlurUnit; +class BoxBlur; + #endif diff --git a/cinelerra-5.1/cinelerra/theme.C b/cinelerra-5.1/cinelerra/theme.C index 20e66688..80ca335c 100644 --- a/cinelerra-5.1/cinelerra/theme.C +++ b/cinelerra-5.1/cinelerra/theme.C @@ -708,7 +708,7 @@ void Theme::draw_mwindow_bg(MWindowGUI *gui) void Theme::get_cwindow_sizes(CWindowGUI *gui, int cwindow_controls) { - int total_buttons = !use_commercials ? 17 : 18; + int total_buttons = !use_commercials ? 16 : 17; int edit_w = EditPanel::calculate_w(mwindow, 1, total_buttons); int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin; int zoom_w = ZoomPanel::calculate_w(czoom_w); diff --git a/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C b/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C index f3c1cde7..28f68fc5 100644 --- a/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C +++ b/cinelerra-5.1/plugins/theme_cakewalk/cakewalk.C @@ -1036,7 +1036,7 @@ void CAKEWALKTHEME::initialize() } void CAKEWALKTHEME::get_vwindow_sizes(VWindowGUI *gui) { - int edit_w = EditPanel::calculate_w(mwindow, 0, xS(10)); + int edit_w = EditPanel::calculate_w(mwindow, 0, 12); int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin; vtimebar_h = yS(16); int division_w = xS(30); @@ -1072,7 +1072,7 @@ void CAKEWALKTHEME::get_vwindow_sizes(VWindowGUI *gui) get_image_set("autokeyframe")[0]->get_h() - widget_border; vdivision_x = xS(280); - vtime_x = vedit_x + xS(65); + vtime_x = vedit_x + xS(85); vtime_y = vedit_y + yS(28); } else { buttons_h = vtimebar_h + diff --git a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C index ac057329..3a02a47e 100644 --- a/cinelerra-5.1/plugins/theme_neophyte/neophyte.C +++ b/cinelerra-5.1/plugins/theme_neophyte/neophyte.C @@ -1193,7 +1193,7 @@ void NEOPHYTETHEME::initialize() // Re-align the Clock. theme.c:931 void NEOPHYTETHEME::get_vwindow_sizes(VWindowGUI *gui) { - int edit_w = EditPanel::calculate_w(mwindow, 0, xS(10)); + int edit_w = EditPanel::calculate_w(mwindow, 0, 12); int transport_w = PlayTransport::get_transport_width(mwindow) + toggle_margin; vtimebar_h = yS(16); // The height of the position indicator int division_w = xS(30); @@ -1260,7 +1260,8 @@ void NEOPHYTETHEME::get_vwindow_sizes(VWindowGUI *gui) vdivision_x = vedit_x + edit_w + division_w; vtime_x = vdivision_x + vtime_border; - vtime_y = vedit_y + widget_border - 7; // vertical height concentric at button height + // vertical height concentric at button height + vtime_y = vedit_y + widget_border - yS(7); } // vtimebar_x = vcanvas_x; diff --git a/cinelerra-5.1/plugins/videoscope/videoscope.C b/cinelerra-5.1/plugins/videoscope/videoscope.C index 1b7322df..e662dacb 100644 --- a/cinelerra-5.1/plugins/videoscope/videoscope.C +++ b/cinelerra-5.1/plugins/videoscope/videoscope.C @@ -39,11 +39,7 @@ #include - - - class VideoScopeEffect; -class VideoScopeEngine; class VideoScopeWindow; class VideoScopeConfig @@ -61,39 +57,7 @@ public: void create_objects(); void toggle_event(); int resize_event(int w, int h); - void update(); - - VideoScopeEffect *plugin; -}; - - - - -class VideoScopePackage : public LoadPackage -{ -public: - VideoScopePackage(); - int row1, row2; -}; - - -class VideoScopeUnit : public LoadClient -{ -public: - VideoScopeUnit(VideoScopeEffect *plugin, VideoScopeEngine *server); - void process_package(LoadPackage *package); - VideoScopeEffect *plugin; -}; - -class VideoScopeEngine : public LoadServer -{ -public: - VideoScopeEngine(VideoScopeEffect *plugin, int cpus); - ~VideoScopeEngine(); - void init_packages(); - LoadClient* new_client(); - LoadPackage* new_package(); VideoScopeEffect *plugin; }; @@ -113,42 +77,19 @@ public: int use_hist, use_wave, use_vector; int use_hist_parade, use_wave_parade; + int use_wave_gain, use_vect_gain, use_smooth; + int w, h; VFrame *input; }; - - - - - - - - - - - - VideoScopeConfig::VideoScopeConfig() { } - - - - - - - - - - - VideoScopeWindow::VideoScopeWindow(VideoScopeEffect *plugin) - : ScopeGUI(plugin, - plugin->w, - plugin->h) + : ScopeGUI(plugin, plugin->w, plugin->h) { this->plugin = plugin; } @@ -164,6 +105,10 @@ void VideoScopeWindow::create_objects() use_vector = plugin->use_vector; use_hist_parade = plugin->use_hist_parade; use_wave_parade = plugin->use_wave_parade; + use_wave_gain = plugin->use_wave_gain; + use_vect_gain = plugin->use_vect_gain; + use_smooth = plugin->use_smooth; + ScopeGUI::create_objects(); } @@ -174,6 +119,9 @@ void VideoScopeWindow::toggle_event() plugin->use_vector = use_vector; plugin->use_hist_parade = use_hist_parade; plugin->use_wave_parade = use_wave_parade; + plugin->use_wave_gain = use_wave_gain; + plugin->use_vect_gain = use_vect_gain; + plugin->use_smooth = use_smooth; // Make it reprocess plugin->send_configure_change(); } @@ -189,32 +137,8 @@ int VideoScopeWindow::resize_event(int w, int h) return 1; } - - - - - - - - - - - - - - - - - - - REGISTER_PLUGIN(VideoScopeEffect) - - - - - VideoScopeEffect::VideoScopeEffect(PluginServer *server) : PluginVClient(server) { @@ -225,16 +149,15 @@ VideoScopeEffect::VideoScopeEffect(PluginServer *server) use_vector = 1; use_hist_parade = 1; use_wave_parade = 1; + use_wave_gain = 5; + use_vect_gain = 5; + use_smooth = 1; } VideoScopeEffect::~VideoScopeEffect() { - - } - - const char* VideoScopeEffect::plugin_title() { return N_("VideoScope"); } int VideoScopeEffect::is_realtime() { return 1; } @@ -250,10 +173,7 @@ void VideoScopeEffect::save_data(KeyFrame *keyframe) // cause data to be stored directly in text output.set_shared_output(keyframe->xbuf); output.tag.set_title("VIDEOSCOPE"); - - - if(is_defaults()) - { + if( is_defaults() ) { output.tag.set_property("W", w); output.tag.set_property("H", h); output.tag.set_property("USE_HIST", use_hist); @@ -261,8 +181,11 @@ void VideoScopeEffect::save_data(KeyFrame *keyframe) output.tag.set_property("USE_VECTOR", use_vector); output.tag.set_property("USE_HIST_PARADE", use_hist_parade); output.tag.set_property("USE_WAVE_PARADE", use_wave_parade); - } + output.tag.set_property("USE_WAVE_GAIN", use_wave_gain); + output.tag.set_property("USE_VECT_GAIN", use_vect_gain); + output.tag.set_property("USE_SMOOTH", use_smooth); + } output.append_tag(); output.tag.set_title("/VIDEOSCOPE"); output.append_tag(); @@ -274,285 +197,44 @@ void VideoScopeEffect::read_data(KeyFrame *keyframe) { FileXML input; input.set_shared_input(keyframe->xbuf); - int result = 0; - - while(!result) - { - result = input.read_tag(); - - if(!result) - { - if(input.tag.title_is("VIDEOSCOPE")) - { - if(is_defaults()) - { - w = input.tag.get_property("W", w); - h = input.tag.get_property("H", h); - use_hist = input.tag.get_property("USE_HIST", use_hist); - use_wave = input.tag.get_property("USE_WAVE", use_wave); - use_vector = input.tag.get_property("USE_VECTOR", use_vector); - use_hist_parade = input.tag.get_property("USE_HIST_PARADE", use_hist_parade); - use_wave_parade = input.tag.get_property("USE_WAVE_PARADE", use_wave_parade); - } + while( !(result = input.read_tag()) ) { + if( input.tag.title_is("VIDEOSCOPE") ) { + if( is_defaults() ) { + w = input.tag.get_property("W", w); + h = input.tag.get_property("H", h); + use_hist = input.tag.get_property("USE_HIST", use_hist); + use_wave = input.tag.get_property("USE_WAVE", use_wave); + use_vector = input.tag.get_property("USE_VECTOR", use_vector); + use_hist_parade = input.tag.get_property("USE_HIST_PARADE", use_hist_parade); + use_wave_parade = input.tag.get_property("USE_WAVE_PARADE", use_wave_parade); + use_wave_gain = input.tag.get_property("USE_WAVE_GAIN", use_wave_gain); + use_vect_gain = input.tag.get_property("USE_VECT_GAIN", use_vect_gain); + use_smooth = input.tag.get_property("USE_SMOOTH", use_smooth); } } } } - - - NEW_WINDOW_MACRO(VideoScopeEffect, VideoScopeWindow) - int VideoScopeEffect::process_realtime(VFrame *input, VFrame *output) { send_render_gui(input); -//printf("VideoScopeEffect::process_realtime 1\n"); - if(input->get_rows()[0] != output->get_rows()[0]) + if( input->get_rows()[0] != output->get_rows()[0] ) output->copy_from(input); return 1; } void VideoScopeEffect::render_gui(void *input) { - if(thread) - { - VideoScopeWindow *window = ((VideoScopeWindow*)thread->window); - window->lock_window(); - -//printf("VideoScopeEffect::process_realtime 1\n"); - this->input = (VFrame*)input; -//printf("VideoScopeEffect::process_realtime 1\n"); - window->process(this->input); - - - window->unlock_window(); - } -} - - - - - -VideoScopePackage::VideoScopePackage() - : LoadPackage() -{ -} - - - - - - -VideoScopeUnit::VideoScopeUnit(VideoScopeEffect *plugin, - VideoScopeEngine *server) - : LoadClient(server) -{ - this->plugin = plugin; -} - - -#define INTENSITY(p) ((unsigned int)(((p)[0]) * 77+ ((p)[1] * 150) + ((p)[2] * 29)) >> 8) - - -static void draw_point(unsigned char **rows, int color_model, - int x, int y, int r, int g, int b) -{ - switch( color_model ) { - case BC_BGR8888: { - unsigned char *pixel = rows[y] + x * 4; - pixel[0] = b; pixel[1] = g; pixel[2] = r; - break; - } - case BC_BGR888: break; - case BC_RGB565: { - unsigned char *pixel = rows[y] + x * 2; - pixel[0] = (r & 0xf8) | (g >> 5); - pixel[1] = ((g & 0xfc) << 5) | (b >> 3); - break; - } - case BC_BGR565: break; - case BC_RGB8: break; - } -} - -#define VIDEOSCOPE(type, temp_type, max, components, use_yuv) { \ - for( int i=pkg->row1; irow2; ++i ) { \ - type *in_row = (type*)plugin->input->get_rows()[i]; \ - for( int j=0; j= 0 && x < waveform_w / 3 && y >= 0 && y < waveform_h) \ - draw_point(waveform_rows, waveform_cmodel, x, y, \ - 0xff, 0x00, 0x00); \ - x = waveform_w / 3 + j * waveform_w / w / 3; /* green */ \ - y = waveform_h - (int)(((float)g / max - FLOAT_MIN) / \ - (FLOAT_MAX - FLOAT_MIN) * waveform_h); \ - if(x >= waveform_w / 3 && x < waveform_w * 2 / 3 && \ - y >= 0 && y < waveform_h) \ - draw_point(waveform_rows, waveform_cmodel, x, y, \ - 0x00, 0xff, 0x00); \ - x = waveform_w * 2 / 3 + j * waveform_w / w / 3; /* blue */ \ - y = waveform_h - (int)(((float)b / max - FLOAT_MIN) / \ - (FLOAT_MAX - FLOAT_MIN) * waveform_h); \ - if(x >= waveform_w * 2 / 3 && x < waveform_w && \ - y >= 0 && y < waveform_h) \ - draw_point(waveform_rows, waveform_cmodel, x, y, \ - 0x00, 0x00, 0xff); \ - } \ - else { \ - if(!use_yuv) intensity = v; \ - intensity = (intensity - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN) * \ - waveform_h; \ - int y = waveform_h - (int)intensity; \ - int x = j * waveform_w / w; \ - if(x >= 0 && x < waveform_w && y >= 0 && y < waveform_h) \ - draw_point(waveform_rows, waveform_cmodel, x, y, \ - 0xff, 0xff, 0xff); \ - } \ -/* Calculate vectorscope */ \ - float adjacent = cos((h + 90) / 360 * 2 * M_PI); \ - float opposite = sin((h + 90) / 360 * 2 * M_PI); \ - int x = (int)(vector_w / 2 + \ - adjacent * (s - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN) * radius); \ - int y = (int)(vector_h / 2 - \ - opposite * (s - FLOAT_MIN) / (FLOAT_MAX - FLOAT_MIN) * radius); \ - CLAMP(x, 0, vector_w - 1); \ - CLAMP(y, 0, vector_h - 1); \ -/* Get color with full saturation & value */ \ - float r_f, g_f, b_f; \ - HSV::hsv_to_rgb(r_f, g_f, b_f, h, s, 1); \ - r = (int)(r_f * 255); \ - g = (int)(g_f * 255); \ - b = (int)(b_f * 255); \ - if(sizeof(type) == 4) { /* float */ \ - r = CLIP(r, 0, 0xff); \ - g = CLIP(g, 0, 0xff); \ - b = CLIP(b, 0, 0xff); \ - } \ - draw_point(vector_rows, vector_cmodel, x, y, \ - (int)r, (int)g, (int)b); \ - } \ - } \ -} - -void VideoScopeUnit::process_package(LoadPackage *package) -{ - VideoScopeWindow *window = (VideoScopeWindow*)plugin->thread->window; - VideoScopePackage *pkg = (VideoScopePackage*)package; - int w = plugin->input->get_w(); -// int h = plugin->input->get_h(); - int waveform_h = window->wave_h; - int waveform_w = window->wave_w; - int waveform_cmodel = window->waveform_vframe->get_color_model(); - unsigned char **waveform_rows = window->waveform_vframe->get_rows(); - int vector_h = window->vector_vframe->get_h(); - int vector_w = window->vector_vframe->get_w(); - int vector_cmodel = window->vector_vframe->get_color_model(); - unsigned char **vector_rows = window->vector_vframe->get_rows(); - float radius = MIN(vector_w / 2, vector_h / 2); - int parade = 1; - - switch( plugin->input->get_color_model() ) { - case BC_RGB888: - VIDEOSCOPE(unsigned char, int, 0xff, 3, 0) - break; - - case BC_RGB_FLOAT: - VIDEOSCOPE(float, float, 1, 3, 0) - break; - - case BC_YUV888: - VIDEOSCOPE(unsigned char, int, 0xff, 3, 1) - break; - - case BC_RGB161616: - VIDEOSCOPE(uint16_t, int, 0xffff, 3, 0) - break; - - case BC_YUV161616: - VIDEOSCOPE(uint16_t, int, 0xffff, 3, 1) - break; - - case BC_RGBA8888: - VIDEOSCOPE(unsigned char, int, 0xff, 4, 0) - break; - - case BC_RGBA_FLOAT: - VIDEOSCOPE(float, float, 1, 4, 0) - break; - - case BC_YUVA8888: - VIDEOSCOPE(unsigned char, int, 0xff, 4, 1) - break; - - case BC_RGBA16161616: - VIDEOSCOPE(uint16_t, int, 0xffff, 4, 0) - break; - - case BC_YUVA16161616: - VIDEOSCOPE(uint16_t, int, 0xffff, 4, 1) - break; - } -} - -VideoScopeEngine::VideoScopeEngine(VideoScopeEffect *plugin, int cpus) - : LoadServer(cpus, cpus) -{ - this->plugin = plugin; -} - -VideoScopeEngine::~VideoScopeEngine() -{ -} - -void VideoScopeEngine::init_packages() -{ - for(int i = 0; i < LoadServer::get_total_packages(); i++) - { - VideoScopePackage *pkg = (VideoScopePackage*)get_package(i); - pkg->row1 = plugin->input->get_h() * i / LoadServer::get_total_packages(); - pkg->row2 = plugin->input->get_h() * (i + 1) / LoadServer::get_total_packages(); - } -} - - -LoadClient* VideoScopeEngine::new_client() -{ - return new VideoScopeUnit(plugin, this); -} - -LoadPackage* VideoScopeEngine::new_package() -{ - return new VideoScopePackage; + if( !thread ) return; + VideoScopeWindow *window = ((VideoScopeWindow*)thread->window); + window->lock_window(); + this->input = (VFrame*)input; + window->process(this->input); + window->unlock_window(); } diff --git a/cinelerra-5.1/po/es.po b/cinelerra-5.1/po/es.po index b8c47879..08a9a39c 100644 --- a/cinelerra-5.1/po/es.po +++ b/cinelerra-5.1/po/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Cinelerra 5.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-10-15 14:02-0600\n" -"PO-Revision-Date: 2020-03-24 11:04+0100\n" +"PO-Revision-Date: 2020-03-29 03:06+0200\n" "Last-Translator: Sergio Daniel Gomez \n" "Language-Team: SPANISH \n" "Language: es\n" @@ -2726,12 +2726,12 @@ msgstr "Encoger" #: cinelerra/cwindowtool.C:462 plugins/titler/titlerwindow.C:291 #: plugins/titler/titlerwindow.C:305 msgid "W:" -msgstr "W:" +msgstr "An:" #: cinelerra/cwindowtool.C:486 plugins/titler/titlerwindow.C:292 #: plugins/titler/titlerwindow.C:310 msgid "H:" -msgstr "H:" +msgstr "Al:" #: cinelerra/cwindowtool.C:550 msgid ": Color" @@ -3972,11 +3972,11 @@ msgstr "Ajustar todas las automatizaciones a la pantalla ( Alt + f )" #: cinelerra/editpanel.C:889 msgid "Drag and drop editing mode" -msgstr "Herramienta de edición para arrastrar y soltar" +msgstr "Herramienta de edición para arrastrar y soltar (e)" #: cinelerra/editpanel.C:909 msgid "Cut and paste editing mode" -msgstr "Herramienta de selección" +msgstr "Herramienta de selección (e)" #: cinelerra/editpanel.C:930 msgid "Generate keyframes while tweeking (j)" @@ -9409,11 +9409,11 @@ msgstr "Nuevo tamaño del proyector:" #: cinelerra/scale.C:226 cinelerra/scale.C:228 cinelerra/setformat.C:393 msgid "W Ratio:" -msgstr "Proporción W:" +msgstr "Proporción An:" #: cinelerra/scale.C:232 cinelerra/scale.C:234 cinelerra/setformat.C:402 msgid "H Ratio:" -msgstr "Proporción H:" +msgstr "Proporción Al:" #: cinelerra/scale.C:343 plugins/scale/scalewin.C:234 msgid "Constrain ratio" @@ -11470,11 +11470,11 @@ msgstr "Escena Y:" #: plugins/findobj/findobjwindow.C:138 msgid "Scene W:" -msgstr "Escena W:" +msgstr "Escena An:" #: plugins/findobj/findobjwindow.C:148 msgid "Scene H:" -msgstr "Escena H:" +msgstr "Escena Al:" #: plugins/findobj/findobjwindow.C:159 msgid "Object X:" @@ -11486,11 +11486,11 @@ msgstr "Objeto Y:" #: plugins/findobj/findobjwindow.C:189 msgid "Object W:" -msgstr "Objeto W:" +msgstr "Objeto An:" #: plugins/findobj/findobjwindow.C:199 msgid "Object H:" -msgstr "Objeto H:" +msgstr "Objeto Al:" #: plugins/findobj/findobjwindow.C:210 msgid "Replace X:" @@ -11502,11 +11502,11 @@ msgstr "Reemplazar Y:" #: plugins/findobj/findobjwindow.C:240 msgid "Replace W:" -msgstr "Reemplazar W:" +msgstr "Reemplazar An:" #: plugins/findobj/findobjwindow.C:250 msgid "Replace H:" -msgstr "Reemplazar H:" +msgstr "Reemplazar Al:" #: plugins/findobj/findobjwindow.C:261 msgid "Replace DX:" @@ -12952,11 +12952,11 @@ msgstr "En R:" #: plugins/scaleratio/scaleratiowin.C:55 plugins/translate/translatewin.C:73 msgid "In W:" -msgstr "En W:" +msgstr "En An:" #: plugins/scaleratio/scaleratiowin.C:60 plugins/translate/translatewin.C:79 msgid "In H:" -msgstr "En H:" +msgstr "En Al:" #: plugins/scaleratio/scaleratiowin.C:67 msgid "Out R:" @@ -12965,12 +12965,12 @@ msgstr "I Salida D:" #: plugins/scaleratio/scaleratiowin.C:72 plugins/svg/svgwin.C:68 #: plugins/translate/translatewin.C:101 msgid "Out W:" -msgstr "Salida W:" +msgstr "Salida An:" #: plugins/scaleratio/scaleratiowin.C:77 plugins/svg/svgwin.C:77 #: plugins/translate/translatewin.C:107 msgid "Out H:" -msgstr "Salida H:" +msgstr "Salida Al:" #: plugins/scaleratio/scaleratiowin.C:92 msgid "Src X:" @@ -12982,11 +12982,11 @@ msgstr "Src Y:" #: plugins/scaleratio/scaleratiowin.C:103 msgid "Src W:" -msgstr "W Src:" +msgstr "Src An:" #: plugins/scaleratio/scaleratiowin.C:108 msgid "Src H:" -msgstr "Src H:" +msgstr "Src Al:" #: plugins/scaleratio/scaleratiowin.C:116 msgid "Dst X:" @@ -12998,11 +12998,11 @@ msgstr "Dst Y:" #: plugins/scaleratio/scaleratiowin.C:126 msgid "Dst W:" -msgstr "Dst W:" +msgstr "Dst An:" #: plugins/scaleratio/scaleratiowin.C:131 msgid "Dst H:" -msgstr "Dst H:" +msgstr "Dst Al:" #: plugins/shapewipe/shapewipe.C:92 msgid "White to Black" @@ -13722,7 +13722,7 @@ msgstr "Animación:" #: plugins/titler/titlerwindow.C:324 msgid "Drop shadow:" -msgstr "Sombra (Distancia):" +msgstr "Sombra:" #: plugins/titler/titlerwindow.C:331 msgid "Fade in (sec):" -- 2.26.2