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

Tom Felker tcfelker at mtco.com
Wed Jun 25 23:58:46 PDT 2003



On Wed, 2003-06-25 at 22:59, General purpose mail wrote:

> I've chosen 4 file compressed with format .ape, .mp3, .ogg ,
> converted back to wav with dbPowerAmp like all the conversions here.
> REMEMBER TO UNCHECK VOLUME NORMALIZE

For testing, I'd use audio straight from a CD, because if it's been
compressed before, there may be less entropy in the low bits.

That code seems overly complex just to take a diff.  I've done trials
myself, using this C++ code:

#include <assert.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char **argv)
{
  assert(argc == 4);
  ifstream i1(argv[1]), i2(argv[2]);
  ofstream o(argv[3]);
  while(i1 && i2) {
    signed short int t1, t2;
    i1.read((char *)&t1, sizeof t1);
    i2.read((char *)&t2, sizeof t2);
    t1 -= t2;
    o.write((char *)&t1, sizeof t1);
  }
  return 0;
}

...which simply subtracts the files from each other in 16-bit chunks. 
The result is quiet windy static that sounds vaguely like the music.

> you must obtain compression rate around 35% (28.53% -> 34.58% for me)

I tried this with track 10 of Independence Day, straight from the CD. 
Uncompressed, it's 16MB.  -q7 Vorbis is 2.2MB, diff.bz2 is 7.5MB.  The
total compressed is 9.7MB, which isn't as good as the FLAC, 7.8MB.

> I can also send all the stuff if someone need it but keep in mind that they
> are about 360 Mb
> 
> P.S. total elapsed time is more than a quarter of hour with php on a athlon
> xp 1.8

In that time you could have learned C++ :-).  My code, which could be
made more efficient, only takes a few seconds per 18MB file.  PHP really
isn't right for quickly moving binary data.

As I said, I'm getting about 60% original size, worse than FLAC.  But
I'm still interested:  for one, bzip2 might not be best way to compress
the difference.  Try using FLAC!  With a q7 Vorbis and a FLAC'd diff, I
got 16MB down to 8.2MB, which still isn't quite as good as just plain
FLAC.

Once I made a program to encode images and text in an audiofile, which
you can view by looking at the file's voiceprint.  This involved writing
a bunch of pure tones to the file.  FLAC compressed this no better than
anything else, about 50%, but Vorbis did way way better than it usually
does.  Also, Vorbis is optimized to throw away the data you don't hear,
but maybe it could also be optimized to make the leftover data more
compressible.

-- 
Tom Felker

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