Detecting change to jit.matrix

Mar 1, 2007 at 1:16am

Detecting change to jit.matrix

Hello all,

I’m trying to rig up a way to detect that the contents of a jit.matrix have changed. Couldn’t figure out if/how jit.op might be of service. Seems like comparing the totalled output of jit.iter on the live matrix to that of another matrix storing preceding frame could be useful… similar to a derivative of the example at the end of the jit.iter html help file… but my best attempt to copy it accurately (and subsequently troubleshoot) isn’t working. I get low numbers that are likely just the value of the last cell. Also, I’m working with fairly large matrices, so something speedier would be ideal. I tried making a version of that jit.iter help html file that unpacked the channels so I could just run the comparison on a single channel, but I’m still having a problem with that whole construct.

I’ve included my best efforts at the aforementioned below in case this is the best way and somebody can see what I’m doing wrong. Or perhaps there’s a more elegant solution, especially for a large matrix? Thanks!

Jeff

#P button 382 113 15 0;
#P window setfont “Sans Serif” 9.;
#P number 130 240 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user jit.pwindow 291 77 82 62 0 1 0 0 1 0;
#P window linecount 2;
#P message 404 270 50 196617 255 9 13 19;
#P window linecount 1;
#P newex 404 246 62 196617 prepend set;
#P newex 404 223 76 196617 vexpr $i1+$i2;
#P newex 421 196 36 196617 zl reg;
#P message 441 171 43 196617 0 0 0 0;
#P newex 441 149 43 196617 route 0;
#P newex 441 127 43 196617 route 0;
#P newex 404 126 27 196617 t l b;
#P button 355 28 15 0;
#P message 382 28 94 196617 importmovie , bang;
#P newex 382 52 131 196617 jit.matrix 4 char @adapt 1;
#P newex 382 76 41 196617 jit.iter;
#P user jit.pwindow 17 72 82 62 0 1 0 0 1 0;
#P newex 130 218 76 196617 vexpr $i1+$i2;
#P newex 147 189 36 196617 zl reg;
#P message 167 166 43 196617 0 0 0 0;
#P newex 167 144 43 196617 route 0;
#P newex 167 122 43 196617 route 0;
#P newex 130 121 27 196617 t l b;
#P newex 108 97 76 196617 unpack 0 0 0 0;
#P button 81 23 15 0;
#P message 108 23 94 196617 importmovie , bang;
#P newex 108 47 131 196617 jit.matrix 4 char @adapt 1;
#P newex 108 71 41 196617 jit.iter;
#P window linecount 2;
#P comment 37 168 74 196617 single channel attempt;
#P window linecount 3;
#P comment 294 171 100 196617 just trying to get the help example to work!;
#P fasten 22 0 23 1 426 221 475 221;
#P fasten 21 0 24 0 446 191 500 191 500 242 409 242;
#P fasten 21 0 22 1 446 191 452 191;
#P connect 20 0 21 0;
#P connect 19 0 20 0;
#P fasten 14 1 19 0 402 96 466 96 466 122 446 122;
#P connect 18 1 22 0;
#P connect 24 0 25 0;
#P connect 23 0 24 0;
#P connect 18 0 23 0;
#P connect 14 0 28 0;
#P connect 14 0 18 0;
#P connect 15 0 26 0;
#P connect 15 0 14 0;
#P connect 17 0 15 0;
#P connect 16 0 15 0;
#P fasten 11 0 12 1 152 210 201 210;
#P fasten 10 0 11 1 172 186 178 186;
#P connect 9 0 10 0;
#P connect 8 0 9 0;
#P fasten 2 1 8 0 128 91 192 91 192 117 172 117;
#P connect 7 1 11 0;
#P connect 12 0 27 0;
#P connect 7 0 12 0;
#P connect 6 1 7 0;
#P connect 2 0 6 0;
#P connect 3 0 13 0;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P connect 5 0 3 0;
#P window clipboard copycount 29;

#30554
Mar 1, 2007 at 2:05am

jit.change?

wes

