[vorbis] About Vorbis Encoder

Stephen So s.so at griffith.edu.au
Fri Feb 27 02:17:38 PST 2004



I'm no expert in Vorbis internals but I have been trying to learn more 
to do my own tunings.  I can tell you what I know and hopefully someone 
more knowledgeable can correct me if I make an error. :)

Currently, the Vorbis encoder use a mix of lossless stereo and point 
stereo for 2 channel encoding.  If there are more channels, each channel 
is coded independently, hence they are uncoupled.

As you have read in the stereo documentation, Vorbis uses square polar 
mapping where L and R channels are converted to a magnitude and angle.  
In lossless stereo coupling, assuming A=L, and B=R  (the rc3 source code 
is clearer on this),

1.  if A is larger than B, set mag to A and angle to A-B (if B is 
positive) or B-A (if B is negative).
2. if B is larger than A, set mag to B and angle to A-B (if B is 
positive) or B-A (if B is negative)

Hence the magnitude represents the strongest common value while the 
angle represents the difference (diffuse sounds) of the other channel.  
This is similar to intensity stereo in MP3 where L and R channels are 
mapped to L and L-R.  In point stereo, the angle is set to 0, thus is no 
diffuse information and the sound appears centered.  The beauty of this 
is that both point stereo and lossless stereo can be decoupled using the 
same procedure (the one in the stereo docs)

Currently, Vorbis mostly uses lossless stereo coupling for quality 
levels of 6 and above while 5 and below uses a mix of point and 
lossless.  In the /lib/modes/psych_44.h file (which contains all the 
important tuning parameters of Vorbis), you will notice close to the 
bottom, a lot of adj_stereo structure initialisations.  The first row 
are prepoint thresholds which govern whether to use point stereo or 
not.  If the quantised residue is less than the threshold, they are 
coupled using point stereo.  Otherwise, they are losslessly coupled.

To see all this in the source code, go to psy.c and the function 
_vp_couple and you will see an if statement determining whether to use 
point stereo or lossless.  To see the decoupling routine, go to 
mapping0.c and it should be in the inverse mapping function down toward 
the end. :)

That's all I know. :)

Best regards,

Steve.

Leena wrote:

>Hello !!
>
>  Can anyone explain me the coupling mechanism used in vorbis . I have read
>the
>spects and enocder code also to clear the 'square polar mapping' concept .
>But still
>I haven't understood it well .
>
>
>Leena
>
>
>
>-----Original Message-----
>From: Leena [mailto:leena.padgaonkar at patni.com]
>Sent: Monday, February 23, 2004 6:48 PM
>To: 'vorbis at xiph.org'
>Subject: RE: [vorbis] About Vorbis Encoder
>
>
>Thanks Steve a lot !! Unless one is clear with encoding process ,only
>deocder
>reading is not going to help to understand Ogg vorbis  in details.
>
>Leena
>
>
>-----Original Message-----
>From: owner-vorbis at xiph.org [mailto:owner-vorbis at xiph.org]On Behalf Of
>Stephen So
>Sent: Monday, February 23, 2004 6:38 PM
>To: vorbis at xiph.org
>Subject: Re: [vorbis] About Vorbis Encoder
>
>
>The Vorbis I specifications only provides details from a decoder point
>of view, which I assume gives some freedom in the implementation of the
>encoder.  Currently the best way to understand the encoder is to
>download the source and try and understand what's going on.  A good
>source file, from which to observe the sequence of Vorbis encoding, is
>mapping0.c in the function called mapping0_forward.
>
>Good luck :)
>
>Best regards,
>
>Steve.
>
>Leena wrote:
>
>  
>
>>Hello !!
>>
>>
>>  Can I get the vorbis -I encoder spects ..? I have Vorbis I
>>    
>>
>specifications
>  
>
>>. That talks mostly about vorbis
>>Decoder .
>>
>>
>>Leena
>>
>>--- >8 ----
>>List archives:  http://www.xiph.org/archives/
>>Ogg project homepage: http://www.xiph.org/ogg/
>>To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
>>containing only the word 'unsubscribe' in the body.  No subject is needed.
>>Unsubscribe messages sent to the list will be ignored/filtered.
>>
>>
>>
>>    
>>
>
>--
>--------------------------------------------------
>Stephen So, BEng(Hons)
>
>PhD Student,
>Signal Processing Laboratory,
>School of Microelectronic Engineering,
>Faculty of Engineering and Information Technology,
>Griffith University, Nathan Campus,
>Brisbane, QLD, Australia, 4111.
>
>Phone: +61-7-3875 3754
>E-mail: s.so at griffith.edu.au
>--------------------------------------------------
>
>--- >8 ----
>List archives:  http://www.xiph.org/archives/
>Ogg project homepage: http://www.xiph.org/ogg/
>To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
>containing only the word 'unsubscribe' in the body.  No subject is needed.
>Unsubscribe messages sent to the list will be ignored/filtered.
>
>--- >8 ----
>List archives:  http://www.xiph.org/archives/
>Ogg project homepage: http://www.xiph.org/ogg/
>To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
>containing only the word 'unsubscribe' in the body.  No subject is needed.
>Unsubscribe messages sent to the list will be ignored/filtered.
>
>  
>


-- 
--------------------------------------------------
Stephen So, BEng(Hons)

PhD Student, 
Signal Processing Laboratory,
School of Microelectronic Engineering,
Faculty of Engineering and Information Technology,
Griffith University, Nathan Campus,
Brisbane, QLD, Australia, 4111.

Phone: +61-7-3875 3754
E-mail: s.so at griffith.edu.au
--------------------------------------------------

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis mailing list