Algorithm to make interleaved buffer to non-interleaved

B

Barzo

Hi,

I have an interleaved audio buffer: short* Buffer.
And I have to to this conversion

[A][C][A][C][A][C] -> [A][A][A][C][C][C]

Is there some pattern or specific algorithm?
Thanks,
Daniele.
 
J

Jonathan Lee

Hi,

I have an interleaved audio buffer: short* Buffer.
And I have to to this conversion

[A][C][A][C][A][C] -> [A][A][A][C][C][C]

Is there some pattern or specific algorithm?
Thanks,
Daniele.


You want to look for matrix transposition algorithms.

If you have different input and output arrays, the simplest
thing to do is to just copy all the As then all the Bs, etc. More
or less what Sam pointed out. This can cause some cache thrash,
though. There are cache oblivious algorithms to handle that.

If you have to do it in place, Google for "in situ matrix
transposition".

--Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top