On 2/28/07, Jeff Burger wrote:
>
> Hello all,
>
> I’m trying to rig up a way to detect that the contents of a jit.matrix have changed. Couldn’t figure out if/how jit.op might be of service. Seems like comparing the totalled output of jit.iter on the live matrix to that of another matrix storing preceding frame could be useful… similar to a derivative of the example at the end of the jit.iter html help file… but my best attempt to copy it accurately (and subsequently troubleshoot) isn’t working. I get low numbers that are likely just the value of the last cell. Also, I’m working with fairly large matrices, so something speedier would be ideal. I tried making a version of that jit.iter help html file that unpacked the channels so I could just run the comparison on a single channel, but I’m still having a problem with that whole construct.
>
> I’ve included my best efforts at the aforementioned below in case this is the best way and somebody can see what I’m doing wrong. Or perhaps there’s a more elegant solution, especially for a large matrix? Thanks!
>
> Jeff
>
> #P button 382 113 15 0;
> #P window setfont “Sans Serif” 9.;
> #P number 130 240 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P user jit.pwindow 291 77 82 62 0 1 0 0 1 0;
> #P window linecount 2;
> #P message 404 270 50 196617 255 9 13 19;
> #P window linecount 1;
> #P newex 404 246 62 196617 prepend set;
> #P newex 404 223 76 196617 vexpr $i1+$i2;
> #P newex 421 196 36 196617 zl reg;
> #P message 441 171 43 196617 0 0 0 0;
> #P newex 441 149 43 196617 route 0;
> #P newex 441 127 43 196617 route 0;
> #P newex 404 126 27 196617 t l b;
> #P button 355 28 15 0;
> #P message 382 28 94 196617 importmovie , bang;
> #P newex 382 52 131 196617 jit.matrix 4 char @adapt 1;
> #P newex 382 76 41 196617 jit.iter;
> #P user jit.pwindow 17 72 82 62 0 1 0 0 1 0;
> #P newex 130 218 76 196617 vexpr $i1+$i2;
> #P newex 147 189 36 196617 zl reg;
> #P message 167 166 43 196617 0 0 0 0;
> #P newex 167 144 43 196617 route 0;
> #P newex 167 122 43 196617 route 0;
> #P newex 130 121 27 196617 t l b;
> #P newex 108 97 76 196617 unpack 0 0 0 0;
> #P button 81 23 15 0;
> #P message 108 23 94 196617 importmovie , bang;
> #P newex 108 47 131 196617 jit.matrix 4 char @adapt 1;
> #P newex 108 71 41 196617 jit.iter;
> #P window linecount 2;
> #P comment 37 168 74 196617 single channel attempt;
> #P window linecount 3;
> #P comment 294 171 100 196617 just trying to get the help example to work!;
> #P fasten 22 0 23 1 426 221 475 221;
> #P fasten 21 0 24 0 446 191 500 191 500 242 409 242;
> #P fasten 21 0 22 1 446 191 452 191;
> #P connect 20 0 21 0;
> #P connect 19 0 20 0;
> #P fasten 14 1 19 0 402 96 466 96 466 122 446 122;
> #P connect 18 1 22 0;
> #P connect 24 0 25 0;
> #P connect 23 0 24 0;
> #P connect 18 0 23 0;
> #P connect 14 0 28 0;
> #P connect 14 0 18 0;
> #P connect 15 0 26 0;
> #P connect 15 0 14 0;
> #P connect 17 0 15 0;
> #P connect 16 0 15 0;
> #P fasten 11 0 12 1 152 210 201 210;
> #P fasten 10 0 11 1 172 186 178 186;
> #P connect 9 0 10 0;
> #P connect 8 0 9 0;
> #P fasten 2 1 8 0 128 91 192 91 192 117 172 117;
> #P connect 7 1 11 0;
> #P connect 12 0 27 0;
> #P connect 7 0 12 0;
> #P connect 6 1 7 0;
> #P connect 2 0 6 0;
> #P connect 3 0 13 0;
> #P connect 3 0 2 0;
> #P connect 4 0 3 0;
> #P connect 5 0 3 0;
> #P window clipboard copycount 29;
>
>
> –
> http://www.jeffreypaulburger.com
> http://www.jpburger.com
>

#97863
Mar 5, 2007 at 6:36am

jit.duh! Just never encountered it before. Thx, Wes!

Jeff

#97864
Mar 5, 2007 at 8:37am

wesly (or any with know) , if you care to expand on the jit.change a bit.
i have been using unique 1 on my jit.dx.grab with much better preformance
from my cpu.
only yestrday i started applying it to jit.qt.movie also (after scanning the
archives for better multi qt playing tips).
adding the unique attribute realy made a big improvment when banging a
qt.movie to fast for it own good.
my question is a design one.
does applying a jit.change in importent matrix crossroards is a good one,
stopping un-changed matrix from flowing thru.
and, is it better to speedlim a qt.movie Vs. unique 1 ?

