From: Good Guy Date: Sat, 27 Apr 2019 20:09:10 +0000 (-0600) Subject: upgrades/fixes for tracer plugin, add vdpau,vaapi build depends X-Git-Tag: 2019-08~62 X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=a4091ab5bcfb46773cbabaf1303c427346b35fbe;p=goodguy%2Fcinelerra.git upgrades/fixes for tracer plugin, add vdpau,vaapi build depends --- diff --git a/cinelerra-5.1/blds/PKGBUILD b/cinelerra-5.1/blds/PKGBUILD index 3cddc5a0..70d20d81 100644 --- a/cinelerra-5.1/blds/PKGBUILD +++ b/cinelerra-5.1/blds/PKGBUILD @@ -11,7 +11,7 @@ DEPENDS=( 'alsa-lib' 'atk' 'bzip2' 'cairo' 'expat' 'fftw' 'flac' 'glib2' 'glibc' 'glu' 'graphite' 'gtk2' 'harfbuzz' 'libavc1394' 'libdatrie' 'libdv' 'libffi' 'libglvnd' 'libiec61883' 'libjpeg-turbo' 'libogg' 'libpng' 'libraw1394' 'libsndfile' 'libthai' 'libusb' - 'libtheora' 'libtiff' 'libutil-linux' 'libvdpau' 'libvorbis' + 'libtheora' 'libtiff' 'libutil-linux' 'libvdpau' 'libva' 'libvorbis' 'libvpx' 'libx11' 'libxau' 'libxcb' 'libxcomposite' 'libxcursor' 'libxdamage' 'libxdmcp' 'libxext' 'libxfixes' 'libxft' 'libxi' 'libxinerama' 'libxrandr' 'libxrender' 'libxv' 'numactl' 'opus' @@ -34,7 +34,6 @@ prepare() { build() { cd "$srcdir/cinelerra-$pkgver" ./autogen.sh - export FFMPEG_EXTRA_CFG=" --disable-vdpau" ./configure --prefix=/usr --with-exec-name=$pkgname CFG_VARS="\ CFLAGS+=' -Wno-narrowing -O2 -g -fno-omit-frame-pointer' \ diff --git a/cinelerra-5.1/blds/bsd.bld b/cinelerra-5.1/blds/bsd.bld index 072a9ca7..82155896 100755 --- a/cinelerra-5.1/blds/bsd.bld +++ b/cinelerra-5.1/blds/bsd.bld @@ -11,6 +11,7 @@ alias make=gmake --disable-static-build --with-lv2=auto --disable-lame --disable-twolame \ --with-oss --without-alsa --without-firewire --without-dv --without-dvb \ --without-video4linux2 --without-xxf86vm --without-ladspa-build \ - --without-libzmpeg --without-commercial --without-thirdparty + --without-libzmpeg --without-commercial --without-thirdparty \ + --disable-vaapi --disable-vdpau gmake gmake install ) 2>&1 | tee log diff --git a/cinelerra-5.1/blds/cin.SlackBuild b/cinelerra-5.1/blds/cin.SlackBuild index 8555bb43..f05f658b 100644 --- a/cinelerra-5.1/blds/cin.SlackBuild +++ b/cinelerra-5.1/blds/cin.SlackBuild @@ -69,9 +69,6 @@ git clone --depth 1 $GITURL $PRGNAM-$VERSION cd $PRGNAM-$VERSION/cinelerra-5.1 chown -R root:root . -# disable vdpau or ffmpeg won't build on Slackware 14.2 -export FFMPEG_EXTRA_CFG=" --disable-vdpau" - # configure the build ./autogen.sh diff --git a/cinelerra-5.1/blds/cinelerra.spec b/cinelerra-5.1/blds/cinelerra.spec index 6c8353a9..2e28e105 100644 --- a/cinelerra-5.1/blds/cinelerra.spec +++ b/cinelerra-5.1/blds/cinelerra.spec @@ -50,6 +50,8 @@ BuildRequires: ncurses-devel BuildRequires: texinfo BuildRequires: udftools BuildRequires: gtk2-devel +BuildRequires: va-devel +BuildRequires: vdpau-devel %{?rhat:BuildRequires: alsa-lib-devel} %{?rhat:BuildRequires: bzip2-devel} %{?rhat:BuildRequires: xorg-x11-fonts-cyrillic} diff --git a/cinelerra-5.1/blds/debian/control b/cinelerra-5.1/blds/debian/control index 74672f66..ef41478a 100644 --- a/cinelerra-5.1/blds/debian/control +++ b/cinelerra-5.1/blds/debian/control @@ -10,7 +10,7 @@ Build-Depends: nasm, yasm, g++, gdb, build-essential, e2fsprogs, freeglut3-dev, libxv-dev, libasound2-dev, libncurses5-dev, libxinerama-dev, libfreetype6-dev, libxft-dev, ttf-bitstream-vera, xfonts-75dpi, xfonts-100dpi, fonts-dejavu, - libflac-dev, inkscape, texinfo, libpng-dev, + libflac-dev, inkscape, texinfo, libpng-dev, libvdpau-dev, libva-dev, cmake, udftools, libxml2-utils, git, gettext, libtool, autoconf, automake diff --git a/cinelerra-5.1/plugins/tracer/tracer.C b/cinelerra-5.1/plugins/tracer/tracer.C index be58496d..a40d0c27 100644 --- a/cinelerra-5.1/plugins/tracer/tracer.C +++ b/cinelerra-5.1/plugins/tracer/tracer.C @@ -56,9 +56,9 @@ TracerPoint::~TracerPoint() TracerConfig::TracerConfig() { - drag = draw = fill = 0; - radius = 0; scale = 1; - selected = 0; + drag = draw = 1; fill = 0; + feather = 0; radius = 1; + invert = 0; selected = -1; } TracerConfig::~TracerConfig() { @@ -69,8 +69,9 @@ int TracerConfig::equivalent(TracerConfig &that) if( this->drag != that.drag ) return 0; if( this->draw != that.draw ) return 0; if( this->fill != that.fill ) return 0; + if( this->feather != that.feather ) return 0; + if( this->invert != that.invert ) return 0; if( this->radius != that.radius ) return 0; - if( this->scale != that.scale ) return 0; if( this->points.size() != that.points.size() ) return 0; for( int i=0, n=points.size(); ipoints[i], *bp = that.points[i]; @@ -86,8 +87,9 @@ void TracerConfig::copy_from(TracerConfig &that) this->draw = that.draw; this->fill = that.fill; this->selected = that.selected; + this->feather = that.feather; + this->invert = that.invert; this->radius = that.radius; - this->scale = that.scale; points.remove_all_objects(); for( int i=0,n=that.points.size(); i=0 ? 0 : rr-1; - for( int i=0; i 0 ? 0xff : 0; + float p = powf(10.f, s/2); + for( int i=0; i 255 ) vv = 255; + psf[i] = vv; + } for( int i=0,n=points.size(); ix-r, xn=pt->x+r; @@ -557,12 +562,11 @@ void Tracer::feather(int r, double s) bclamp(yn, 0, h); for( int y=ys ; yx, dy = y-pt->y; int dd = dx*dx + dy*dy; if( dd >= rr ) continue; - int pix = msk_rows[y][x], v = psf[dd]; - msk_rows[y][x] = dir >= 0 ? pix+v-(pix*v)/255 : (pix*v)/255; + int v = psf[dd], px = msk_rows[y][x]; + if( dir < 0 ? pxv ) msk_rows[y][x] = v; } } } @@ -576,8 +580,7 @@ void Tracer::draw_mask() uint8_t *mp = msk_rows[y]; uint8_t *rp = frm_rows[y]; for( int x=0; xplugin = plugin; this->title_x = 0; this->point_x = 0; @@ -93,9 +93,9 @@ TracerWindow::TracerWindow(Tracer *plugin) this->new_point = 0; this->del_point = 0; this->point_up = 0; this->point_dn = 0; this->drag = 0; this->draw = 0; - this->dragging = 0; + this->button_no = 0; this->invert = 0; this->title_r = 0; this->title_s = 0; - this->radius = 0; this->scale = 0; + this->feather = 0; this->radius = 0; this->last_x = 0; this->last_y = 0; this->point_list = 0; this->pending_config = 0; } @@ -110,10 +110,11 @@ void TracerWindow::create_objects() { int x = 10, y = 10; int margin = plugin->get_theme()->widget_border; - TracerPoint *pt = plugin->config.points[plugin->config.selected]; + int hot_point = plugin->config.selected; add_subwindow(title_x = new BC_Title(x, y, _("X:"))); int x1 = x + title_x->get_w() + margin; - point_x = new TracerPointX(this, x1, y, pt->x); + TracerPoint *pt = hot_point >= 0 ? plugin->config.points[hot_point] : 0; + point_x = new TracerPointX(this, x1, y, !pt ? 0 : pt->x); point_x->create_objects(); x1 += point_x->get_w() + margin; add_subwindow(new_point = new TracerNewPoint(this, plugin, x1, y)); @@ -122,7 +123,7 @@ void TracerWindow::create_objects() y += point_x->get_h() + margin; add_subwindow(title_y = new BC_Title(x, y, _("Y:"))); x1 = x + title_y->get_w() + margin; - point_y = new TracerPointY(this, x1, y, pt->y); + point_y = new TracerPointY(this, x1, y, !pt ? 0 : pt->y); point_y->create_objects(); x1 += point_y->get_w() + margin; add_subwindow(del_point = new TracerDelPoint(this, plugin, x1, y)); @@ -140,22 +141,31 @@ void TracerWindow::create_objects() x1 += draw->get_w() + margin + 20; add_subwindow(fill = new TracerFill(this, x1, y)); x1 += drag->get_w() + margin + 20; - add_subwindow(reset = new TracerReset(this, plugin, x1, y+3)); - y += drag->get_h() + margin; - - add_subwindow(title_r = new BC_Title(x1=x, y, _("Radius:"))); - x1 += title_r->get_w() + margin; - add_subwindow(radius = new TracerRadius(this, x1, y, 100)); - x1 += radius->get_w() + margin + 20; - add_subwindow(title_s = new BC_Title(x1, y, _("Scale:"))); - x1 += title_s->get_w() + margin; - add_subwindow(scale = new TracerScale(this, x1, y, 100)); - y += radius->get_h() + margin + 20; + int y1 = y + 3; + add_subwindow(reset = new TracerReset(this, plugin, x1, y1)); + y1 += reset->get_h() + margin; + add_subwindow(invert = new TracerInvert(this, plugin, x1, y1)); + y += drag->get_h() + margin + 15; + + x1 = x + 80; + add_subwindow(title_r = new BC_Title(x, y, _("Feather:"))); + add_subwindow(feather = new TracerFeather(this, x1, y, 150)); + y += feather->get_h() + margin; + add_subwindow(title_s = new BC_Title(x, y, _("Radius:"))); + add_subwindow(radius = new TracerRadius(this, x1, y, 150)); + y += radius->get_h() + margin + 5; add_subwindow(point_list = new TracerPointList(this, plugin, x, y)); point_list->update(plugin->config.selected); -// y += point_list->get_h() + 10; - + y += point_list->get_h() + 10; + + add_subwindow(new BC_Title(x, y, _( + "Btn1: select/drag point\n" + "Btn2: drag all points\n" + "Btn3: add point on nearest line\n" + "Btn3: shift: append point to end\n" + "Wheel: rotate, centered on cursor\n" + "Wheel: shift: scale, centered on cursor\n"))); show_window(1); } @@ -190,7 +200,7 @@ int TracerWindow::do_grab_event(XEvent *event) cx -= canvas->view_x; cy -= canvas->view_y; - if( !dragging ) { + if( !button_no ) { if( cx < 0 || cx >= canvas->view_w || cy < 0 || cy >= canvas->view_h ) return 0; @@ -198,15 +208,15 @@ int TracerWindow::do_grab_event(XEvent *event) switch( event->type ) { case ButtonPress: - if( dragging ) return 0; - dragging = event->xbutton.state & ShiftMask ? -1 : 1; + if( button_no ) return 0; + button_no = event->xbutton.button; break; case ButtonRelease: - if( !dragging ) return 0; - dragging = 0; + if( !button_no ) return 0; + button_no = 0; return 1; case MotionNotify: - if( !dragging ) return 0; + if( !button_no ) return 0; break; default: return 0; @@ -229,20 +239,62 @@ int TracerWindow::do_grab_event(XEvent *event) point_y->update((int64_t)(output_y)); TracerPoints &points = plugin->config.points; - if( dragging > 0 ) { - switch( event->type ) { - case ButtonPress: { - int button_no = event->xbutton.button; - int hot_point = -1; - if( button_no == RIGHT_BUTTON ) { - hot_point = plugin->new_point(); - TracerPoint *pt = points[hot_point]; - pt->x = output_x; pt->y = output_y; - point_list->update(hot_point); - break; - } + switch( event->type ) { + case ButtonPress: { + float s = 1.02; + float th = M_PI/360.f; // .5 deg per wheel_btn + int shift_down = event->xbutton.state & ShiftMask; + switch( button_no ) { + case WHEEL_DOWN: + s = 0.98; + th = -th; // fall thru + case WHEEL_UP: { + // shift_down scale, !shift_down rotate + float st = sin(th), ct = cos(th); int sz = points.size(); - if( hot_point < 0 && sz > 0 ) { + for( int i=0; ix - output_x, py = pt->y - output_y; + float nx = shift_down ? px*s : px*ct + py*st; + float ny = shift_down ? py*s : py*ct - px*st; + point_list->set_point(i, PT_X, pt->x = nx + output_x); + point_list->set_point(i, PT_Y, pt->y = ny + output_y); + } + point_list->update(-1); + button_no = 0; + break; } + case RIGHT_BUTTON: { + // shift_down adds to end + int sz = !shift_down ? points.size() : 0; + int k = !shift_down ? -1 : points.size()-1; + float mx = FLT_MAX; + for( int i=0; ix, y0 = pt0->y; + float x1 = pt1->x, y1 = pt1->y; + float dx = x1-x0, dy = y1-y0; + float rr = dx*dx + dy*dy; + if( !rr ) continue; + float u = ((x1-output_x)*dx + (y1-output_y)*dy) / rr; + if( u < 0 || u > 1 ) continue; // past endpts + float x = x0*u + x1*(1-u); + float y = y0*u + y1*(1-u); + dx = output_x-x; dy = output_y-y; + float dd = dx*dx + dy*dy; // d**2 closest approach + if( mx > dd ) { mx = dd; k = i; } + } + TracerPoint *pt = points[sz=plugin->new_point()]; + int hot_point = k+1; + for( int i=sz; i>hot_point; --i ) points[i] = points[i-1]; + points[hot_point] = pt; + pt->x = output_x; pt->y = output_y; + point_list->update(hot_point); + break; } + case LEFT_BUTTON: { + int hot_point = -1, sz = points.size(); + if( sz > 0 ) { TracerPoint *pt = points[hot_point=0]; double dist = DISTANCE(output_x,output_y, pt->x,pt->y); for( int i=1; iupdate_list(hot_point); } break; } - case MotionNotify: { + } + break; } + case MotionNotify: { + switch( button_no ) { + case LEFT_BUTTON: { int hot_point = point_list->get_selection_number(0, 0); if( hot_point >= 0 && hot_point < points.size() ) { TracerPoint *pt = points[hot_point]; @@ -276,11 +332,7 @@ int TracerWindow::do_grab_event(XEvent *event) point_list->update_list(hot_point); } break; } - } - } - else { - switch( event->type ) { - case MotionNotify: { + case MIDDLE_BUTTON: { float dx = output_x - last_x, dy = output_y - last_y; int sz = points.size(); for( int i=0; iconfig.points.size(); + if( k < 0 || k >= sz ) k = -1; + plugin->config.selected = k; update_selection(&cols[0], k); + int xpos = get_xposition(), ypos = get_yposition(); BC_ListBox::update(&cols[0], &titles[0],&widths[0],PT_SZ, xpos,ypos,k); center_selection(); } @@ -411,9 +466,7 @@ void TracerPointList::update(int k) if( k >= 0 && k < sz ) { gui->point_x->update(gui->point_list->cols[PT_X].get(k)->get_text()); gui->point_y->update(gui->point_list->cols[PT_Y].get(k)->get_text()); - plugin->config.selected = k; } - update_list(k); } @@ -423,9 +476,9 @@ void TracerWindow::update_gui() drag->update(config.drag); draw->update(config.draw); fill->update(config.fill); + feather->update(config.feather); radius->update(config.radius); - scale->update(config.scale); - drag->update(config.drag); + invert->update(config.invert); point_list->update(-1); } @@ -525,26 +578,26 @@ int TracerFill::handle_event() return 1; } -TracerRadius::TracerRadius(TracerWindow *gui, int x, int y, int w) - : BC_ISlider(x,y,0,w,w, -50,50, gui->plugin->config.radius) +TracerFeather::TracerFeather(TracerWindow *gui, int x, int y, int w) + : BC_ISlider(x,y,0,w,w, -50,50, gui->plugin->config.feather) { this->gui = gui; } -int TracerRadius::handle_event() +int TracerFeather::handle_event() { - gui->plugin->config.radius = get_value(); + gui->plugin->config.feather = get_value(); gui->send_configure_change(); return 1; } -TracerScale::TracerScale(TracerWindow *gui, int x, int y, int w) - : BC_FSlider(x,y, 0,w,w, 1.f,10.f, gui->plugin->config.scale) +TracerRadius::TracerRadius(TracerWindow *gui, int x, int y, int w) + : BC_FSlider(x,y, 0,w,w, -5.f,5.f, gui->plugin->config.radius) { this->gui = gui; } -int TracerScale::handle_event() +int TracerRadius::handle_event() { - gui->plugin->config.scale = get_value(); + gui->plugin->config.radius = get_value(); gui->send_configure_change(); return 1; } @@ -581,10 +634,7 @@ int TracerDelPoint::handle_event() TracerPoints &points = plugin->config.points; if( hot_point >= 0 && hot_point < points.size() ) { plugin->config.del_point(hot_point); - if( !points.size() ) plugin->new_point(); - int sz = points.size(); - if( hot_point >= sz && hot_point > 0 ) --hot_point; - gui->point_list->update(hot_point); + gui->point_list->update(--hot_point); gui->send_configure_change(); } return 1; @@ -602,18 +652,41 @@ TracerReset::~TracerReset() int TracerReset::handle_event() { TracerConfig &config = plugin->config; - config.drag = 0; - config.draw = 0; + if( !config.drag ) { + MWindow *mwindow = plugin->server->mwindow; + CWindowGUI *cwindow_gui = mwindow->cwindow->gui; + if( gui->grab(cwindow_gui) ) + config.drag = 1; + else + gui->drag->flicker(10,50); + } + config.draw = 1; config.fill = 0; - config.radius = 0; - config.scale = 1; - config.selected = 0; + config.invert = 0; + config.feather = 0; + config.radius = 1; + config.selected = -1; TracerPoints &points = plugin->config.points; points.remove_all_objects(); - plugin->new_point(); - gui->point_list->update(0); + gui->point_list->update(-1); gui->update_gui(); gui->send_configure_change(); return 1; } +TracerInvert::TracerInvert(TracerWindow *gui, Tracer *plugin, int x, int y) + : BC_CheckBox(x, y, gui->plugin->config.invert, _("Invert")) +{ + this->gui = gui; + this->plugin = plugin; +} +TracerInvert::~TracerInvert() +{ +} +int TracerInvert::handle_event() +{ + plugin->config.invert = get_value(); + gui->send_configure_change(); + return 1; +} + diff --git a/cinelerra-5.1/plugins/tracer/tracerwindow.h b/cinelerra-5.1/plugins/tracer/tracerwindow.h index b6231cf7..75532822 100644 --- a/cinelerra-5.1/plugins/tracer/tracerwindow.h +++ b/cinelerra-5.1/plugins/tracer/tracerwindow.h @@ -31,14 +31,15 @@ class TracerPointY; class TracerDrag; class TracerDraw; class TracerFill; +class TracerFeather; class TracerRadius; -class TracerScale; class TracerPointList; class TracerNewPoint; class TracerDelPoint; class TracerPointUp; class TracerPointDn; class TracerReset; +class TracerInvert; class TracerNum : public BC_TumbleTextBox @@ -104,19 +105,19 @@ public: TracerWindow *gui; }; -class TracerRadius : public BC_ISlider +class TracerFeather : public BC_ISlider { public: - TracerRadius(TracerWindow *gui, int x, int y, int w); + TracerFeather(TracerWindow *gui, int x, int y, int w); int handle_event(); TracerWindow *gui; }; -class TracerScale : public BC_FSlider +class TracerRadius : public BC_FSlider { public: - TracerScale(TracerWindow *gui, int x, int y, int w); + TracerRadius(TracerWindow *gui, int x, int y, int w); int handle_event(); TracerWindow *gui; @@ -206,6 +207,18 @@ public: TracerWindow *gui; }; +class TracerInvert : public BC_CheckBox +{ +public: + TracerInvert(TracerWindow *gui, Tracer *plugin, int x, int y); + ~TracerInvert(); + + int handle_event(); + + Tracer *plugin; + TracerWindow *gui; +}; + class TracerWindow : public PluginClientWindow { @@ -229,16 +242,17 @@ public: TracerDelPoint *del_point; TracerPointUp *point_up; TracerPointDn *point_dn; - int dragging, pending_config; + int button_no, pending_config; float last_x, last_y; TracerDrag *drag; TracerDraw *draw; TracerFill *fill; BC_Title *title_r, *title_s; + TracerFeather *feather; TracerRadius *radius; - TracerScale *scale; TracerPointList *point_list; TracerReset *reset; + TracerInvert *invert; }; #endif