[vorbis-dev] Samples inside a packet

Sebastian Gesemann sgeseman at upb.de
Fri May 7 14:40:13 PDT 2004



Adriano Almeida wrote:

> Hi,
>  
> Just to confirm:
> for blockSizes of 256 and 2048 (0 and 1 respectively) the number of 
> sample inside this audio packet will be acording to table below:
>  
> LastWind    ThisWin    Samples
> 0                0               128
> 0                1                576
> 1                0                576
> 1                1                1024
>  
> Correct?? 

There're (usually) 128 MDCT coeffs/ch in a "0"-packet and 1024
samples in a "1"-packet. (The blocksize field in the packet
header refers to the nominal window sizes which are
2*samples/packet). Due to this overlap add synthesis of the MDCT
you have to buffer some samples for the next packet in order to
return the correct values.

One possible and easy solution would be to return blocksize/4
samples from the previous block and blocksize/4 from the current
block. I'm not sure if libVorbis does it this way. (If it is,
your values are correct.)

But this can be improved. For example: If the last and the current
blocks are long blocks and is followd by a short block, the
decoder could return 1472 samples because the next packet (due to
its short window) does not effect that many samples.

My experimental Java decoder for example tries to minimize the
delay as much as possible. It works like this:

prev	curr	next	smpls you get
1	1	0	1472
1	1	1	1024
0	1	0	1024
0	1	1	576
1	0	0	128
1	0	1	128
0	0	0	128
0	0	1	128

Unfortunalety it has not been specified how one should do this
and what the granule pos actually means in detail. :-(

<p>bye,
Sebastian

<p>--- >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-dev-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-dev mailing list