Forums > Jitter

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

Jan 06 2012 | 6:13 pm

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. --

```
```
Jan 06 2012 | 6:28 pm

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.

Jan 06 2012 | 6:30 pm

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

Jan 06 2012 | 6:37 pm

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

``````
-- Pasted Max  Patch, click to expand. --

```
```
Jan 06 2012 | 6:40 pm

You misspelled in:

``````
-- Pasted Max  Patch, click to expand. --

```
```
Jan 06 2012 | 6:50 pm

Well, that’ll do it.

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

Thanks!

Jan 07 2012 | 11:44 pm

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. --

```
```
Viewing 7 posts - 1 through 7 (of 7 total)

Forums > Jitter