On 3/5/07, Jeff Burger wrote:
>
>
> jit.duh! Just never encountered it before. Thx, Wes!
>
> Jeff
> –
> http://www.jeffreypaulburger.com
> http://www.jpburger.com
>

#97865
Mar 5, 2007 at 8:44am

Applying it a jit.qt.movie makes the most sense since this is where
your source material originates and us unadulterated. Further down
the processing chain, I think you’ll see little to no improvement both
efficiency-wise and aesthetically. This is because for any moderately
involved processing chain with any feedback you’re going to get more
variation and jit.change not save you anything. If you trty to
compensate by setting the jit.change threshold higher, you’ll get
jumpier results.

wes

On 3/5/07, yair reshef wrote:
> wesly (or any with know) , if you care to expand on the jit.change a bit.
> i have been using unique 1 on my jit.dx.grab with much better preformance
> from my cpu.
> only yestrday i started applying it to jit.qt.movie also (after scanning the
> archives for better multi qt playing tips).
> adding the unique attribute realy made a big improvment when banging a
> qt.movie to fast for it own good.
> my question is a design one.
> does applying a jit.change in importent matrix crossroards is a good one,
> stopping un-changed matrix from flowing thru.
> and, is it better to speedlim a qt.movie Vs. unique 1 ?
>
>
>
> On 3/5/07, Jeff Burger wrote:
> >
> > jit.duh! Just never encountered it before. Thx, Wes!
> >
> > Jeff
> > –
> > http://www.jeffreypaulburger.com
> > http://www.jpburger.com
> >
>
>
>
>

#97866
Mar 5, 2007 at 9:41am

@unique uses a fairly lightweight method to determine whether a new
matrix should be sent out or not. Since speedlim/qlim don’t know
anything about the contents of the movie, I would generally opt for
using @unique, if you need to thin the output of jit.qt.movie.

jit.change has to do a pixel-by-pixel comparison of each incoming
matrix to the previous one. As such, it’s a bit slower. However, it’s
a bit unclear to me what multiple “time thinning” would provide: if
your movies are being @unique’d, the rate of outgoing matrices isn’t
going to speed up as the patch runs.

jb

Am 05.03.2007 um 09:37 schrieb yair reshef:

> does applying a jit.change in importent matrix crossroards is a
> good one,
> stopping un-changed matrix from flowing thru.
> and, is it better to speedlim a qt.movie Vs. unique 1 ?

#97867
Mar 5, 2007 at 11:39am

i ask because i am hacking the moviebank js example to spit random movies on
named textures.
one of my functions, which handles the bang routine is not banging the movie
directly but a dummy matrix that the qt.movie is passing matrix into.
if you someone has the time please go over this and see if this can be
better managed.

the javascript accepts 3 kind of lists.
the first is newTextures = which is iterated and passed as a 2 member
sequence with the second member a random index of a movie file from the
patchmedia folder, inside the function another function is called,
createMovTexture which handles the creating of new movie textures and the
binding to named textures.

goneTextures, handles the freepeering of textures etc.

sameTextures is banged with a metro for the actuall playing of the qt.movies
.

