sorting a matrix / gpbitonicsort.jxf shader

Dec 10, 2013 at 1:19pm

sorting a matrix / gpbitonicsort.jxf shader

Hi there,

I’m trying to sort a 4 plane matrix depending on the values of 1 plane of that matrix. Eg. if you got a 3×3-Matrix with values

1 1 1 1; 4 3 1 4; 2 0 9 3
8 2 9 3; 5 7 8 1; 6 9 4 1
9 6 1 2; 7 2 7 1; 3 1 3 5

and sort the matrix depending on plane 1 you’ll get

1 1 1 1; 2 0 9 3; 3 1 3 5
4 3 1 4; 5 7 8 1; 6 9 4 1
7 2 7 1; 8 2 9 3; 9 6 1 2

So the goal is to sort the entire matrix. Not just the columns or rows, which would be possible with j.bsort. The operation will be performed with videomatrices .. so they can get quiet big. Unfortunately I didn’t find a solution to perform this operation by using matrix-processing objects. Currently I’m using a workaround whereby I parse the matrix into lists, which then get sorted and afterwards recombined. Although this works quiet fine it is fairly cpu intensitiv and (because of the limitations of zl objects to 32768) I can’t process matrices greater than 208×156.

I was hoping that the gpbitonicsort shader could be used to do what I want to do (and let the GPU do the work).. but as I am just start working with shaders and the documentation on the shaders included in jitter is quiet poor, I can’t get it running. Strictly speaking I even don’t no if it does what I want to do .. :).

Hope anyone can shed some light on the functionality of this shader or has some other approach to the problem.

Thanks in advance
Julian

#275356

You must be logged in to reply to this topic.