diff options
author | Monty <xiphmont@xiph.org> | 2000-10-05 22:41:25 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2000-10-05 22:41:25 +0000 |
commit | c9a54d3942df50b1306563a58cb29b81d96b201f (patch) | |
tree | 9b4541eb18925dda20fa0e9cbc5c0fa3d4036b78 | |
parent | b420a6b7749cdb9438da7f992dad0afec4081068 (diff) | |
download | libvorbis-git-c9a54d3942df50b1306563a58cb29b81d96b201f.tar.gz |
README update, cleaning up some empty dirs, consolidating vq/ and
huff/ (build not repaired yet)
Monty
svn path=/branches/branch_postbeta2/vorbis/; revision=716
-rw-r--r-- | README | 107 | ||||
-rwxr-xr-x | vq/auxpartition.pl | 71 | ||||
-rw-r--r-- | vq/huffbuild.c | 195 | ||||
-rw-r--r-- | vq/residuesplit.c | 2 |
4 files changed, 374 insertions, 1 deletions
@@ -0,0 +1,107 @@ +******************************************************************** +* * +* THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * +* USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * +* THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * +* PLEASE READ THESE TERMS DISTRIBUTING. * +* * +* THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * +* by Monty <monty@xiph.org> and The XIPHOPHORUS Company * +* http://www.xiph.org/ * +* * +******************************************************************** + +NEW AND IMPORTANT: + +If you're used to the source distribution from the first two beta +relaeases, things are now rearranged a bit. Specifically, the +'vorbis' CVS module contains only the libvorbis and libvorbisfile +libraries. Because Ogg bitstreams are to be used by other Ogg codecs, +Ogg framing and streaming functionality is now in libogg (the 'ogg' +CVS module). Vorbis utilities are in 'vorbis-tools' and various +player plugins are in 'vorbis-plugins'. For now, you'll need to check +out these other modules seperately. + +Secondly, the Ogg/Vorbis build systems now use automake. Instead of +'./configure;make', the proper build sequence (in each module) is +'./autogen.sh;make'. + +WHAT'S HERE: + +This source distribution includes libvorbis and an example +encoder/player to demonstrate use of libvorbis and documentation on +the Ogg Vorbis audio coding format. + +Directory: + +./lib The source for libvorbis, an LGPLed inplementation of + the public domain OggSquish Vorbis audio encoding + format. + +./include Library API headers and codebooks + +./debian Rules/spec files for building Debian .deb packages + +./doc Vorbis specification documents + +./examples Example code illustrating programmatic use of libogg, + libvorbis, libvorbisfile and libvorbisenc + +./mac Codewarrior project files and build tweaks for MacOS. + + +./vq Internal utilities for training/building new LSP/residue + and auxiliary codebooks. + +WHAT IS VORBIS: + +Vorbis is a general purpose audio and music encoding format +contemporary to MPEG-4's AAC and TwinVQ, the next generation beyond +MPEG audio layer 3. Unlike the MPEG sponsored formats (and other +proprietary formats such as RealAudio G2 and Windows' flavor of the +month), the Vorbis CODEC specification belongs to the public domain. +All the technical details are published and documented, and any +software entity may make full use of the format without royalty or +patent concerns. + +This package contains: + +.) libvorbis, an LGPLed software implementation of +the Vorbis specification by the Xiphophorus company +(http://www.xiph.org/) + +.) libvorbisfile, an LGPLed convenience library +built on Vorbis designed to simplify common uses and a number of GPL +example programs + +.) libvorbisenc, an LGPL library that provides a simple, programmatic +encoding setup interface + +.) example code making use of libogg, libvorbis, libvorbisfile and +libvorbisenc + +CONTACT: + +The OggSquish homepage is located at 'http://www.xiph.org/ogg/'. +Vorbis's homepage is located at 'http://www.xiph.org/ogg/vorbis/'. +Up to date technical documents, contact information, source code and +pre-built utilities may be found there. + +BUILD: + +A standard build should consist of nothing more than: + +./autogen.sh +make + +and as root if desired : + +make install + +This will install the vorbis libraries (static and shared) into +/usr/local/lib, includes into /usr/local/include and API manpages +(once we write some) into /usr/local/man. + +Monty <monty@xiph.org> + +$Id: README,v 1.4.8.1 2000/10/05 22:41:25 xiphmont Exp $ diff --git a/vq/auxpartition.pl b/vq/auxpartition.pl new file mode 100755 index 00000000..73708a1a --- /dev/null +++ b/vq/auxpartition.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +if($#ARGV<0){ + &usage; +} + +$|=1; + +$bands=0; + +foreach $arg (@ARGV){ + ($entries[$bands],$file[$bands])=split(/,/,$arg); + $bands++; +} + +# no time to deal with globs right now +if($bands>0){ + die unless open(ONE,"<".$file[0]); +} +if($bands>1){ + die unless open(TWO,"<".$file[1]); +} +if($bands>2){ + die unless open(THREE,"<".$file[2]); +} + + +while (<ONE>) { + my@nums = (); + @nums = split(/,/); + my$cols=$#nums; + for($i=0;$i<$cols;$i++){ + print $nums[$i].", "; + } + if($bands>1){ + $_=<TWO>; + @nums = (); + @nums = split(/,/); + $cols=$#nums; + for($i=0;$i<$cols;$i++){ + print $nums[$i]+$entries[0].", "; + } + if($bands>2){ + $_=<THREE>; + @nums = (); + @nums = split(/,/); + $cols=$#nums; + for($i=0;$i<$cols;$i++){ + print $nums[$i]+$entries[0]+$entries[1].", "; + } + } + } + print "\n"; + +} + +if($bands>0){ + close ONE; +} +if($bands>1){ + close TWO; +} +if($bands>2){ + close THREE; +} + +sub usage{ + print "\nOggVorbis auxbook spectral partitioner\n\n"; + print "auxpartition.pl <part_entries>,file [<part_entries>,file...]\n\n"; + exit(1); +} diff --git a/vq/huffbuild.c b/vq/huffbuild.c new file mode 100644 index 00000000..04b0326a --- /dev/null +++ b/vq/huffbuild.c @@ -0,0 +1,195 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * + * PLEASE READ THESE TERMS DISTRIBUTING. * + * * + * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: hufftree builder + last mod: $Id: huffbuild.c,v 1.4.4.1 2000/10/05 22:41:25 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <stdio.h> +#include "../vq/bookutil.h" + +static int nsofar=0; +static int getval(FILE *in,int begin,int n,int group,int max){ + double v; + int i; + long val=0; + + if(nsofar>=n || get_line_value(in,&v)){ + reset_next_value(); + nsofar=0; + if(get_next_value(in,&v)) + return(-1); + for(i=1;i<=begin;i++) + get_line_value(in,&v); + } + + val=(int)v; + nsofar++; + + for(i=1;i<group;i++,nsofar++) + if(nsofar>=n || get_line_value(in,&v)) + return(getval(in,begin,n,group,max)); + else + val = val*max+(int)v; + return(val); +} + +static void usage(){ + fprintf(stderr, + "usage:\n" + "huffbuild <input>.vqd <begin,n,group> [noguard]\n" + " where begin,n,group is first scalar, \n" + " number of scalars of each in line,\n" + " number of scalars in a group\n" + "eg: huffbuild reslongaux.vqd 0,1024,4\n" + "produces reslongaux.vqh\n\n"); + exit(1); +} + +int main(int argc, char *argv[]){ + char *base; + char *infile; + int i,j,k,begin,n,subn,guard=1; + FILE *file; + int maxval=0; + + if(argc<3)usage(); + if(argc==4)guard=0; + + infile=strdup(argv[1]); + base=strdup(infile); + if(strrchr(base,'.')) + strrchr(base,'.')[0]='\0'; + + { + char *pos=strchr(argv[2],','); + begin=atoi(argv[2]); + if(!pos) + usage(); + else + n=atoi(pos+1); + pos=strchr(pos+1,','); + if(!pos) + usage(); + else + subn=atoi(pos+1); + if(n/subn*subn != n){ + fprintf(stderr,"n must be divisible by group\n"); + exit(1); + } + } + + /* scan the file for maximum value */ + file=fopen(infile,"r"); + if(!file){ + fprintf(stderr,"Could not open file %s\n",infile); + exit(1); + } + i=0; + while(1){ + long v; + if(get_next_ivalue(file,&v))break; + if(v>maxval)maxval=v; + + if(!(i++&0xff))spinnit("loading... ",i); + } + rewind(file); + maxval++; + + { + long vals=pow(maxval,subn); + long *hist=malloc(vals*sizeof(long)); + long *lengths=malloc(vals*sizeof(long)); + + for(j=0;j<vals;j++)hist[j]=guard; + + reset_next_value(); + i/=subn; + while(!feof(file)){ + long val=getval(file,begin,n,subn,maxval); + if(val==-1)break; + hist[val]++; + if(!(i--&0xff))spinnit("loading... ",i*subn); + } + fclose(file); + + /* we have the probabilities, build the tree */ + fprintf(stderr,"Building tree for %ld entries\n",vals); + build_tree_from_lengths0(vals,hist,lengths); + + /* save the book */ + { + char *buffer=alloca(strlen(base)+5); + strcpy(buffer,base); + strcat(buffer,".vqh"); + file=fopen(buffer,"w"); + if(!file){ + fprintf(stderr,"Could not open file %s\n",buffer); + exit(1); + } + } + + fprintf(file, + "/********************************************************************\n" + " * *\n" + " * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *\n" + " * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *\n" + " * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *\n" + " * PLEASE READ THESE TERMS DISTRIBUTING. *\n" + " * *\n" + " * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *\n" + " * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *\n" + " * http://www.xiph.org/ *\n" + " * *\n" + " ********************************************************************\n" + "\n" + " function: static codebook autogenerated by huff/huffbuld\n" + "\n" + " ********************************************************************/\n\n"); + + fprintf(file,"#ifndef _V_%s_VQH_\n#define _V_%s_VQH_\n",base,base); + fprintf(file,"#include \"vorbis/codebook.h\"\n\n"); + + /* first, the static vectors, then the book structure to tie it together. */ + /* lengthlist */ + fprintf(file,"static long _huff_lengthlist_%s[] = {\n",base); + for(j=0;j<vals;){ + fprintf(file,"\t"); + for(k=0;k<16 && j<vals;k++,j++) + fprintf(file,"%2ld,",lengths[j]); + fprintf(file,"\n"); + } + fprintf(file,"};\n\n"); + + /* the toplevel book */ + fprintf(file,"static static_codebook _huff_book_%s = {\n",base); + fprintf(file,"\t%d, %ld,\n",subn,vals); + fprintf(file,"\t_huff_lengthlist_%s,\n",base); + fprintf(file,"\t0, 0, 0, 0, 0,\n"); + fprintf(file,"\tNULL,\n"); + fprintf(file,"\tNULL,\n"); + fprintf(file,"\tNULL,\n"); + fprintf(file,"};\n\n"); + + fprintf(file,"\n#endif\n"); + fclose(file); + fprintf(stderr,"Done. \n\n"); + } + exit(0); +} + + diff --git a/vq/residuesplit.c b/vq/residuesplit.c index 6329a2ef..45302844 100644 --- a/vq/residuesplit.c +++ b/vq/residuesplit.c @@ -12,7 +12,7 @@ ******************************************************************** function: residue backend 0 partitioner/classifier - last mod: $Id: residuesplit.c,v 1.4.2.1 2000/08/31 08:59:58 xiphmont Exp $ + last mod: $Id: residuesplit.c,v 1.4.2.2 2000/10/05 22:41:25 xiphmont Exp $ ********************************************************************/ |