Math operations on true/false flags from [jit.op]?

Jan 6, 2012 at 6:13pm

Math operations on true/false flags from [jit.op]?

from my observations, true/false data from jit.op or jit.expr render as 0 or 255 in a jit.cellblock, but do not behave like real integers if further math is done on them. Is there something special about true/false output from jiter operations that I should know about?

I am working with char matrices. Here is an example patch:

Thanks!

– Pasted Max Patch, click to expand. –
#61061
Jan 6, 2012 at 6:28pm

What do you mean they don’t behave like real integers? in char-land true=255, false=0 as you noticed. It’s basically true=white, 0=black. long matrices have 0/1 behavior. If you do jit.op @op > and then multiply the result by a video, the video’s pixels will be multiplied by 255 where true, which doesn’t affect their brightness. If true were 1 as you suggest, then you’d have to multiply the output of jit.op @op > by 255 before using the T/F matrix to mask an image.

#220014
Jan 6, 2012 at 6:30pm

Strange, now it just started working in the demo patch, but not in my real patch. Time to rebuild.

#220015
Jan 6, 2012 at 6:37pm

Here is an example of [jit.expr] generating zeros for all output instead of processing the math:

– Pasted Max Patch, click to expand. –
#220016
Jan 6, 2012 at 6:40pm

You misspelled in:

– Pasted Max Patch, click to expand. –
#220017
Jan 6, 2012 at 6:50pm

Well, that’ll do it.

Is it Max’s fault? 0
Is it my fault? 255

Thanks!

#220018
Jan 7, 2012 at 11:44pm

With further investigation I found that scalar values are not properly calculated in the expression. They work as expected from a float32 matrix though (of course the number ranges are different because float32 noise generates 0. to 1. vs. char noise 0 to 255

Note that the same multiplier written into the expression, and it works as I would expect.

– Pasted Max Patch, click to expand. –
#220019

You must be logged in to reply to this topic.