Quick background on this idea - I'm building a lighting control system that uses a 5-plane matrix (A,R,G,B, lighting fixture index) to drive lighting fixtures using arbitrary 2D RGB info. The 2D 'space' is represented as the floorplan of a venue where the ceiling is sprinkled with about 300 RGB LED fixtures. I'm laying out the LED distribution on the floorplan by sparsely populating the 5th plane of my matrix with lighting fixture indices in the appropriate locations.
The idea is that the ARGB part of the matrix can be used to generate and visualize arbitrary color content and then to subsample that color information, formatting DMX messages to the lights using the addresses in the index plane.
I underestimated the complexity of sorting the matrix based on the index plane values. I had thought I'd run some jit sort (like jit.bsort) on the index plane (sorting the ARGB info along with it), and then pull the bottom 300 or so cells from that sort (0 - number of fixtures-1) and use the ARGB info to generate DMX commands, all hopefully at a decent refresh rate.
jit.bsort sorts on only one axis at a time. My CS days were a while ago but I think I'd need to cascade some fairly significant number of jit.bsorts in order to get the result I'm looking for. Undesirable from a processor overhead standpoint.
I can make this happen without actually sorting the values - I really need only to select cells that have non-zero values in the index plane - but my iterative thinking doesn't map well to the way jitter objects work.
Can anybody advise on a best way to approach this? Pseudocode-wise, I'm thinking:
1) Take a 5-plane matrix as input (resolution of original matrix is roughly 560 x 820)
2) Select cells that have non-zero value in the 5th (index) plane
3) Extract ARGB information from those cells, coupled with their index values
4) Make available those (300-ish) 5-value lists (per frame) at a reasonable rate (~40Hz)
Thanks for any help in advance!