Forums > Jitter

odd jit.expr behavior

June 19, 2006 | 11:15 am

Maybe I’m doing something with jit.expr that I’m not supposed to, but
can someone explain the result of this little patch?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 348 277 50 196617 jit.print;
#P button 348 231 15 0;
#P newex 348 253 264 196617 jit.expr 4 char 1 1 @expr "255" "5" "255"
"160";
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P window clipboard copycount 3;

It prints out "0 0 0 0" in the max window when you press the bang
button. I would expect that using a constant in jit.expr would
output that constant, not 0. I’m not saying that this is a bug, but
it’s what I would expect jit.expr to do in this case.

In the end, what I’d like to do is replace everything in a few
specific planes of an incoming matrix with a constants. I just
wanted a simple patch that created a "noisy" hue along very specific
lines, and held the saturation and luminosity of the video constant,
but due to the problem (or my misunderstanding) above, it doesn’t
work that way I’d like:

#P user jit.pwindow 241 272 98 98 0 0 0 0 0 0;
#P user jit.pwindow 125 272 98 98 0 0 0 0 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 126 185 264 196617 jit.expr 4 char 48 48 @expr "255" "in[0]"
"255" "160";
#P newex 126 215 58 196617 jit.hsl2rgb;
#P newex 126 49 57 196617 qmetro 50;
#P newex 126 85 122 196617 jit.noise 1 char 48 48;
#P connect 0 0 3 0;
#P connect 3 0 2 0;
#P fasten 3 0 5 0 131 207 247 207;
#P connect 1 0 0 0;
#P connect 2 0 4 0;
#P window clipboard copycount 6;

Best,
Evan


June 19, 2006 | 11:44 am

sorry, I should have read the fine print first before sending this
example – jit.expr only supports float32. Duh.

But there’s still the same unexpected behavior using float32 – in
this new patch, try first banging jit.expr – it will print "0. 0. 0.
0." to the max window. Then, try banging the jit.matrix – it will
print the correct constants "1. 0.5 0. 0.1" to the max window. Since
jit.expr is only supposed to print out the constants defined in it’s
expression, i’d consider this at least bug-like – it shouldn’t matter
whether or not i send it a valid matrix, those constants should
always come out, or an error, but especially not "0 0 0 0".

#P button 628 298 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 629 321 118 196617 jit.matrix 4 float32 1 1;
#P newex 458 394 50 196617 jit.print;
#P button 458 348 15 0;
#P newex 458 370 264 196617 jit.expr 4 float32 1 1 @expr "1" "0.5"
"0" "0.1";
#P connect 4 0 3 0;
#P connect 3 0 0 0;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P window clipboard copycount 5;

Best,
Evan


June 19, 2006 | 2:13 pm

I beleive that jit.expr only supports float32 matrices.
wes

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 214 202 264 196617 jit.expr 4 char 48 48 @expr "255" "in[0]"
"255" "160";
#P toggle 186 83 15 0;
#P user jit.pwindow 185 332 98 98 0 0 0 0 0 0;
#P newex 186 245 247 196617 jit.expr 4 float32 48 48 @expr "1" "in[0]" "1" ".5";
#P newex 186 275 58 196617 jit.hsl2rgb;
#P newex 186 109 57 196617 qmetro 50;
#P newex 186 145 122 196617 jit.noise 1 float32 48 48;
#P connect 3 0 2 0;
#P connect 0 0 3 0;
#P connect 1 0 0 0;
#P connect 5 0 1 0;
#P connect 2 0 4 0;
#P window clipboard copycount 7;


June 19, 2006 | 3:43 pm

Thanks for pointing this out, Evan. I can reproduce here.

FWIW, jit.expr converts all types to float32 internally, so it will be
less efficient with other data types, but it should still work (assuming
the data easily converts to float32). This appears to be a different
thing altogether.

Until we can fix this behaviour, the simple workaround is to either use
the "setall" jit.matrix message or always send a matrix through jit.expr.

Cheers,
Andrew B,


June 19, 2006 | 5:26 pm

Great. The workaround is fairly easy, I did wind up using setall.
Luckily, I’m dealing with very small matrices and so sending them to
jit.expr each time isn’t a problem this time, either. Thanks for
taking a look at it.

Best,
Evan


Viewing 5 posts - 1 through 5 (of 5 total)