Converting 3-plane matrix to 1-plane, strange jit.expr behavior
Hi there,
I want to convert a 1-dimension 3-plane matrix with RGB values to a 1-dimension 1-plane matrix, which I will eventually unroll as a list and send over a serial connection. So principle is:
3-plane matrix : r1 b1 g1, r2 b2 g2, ...
to
1-plane matrix: r1, b1, g1, r2, b2, g2,...
I came up with a jit.expr that works. A bit. 'Cause from cell 65 on it glitches. Then the R value of a cell ends up in the next cell, not the right one. It seems like some kind of rounding error.
Any thoughts on getting this right? Not necessarily using jit.expr.
Interestingly this jit.gen alternative displays a similar glitch from cell 50 on:
I'm sure I'm missing something simple here... but what?
Ok I solved it with jit.multiplex:
Still interested to learn why my previous alternatives didn't work though.