Help - Search - Members - Calendar
Full Version: SBC to PCM16 decoding...
Hydrogenaudio Forums > Lossy Audio Compression > Other Lossy Codecs
rpodraza
Hi all, this is my first post, I apologize if this question is out of this forum's domain, I am having difficulty finding codec development forums. My hope is that this is a general question that can be answered without much specific knowledge.

I am writing a decoder, decoding SBC (as specificied in the Bluetooth A2DP spec) to PCM16 audio. I have an issue with how to parse the SBC frames, to determine where one frame begins and ends. My understanding is that because with SBC a configuration is contained in EACH frame's header, the configurations are inherently variable and so the frame size is not necessarily consistent throughout one sbc audio file.

That being said, the specification does mention each frame begins with a syncword, 0x9C. So my implementation, in an attempt to extract a single frame from a file, basically inspects the next byte for the expected syncword (0x9C), and then searches for the NEXT syncword, and assumes everything inbetween to be one frame.

This of course means that should 0x9C happen to be part of the data at any point, my algorithm will produce bad results, returning a short frame and corrupting the data.

So my questions are:
Is it safe to assume the syncword 0x9C will never be part of the data? I already think by inspection of my test files that the answer to this is no.

Is there a better or standard algorithm for parsing frames having knowledge of the syncword? I assume this is a feature other audio formats include as well...how do other codecs do it?

Thanks for any help...even pointing me to a more appropriate forum would be appreciated!

Rich
Groundskeeper Willie
SBC ist basically MPEG1 Audio Layer I (AFAIR), so having a looking at existing decoders (eg mpeg123 or dist10)could be a good starting point.

Besides, I would read the maximum possible frame length into a buffer and determine the actual length when decoding and parsing, which can be used in the next step to point from the current to the beginning of the next frame.

Greets, GW
SebastianG
I only once looked at the SBC specification a longer time ago.
I wasn't impressed.
SBC and MPEG1 Audio Layer I may share the same (or similar?) filterbank but that's pretty much all they have in common. Bit allocation is a big difference. (SBC: implicitly given by a very simple fixed algorithm that works on the scalefactors / MP1: forward adaptive)

But the problem of detecting the frames is likely the same.


Sebi
Groundskeeper Willie
QUOTE(SebastianG @ Jan 5 2006, 08:12 PM)
SBC and MPEG1 Audio Layer I may share the same (or similar?) filterbank but that's pretty much all they have in common. Bit allocation is a big difference. (SBC: implicitly given by a very simple fixed algorithm that works on the scalefactors / MP1: forward adaptive)


Yes, SBC bit allocation is just bloody simple by spec, but remember: MPEG only specifies the decoding, not encoding, so bit allocation on encoder side may be as sophisticated as you like, eg according to psychoacoustic models, or just as simple as the SBC approach (cf. annotations concerning PAMs in twoLame).

GW
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.