Real Lossless Codec

From MultimediaWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:35, 10 March 2012
Kostya (Talk | contribs)

← Previous diff
Revision as of 16:17, 10 March 2012
Kostya (Talk | contribs)
(Frame format)
Next diff →
Line 25: Line 25:
Data is read MSB. Data is read MSB.
 +
 + block header
 + channel data 1
 + if (stereo)
 + channel data 2
 +
 + Each channel is then restored by applying filter and in stereo case channels are recombined.
=== Block header === === Block header ===
Line 59: Line 66:
| align="center" | 4 || align="center" | 2 || align="center" | 17 || align="center" | 2 || align="center" | 17 || align="center" | (L+R)/2, (L-R)/2 | align="center" | 4 || align="center" | 2 || align="center" | 17 || align="center" | 2 || align="center" | 17 || align="center" | (L+R)/2, (L-R)/2
|} |}
 +
 +=== Block data ===
 +
 + code from tree 0 (0..642) - something to do with filter length
 + also if code == 642 just read raw data and return it

Revision as of 16:17, 10 March 2012

This is RealNetworks lossless audio codec.

Audio header in rm files is different from other Real audio codecs; the interface of the binary decoder is also different.


Contents

Extradata format

Numbers are stored big-endian.

bytes  0- 3 - codec FOURCC, always "LSD:"
bytes  4- 5 - version
bytes  8- 9 - number of channels
bytes 10-11 - bits per sample
bytes 12-15 - sampling rate
bytes 16-19 - block size in samples?
bytes 20-23 - ignored?

Known decoder support only 1/2 channel 16-bit audio with sampling rate up to 96 kHz.

Frame format

Data is read MSB.

 block header
 channel data 1
 if (stereo)
   channel data 2
 Each channel is then restored by applying filter and in stereo case channels are recombined.

Block header

 get frame length code
 if (stereo)
   decoding_mode = get_bits(2) + 1;
 else
   decoding_mode = 0;

Frame length code:

   64 - 11110
  128 - 11111
  256 - 1110
  512 - 110
 1024 - 10
 2048 - 0

Decoding mode specifies table sets, bits and channel recombining:

Mode tableset1 bits1 tableset2 bits2 Channel decoupling
0 0 16 n/a n/a mono
1 0 16 0 16 L, R
2 0 16 2 17 L+R, R
3 1 16 2 17 L, R-L
4 2 17 2 17 (L+R)/2, (L-R)/2

Block data

 code from tree 0 (0..642) - something to do with filter length
 also if code == 642 just read raw data and return it
Personal tools