Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interleave / Deinterleave Arrays



On Wed, 2 Nov 2005, Olivier Tristan wrote:

> Rustam Muginov wrote:

[...]
> Here is an example
>
> float src[] = { 13.f, 22.f, 45.f, 3.f, 6.f, 8.f, 7.f, 1.f, 2.f)
> Let's say this is an audio data array with 3 channels
> so I would like to deinterleave this array into 3 other C arrays.
>
> Results:
> float *dst1 which contains 13.f, 3.f and 7.f
> float *dst2 which contains 22.f, 6.f and 1.f
> float *dst3 which contains 45.f, 8.f and 2.f
>
> For interleaving, it takes dst1, dst2 and dst3 and generate an array
> equivalent to src given a number of "channels".
>
> So it's not on a vector basis but on a whole array.
>
If the number of channels does not vary a whole lot, you could write
specific routines for each case. Some simple cases (e.g. two or four
channels) can use the predefined pack and unpack primitives, while other
cases need the more general vector permute. In case you only ever process
relatively short blocks of data that are known to reside in the cache, you
can further improve performance with creative use of vector select in
parallel with vector permute (only for certain values of number of
channels).

Programming would be simplified a lot if you could guarantee that all
participating arrays have sizes divisible by four, and are aligned in
memory.

Even if the number of channels varies widely, there might still be a
fairly small number of cases that cover most uses of the function. So it
would pay off to have special case routines for these most frequent
operations.

  Holger
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden

References: 
 >Interleave / Deinterleave Arrays (From: Olivier Tristan <email@hidden>)
 >Re: Interleave / Deinterleave Arrays (From: Rustam Muginov <email@hidden>)
 >Re: Interleave / Deinterleave Arrays (From: Olivier Tristan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.