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

Packed (interlaced) audio data #32

Open
lp35 opened this issue Mar 20, 2018 · 4 comments
Open

Packed (interlaced) audio data #32

lp35 opened this issue Mar 20, 2018 · 4 comments

Comments

@lp35
Copy link

lp35 commented Mar 20, 2018

Hi,

Currently using Portaudio for retrieving audio signal, I saw that ltc decoder does not support interlaced data (for 16bits for instance). I had to create my own template.

I have made a working prototype for s16i template. Any chance to see this update upstream?

@x42
Copy link
Owner

x42 commented Mar 20, 2018

Interleaved (not interlaced)?

With Portaudio the easiest is to just use the paNonInterleaved PaSampleFormat. Portaudio can also directly provide paUInt8.

I'm not opposed to adding adding more formats, but I don't really see the point to add all possible combinations. Support for float and 16bit was added "make the common case fast".

I have no interested to write code for other cases, it is easy to convert/de-interleave at application level and call ltc_decoder_write(), but you're very welcome to file a pull-request.

I suppose adding a stride parameter to the LTCWRITE_TEMPLATE define can work and simply skip over samples (and the application provides a buffer that is already offset to the given channel).

How did you implement it?

@lp35
Copy link
Author

lp35 commented Mar 30, 2018

Yes I was meaning interlaced, paNonInterleaved in portaudio misled me. Thanks!

  1. Concerning your portaudio suggestion, my pipeline need to use interlaced data, I can't add paNonInterleaved.

  2. I agree with you regarding not supporting all the format the world can carry. However, depending on the rollout of Avoid buffer copy with ltc_decoder_write_ template #31, I think it could be a good thing to move the template LTCWRITE_TEMPLATE from ltc.c to ltc.h, so the users can implement their own conversion without recompiling ltc.

  3. Agree on stride parameter.

  4. Here you can see my implementation for short data interlaced:
    https://github.com/lp35/libltc/blob/master/src/ltc.c#L97
    Note: I really like how you did implement the template, on a coding style perspective.

@lp35
Copy link
Author

lp35 commented Jun 28, 2018

Hi,

I re-up this question, I am ready to invest some time for this. Any thought on my last comments?

Thank youm BR

@x42
Copy link
Owner

x42 commented Jun 28, 2018

LTCWRITE_TEMPLATE(s16i, short, 128 + (((short*)buf)[(copyStart + i)*2] >> 8))

would be for interleaved (not interlaced) stereo only. I suppose the * 2 should become a parameter alike:

ltc_decoder_write_interleaved_s16(LTCDecoder *d, short *buf, size_t size, size_t stride, ltc_off_t posinfo)

Then again, I'm probably going to regret this. The current 8,16, 32bit conversion functions are already overkill and converting sample-formats is not the purpose of this lib. The libraries copies data onto the stack for conversion and doing this in the lib cannot be more efficient than application code.

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

2 participants