archive-ca.com » CA » G » GRIDFLOW.CA

Total: 601

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • 1307 USA include gridflow hxx fcs define aa hardwareparams aa hardware params include include MINNOR is a typo in aalib h sorry typedef if AA LIB MINNOR 2 int else enum aa attribute endif AAAttr static map drivers class FormatAALib Format aa context context aa renderparams rparams attr bool autodraw bool raw mode varargs missing here constructor t symbol mode string target context 0 autodraw 1 argc 2 argv 2 char argv2 argc for int i 0 i imgheight context imgwidth 1 post aalib image size s Dim 3 v to s FormatAALib if context aa close context decl 0 hidecursor aa hidemouse context decl 0 print int y int x int a string text aa puts context x y AAAttr a char text data if autodraw 1 aa flush context decl 0 draw aa flush context decl 0 dump int32 v aa scrheight context aa scrwidth context 2 GridOut out this 0 Dim 3 v for int y 0 y textbuffer y aa scrwidth context x data 1 context attrbuffer y aa scrwidth context x out send 2 data grin 0 int GRID INLET 0 if context RAISE boo if in dim n 3 RAISE expecting 3 dimensions rows

    Original URL path: http://gridflow.ca/svn/trunk/src/aalib.cxx (2013-06-03)
    Open archived version from archive



  • 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 gridflow hxx fcs include for

    Original URL path: http://gridflow.ca/svn/trunk/src/android.cxx (2013-06-03)
    Open archived version from archive


  • happened when r was especially empty nnc 0 int ngreatest nt greatest T 0 if lastindexable ngreatest RAISE lastindexable d ngreatest d ask matju lastindexable ngreatest int nd nb nc na 1 COPY v in dim v na 1 COPY v na 1 r dim v nc nb nc go new GridOut this 0 Dim nd v r nt if nc 0 in set chunk na 1 GRID FLOW int na in dim n int nc in dim na 1 long size r dim prod nc long nd n nc T w n T v w if sizeof T 1 nc 1 r dim 0 send size nd tada else for int i 0 i send size p size v i TYPESWITCH r nt FOO undef FOO GRID FINISH if in dim prod 0 long n in dim prod 0 2 long size r dim prod define FOO T while n go send size T r TYPESWITCH r nt FOO undef FOO GRID END GRID INLET 1 NumberTypeE nt NumberTypeE type of data if put at reassign this was supposed to be inlets 0 sender i suppose but it s not if in sender r next new Grid in dim nt else r new Grid in dim nt return put at snap backstore r SAME TYPE in r long nn r dim n na put at dim 0 nb in dim n if nn dim prod COPY fromb nn na int32 put at na COPY sizeb nn nb int32 in dim v nb for int i 0 i nn in dim n lsd int cs in dim prod lsd nn in dim n if cs number type table in nt size 8 GridOut MAX PACKET SIZE fromb lsd 0 sizeb lsd r dim lsd break lsd long chunk lsd nn in dim n in set chunk chunk cs in dim prod chunk GRID FLOW if put at reassign COPY T r next r next p r p in dex data n return put at int32 v lsd int32 x wdex while n here d is the dim to reset d n for none for d zip cs T r v 0 cs data data cs n cs find next set of indices here d is the dim to increment for d if d Dim As or Dim As Dim Bs Dim As class GridOp attr Numop op P r constructor Numop op 0 Grid r 0 this op op op TO Numop2 gensym ignore this r r r new Grid Dim int32 e true post op name s op size d op arity d op name op size op arity grin 0 grin 1 GRID INLET 0 snap backstore r if op arity 2 SAME TYPE in r if op size 1 in dim in dim n 1 op size op arity 2 r dim r dim n 1 op size RAISE using s requires Dim d in both inlets but got left s right s op name op size in dim to s r dim to s go new GridOut this 0 in dim in nt if go inlets size 1 post 1 receiver with bugger size s go inlets 0 dim to s if go fresh go create buf force it now hack GRID FLOW long moton go buf dim prod if op arity 2 Numop2 op Numop2 this op T rdata T r long loop r dim prod while n long pn min moton n T tada pn COPY tada data pn if loop 1 if in dex pn zip pn op size tada rdata go dex else should prebuild and reuse this array when loop is small T data2 pn long ii mod go dex loop long m min loop ii pn COPY data2 rdata ii m long nn m pn m loop loop for long i m i nn COPY data2 nn rdata pn nn op zip pn op size tada data2 else op map pn tada loop rdata T 0 go send pn tada n pn data pn else Numop1 op Numop1 this op T tada n COPY tada data n op map n op size tada go send n tada GRID END GRID INPUT2 1 r GRID END end class install 2 1 add creator class GridFold attr Numop2 op attr P seed constructor Numop2 op this op op grin 0 GRID INLET 0 Dim As B Cs Dim Cs Dim As Cs if seed SAME TYPE in seed int an in dim n int bn seed seed dim n 0 if an dim 0 if op on data fold RAISE operator s does not support fold op name go new GridOut this 0 Dim an 1 v in nt in set chunk yi if in dim prod yi 0 long n go dim prod T x 0 op on x neutral x at left for long i 0 i send 1 x GRID FLOW int an in dim n int bn seed seed dim n 0 long yn in dim an bn 1 long zn in dim prod an bn T buf n yn long nn n long yzn yn zn if seed yn 1 go send nn yn data return don t know why this isn t any faster than what there was before 9 13 except for the yn 1 case above which makes a huge difference if seed for long i 0 n i zn data yzn n yzn COPY buf i T seed zn op fold zn yn buf i data else if yn for long i 0 n i zn data yzn n yzn op put zip zn buf i data op fold zn yn 1 buf i data zn else T neu op on buf neutral neu at left for long i 0 n i zn data yzn n yzn op put map zn buf i neu go send nn yn buf GRID FINISH GRID END end class install fold 1 1 class GridScan attr Numop2

    Original URL path: http://gridflow.ca/svn/trunk/src/classes1.cxx (2013-06-03)
    Open archived version from archive




  • for int i argc 1 2 i 0 i swap argv i argv argc i 1 out 0 argc argv end class install listreverse 1 1 class ListFlatten FObject vector contents constructor void traverse int argc t atom2 argv for int i 0 i r constructor 1 list argc argv decl 0 list t atom a for size t i 0 i r constructor 1 list argc argv decl 0 float float f int i int f if i int r size out 0 return out of range out 0 r i decl 1 list r resize argc for int i 0 i mosusses use vector constructor mosusses resize argc for int i 0 i tm year 1900 tmp tm mon 1 tmp tm mday tmp tm hour tmp tm min tmp tm sec t atom2 b 3 tv tv sec 86400 mod tv tv sec 86400 tv tv usec out 2 6 a out 1 3 b send out 0 strlen tt tt end class UnixTime install unix time 1 3 if using a DB 25 female connector as found on a PC then the pin numbering is like 13 1 25 14 1 STROBE the clock line is a square wave often at 9600 Hz which determines the data rate in usual circumstances 2 9 D0 D7 the eight ordinary data bits 10 ACK status bit 6 11 BUSY status bit 7 12 PAPER END status bit 5 13 SELECT status bit 4 14 AUTOFD 15 ERROR status bit 3 16 INIT 17 SELECT IN 18 25 GROUND include define LPCHAR 0x0601 define LPCAREFUL 0x0609 obsoleted wtf define LPGETSTATUS 0x060b return LP S minor define LPGETFLAGS 0x060e get status flags ifndef WIN32 include endif struct ParallelPort void ParallelPort call ParallelPort self class ParallelPort FILE f int fd int status int flags bool manually t clock clock ParallelPort if clock clock free clock if f fclose f constructor string port bool manually 0 ifdef WIN32 RAISE doesn t work on win32 endif f fopen port data r if f RAISE open s s port data strerror errno fd fileno f status 0xdeadbeef flags 0xdeadbeef this manually manually clock manually 0 clock new this void ParallelPort call clock delay clock 0 void call define FRAISE funk f RAISE can t funk s strerror ferror f decl 0 float float x uint8 foo uint8 x if fwrite foo 1 1 f call void ParallelPort call ifndef WIN32 int flags if ioctl fd LPGETFLAGS flags flags flags out 2 flags this flags flags int status if ioctl fd LPGETSTATUS status status status out 1 status this status status if clock clock delay clock 2000 endif outlet 0 reserved future use end class install parallel port 1 3 void setsels vector sels int argc t atom2 argv for int i 0 i sels constructor 1 list argc argv noutlets set 1 argc decl void anything t symbol sel argv 1 int i 0 for i 0 i sels constructor 1 list argc argv noutlets set 1 argc decl void anything t symbol sel argv 1 int i 0 for i 0 i int sgn T a T b 0 return a b class Shunt int n attr int index attr int mode attr int lo attr int hi constructor int n 2 int i 0 this n n index i mode 0 lo 0 hi n 1 noutlets set n decl 1 float int i index mod i n decl 1 list int i index mod i n necessary because otherwise void anything catches it decl void anything if int argv 0 RAISE no such method out index argv 1 argc 2 argv 2 if mode index sgn mode if index hi if gf abs mode 1 index mod index lo max hi lo 1 0 lo else mode mode index mode end class install shunt 2 0 struct Receives struct ReceivesProxy t pd x pd Receives parent t symbol suffix t class ReceivesProxy class class Receives vector rp t symbol prefix t symbol local t symbol suffix return symprintf s s prefix s name suffix s name constructor t symbol prefix s this prefix prefix gensym empty s prefix int n min 1 argc do bind argc n argv n decl 0 symbol t symbol s t atom2 a 1 s 0 list 1 a decl 0 list do unbind do bind argc argv void do bind int argc t atom2 argv rp resize argc for int i 0 i parent out 1 self suffix self parent out 0 s argc argv end class install receives 1 2 ReceivesProxy class class new gensym receives proxy 0 0 sizeof ReceivesProxy CLASS PD CLASS NOINLET A NULL class addanything ReceivesProxy class t method ReceivesProxy anything this can t report on bang float symbol pointer blob list because zgetfn can t either class ClassExists constructor decl 0 symbol t symbol s out 0 zgetfn pd objectmaker s end class install class exists 1 1 class ListEqual vector list constructor 1 list argc argv decl 1 list list resize argc for int i 0 i include ifdef WIN32 struct tms long tms utime tms stime static void times struct tms dummy define HZ 31337 define NOWIN RAISE win32 unsupported else include define NOWIN endif include include endif if defined APPLE defined FreeBSD define HZ CLK TCK endif uint64 cpu hertz int uint64 compare uint64 a uint64 b return a b class UserTime clock t time constructor 0 bang decl 0 bang NOWIN struct tms t times t time t tms utime decl 1 bang NOWIN struct tms t times t out 0 t tms utime time 1000 HZ end class install usertime 2 1 class SystemTime clock t time constructor 0 bang decl 0 bang NOWIN struct tms t times t time t tms stime decl 1 bang NOWIN struct tms t times t out 0 t tms stime time 1000 HZ end class install systemtime 2 1 class TSCTime uint64 time constructor 0 bang decl 0 bang time rdtsc decl 1 bang out 0 rdtsc time 1000 0 cpu hertz end class install tsctime 2 1 struct timeval t0 t1 uint64 u0 u1 uint64 estimates 3 for int i 0 i gl owner if canvas RAISE can t uplevel d times level canvas canvas getrootfor canvas t binbuf b canvas gl obj te binbuf t canvasenvironment ce canvas getenv canvas ostringstream o o ce argc i o ce argv i o gl owner if m RAISE no such canvas class GFCanvasFileName int n constructor int n 0 this n n decl 0 bang MOM out 0 m gl name m gl name gensym empty end class install gf canvas filename 1 1 class GFCanvasDollarZero int n constructor int n 0 this n n decl 0 bang MOM out 0 canvas getenv m ce dollarzero end class install gf canvas dollarzero 1 1 class GFCanvasGetPos int n constructor int n 0 this n n decl 0 bang MOM t atom2 a 2 m gl obj te xpix m gl obj te ypix out 0 2 a end class install gf canvas getpos 1 1 class GFCanvasSetPos int n constructor int n 0 this n n decl 0 list MOM if argc 2 RAISE wrong number of args t text m te xpix argv 0 t text m te ypix argv 1 t canvas granny m gl owner if granny RAISE chosen canvas is not in any canvas gobj vis t gobj m granny 0 gobj vis t gobj m granny 1 canvas fixlinesfor glist getcanvas granny t text m end class install gf canvas setpos 1 0 class GFCanvasEditMode int n constructor int n 0 this n n decl 0 bang MOM out 0 int m gl edit end class install gf canvas edit mode 1 1 class GFCanvasIsSelected contributed by rumence of Slovakia on IRC bugfix by matju int n constructor int n 0 this n n decl 0 bang MOM if m gl owner RAISE chosen canvas is not in any canvas out 0 glist isselected m gl owner t gobj m end class install gf canvas isselected 1 1 extern C void canvas setgraph t glist x int flag int nogoprect class GFCanvasSetGOP int n constructor int n 0 this n n decl 0 float float gop MOM canvas setgraph m int gop 0 end class install gf canvas setgop 1 0 class GFCanvasXID int n t symbol name constructor int n 0 n n name symprintf gf canvas xid lx bself pd bind t pd bself name GFCanvasXID pd unbind t pd bself name decl 0 bang MOM sys vgui pd s xid winfo id x lx c winfo id x lx n name s name long intptr t m long intptr t m decl 0 xid t symbol t t symbol u MOM out 2 symprintf x lx m out 1 u out 0 t end class install gf canvas xid 1 3 class GFCanvasHeHeHe int n constructor int n this n n decl 0 float float y MOM int osx int m gl screenx2 m gl screenx1 old size x int osy int m gl screeny2 m gl screeny1 old size y m gl screenx2 m gl screenx1 632 if m gl screeny2 m gl screeny1 gl screeny2 m gl screeny1 int y int sx int m gl screenx2 m gl screenx1 new size x int sy int m gl screeny2 m gl screeny1 new size y if osx sx osy sy sys vgui wm geometry x lx dx d n long intptr t m sx sy end class install gf canvas hehehe 1 1 define DASHRECT outline 80d4b2 dash 2 6 2 6 class GFCanvasHoHoHo int n t canvas last constructor int n this n n last 0 GFCanvasHoHoHo 0 hide decl 0 hide if last sys vgui x lx c delete lxRECT n long intptr t last long intptr t bself decl 0 list int x1 int y1 int x2 int y2 MOM 0 hide last m sys vgui x lx c create rectangle d d d d DASHRECT tags lxRECT n long intptr t m x1 y1 x2 y2 long intptr t bself end class install gf canvas hohoho 1 0 define canvas each y x for t gobj y x gl list y y y g next class GFCanvasCount int n constructor int n 0 this n n decl 0 bang MOM int k 0 canvas each y m k out 0 k end class install gf canvas count 1 1 class GFCanvasIndex int n constructor int n 0 this n n decl 0 bang MOM t canvas mm m gl owner if mm RAISE chosen canvas is not in any canvas int k 0 canvas each y mm if y t gobj m break else k out 0 k end class install gf canvas index 1 1 class GFCanvasLoadbang int n constructor int n 0 this n n decl 0 float float z MOM int k 0 canvas each y m if k z pd class t pd y canvas class canvas loadbang t canvas y k end class install gf canvas loadbang 1 0 class GFCanvasSend int n constructor int n 0 this n n decl void anything MOM typedmess t pd m argv 1 argc 2 argv 2 end class install gf canvas send 1 0 define BEGIN t outlet ouch t object mom te outlet t canvas can mom gl owner if can RAISE no such canvas for int i 0 i next if ouch RAISE no such outlet define wire each wire ouchlet for t outconnect wire ouchlet connections wire wire wire next class GFLOL int n constructor int n this n n decl 0 wire dotted int r int g int b BEGIN wire each wire ouch sys vgui x lx c itemconfigure l lx fill 02x 02x 02x dash 3 3 3 3 n long intptr t can long intptr t wire r g b decl 0 wire bracket int r int g int b BEGIN t outconnect wire t linetraverser lt linetraverser start lt can lt tr ob t object mom lt tr nextoc wire would like this shortcut but can t use it while wire linetraverser next lt if lt tr outlet ouch int x1 lt tr lx1 y1 lt tr ly1 x2 lt tr lx2 y2 lt tr ly2 sys vgui x lx c itemconfigure l lx fill 02x 02x 02x dash n x lx c coords l lx d d d d d d d d d d n long intptr t can long intptr t wire r g b long intptr t can long intptr t wire x1 y1 x1 y1 3 x1 7 y1 3 x1 7 y2 8 x2 2 y2 8 decl 0 wire hide BEGIN wire each wire ouch sys vgui x lx c delete l lx n long intptr t can long intptr t wire decl 0 box dotted int r int g int b BEGIN wire each wire ouch t object t t object wire to int x1 y1 x2 y2 gobj getrect t gobj wire to can x1 y1 x2 y2 was 00aa66 3 5 3 5 sys vgui x lx c delete lxRECT x lx c create rectangle d d d d DASHRECT tags lxRECT n long intptr t can long intptr t t long intptr t can x1 y1 x2 y2 long intptr t t decl 0 box align t symbol s int x start int y start int incr bool comment sort y lt t object const a t object const b is a StrictWeakOrdering return a te ypix te ypix static t class inlet class floatinlet class symbolinlet class pointerinlet class static bool ISINLET t pd o t class c pd class o return c inlet class c floatinlet class c symbolinlet class c pointerinlet class struct inlet t pd pd struct inlet next t object owner t pd dest t symbol symfrom union inletunion un def 0 box align t symbol dir int x start int y start int incr int x x start y y start bool horiz if dir s x horiz false else if dir s y horiz true else RAISE 1 must be x or y vector v BEGIN wire each wire ouch post wire to object of class s ISINLET d pd class wire to c name s name ISINLET wire to t object to ISINLET wire to t inlet wire to owner t object wire to v push back to sort v begin v end comment sort y lt foreach tt v t object t tt if t te xpix x t te ypix y gobj vis t gobj t can 0 t te xpix x t te ypix y gobj vis t gobj t can 1 canvas fixlinesfor can t int x1 y1 x2 y2 gobj getrect t gobj t can x1 y1 x2 y2 if horiz x x2 x1 incr else y y2 y1 incr if horiz out 0 x x start else out 0 y y start extern t widgetbehavior text widgetbehavior t widgetbehavior text widgetbehavi0r i was gonna use gobj shouldvis but it s only for 0 42 static int text chou de vis t text x t glist glist return glist gl havewindow x te pd canvas class x te pd c wb text widgetbehavior x te pd canvas class t glist x gl isgraph glist gl goprect x te type T TEXT static void text visfn hax0r t gobj o t canvas can int vis text widgetbehavior w visfn o can vis if vis return if you want to see X text inlets uncomment this line t rtext y glist findrtext can t text o if text chou de vis t text o can glist eraseiofor can t object o rtext gettag y size t properties offset end class install gf lol 1 1 class setpropertiesfn text class t propertiesfn 0xDECAFFED unsigned long lol unsigned long text class int i 0 while lol i 0xDECAFFED i char lol i 1 6 1 properties offset i class setpropertiesfn text class 0 t object bogus t object pd new text class inlet class pd class t pd inlet new bogus 0 0 0 floatinlet class pd class t pd floatinlet new bogus 0 symbolinlet class pd class t pd symbolinlet new bogus 0 pointerinlet class pd class t pd pointerinlet new bogus 0 memcpy text widgetbehavi0r text widgetbehavior sizeof t widgetbehavior text widgetbehavi0r w visfn text visfn hax0r class setwidget text class text widgetbehavi0r static t gobj canvas index t canvas x int n int i 0 for t gobj g x gl list g g g g next i if i n return g return 0 static int canvas find index t canvas x t gobj y int i 0 for t gobj g x gl list g g g g next i if g y return i return 1 static bool canvas contains t canvas x t gobj y return canvas find index x y 0 t widgetbehavior class getwidget t class x return t widgetbehavior long x properties offset 3 class GFObjectBBox constructor void look at t gobj o t widgetbehavior wb class getwidget pd class t pd o if wb RAISE not a patchable object if canvas contains mom o RAISE object is not in this canvas int x1 y1 x2 y2 wb w getrectfn o mom x1 y1 x2 y2 t atom2 a 4 x1 y1 x2 y2 out 0 4 a decl 0 symbol t symbol s if s s thing RAISE no such object if pd class s s thing c name gensym bindlist RAISE multiple such objects look at t gobj s s thing decl 0 float int i if i from from this to to decl 0 symbol t symbol victim string a string replace victim s name from s name to s name out 0 gensym a c str end class install

    Original URL path: http://gridflow.ca/svn/trunk/src/classes2.cxx (2013-06-03)
    Open archived version from archive


  • val form initialize3 end class install labelling 1 0 add creator labeling class GridPerspective attr int32 z grin 0 constructor int32 z 256 this z z GRID INLET 0 int n in dim n int32 v n COPY v in dim v n v n 1 in set chunk in dim n 1 go new GridOut this 0 Dim n v in nt GRID FLOW int m in dim prod in dim n 1 for n n m data m op mul map m 1 data T z op div map m 1 data data m 1 go send m 1 data GRID END end class install perspective 1 1 add creator perspective class GridBorder attr Dim diml attr Dim dimr P diml grid P dimr grid grin 0 grin 1 int grin 2 int constructor Grid dl 0 Grid dr 0 t atom2 a 2 1 1 diml grid dl dl new Grid 2 a int32 e dimr grid dr dr new Grid 2 a int32 e diml diml grid to dim dimr dimr grid to dim GRID INLET 0 int n in dim n if n 3 RAISE only 2 or 3 dims supported for now if diml n n RAISE diml mismatch if dimr n n RAISE dimr mismatch if diml n 2 diml 2 diml n 2 dimr 2 RAISE can t augment channels todo int32 v n for int i 0 i send zxc duh for int y 0 y send diml 1 sc duh go send sxc data y sxc go send dimr 1 sc duh for int i 0 i send zxc duh GRID END GRID INPUT 1 diml grid diml diml grid to dim GRID END GRID INPUT 2 dimr grid dimr dimr grid to dim GRID END end class install border 3 1 static CONSTRAINT expect picture if d n 3 RAISE height width chans dimensions please static CONSTRAINT expect rgb picture expect picture d nt if d 2 3 RAISE red green blue channels please static CONSTRAINT expect rgba picture expect picture d nt if d 2 4 RAISE red green blue alpha channels please Dim A B Cs Dim D E Dim A B Cs static CONSTRAINT expect convolution matrix if d n 2 RAISE only exactly two dimensions allowed for now got d d n class GridConvolve entry in a compiled convolution kernel struct PlanEntry long y long x long k bool neutral PlanEntry long y long x long k bool neutral y y x x k k neutral neutral attr Numop2 op attr Numop2 fold attr P seed attr P b attr bool wrap attr bool anti vector plan int margx margy margins constructor Grid r 0 b but expect convolution matrix this op op mul this fold op add this seed 0 new Grid Dim int32 e true this b r r new Grid Dim 1 1 int32 e true this wrap true this anti true grin 0 grin 1 template void copy row Dim dim T data T buf long sx long y long x template void muladd row Dim dim T data T buf long sx long y long x T m template void mul row Dim dim T data T buf long sx long y long x T m template void make plan T bogus template void GridConvolve copy row Dim dim T data T buf long sx long y long x long day dim 0 dax dim 1 dac dim prod 2 y mod y day x mod x dax T ap data y dax dac while sx long sx1 min sx dax x COPY buf ap x dac sx1 dac x 0 buf sx1 dac sx sx1 define UNROLL 8B MACRO LABEL N A B ARGS int n N 7 A n B n N n switch n LABEL case 0 MACRO 0 case 1 MACRO 1 case 2 MACRO 2 case 3 MACRO 3 case 4 MACRO 4 case 5 MACRO 5 case 6 MACRO 6 case 7 MACRO 7 A 8 B 8 N 8 ARGS fprintf stderr n d n N if N goto LABEL map then zip UNROLL 8 and UNROLL 8B seem to be pretty useless nowadays gcc 4 x and even the whole muladd mul business seems to not have so much effect template void muladd int n T as T bs T c fprintf stderr muladd n d as p bs p c d n n as bs c if n return if c 1 define FOO I as I bs I UNROLL 8B FOO L1 n as bs undef FOO else if c 1 define FOO I as I bs I UNROLL 8B FOO L2 n as bs undef FOO else define FOO I as I bs I c UNROLL 8B FOO L3 n as bs undef FOO template void mul int n T as T bs T c fprintf stderr mul n d as p bs p c d n n as bs c if n return if c 1 define FOO I as I bs I UNROLL 8B FOO L1 n as bs undef FOO else if c 1 define FOO I as I bs I UNROLL 8B FOO L2 n as bs undef FOO else define FOO I as I bs I c UNROLL 8B FOO L3 n as bs undef FOO map then zip template void muladd int n T as T bs T c if c 1 while n as bs else if c 1 while n as bs else else while n as bs c template void mul int n T as T bs T c if c 1 while n as bs else if c 1 while n as bs else while n as bs c template void GridConvolve muladd row Dim dim T data T buf long sx long y long x T m long day dim 0 dax dim 1 dac dim prod 2 y mod y day x mod x dax T ap data y dax dac while sx long sx1 min sx dax x muladd sx1 dac buf ap x dac m x 0 buf sx1 dac sx sx1 template void GridConvolve mul row Dim dim T data T buf long sx long y long x T m long day dim 0 dax dim 1 dac dim prod 2 y mod y day x mod x dax T ap data y dax dac while sx long sx1 min sx dax x mul sx1 dac buf ap x dac m x 0 buf sx1 dac sx sx1 template void GridConvolve make plan T bogus Dim db b dim long dby db 0 long dbx db 1 plan clear for long y 0 y on rh is neutral rh at right bool absorbent op on rh is absorbent rh at right T foo 1 0 how does this work again if absorbent op map 1 foo rh absorbent fold on rh is neutral foo 0 at right if absorbent continue plan push back PlanEntry y x k neutral GRID INLET 0 SAME TYPE in b if seed SAME TYPE in seed Dim da in dim db b dim if db n 2 RAISE right grid must have two dimensions if da n dim n RAISE seed must be scalar if da 0 dim 1 long day go dim 0 long n go dim prod 1 long sx go dim 1 dbx 1 long sxc go dim prod 2 sx T buf n T buf2 sxc if op op mul fold op add seed T seed T 0 for long ay 0 ay send n buf else T orh 0 for long ay 0 ay map n buf seed T seed T 0 for size t i 0 i map sxc buf2 rh fold zip n buf buf2 bx go dim prod 2 orh rh go send n buf GRID END GRID INPUT 1 b GRID END end class install convolve 2 1 scale by does quick scaling of pictures by integer factors Dim A B 3 Dim C D 3 static CONSTRAINT expect scale factor if d n 1 RAISE expecting no more than one dimension if d prod 1 d prod 2 RAISE expecting only one or two numbers class GridScaleBy attr P scale integer scale factor int scaley int scalex constructor Grid factor 0 scale but expect scale factor t atom2 a 1 2 scale factor factor new Grid 1 a prepare scale factor grin 0 grin 1 void prepare scale factor scaley max 1 int32 scale 0 scalex max 1 int32 scale scale dim prod 1 GRID INLET 0 Dim a in dim expect picture a in nt go new GridOut this 0 Dim a 0 scaley a 1 scalex a 2 in nt in set chunk 1 GRID FLOW int rowsize in dim prod 1 T buf rowsize scalex int chans in dim 2 define Z z buf p z data i z for n 0 data rowsize n rowsize int p 0 define LOOP z for int i 0 i send rowsize scalex buf undef Z GRID END GRID INPUT 1 scale prepare scale factor GRID END end class install scale by 2 1 add creator scale by Dim A B 3 Dim C D 3 class GridDownscaleBy attr P scale attr bool smoothly int scaley int scalex P temp constructor Grid factor 0 t symbol option 0 scale but expect scale factor t atom2 a 1 2 scale factor factor new Grid 1 a int32 e prepare scale factor smoothly option gensym smoothly grin 0 grin 1 void prepare scale factor scaley int32 scale 0 scalex int32 scale scale dim prod 1 0 1 if scaley dim prod 1 T buf T temp maybe should be something else than T to avoid overflow int xinc in dim 2 scalex int y in dex rowsize int chans in dim 2 define Z z buf p z data i z if smoothly while n 0 if y scaley 0 CLEAR buf rowsize2 define LOOP z for int i 0 p 0 p sender op div map rowsize2 buf T scalex scaley go send rowsize2 buf CLEAR buf rowsize2 data rowsize n rowsize undef Z else define Z z buf p z data i z for n 0 go sender data rowsize n rowsize y if y scaley 0 continue define LOOP z for int i 0 p 0 p send rowsize2 buf undef Z GRID END GRID INPUT 1 scale prepare scale factor GRID END end class install downscale by 2 1 add creator downscale by class GridLayer P r constructor r but expect rgb picture r new Grid Dim 1 1 3 int32 e true grin 0 int grin 1 int GRID INLET 0 SAME TYPE in r Dim a in dim expect rgba picture a in nt if a 1 r dim 1 RAISE same width please if a 0 r dim 0 RAISE same height please in set chunk 2 go new GridOut this 0 r dim GRID FLOW T rr T r in dex 3 4 T foo n 3 4 define COMPUTE ALPHA c a foo j c data i c data i a rr j c 256 data i a 8 for int i 0 j 0 i send n 3 4 foo GRID END GRID INPUT 1 r GRID END end class install layer 2 1 add creator layer pad1 pad2 only are there for 32 byte alignment struct Line int32 y1 x1 y2 x2 x m ox dir static CONSTRAINT expect polygon if d n 2 d 1 2 RAISE expecting Dim n 2 polygon enum DrawMode DRAW FILL DRAW LINE DRAW POINT enum OmitMode OMIT NONE OMIT LAST OMIT ODD enum Rule RULE ODDEVEN RULE WINDING RULE MULTI DrawMode convert const t atom2 x DrawMode foo t symbol s convert x t symbol 0 if s gensym fill return DRAW FILL if s gensym line return DRAW LINE if s gensym point return DRAW POINT RAISE unknown DrawMode s want fill or line s s name OmitMode convert const t atom2 x OmitMode foo t symbol s convert x t symbol 0 if s gensym none return OMIT NONE if s gensym last return OMIT LAST if s gensym odd return OMIT ODD RAISE unknown OmitMode s want none or last or odd s s name Rule convert const t atom2 x Rule foo t symbol s convert x t symbol 0 if s gensym oddeven return RULE ODDEVEN if s gensym winding return RULE WINDING if s gensym multi return RULE MULTI RAISE unknown Rule s want oddeven or winding or multi s s name class DrawPolygon attr Numop2 op attr P color attr P polygon attr DrawMode draw attr OmitMode omit attr Rule rule unimplemented P color2 P lines int lines start int lines stop constructor Numop2 op op put Grid color 0 Grid polygon 0 draw DRAW FILL omit OMIT NONE rule RULE ODDEVEN this color but expect one dim this polygon but expect polygon this op op this color color color new Grid Dim 1 int32 e true this polygon polygon polygon new Grid Dim 0 2 int32 e true changed grin 0 grin 1 grin 2 int32 void init lines void changed t symbol s 0 init lines void DrawPolygon init lines if polygon return int tnl polygon dim 0 total number of vertices int nl draw DRAW FILL tnl omit OMIT LAST max 0 tnl 1 omit OMIT ODD tnl 1 2 tnl number of lines to draw lines new Grid Dim nl 8 int32 e Line ld Line int32 lines int32 pd polygon for int i 0 j 0 i ld i y2 memswap int32 ld i 0 int32 ld i 2 2 long dy ld i y2 ld i y1 long dx ld i x2 ld i x1 ld i m dy dx y1 Line b y1 static int order by column const void a const void b return Line a x Line b x GRID INLET 0 SAME TYPE in color if in dim n 3 RAISE expecting 3 dimensions if in dim 2 color dim 0 RAISE image does not have same number of channels d as stored color d in dim 2 color dim 0 go new GridOut this 0 in dim in nt lines start lines stop 0 in set chunk 1 int nl lines dim 0 qsort int32 lines nl sizeof Line order by starting scanline int cn color dim prod color2 new Grid Dim cn 16 color nt for int i 0 i dim 0 Line ld Line int32 lines int f in dim prod 1 int y in dex f int cn color dim prod T cd T color2 while n while lines stop nl ld lines stop y1 16 lines stop if draw DRAW POINT int fudge draw DRAW FILL 0 1 for int i lines start i send f data else int32 xl in dim 1 T data2 f COPY data2 data f for int i lines start i 16 if draw DRAW POINT qsort ld lines start lines stop lines start sizeof Line order by column if draw DRAW FILL if rule RULE ODDEVEN for int i lines start i 16 op zip 16 cn data2 cn xs cd xs 16 op zip xe xs cn data2 cn xs cd else for int k 0 i lines start i 16 for int w 0 w zip 16 cn data2 cn xs cd xs 16 for int w 0 w zip xe xs cn data2 cn xs cd else if draw DRAW LINE for int i lines start i xl xe xl continue xs max 0 xs xe min xl xe while xe xs 16 op zip 16 cn data2 cn xs cd xs 16 op zip xe xs cn data2 cn xs cd else for int i lines start i xl continue op zip xe xs cn data2 cn xs cd lines start lines stop go send f data2 n f data f y GRID END GRID INPUT 1 color GRID END GRID INPUT 2 polygon init lines GRID END end class install draw polygon 3 1 add creator draw polygon static CONSTRAINT expect position if d n 1 RAISE position should have 1 dimension not d d n if d 0 2 RAISE position dim 0 should have 2 elements not d d 0 class DrawImage attr Numop2 op attr P image attr P position attr bool alpha attr bool tile constructor Numop2 op op put Grid image 0 Grid position 0 alpha false tile false this op op this position but expect position this image but expect picture this image image image new Grid Dim 1 1 3 int32 e true this position position position new Grid Dim 2 int32 e true grin 0 grin 1 grin 2 int32 draw row ry of right image in row buffer buf starting at xs overflow on both sides has to be handled automatically by this method template void draw segment T obuf T ibuf int ry int x0 define COMPUTE ALPHA c a obuf j c ibuf j c rbuf a obuf j c ibuf j c 256 define COMPUTE ALPHA4 b COMPUTE ALPHA b 0 b 3 COMPUTE ALPHA b 1 b 3 COMPUTE ALPHA b 2 b 3 obuf b 3 rbuf b 3 255 rbuf b 3 ibuf j b 3 256 template void DrawImage draw segment T obuf T ibuf int ry int x0 if ry image dim 0 return outside of image int sx in 0 dim 1 rsx image dim 1 int sc in 0 dim 2 rsc image dim 2 T rbuf T image ry rsx rsc if x0 sx x0 sx n sx x0 if x0 zip sc obuf j rbuf COMPUTE ALPHA 0 3 COMPUTE ALPHA 1 3 COMPUTE ALPHA 2 3 else if alpha rsc 4 sc 4 RGBA by RGBA op zip

    Original URL path: http://gridflow.ca/svn/trunk/src/classes3.cxx (2013-06-03)
    Open archived version from archive


  • unbind and bindlist anything class MouseSpyProxy t clock clock t symbol rcv t pd snd constructor t symbol r s empty snd 0 rcv r s empty 0 r if rcv pd bind t pd bself rcv decl void anything if snd pd anything snd argv 1 argc 2 argv 2 void set rcv t symbol rcv 0 if rcv pd unbind t pd bself rcv rcv rcv if rcv pd bind t pd bself rcv static void bye void x INIT1 clock free self clock if self rcv pd unbind t pd bself self rcv pd free t pd x void delayed free snd 0 clock clock new bself void bye clock delay clock 0 end class install gf mouse spy proxy 1 1 class MouseSpy int y x flags t pd snd BFObject proxy constructor t symbol rcv s default snd 0 t atom2 a 1 rcv s default symprintf x x mom rcv pd anything pd objectmaker gensym gf mouse spy proxy 1 a proxy BFObject pd newest MouseSpyProxy proxy self snd t pd bself y x flags 0 void set rcv t symbol rcv 0 MouseSpyProxy proxy self set rcv rcv MouseSpy MouseSpyProxy proxy self delayed free void event const char ss t symbol key 0 t atom2 a 4 y x flags 511 if key a 3 key t symbol s gensym ss if snd pd anything t pd snd s key 4 3 a else out 0 s key 4 3 a decl 0 mouse int x int y int but int z 0 y y x x flags 128 128 keyboard i symprintf c i keyboard i if key key symprintf whoah d i event on keypress keyrelease key decl void anything end class install gf mouse spy 1 1 s default gensym default s empty gensym empty copied from io sdl KEYS ARE 8 BackSpace Tab KEYS ARE 13 Return KEYS ARE 19 Pause KEYS ARE 27 Escape KEYS ARE 32 space exclam quotedbl numbersign dollar percent ampersand apostrophe KEYS ARE 40 parenleft parenright asterisk plus comma minus period slash KEYS ARE 48 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 KEYS ARE 58 colon semicolon less equal greater question at KEYS ARE 91 bracketleft backslash bracketright asciicircum underscore grave quoteleft KEYS ARE 65 a b c d e f g h i j k l m n o p q r s t u v w x y z KEYS ARE 97 a b c d e f g h i j k l m n o p q r s t u v w x y z KEYS ARE 127 Delete class GridSee GUI FObject BFObject spy P buf bool hold bool fast string filename FILE file decl 0 fast bool fast 1 this fast fast t clock clock pitià à à à à à à à à à à à à à à int my1 mx1 my2 mx2 margins t symbol receive constructor bool fast false clock

    Original URL path: http://gridflow.ca/svn/trunk/src/classes_gui.cxx (2013-06-03)
    Open archived version from archive


  • 1024 lut for clipping because YUV2R G B formula outputs can go from 317 to 573 inline uint8 fastclip int x return cliptab x 384 be careful with this these convert from reduced range YUV to full range RGB define YUV2R Y U V fastclip 298 Y 16 409 V 128 128 8 define YUV2G Y U V fastclip 298 Y 16 100 U 128 208 V 128 128 8 define YUV2B Y U V fastclip 298 Y 16 516 U 128 128 8 define YUV2RGB b Y U V b 0 YUV2R Y U V b 1 YUV2G Y U V b 2 YUV2B Y U V these convert from reduced range YUV to full range YUV define YUV2Y Y U V fastclip 298 Y 16 128 8 define YUV2U Y U V fastclip 293 U 128 128 8 128 define YUV2V Y U V fastclip 293 V 128 128 8 128 define YUV2YUV b Y U V b 0 YUV2Y Y U V b 1 YUV2U Y U V b 2 YUV2V Y U V these are for reading different memory layouts of YUV define GET420P x do Y1 bufy x 0 U bufu x 2 Y2 bufy

    Original URL path: http://gridflow.ca/svn/trunk/src/colorspace.hxx (2013-06-03)
    Open archived version from archive


  • 2 3 image formats start at 384 and are VGA NONCOMPRESSED SVGA NONCOMPRESSED 1 SVGA NONCOMPRESSED 2 and continue at 390 and are STILL IMAGE FORMAT SCALABLE IMAGE SIZE define FEATURE foo feature names i foo i 416 FEATURE BRIGHTNESS FEATURE EXPOSURE FEATURE SHARPNESS FEATURE WHITE BALANCE FEATURE HUE FEATURE SATURATION FEATURE GAMMA FEATURE SHUTTER FEATURE GAIN FEATURE IRIS FEATURE FOCUS FEATURE TEMPERATURE FEATURE TRIGGER FEATURE TRIGGER DELAY FEATURE WHITE SHADING FEATURE FRAME RATE i 16 16 reserved features FEATURE ZOOM FEATURE PAN FEATURE TILT FEATURE OPTICAL FILTER i 12 12 reserved features FEATURE CAPTURE SIZE FEATURE CAPTURE QUALITY i 14 14 reserved features i 480 operation modes OPERATION MODE LEGACY OPERATION MODE 1394B i 512 sensor layouts RGGB GBRG GRBG BGGR i 544 IIDC VERSION if 0 IIDC VERSION 1 04 IIDC VERSION 1 20 IIDC VERSION PTGREY IIDC VERSION 1 30 IIDC VERSION 1 31 IIDC VERSION 1 32 IIDC VERSION 1 33 IIDC VERSION 1 34 IIDC VERSION 1 35 IIDC VERSION 1 36 IIDC VERSION 1 37 IIDC VERSION 1 38 IIDC VERSION 1 39 endif Return values are SUCCESS FAILURE NO FRAME NO CAMERA Parameter flags for dc1394 setup format7 capture define QUERY FROM CAMERA 1 define USE MAX AVAIL 2 define USE RECOMMENDED 3 The video1394 policy blocking wait for a frame forever or polling returns if no frames in buffer WAIT 0 POLL 1 typedef raw1394handle t RH typedef nodeid t NID define IO func args if func rh usenode args DC1394 SUCCESS RAISE func failed class FormatDC1394 Format RH rh int useport int usenode int framerate e int height int width dc1394 cameracapture camera dc1394 feature set features map feature index constructor t symbol mode bool gotone false post DC1394 hello world rh raw1394 new handle if rh RAISE could not get

    Original URL path: http://gridflow.ca/svn/trunk/src/dc1394.cxx (2013-06-03)
    Open archived version from archive