again, any help would be welcomed. im on win/xp btw

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 65 43 158 9109513 readfolder ./patches/media/quiltTest;
#P window setfont “Sans Serif” 14.;
#P message 10 98 16 9109518 4;
#B color 6;
#P message 363 91 16 9109518 3;
#B color 6;
#P message 236 25 16 9109518 2;
#B color 6;
#P message 121 111 16 9109518 1;
#B color 6;
#P window setfont “Sans Serif” 9.;
#P newex 366 390 320 9109513 jit.gl.videoplane table @position 0.5 -0.5@scale
0.3 0.3 @texture m3;
#P newex 366 350 323 9109513 jit.gl.videoplane table @scale 0.3 0.3@position -
0.5 -0.5 @texture m1;
#P newex 366 410 312 9109513 jit.gl.videoplane table @position 0.5 0. @scale
0.3 0.3 @texture m4;
#P newex 366 430 315 9109513 jit.gl.videoplane table @scale 0.3 0.3@position -
0.5 0. @texture m5;
#P window setfont “Sans Serif” 14.;
#P number 299 111 35 14 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P newex 253 111 44 9109513 pack 0 0;
#P newex 253 67 45 9109513 t i b;
#P newex 253 48 21 9109513 iter;
#N vpatcher -34 432 196 832;
#P inlet 88 26 15 0;
#P window setfont “Sans Serif” 12.;
#P window linecount 0;
#P newex 52 153 27 9109516 i;
#P newex 68 235 21 9109516 t b;
#P newex 52 203 50 9109516 sel 1;
#P newex 52 179 48 9109516 ==;
#P newex 50 122 50 9109516 t i b i;
#P window linecount 2;
#P message 90 77 36 9109516 clear , bang;
#P window linecount 1;
#P newex 50 50 50 9109516 urn 10;
#P newex 68 266 31 9109516 i;
#P inlet 50 30 15 0;
#P outlet 68 293 15 0;
#P connect 1 0 3 0;
#P fasten 4 0 3 0 95 117 160 117 160 42 55 42;
#P fasten 7 0 3 0 57 227 157 227 157 44 55 44;
#P connect 3 0 5 0;
#P connect 5 1 9 0;
#P connect 9 0 6 0;
#P connect 6 0 7 0;
#P connect 7 1 8 0;
#P connect 8 0 2 0;
#P connect 2 0 0 0;
#P connect 5 0 9 1;
#P connect 5 2 2 1;
#P connect 10 0 3 1;
#P connect 3 1 4 0;
#P connect 5 2 6 1;
#P pop;
#P newobj 287 90 51 9109513 p goodUrn;
#P window setfont “Sans Serif” 14.;
#P message 350 115 76 9109518 1 2 3 4 5 6;
#P window setfont “Sans Serif” 9.;
#P newex 253 141 96 9109513 prepend newTextures;
#P newex 350 141 100 9109513 prepend goneTextures;
#P message 21 283 54 9109513 name table;
#P user jit.pwindow 20 305 322 242 0 0 0 0 1 0;
#X name table;
#P message 31 161 115 9109513 sameTextures 1 2 3 4 5 6;
#P newex 366 370 317 9109513 jit.gl.videoplane table @position 0.5 0.5@scale
0.3 0.3 @texture m2;
#P newex 366 450 320 9109513 jit.gl.videoplane table @scale 0.3 0.3@position -
0.5 0.5 @texture m6;
#P newex 3 221 53 9109513 t b b erase;
#P newex 3 250 77 9109513 jit.gl.render table;
#P comment 231 221 60 9109513 movie count;
#P number 195 221 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ubumenu 84 221 100 9109513 0 1 1 0;
#X add bball.mov;
#X add blading.mov;
#X add countdown.mov;
#X add countdown15.mov;
#X add crashtest.mov;
#X add dishes.mov;
#X add dozer.mov;
#X add dvducks.mov;
#X add dvkite.mov;
#X add garbage.mov;
#X add oh.mov;
#X add ozone.mov;
#X add rain.mov;
#X add rca.mov;
#X add redball.mov;
#X add track1.mov;
#X add track2.mov;
#X add traffic.mov;
#X add wheel.mov;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P message 84 131 120 9109513 readfolder ./patches/media;
#P number 71 101 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 31 101 15 0;
#P newex 31 130 50 9109513 qmetro 2;
#P newex 31 196 116 9109513 js moviebank_totexture.js;
#P window linecount 2;
#P comment 83 243 124 9109513 output designed to populate umenu/ubumenu;
#P window setfont “Sans Serif” 14.;
#P window linecount 1;
#P message 253 24 76 9109518 1 2 3 4 5 6;
#P fasten 6 0 2 0 89 185 36 185;
#P connect 19 0 17 0;
#P fasten 2 2 8 0 142 217 200 217;
#P fasten 2 2 20 1 142 217 340 217 340 87 333 87;
#P fasten 20 0 24 0 304 109;
#P fasten 20 0 23 1 292 107 292 107;
#P connect 22 1 20 0;
#P connect 23 0 18 0;
#P connect 22 0 23 0;
#P connect 21 0 22 0;
#P fasten 0 0 21 0 258 50 258 50;
#P fasten 2 1 7 0 89 217 89 217;
#P connect 5 0 3 1;
#P connect 14 0 2 0;
#P fasten 18 0 2 0 258 185 36 185;
#P fasten 17 0 2 0 355 185 36 185;
#P fasten 3 0 11 0 36 154 8 154;
#P connect 3 0 14 0;
#P connect 4 0 3 0;
#P connect 16 0 15 0;
#P connect 11 0 10 0;
#P fasten 11 2 10 0 50 245 8 245;
#P window clipboard copycount 34;

