Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channel-major vs frame-major? #59

Open
ssfrr opened this issue Mar 18, 2020 · 3 comments
Open

channel-major vs frame-major? #59

ssfrr opened this issue Mar 18, 2020 · 3 comments
Milestone

Comments

@ssfrr
Copy link
Collaborator

ssfrr commented Mar 18, 2020

Given that there are likely a number of breaking changes coming down the pike, this might be a good time to think about whether keeping each channel's data contiguous is the right design.

Pros of channel-major:

  • operations that run across an individual channel are fast (memory locality and SIMD-able)
  • We usually think of Vectors as being vertical, which means that 1D SampleBufs and 1-channel 2D (Nx1) SampleBufs map onto each other. That said, I've always found that distinction to be a bit awkward anyways.

Pros of frame-major:

  • Keeping each frame contiguous would be more compatible with streaming data, which is fundamentally interleaved
  • time-slices of a multichannel signal would be contiguous

There are probably other pros and cons I'm not thinking of right now. I just wanted to mark this to see if anyone had thoughts, given that there's a bit of activity lately.

cc @mchitre @haberdashPI

@haberdashPI
Copy link
Contributor

I am also currently using channel-major by default in SignalOperators, and am leaning towards moving to frame-major by default. I have almost identical reasons for it though, and no new insights to add here.

@ssfrr
Copy link
Collaborator Author

ssfrr commented Mar 18, 2020

Thanks, it's nice to hear some confirmation.

Another consideration is that it's kind of nice that for the frame-major orientation the memory layout is the same between a Array and a Vector{NTuple}, which is another reasonable way to represent multichannel signals, and lets you iterate frames easily.

@mchitre
Copy link

mchitre commented Mar 20, 2020

My vote for frame-major. In my experience, reading a single channel chunk (many frames) of data for processing is a more common requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants