From 196a2c029f9b1c812e1448bbc06572fc9dffe1cd Mon Sep 17 00:00:00 2001 From: Sojourner Truth <jon.w.wilkes@gmail.com> Date: Fri, 22 Jul 2016 18:51:29 -0400 Subject: [PATCH] Matt Barber's revisions to PDP: Link to pd-l2ork and remove closures --- externals/pdp/Makefile | 2 +- externals/pdp/configure.ac | 4 ++-- externals/pdp/modules/image_io/pdp_qt.c | 6 ++--- externals/pdp/opengl/Makefile.config | 2 +- externals/pdp/system/X11/pdp_xwindow.c | 3 ++- .../pdp/system/image/pdp_imageproc_portable.c | 22 +++++++++++-------- externals/pdp/system/type/pdp_bitmap.c | 10 +++++---- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/externals/pdp/Makefile b/externals/pdp/Makefile index 445a2a553..9ef3d3bd6 100644 --- a/externals/pdp/Makefile +++ b/externals/pdp/Makefile @@ -21,7 +21,7 @@ pdp_all: darwin: pdp_all rm -f pdp.pd_darwin - $(CC) -o pdp.pd_darwin modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS) -bundle -undefined dynamic_lookup -twolevel_namespace -bundle_loader $(PD_EXECUTABLE) + $(CC) -o pdp.pd_darwin modules/*/*.o system/pdp.o system/*/*.o puredata/*.o $(PDP_LIBS) -bundle -undefined dynamic_lookup -twolevel_namespace -bundle_loader ../../pd/bin/pd-l2ork linux: pdp_all diff --git a/externals/pdp/configure.ac b/externals/pdp/configure.ac index 15d686ad2..35bd1e9eb 100644 --- a/externals/pdp/configure.ac +++ b/externals/pdp/configure.ac @@ -68,7 +68,7 @@ fi if test $prefix == NONE; then - prefix=/usr/local + prefix=/Users/mbarb/build/purr-data/pd fi @@ -138,7 +138,7 @@ dnl Darwin specific stuff: this is still pretty experimental dnl How to test if frameworks are present ???? if test $ARCH == Darwin then - PD_EXECUTABLE=$prefix/bin/pd + PD_EXECUTABLE=$prefix/bin/pd-l2ork LIBS="$LIBS -L/sw/lib" CPPFLAGS="$CPPFLAGS -I/sw/include" PDP_EXTRA_CPPFLAGS="-I/sw/include" diff --git a/externals/pdp/modules/image_io/pdp_qt.c b/externals/pdp/modules/image_io/pdp_qt.c index f5fdd65e8..530b87fe1 100644 --- a/externals/pdp/modules/image_io/pdp_qt.c +++ b/externals/pdp/modules/image_io/pdp_qt.c @@ -28,9 +28,9 @@ #include "pdp_llconv.h" -#if PD_MAJOR_VERSION==0 && PD_MINOR_VERSION>=43 -#include "s_stuff.h" // need to get sys_libdir for libquicktime plugins -#endif +//#if PD_MAJOR_VERSION==0 && PD_MINOR_VERSION>=43 +#include <s_stuff.h> // need to get sys_libdir for libquicktime plugins +//#endif #define min(x,y) ((x<y)?(x):(y)) diff --git a/externals/pdp/opengl/Makefile.config b/externals/pdp/opengl/Makefile.config index b3dbb6f42..8968b3e39 100644 --- a/externals/pdp/opengl/Makefile.config +++ b/externals/pdp/opengl/Makefile.config @@ -23,7 +23,7 @@ endif ifeq ($(UNAME),Darwin) TARGET = darwin CPPFLAGS += -I/sw/include - PD_EXECUTABLE=../../../pd/src/pd + PD_EXECUTABLE=../../../pd/bin/pd-l2ork LDFLAGS = -lgsl -lGL -lGLU -lglut -lX11 -L/sw/lib -L/usr/X11R6/lib endif diff --git a/externals/pdp/system/X11/pdp_xwindow.c b/externals/pdp/system/X11/pdp_xwindow.c index 02ab5dad8..0f4e1e3c0 100644 --- a/externals/pdp/system/X11/pdp_xwindow.c +++ b/externals/pdp/system/X11/pdp_xwindow.c @@ -130,6 +130,7 @@ void pdp_xdisplay_unregister_window(t_pdp_xdisplay *d, t_pdp_xwindow *w) if (_windowset_contains(d, w)) _windowset_remove(d, w); } +static char *BUT(char *c) {return c + strlen(c) - 1;} /* LOCKING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1111*/ /* get events from display and store in queues */ @@ -145,7 +146,7 @@ void pdp_xdisplay_get_events(t_pdp_xdisplay *d) char tag_release[] = "release0"; char tag_motion[] = "motion0"; - char *BUT(char *c) {return c + strlen(c) - 1;} + /* button chars */ char *but_drag = BUT(tag_drag); diff --git a/externals/pdp/system/image/pdp_imageproc_portable.c b/externals/pdp/system/image/pdp_imageproc_portable.c index 2e2207acc..a6daa9921 100644 --- a/externals/pdp/system/image/pdp_imageproc_portable.c +++ b/externals/pdp/system/image/pdp_imageproc_portable.c @@ -576,6 +576,12 @@ void pdp_imageproc_resample_affinemap_setcentery(void *x, float f){((t_affine_ma void pdp_imageproc_resample_affinemap_setzoomx(void *x, float f){((t_affine_map *)x)->zoomx = f;} void pdp_imageproc_resample_affinemap_setzoomy(void *x, float f){((t_affine_map *)x)->zoomy = f;} void pdp_imageproc_resample_affinemap_setangle(void *x, float f){((t_affine_map *)x)->angle = f;} + + /* affine x, y mappings in screen coordinates */ + double _mapx(double _x, double _y, double cx, double cy, double c, double s, double izx) + {return cx + izx * ( c * (_x-cx) + s * (_y-cy));} + double _mapy(double _x, double _y, double cx, double cy, double c, double s, double izy) + {return cy + izy * (-s * (_x-cx) + c * (_y-cy));} void pdp_imageproc_resample_affinemap_process(void *x, u32 width, u32 height, s16 *srcimage, s16 *dstimage) { t_affine_map *a = (t_affine_map *)x; @@ -590,19 +596,17 @@ void pdp_imageproc_resample_affinemap_process(void *x, u32 width, u32 height, s1 double c = cos(angle); double s = sin(angle); - /* affine x, y mappings in screen coordinates */ - double mapx(double _x, double _y){return cx + izx * ( c * (_x-cx) + s * (_y-cy));} - double mapy(double _x, double _y){return cy + izy * (-s * (_x-cx) + c * (_y-cy));} - u32 colstate_x = (u32)(scalew * mapx(0,0)); - u32 colstate_y = (u32)(scaleh * mapy(0,0)); + + u32 colstate_x = (u32)(scalew * _mapx(0,0,cx,cy,c,s,izx)); + u32 colstate_y = (u32)(scaleh * _mapy(0,0,cx,cy,c,s,izy)); u32 rowstate_x = colstate_x; u32 rowstate_y = colstate_y; - u32 row_inc_x = (u32)(scalew * (mapx(1,0)-mapx(0,0))); - u32 row_inc_y = (u32)(scaleh * (mapy(1,0)-mapy(0,0))); - u32 col_inc_x = (u32)(scalew * (mapx(0,1)-mapx(0,0))); - u32 col_inc_y = (u32)(scaleh * (mapy(0,1)-mapy(0,0))); + u32 row_inc_x = (u32)(scalew * (_mapx(1,0,cx,cy,c,s,izx)-_mapx(0,0,cx,cy,c,s,izx))); + u32 row_inc_y = (u32)(scaleh * (_mapy(1,0,cx,cy,c,s,izy)-_mapy(0,0,cx,cy,c,s,izy))); + u32 col_inc_x = (u32)(scalew * (_mapx(0,1,cx,cy,c,s,izx)-_mapx(0,0,cx,cy,c,s,izx))); + u32 col_inc_y = (u32)(scaleh * (_mapy(0,1,cx,cy,c,s,izy)-_mapy(0,0,cx,cy,c,s,izy))); u32 i,j; diff --git a/externals/pdp/system/type/pdp_bitmap.c b/externals/pdp/system/type/pdp_bitmap.c index 0c20e67ff..40f31933c 100644 --- a/externals/pdp/system/type/pdp_bitmap.c +++ b/externals/pdp/system/type/pdp_bitmap.c @@ -509,6 +509,11 @@ static int _pdp_packet_bitmap_convert_yv12_to_image(int packet, t_pdp_symbol *de return new_p; } + inline u8 _map(s32 pixel){ + s32 mask = ~(pixel>>16); + return ((pixel >> 7) & mask); + } + static int _pdp_packet_bitmap_convert_mchp_to_rgb8(int packet, t_pdp_symbol *dest_template) { t_pdp *header = pdp_packet_header(packet); @@ -522,10 +527,7 @@ static int _pdp_packet_bitmap_convert_mchp_to_rgb8(int packet, t_pdp_symbol *des int new_p, i; // static inline u8 _map(s32 pixel){ - inline u8 _map(s32 pixel){ - s32 mask = ~(pixel>>16); - return ((pixel >> 7) & mask); - } + switch(nb_channels){ default: return -1; -- GitLab