//////////////////////////////////////////////////
//JS FILE moviebank_totexture.js
//////////////////////////////////////////////////
autowatch=1;
outlets = 3;
post(“ncompiledn”);
//
var vdim = [512,512];
var vindex = 0;
var vcount = 0;
var movarray = new Array();
var glTextureArray = new Array();
var outmatrix = new Array();
var dummymatrix = new JitterMatrix(4,”char”,vdim[0],vdim[1]);
var filenames = new Array();
var texMatrix = new Array();

//
//
function sameTextures(){ //this list accepts currently playing texture
numbers and use them to bang
var a = arrayfromargs(arguments);
for(i=0;i
if (movarray[a[i]]){

movarray[a[i]].matrixcalc(outmatrix[a[i]]/*null*/,outmatrix[a[i]]);
glTextureArray[a[i]].jit_matrix(“texMatrix”+a[i]);
}
}
}
//
function newTextures()//this list will initiate new textures
{
var a = arrayfromargs(arguments);
vindex = a[0];
createMovTexture(vindex,a[1]); //look for this function for
initializing
movarray[vindex].frame(0)
movarray[vindex].start();

}
//
function goneTextures()//this list will deal with gone textures, freepeer
stylie
{
var a = arrayfromargs(arguments);
for(i=0;i< a.length;i++){
vindex = a[i];
movarray[vindex].dispose();
glTextureArray[vindex].freepeer();
glTextureArray[vindex].name= false;
//post(glTextureArray[vindex].name+”nn”);
movarray[vindex].matrixcalc(dummymatrix/*null*/,dummymatrix);
}
}

//
//read ze folder
function readfolder(foldername)
{
var fold;
var i,rv;

fold = new Folder(foldername);
fold.typelist = ["MooV"]
if (fold.count) {
// build filename array
vcount = 0; //number of valid movies in folder
fold.reset();
filenames = new Array();
outlet(1,”clear”); //reset umenu
// dump movienames to ubmenu
for (i=0;i
fold.next();
filenames[vcount] = fold.pathname + “/” + fold.filename;
outlet(1,”append”,fold.filename);
vcount++;
}

outlet(2,vcount); //send number of movies to leftmost outlet
}
}
//
// this function creates movies and binds them to texture absed on the name
of the blob
//add random run on valid movie names in folder (filenames array)
function createMovTexture(name, urn){
movarray[name] = new JitterObject(” jit.qt.movie”);
glTextureArray[name] = new JitterObject(“jit.gl.texture”,”table”);
glTextureArray[name].name=”m”+name;
movarray[name].autostart = 0;
movarray[name].loadram = 1;
movarray[name].vol = 0;
movarray[name].unique = 1;
rv = movarray[name].read(filenames[urn]);
if (rv[1]==1) { // success, read returns an array [filename,success]
outmatrix[name] = new JitterMatrix(4,”char”,vdim[0],vdim[1]);
outmatrix[name].name=”texMatrix”+name;
/* Actually only MOPs support the matrixcalc() method. All the
gl objects use the
jit_matrix method which requires being sent as a name. So the
following:
texture.jit_matrix(matx.name); */
glTextureArray[name].jit_matrix(“texMatrix”+name);
}
//post(glTextureArray[name].name+”nn”);
}

On 3/5/07, Jeremy Bernstein wrote:
>
> @unique uses a fairly lightweight method to determine whether a new
> matrix should be sent out or not. Since speedlim/qlim don’t know
> anything about the contents of the movie, I would generally opt for
> using @unique, if you need to thin the output of jit.qt.movie.
>
> jit.change has to do a pixel-by-pixel comparison of each incoming
> matrix to the previous one. As such, it’s a bit slower. However, it’s
> a bit unclear to me what multiple “time thinning” would provide: if
> your movies are being @unique’d, the rate of outgoing matrices isn’t
> going to speed up as the patch runs.
>
> jb
>
> Am 05.03.2007 um 09:37 schrieb yair reshef:
>
> > does applying a jit.change in importent matrix crossroards is a
> > good one,
> > stopping un-changed matrix from flowing thru.
> > and, is it better to speedlim a qt.movie Vs. unique 1 ?
>
>

#97868

You must be logged in to reply to this topic.