[vorbis-dev] lossless ogg encoding with good compression rate

Lourens Veen lourens at rainbowdesert.net
Thu Jun 26 12:01:27 PDT 2003



On Thu 26 June 2003 12:53, Beni Cherniavsky wrote:
> Charles Keepax wrote on 2003-06-26:
> > Just to add my 2 cents, surely the difference will always be
> > quite small , thus you don't need the full 16-bits for each one
> > in the PCM file. i.e. say each difference could be 8-bits, thus
> > halfing the difference file size. Although just a passing
> > though and might not work in practice.
>
> You can't be 100% sure, what if in one sample of million it
> isn't? Bzip2 will take advantage of the values being small
> anyway.

There's another problem though. The difference of two signed 16-bit 
numbers is somewhere between 32767 - (-32768) = 65535 and (-32768) 
- 32767 = -65535. That is, you need 17 bits to specify the 
difference in the most general case. The PHP code given in the 
other post chops off the most significant bit of the difference. Oh 
and incidentally, the last four bytes of the file not being copied 
is the result in an off-by-one error in the for loop, it should 
read

  for($i=0; $i < $blockSize; $i += 2) {

instead of

  for($i=0; $i < $blockSize -2; $i += 2) {

and the other two bytes are in

 $blockSize = max(filesize($filename1) -2, 0);

which I figure should be

 $blockSize = max(filesize($filename1), 0);

Lourens

-- 
GPG public key: http://home.student.utwente.nl/l.e.veen/lourens.key

--- >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