diff options
author | Monty <xiphmont@xiph.org> | 2000-11-04 06:22:11 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2000-11-04 06:22:11 +0000 |
commit | 7344a1c20fb4acfb8f2de692d55a0b4fec7bcc59 (patch) | |
tree | 3462eccb3dab11c902c2f987ae6d038bc19afe81 | |
parent | 24fa1bd0a3083dd8df0c8db2198a6e752cc12f49 (diff) | |
download | libvorbis-git-7344a1c20fb4acfb8f2de692d55a0b4fec7bcc59.tar.gz |
Batch change source comments to fix typos, read LGPL (except the
example source, it reads GPL)
Monty
svn path=/branches/branch_beta3/vorbis/; revision=970
155 files changed, 8862 insertions, 594 deletions
diff --git a/examples/chaining_example.c b/examples/chaining_example.c index ecc35150..f8848407 100644 --- a/examples/chaining_example.c +++ b/examples/chaining_example.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: illustrate simple use of chained bitstream and vorbisfile.a - last mod: $Id: chaining_example.c,v 1.6.2.1 2000/10/30 20:51:21 jack Exp $ + last mod: $Id: chaining_example.c,v 1.6.2.2 2000/11/04 06:21:39 xiphmont Exp $ ********************************************************************/ diff --git a/examples/decoder_example.c b/examples/decoder_example.c index 31330ec0..7846c102 100644 --- a/examples/decoder_example.c +++ b/examples/decoder_example.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: simple example decoder - last mod: $Id: decoder_example.c,v 1.13.2.1 2000/10/30 20:51:21 jack Exp $ + last mod: $Id: decoder_example.c,v 1.13.2.2 2000/11/04 06:21:39 xiphmont Exp $ ********************************************************************/ diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 73491cb1..cde5c0c4 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.14.2.2 2000/11/03 11:31:35 xiphmont Exp $ + last mod: $Id: encoder_example.c,v 1.14.2.3 2000/11/04 06:21:39 xiphmont Exp $ ********************************************************************/ diff --git a/examples/seeking_example.c b/examples/seeking_example.c index 94dc7503..4016c606 100644 --- a/examples/seeking_example.c +++ b/examples/seeking_example.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: illustrate seeking, and test it too - last mod: $Id: seeking_example.c,v 1.4.2.1 2000/10/30 20:51:21 jack Exp $ + last mod: $Id: seeking_example.c,v 1.4.2.2 2000/11/04 06:21:39 xiphmont Exp $ ********************************************************************/ diff --git a/examples/vorbisfile_example.c b/examples/vorbisfile_example.c index 7910946e..77403948 100644 --- a/examples/vorbisfile_example.c +++ b/examples/vorbisfile_example.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: simple example decoder using vorbisfile - last mod: $Id: vorbisfile_example.c,v 1.2.2.1 2000/10/30 20:51:21 jack Exp $ + last mod: $Id: vorbisfile_example.c,v 1.2.2.2 2000/11/04 06:21:39 xiphmont Exp $ ********************************************************************/ diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h index 2b6870ad..d70b69ef 100644 --- a/include/vorbis/codec.h +++ b/include/vorbis/codec.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec.h,v 1.32.2.3 2000/11/03 10:05:43 xiphmont Exp $ + last mod: $Id: codec.h,v 1.32.2.4 2000/11/04 06:21:40 xiphmont Exp $ ********************************************************************/ diff --git a/include/vorbis/mode_A.h b/include/vorbis/mode_A.h new file mode 100644 index 00000000..8b13ee76 --- /dev/null +++ b/include/vorbis/mode_A.h @@ -0,0 +1,206 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: mode_A.h,v 1.3.6.1 2000/11/04 06:21:40 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_MODES_A_H_ +#define _V_MODES_A_H_ + +#include <stdio.h> +#include "vorbis/codec.h" +#include "vorbis/backends.h" + +#include "vorbis/book/lsp12_0.vqh" +#include "vorbis/book/lsp30_0.vqh" + +#include "vorbis/book/resaux0_128a_128.vqh" +#include "vorbis/book/resaux0_1024a_128.vqh" + +#include "vorbis/book/res0_128a_128_1.vqh" +#include "vorbis/book/res0_128a_128_2.vqh" +#include "vorbis/book/res0_128a_128_3.vqh" +#include "vorbis/book/res0_128a_128_4.vqh" +#include "vorbis/book/res0_128a_128_5.vqh" +#include "vorbis/book/res0_1024a_128_1.vqh" +#include "vorbis/book/res0_1024a_128_2.vqh" +#include "vorbis/book/res0_1024a_128_3.vqh" +#include "vorbis/book/res0_1024a_128_4.vqh" +#include "vorbis/book/res0_1024a_128_5.vqh" +#include "vorbis/book/res0_1024a_128_6.vqh" +#include "vorbis/book/res0_1024a_128_7.vqh" +#include "vorbis/book/res0_1024a_128_8.vqh" +#include "vorbis/book/res0_1024a_128_9.vqh" + +static vorbis_info_psy _psy_set_A={ + 1,/*athp*/ + 1,/*decayp*/ + 1,/*smoothp*/ + 0,.1, + + -100., + -140., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 1,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/ + {-30.,-30.,-35.,-37.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/ + {-20.,-25.,-30.,-35.,-35.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/ + {-20.,-25.,-30.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/ + {-20.,-24.,-26.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/ + }, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/ + { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/ + { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/ + }, + + 1,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/ + { 6., 6., 6., 2., 2., 2., 2., 2., 2., 1., 0.}, /*700*/ + + { 6., 6., 6., 5., 5., 5., 5., 5., 5., 4., 3.}, /*1000*/ + { 6., 6., 6., 5., 5., 5., 5., 5., 5., 4., 3.}, /*1400*/ + { 6., 6., 6., 5., 5., 5., 5., 5., 5., 4., 3.}, /*2000*/ + { 6., 6., 6., 5., 5., 5., 5., 5., 5., 4., 3.}, /*2800*/ + { 6., 6., 6., 5., 5., 5., 5., 5., 5., 4., 3.}, /*4000*/ + { 10., 10., 10., 10., 10., 10., 8., 8., 6., 6., 6.}, /*5600*/ + { 10., 10., 10., 10., 10., 10., 8., 8., 8., 8., 8.}, /*8000*/ + { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*11500*/ + { 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.}, /*16000*/ + }, + + 100., + + -0., -.004 /* attack/decay control */ +}; + + +/* with GNUisms, this could be short and readable. Oh well */ +static vorbis_info_time0 _time_set0A={0}; +static vorbis_info_floor0 _floor_set0A={12, 44100, 64, 12,150, 1, {0} }; +static vorbis_info_floor0 _floor_set1A={30, 44100, 256, 12,150, 1, {1} }; +static vorbis_info_residue0 _residue_set0A={0,128, 32,6,2, + {0,1,1,1,1,1}, + {4,5,6,7,8}, + + {0,99999,9999,9999,9999}, + {99,1.5,2.5,3.5,5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_residue0 _residue_set1A={0,1024, 32,10,3, + {0,1,1,1,1,1,1,1,1,1}, + {9,10,11,12,13,14,15,16,17}, + + {0,9,9999,17,9999, + 27,9999,9999,9999}, + {99,1.5,1.5,2.5,2.5,3.5,3.5,7,13}, + {5,5,5,5,5,5,5,5,5}, + {99,99,99,99,99,99,99,99,99}}; + +static vorbis_info_mapping0 _mapping_set0A={1, {0,0}, {0}, {0}, {0}, {0}}; +static vorbis_info_mapping0 _mapping_set1A={1, {0,0}, {0}, {1}, {1}, {0}}; +static vorbis_info_mode _mode_set0A={0,0,0,0}; +static vorbis_info_mode _mode_set1A={1,0,0,1}; + +/* CD quality stereo, no channel coupling */ +vorbis_info info_A={ + /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ + 0, 2, 44100, 0,0,0, + /* smallblock, largeblock */ + {256, 2048}, + /* modes,maps,times,floors,residues,books,psys */ + 2, 2, 1, 2, 2, 18, 1, + /* modes */ + {&_mode_set0A,&_mode_set1A}, + /* maps */ + {0,0},{&_mapping_set0A,&_mapping_set1A}, + /* times */ + {0,0},{&_time_set0A}, + /* floors */ + {0,0},{&_floor_set0A,&_floor_set1A}, + /* residue */ + {0,0},{&_residue_set0A,&_residue_set1A}, + /* books */ + {&_vq_book_lsp12_0, /* 0 */ + &_vq_book_lsp30_0, /* 1 */ + + &_huff_book_resaux0_128a_128, + &_huff_book_resaux0_1024a_128, + + &_vq_book_res0_128a_128_1, + &_vq_book_res0_128a_128_2, + &_vq_book_res0_128a_128_3, + &_vq_book_res0_128a_128_4, + &_vq_book_res0_128a_128_5, + &_vq_book_res0_1024a_128_1, + &_vq_book_res0_1024a_128_2, + &_vq_book_res0_1024a_128_3, + &_vq_book_res0_1024a_128_4, + &_vq_book_res0_1024a_128_5, + &_vq_book_res0_1024a_128_6, + &_vq_book_res0_1024a_128_7, + &_vq_book_res0_1024a_128_8, + &_vq_book_res0_1024a_128_9, + + }, + /* psy */ + {&_psy_set_A}, + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, 32, 6, -96. +}; + +#define PREDEF_INFO_MAX 0 + +#endif diff --git a/include/vorbis/mode_B.h b/include/vorbis/mode_B.h new file mode 100644 index 00000000..8dd3617f --- /dev/null +++ b/include/vorbis/mode_B.h @@ -0,0 +1,205 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: mode_B.h,v 1.1.6.1 2000/11/04 06:21:40 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_MODES_B_H_ +#define _V_MODES_B_H_ + +#include <stdio.h> +#include "vorbis/codec.h" +#include "vorbis/backends.h" + +#include "vorbis/book/lsp12_0.vqh" +#include "vorbis/book/lsp30_0.vqh" + +#include "vorbis/book/resaux0_128a_160.vqh" +#include "vorbis/book/resaux0_1024a_160.vqh" + +#include "vorbis/book/res0_128a_160_1.vqh" +#include "vorbis/book/res0_128a_160_2.vqh" +#include "vorbis/book/res0_128a_160_3.vqh" +#include "vorbis/book/res0_128a_160_4.vqh" +#include "vorbis/book/res0_128a_160_5.vqh" +#include "vorbis/book/res0_1024a_160_1.vqh" +#include "vorbis/book/res0_1024a_160_2.vqh" +#include "vorbis/book/res0_1024a_160_3.vqh" +#include "vorbis/book/res0_1024a_160_4.vqh" +#include "vorbis/book/res0_1024a_160_5.vqh" +#include "vorbis/book/res0_1024a_160_6.vqh" +#include "vorbis/book/res0_1024a_160_7.vqh" +#include "vorbis/book/res0_1024a_160_8.vqh" +#include "vorbis/book/res0_1024a_160_9.vqh" + +static vorbis_info_psy _psy_set_B={ + 1,/*athp*/ + 1,/*decayp*/ + 1,/*smoothp*/ + 0,.1, + + -100., + -140., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 1,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/ + {-30.,-30.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/ + {-30.,-30.,-35.,-35.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/ + {-30.,-30.,-35.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/ + {-30.,-28.,-30.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/ + }, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/ + { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/ + { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/ + }, + + 1,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*700*/ + + { 4., 4., 4., 4., 4., 2., 1., 0., -1., -2., -3.}, /*1000*/ + { 4., 4., 4., 4., 4., 2., 1., 0., 0., -2., -3.}, /*1400*/ + { 4., 4., 4., 4., 2., 2., 1., 0., 0., -2., -3.}, /*2000*/ + { 4., 4., 4., 4., 2., 2., 1., 0., 0., -2., -3.}, /*2800*/ + { 4., 4., 4., 4., 4., 4., 2., 0., 0., 0., 0.}, /*4000*/ + { 4., 4., 4., 4., 4., 4., 2., 2., 2., 2., 2.}, /*5600*/ + { 6., 6., 6., 6., 4., 4., 4., 4., 4., 2., 2.}, /*8000*/ + { 8., 8., 8., 8., 6., 6., 6., 6., 6., 4., 4.}, /*11500*/ + { 8., 8., 8., 8., 8., 8., 8., 6., 6., 6., 4.}, /*16000*/ + }, + + 110., + + -0., -.004 /* attack/decay control */ +}; + +/* with GNUisms, this could be short and readable. Oh well */ +static vorbis_info_time0 _time_set0B={0}; +static vorbis_info_floor0 _floor_set0B={12, 44100, 64, 12,150, 1, {0} }; +static vorbis_info_floor0 _floor_set1B={30, 44100, 256, 12,150, 1, {1} }; +static vorbis_info_residue0 _residue_set0B={0,128, 32,6,2, + {0,1,1,1,1,1}, + {4,5,6,7,8}, + + {0,99999,9999,9999,9999}, + {99,1.5,2.5,3.5,5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_residue0 _residue_set1B={0,1024, 32,10,3, + {0,1,1,1,1,1,1,1,1,1}, + {9,10,11,12,13,14,15,16,17}, + + {0,9,9999,17,9999, + 27,9999,9999,9999}, + {99,1.5,1.5,2.5,2.5,3.5,3.5,7,13}, + {5,5,5,5,5,5,5,5,5}, + {99,99,99,99,99,99,99,99,99}}; + +static vorbis_info_mapping0 _mapping_set0B={1, {0,0}, {0}, {0}, {0}, {0}}; +static vorbis_info_mapping0 _mapping_set1B={1, {0,0}, {0}, {1}, {1}, {0}}; +static vorbis_info_mode _mode_set0B={0,0,0,0}; +static vorbis_info_mode _mode_set1B={1,0,0,1}; + +/* CD quality stereo, no channel coupling */ +vorbis_info info_B={ + /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ + 0, 2, 44100, 0,0,0, + /* smallblock, largeblock */ + {256, 2048}, + /* modes,maps,times,floors,residues,books,psys */ + 2, 2, 1, 2, 2, 18, 1, + /* modes */ + {&_mode_set0B,&_mode_set1B}, + /* maps */ + {0,0},{&_mapping_set0B,&_mapping_set1B}, + /* times */ + {0,0},{&_time_set0B}, + /* floors */ + {0,0},{&_floor_set0B,&_floor_set1B}, + /* residue */ + {0,0},{&_residue_set0B,&_residue_set1B}, + /* books */ + {&_vq_book_lsp12_0, /* 0 */ + &_vq_book_lsp30_0, /* 1 */ + + &_huff_book_resaux0_128a_160, + &_huff_book_resaux0_1024a_160, + + &_vq_book_res0_128a_160_1, + &_vq_book_res0_128a_160_2, + &_vq_book_res0_128a_160_3, + &_vq_book_res0_128a_160_4, + &_vq_book_res0_128a_160_5, + &_vq_book_res0_1024a_160_1, + &_vq_book_res0_1024a_160_2, + &_vq_book_res0_1024a_160_3, + &_vq_book_res0_1024a_160_4, + &_vq_book_res0_1024a_160_5, + &_vq_book_res0_1024a_160_6, + &_vq_book_res0_1024a_160_7, + &_vq_book_res0_1024a_160_8, + &_vq_book_res0_1024a_160_9, + + }, + /* psy */ + {&_psy_set_B}, + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, 32, 6, -96. +}; + +#define PREDEF_INFO_MAX 0 + +#endif diff --git a/include/vorbis/mode_C.h b/include/vorbis/mode_C.h new file mode 100644 index 00000000..87e016c8 --- /dev/null +++ b/include/vorbis/mode_C.h @@ -0,0 +1,196 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: mode_C.h,v 1.2.6.1 2000/11/04 06:21:40 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_MODES_C_H_ +#define _V_MODES_C_H_ + +#include <stdio.h> +#include "vorbis/codec.h" +#include "vorbis/backends.h" + +#include "vorbis/book/lsp12_0.vqh" +#include "vorbis/book/lsp30_0.vqh" + +#include "vorbis/book/resaux0_128a_192.vqh" +#include "vorbis/book/resaux0_1024a_192.vqh" + +#include "vorbis/book/res0_128a_192_1.vqh" +#include "vorbis/book/res0_128a_192_2.vqh" +#include "vorbis/book/res0_128a_192_3.vqh" +#include "vorbis/book/res0_128a_192_4.vqh" +#include "vorbis/book/res0_128a_192_5.vqh" +#include "vorbis/book/res0_1024a_192_1.vqh" +#include "vorbis/book/res0_1024a_192_2.vqh" +#include "vorbis/book/res0_1024a_192_3.vqh" +#include "vorbis/book/res0_1024a_192_4.vqh" +#include "vorbis/book/res0_1024a_192_5.vqh" + +static vorbis_info_psy _psy_set_C={ + 1,/*athp*/ + 0,/*decayp*/ + 1,/*smoothp*/ + 0,.1, + + -100., + -140., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 1,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/ + {-30.,-35.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/ + {-30.,-30.,-35.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/ + {-30.,-30.,-35.,-35.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/ + {-30.,-30.,-35.,-33.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*11500*/ + {-30.,-28.,-30.,-32.,-35.,-45.,-55.,-65.,-75.,-90.,-100.}, /*16000*/ + }, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/ + { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/ + { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/ + }, + + 1,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*500*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*700*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*1000*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*1400*/ + + { 0., -4., -4., -4., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/ + { 0., -3., -4., -4., -4., -5., -6., -6., -6., -6., -6.}, /*2800*/ + { 0., -2., -2., -2., -2., -2., -2., -2., -4., -4., -4.}, /*4000*/ + { 0., -0., -0., -0., -0., -2., -2., -2., -2., -2., -2.}, /*5600*/ + { 0., 0., 0., 0., 0., 0., 0., 0., 0., -2., -4.}, /*8000*/ + { 2., 2., 2., 2., 2., 2., 0., 0., 0., 0., 0.}, /*11500*/ + { 2., 2., 2., 2., 2., 4., 4., 4., 4., 4., 4.}, /*16000*/ + }, + + 100., + + -0., -.004 /* attack/decay control */ +}; + +/* with GNUisms, this could be short and readable. Oh well */ +static vorbis_info_time0 _time_set0C={0}; +static vorbis_info_floor0 _floor_set0C={12, 44100, 64, 12,150, 1, {0} }; +static vorbis_info_floor0 _floor_set1C={30, 44100, 256, 12,150, 1, {1} }; +static vorbis_info_residue0 _residue_set0C={0,128, 32,6,2, + {0,1,1,1,1,1}, + {4,5,6,7,8}, + + {0,99999,9999,9999,9999}, + {99,1.5,2.5,3.5,5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_residue0 _residue_set1C={0,1024, 32,6,3, + {0,1,1,1,1,1}, + {9,10,11,12,13}, + + {0,99999,9999,9999,9999}, + {99,1.5,2.5,3.5,5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_mapping0 _mapping_set0C={1, {0,0}, {0}, {0}, {0}, {0}}; +static vorbis_info_mapping0 _mapping_set1C={1, {0,0}, {0}, {1}, {1}, {0}}; +static vorbis_info_mode _mode_set0C={0,0,0,0}; +static vorbis_info_mode _mode_set1C={1,0,0,1}; + +/* CD quality stereo, no channel coupling */ +vorbis_info info_C={ + /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ + 0, 2, 44100, 0,0,0, + /* smallblock, largeblock */ + {256, 2048}, + /* modes,maps,times,floors,residues,books,psys */ + 2, 2, 1, 2, 2, 14, 1, + /* modes */ + {&_mode_set0C,&_mode_set1C}, + /* maps */ + {0,0},{&_mapping_set0C,&_mapping_set1C}, + /* times */ + {0,0},{&_time_set0C}, + /* floors */ + {0,0},{&_floor_set0C,&_floor_set1C}, + /* residue */ + {0,0},{&_residue_set0C,&_residue_set1C}, + /* books */ + {&_vq_book_lsp12_0, /* 0 */ + &_vq_book_lsp30_0, /* 1 */ + + &_huff_book_resaux0_128a_192, + &_huff_book_resaux0_1024a_192, + + &_vq_book_res0_128a_192_1, + &_vq_book_res0_128a_192_2, + &_vq_book_res0_128a_192_3, + &_vq_book_res0_128a_192_4, + &_vq_book_res0_128a_192_5, + &_vq_book_res0_1024a_192_1, + &_vq_book_res0_1024a_192_2, + &_vq_book_res0_1024a_192_3, + &_vq_book_res0_1024a_192_4, + &_vq_book_res0_1024a_192_5, + + }, + /* psy */ + {&_psy_set_C}, + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, 24, 6, -96. +}; + +#define PREDEF_INFO_MAX 0 + +#endif diff --git a/include/vorbis/mode_D.h b/include/vorbis/mode_D.h new file mode 100644 index 00000000..22edd187 --- /dev/null +++ b/include/vorbis/mode_D.h @@ -0,0 +1,179 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: mode_D.h,v 1.5.2.1 2000/11/04 06:21:40 xiphmont Exp $ + + ********************************************************************/ + +/* this is really a freeform VBR mode. It roughly centers on 256 kbps stereo */ + +#ifndef _V_MODES_D_H_ +#define _V_MODES_D_H_ + +#include <stdio.h> +#include "vorbis/codec.h" +#include "vorbis/backends.h" + +#include "vorbis/book/lsp12_0.vqh" +#include "vorbis/book/lsp30_0.vqh" + +#include "vorbis/book/resaux0_128a_256.vqh" +#include "vorbis/book/resaux0_1024a_256.vqh" + +#include "vorbis/book/res0_128a_256_1.vqh" +#include "vorbis/book/res0_128a_256_2.vqh" +#include "vorbis/book/res0_128a_256_3.vqh" +#include "vorbis/book/res0_128a_256_4.vqh" +#include "vorbis/book/res0_128a_256_5.vqh" +#include "vorbis/book/res0_1024a_256_1.vqh" +#include "vorbis/book/res0_1024a_256_2.vqh" +#include "vorbis/book/res0_1024a_256_3.vqh" +#include "vorbis/book/res0_1024a_256_4.vqh" +#include "vorbis/book/res0_1024a_256_5.vqh" + +static vorbis_info_psy _psy_set_256 ={ + 1,/*athp*/ + 0,/*decayp*/ + 1,/*smoothp*/ + 0,.1, + + -100., + -140., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 1,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*63*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*125*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*175*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*250*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*350*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*500*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*700*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*1000*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*1400*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2000*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*2800*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*4000*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*5600*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*8000*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*11500*/ + {-40.,-40.,-40.,-45.,-45.,-55.,-65.,-75.,-85.,-95.,-105.}, /*16000*/ + }, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*175*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*250*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*350*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*500*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*700*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*1000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*1400*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*2000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*2800*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*4000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*5600*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*8000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*11500*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*16000*/ + }, + + 0,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{0}}, + + 110., + + -0., -.004 /* attack/decay control */ +}; + +/* with GNUisms, this could be short and readable. Oh well */ +static vorbis_info_time0 _time_set0_256={0}; +static vorbis_info_floor0 _floor_set0_256={12, 44100, 64, 12,150, 1, {0} }; +static vorbis_info_floor0 _floor_set1_256={30, 44100, 256, 12,150, 1, {1} }; +static vorbis_info_residue0 _residue_set0_256={0,128, 32,6,2, + {0,1,1,1,1,1}, + {4,5,6,7,8}, + + {0,9999,9999,9999,9999}, + {99,2.5,7,13.5,27.5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_residue0 _residue_set1_256={0,1024, 32,6,3, + {0,1,1,1,1,1}, + {9,10,11,12,13}, + + {0,9999,9999,9999,9999}, + {99,2.5,7,13.5,27.5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_mapping0 _mapping_set0_256={1, {0,0}, {0}, {0}, {0}, {0}}; +static vorbis_info_mapping0 _mapping_set1_256={1, {0,0}, {0}, {1}, {1}, {0}}; +static vorbis_info_mode _mode_set0_256={0,0,0,0}; +static vorbis_info_mode _mode_set1_256={1,0,0,1}; + +/* CD quality stereo, no channel coupling */ +vorbis_info info_D={ + /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ + 0, 2, 44100, 0,0,0, + /* smallblock, largeblock */ + {256, 2048}, + /* modes,maps,times,floors,residues,books,psys */ + 2, 2, 1, 2, 2, 14, 1, + /* modes */ + {&_mode_set0_256,&_mode_set1_256}, + /* maps */ + {0,0},{&_mapping_set0_256,&_mapping_set1_256}, + /* times */ + {0,0},{&_time_set0_256}, + /* floors */ + {0,0},{&_floor_set0_256,&_floor_set1_256}, + /* residue */ + {0,0},{&_residue_set0_256,&_residue_set1_256}, + /* books */ + {&_vq_book_lsp12_0, /* 0 */ + &_vq_book_lsp30_0, /* 1 */ + + &_huff_book_resaux0_128a_256, + &_huff_book_resaux0_1024a_256, + + &_vq_book_res0_128a_256_1, + &_vq_book_res0_128a_256_2, + &_vq_book_res0_128a_256_3, + &_vq_book_res0_128a_256_4, + &_vq_book_res0_128a_256_5, + &_vq_book_res0_1024a_256_1, + &_vq_book_res0_1024a_256_2, + &_vq_book_res0_1024a_256_3, + &_vq_book_res0_1024a_256_4, + &_vq_book_res0_1024a_256_5, + + }, + /* psy */ + {&_psy_set_256}, + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, 24, 6, -96. +}; + +#define PREDEF_INFO_MAX 0 + +#endif diff --git a/include/vorbis/mode_E.h b/include/vorbis/mode_E.h new file mode 100644 index 00000000..768f516b --- /dev/null +++ b/include/vorbis/mode_E.h @@ -0,0 +1,163 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: mode_E.h,v 1.3.2.1 2000/11/04 06:21:40 xiphmont Exp $ + + ********************************************************************/ + +/* this is really a freeform VBR mode. It roughly centers on 350 kbps stereo */ + +#ifndef _V_MODES_E_H_ +#define _V_MODES_E_H_ + +#include <stdio.h> +#include "vorbis/codec.h" +#include "vorbis/backends.h" + +#include "vorbis/book/lsp12_0.vqh" +#include "vorbis/book/lsp30_0.vqh" + +#include "vorbis/book/resaux0_128a_350.vqh" +#include "vorbis/book/resaux0_1024a_350.vqh" + +#include "vorbis/book/res0_128a_350_1.vqh" +#include "vorbis/book/res0_128a_350_2.vqh" +#include "vorbis/book/res0_128a_350_3.vqh" +#include "vorbis/book/res0_128a_350_4.vqh" +#include "vorbis/book/res0_128a_350_5.vqh" +#include "vorbis/book/res0_1024a_350_1.vqh" +#include "vorbis/book/res0_1024a_350_2.vqh" +#include "vorbis/book/res0_1024a_350_3.vqh" +#include "vorbis/book/res0_1024a_350_4.vqh" +#include "vorbis/book/res0_1024a_350_5.vqh" + +static vorbis_info_psy _psy_set_E ={ + 1,/*athp*/ + 0,/*decayp*/ + 1,/*smoothp*/ + 0,.1, + + -140., + -180., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 0,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{0}}, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*125*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*175*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*250*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*350*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*500*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*700*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*1000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*1400*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*2000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*2800*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*4000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*5600*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*8000*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*11500*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-24.,-24.}, /*16000*/ + }, + + 0,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{0}}, + + 110., + + -0., -.004 /* attack/decay control */ +}; + +/* with GNUisms, this could be short and readable. Oh well */ +static vorbis_info_time0 _time_set0_E={0}; +static vorbis_info_floor0 _floor_set0_E={12, 44100, 64, 12,150, 1, {0} }; +static vorbis_info_floor0 _floor_set1_E={30, 44100, 256, 12,150, 1, {1} }; +static vorbis_info_residue0 _residue_set0_E={0,128, 32,6,2, + {0,1,1,1,1,1}, + {4,5,6,7,8}, + + {0,9999,9999,9999,9999}, + {99,2.5,7,13.5,27.5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_residue0 _residue_set1_E={0,1024, 32,6,3, + {0,1,1,1,1,1}, + {9,10,11,12,13}, + + {0,9999,9999,9999,9999}, + {99,2.5,7,13.5,27.5}, + {5,5,5,5,5}, + {99,99,99,99,99}}; + +static vorbis_info_mapping0 _mapping_set0_E={1, {0,0}, {0}, {0}, {0}, {0}}; +static vorbis_info_mapping0 _mapping_set1_E={1, {0,0}, {0}, {1}, {1}, {0}}; +static vorbis_info_mode _mode_set0_E={0,0,0,0}; +static vorbis_info_mode _mode_set1_E={1,0,0,1}; + +/* CD quality stereo, no channel coupling */ +vorbis_info info_E={ + /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ + 0, 2, 44100, 0,0,0, + /* smallblock, largeblock */ + {256, 2048}, + /* modes,maps,times,floors,residues,books,psys */ + 2, 2, 1, 2, 2, 14, 1, + /* modes */ + {&_mode_set0_E,&_mode_set1_E}, + /* maps */ + {0,0},{&_mapping_set0_E,&_mapping_set1_E}, + /* times */ + {0,0},{&_time_set0_E}, + /* floors */ + {0,0},{&_floor_set0_E,&_floor_set1_E}, + /* residue */ + {0,0},{&_residue_set0_E,&_residue_set1_E}, + /* books */ + {&_vq_book_lsp12_0, /* 0 */ + &_vq_book_lsp30_0, /* 1 */ + + &_huff_book_resaux0_128a_350, + &_huff_book_resaux0_1024a_350, + + &_vq_book_res0_128a_350_1, + &_vq_book_res0_128a_350_2, + &_vq_book_res0_128a_350_3, + &_vq_book_res0_128a_350_4, + &_vq_book_res0_128a_350_5, + &_vq_book_res0_1024a_350_1, + &_vq_book_res0_1024a_350_2, + &_vq_book_res0_1024a_350_3, + &_vq_book_res0_1024a_350_4, + &_vq_book_res0_1024a_350_5, + + }, + /* psy */ + {&_psy_set_E}, + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, 24, 6, -96. +}; + +#define PREDEF_INFO_MAX 0 + +#endif diff --git a/include/vorbis/modes.h b/include/vorbis/modes.h new file mode 100644 index 00000000..2f76ddcd --- /dev/null +++ b/include/vorbis/modes.h @@ -0,0 +1,28 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: predefined encoding modes + last mod: $Id: modes.h,v 1.20.6.1 2000/11/04 06:21:41 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_MODES_H_ +#define _V_MODES_H_ + +#include "vorbis/mode_A.h" +#include "vorbis/mode_B.h" +#include "vorbis/mode_C.h" +#include "vorbis/mode_D.h" +#include "vorbis/mode_E.h" + +#endif diff --git a/include/vorbis/vorbisenc.h b/include/vorbis/vorbisenc.h index a93af403..88dbcfe6 100644 --- a/include/vorbis/vorbisenc.h +++ b/include/vorbis/vorbisenc.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h,v 1.1.2.1 2000/11/03 10:49:02 xiphmont Exp $ + last mod: $Id: vorbisenc.h,v 1.1.2.2 2000/11/04 06:21:41 xiphmont Exp $ ********************************************************************/ diff --git a/include/vorbis/vorbisfile.h b/include/vorbis/vorbisfile.h new file mode 100644 index 00000000..6866a3ae --- /dev/null +++ b/include/vorbis/vorbisfile.h @@ -0,0 +1,120 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: stdio-based convenience library for opening/seeking/decoding + last mod: $Id: vorbisfile.h,v 1.9.2.1 2000/11/04 06:21:41 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _OV_FILE_H_ +#define _OV_FILE_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include <stdio.h> +#include "codec.h" + +/* The function prototypes for the callbacks are basically the same as for + * the stdio functions fread, fseek, fclose, ftell. + * The one difference is that the FILE * arguments have been replaced with + * a void * - this is to be used as a pointer to whatever internal data these + * functions might need. In the stdio case, it's just a FILE * cast to a void * + * + * If you use other functions, check the docs for these functions and return + * the right values. For seek_func(), you *MUST* return -1 if the stream is + * unseekable + */ +typedef struct { + size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); + int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); + int (*close_func) (void *datasource); + long (*tell_func) (void *datasource); +} ov_callbacks; + + +typedef struct { + void *datasource; /* Pointer to a FILE *, etc. */ + int seekable; + ogg_int64_t offset; + ogg_int64_t end; + ogg_sync_state oy; + + /* If the FILE handle isn't seekable (eg, a pipe), only the current + stream appears */ + int links; + ogg_int64_t *offsets; + ogg_int64_t *dataoffsets; + long *serialnos; + ogg_int64_t *pcmlengths; + vorbis_info *vi; + vorbis_comment *vc; + + /* Decoding working state local storage */ + ogg_int64_t pcm_offset; + int decode_ready; + long current_serialno; + int current_link; + + double bittrack; + double samptrack; + + ogg_stream_state os; /* take physical pages, weld into a logical + stream of packets */ + vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ + vorbis_block vb; /* local working space for packet->PCM decode */ + + ov_callbacks callbacks; + +} OggVorbis_File; + +extern int ov_clear(OggVorbis_File *vf); +extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); +extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, + char *initial, long ibytes, ov_callbacks callbacks); + +extern long ov_bitrate(OggVorbis_File *vf,int i); +extern long ov_bitrate_instant(OggVorbis_File *vf); +extern long ov_streams(OggVorbis_File *vf); +extern long ov_seekable(OggVorbis_File *vf); +extern long ov_serialnumber(OggVorbis_File *vf,int i); + +extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); +extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); +extern double ov_time_total(OggVorbis_File *vf,int i); + +extern int ov_raw_seek(OggVorbis_File *vf,long pos); +extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_time_seek(OggVorbis_File *vf,double pos); +extern int ov_time_seek_page(OggVorbis_File *vf,double pos); + +extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); +extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); +extern double ov_time_tell(OggVorbis_File *vf); + +extern vorbis_info *ov_info(OggVorbis_File *vf,int link); +extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); + +extern long ov_read(OggVorbis_File *vf,char *buffer,int length, + int bigendianp,int word,int sgned,int *bitstream); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + + diff --git a/lib/analysis.c b/lib/analysis.c index bedc54fd..ed98a1f1 100644 --- a/lib/analysis.c +++ b/lib/analysis.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c,v 1.34.2.2 2000/11/03 10:05:46 xiphmont Exp $ + last mod: $Id: analysis.c,v 1.34.2.3 2000/11/04 06:21:42 xiphmont Exp $ ********************************************************************/ diff --git a/lib/backends.h b/lib/backends.h index 4a5f4cdd..9db277a7 100644 --- a/lib/backends.h +++ b/lib/backends.h @@ -1,19 +1,19 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: libvorbis backend and mapping structures; needed for static mode headers - last mod: $Id: backends.h,v 1.1.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: backends.h,v 1.1.2.2 2000/11/04 06:21:42 xiphmont Exp $ ********************************************************************/ diff --git a/lib/barkmel.c b/lib/barkmel.c new file mode 100644 index 00000000..b6d2844a --- /dev/null +++ b/lib/barkmel.c @@ -0,0 +1,61 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: bark scale utility + last mod: $Id: barkmel.c,v 1.1.14.1 2000/11/04 06:21:42 xiphmont Exp $ + + ********************************************************************/ + +#include <stdio.h> +#include "scales.h" +int main(){ + int i; + double rate; + for(i=64;i<32000;i*=2){ + rate=48000.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=44100.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=32000.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=22050.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=16000.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=11025.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=8000.; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + + } + for(i=0;i<28;i++){ + fprintf(stderr,"bark=%d %gHz\n", + i,fromBARK(i)); + } + return(0); +} + diff --git a/lib/block.c b/lib/block.c index 59d89f9b..db1a4ab2 100644 --- a/lib/block.c +++ b/lib/block.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c,v 1.39.2.3 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: block.c,v 1.39.2.4 2000/11/04 06:21:42 xiphmont Exp $ Handle windowing, overlap-add, etc of the PCM vectors. This is made more amusing by Vorbis' current two allowed block sizes. diff --git a/lib/books/lsp12_0.vqh b/lib/books/lsp12_0.vqh index dff8b68d..96ba7e7f 100644 --- a/lib/books/lsp12_0.vqh +++ b/lib/books/lsp12_0.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/lsp30_0.vqh b/lib/books/lsp30_0.vqh index 22770ccd..5041fdc4 100644 --- a/lib/books/lsp30_0.vqh +++ b/lib/books/lsp30_0.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_1.vqh b/lib/books/res0_1024a_128_1.vqh index d790e93b..c066d4b3 100644 --- a/lib/books/res0_1024a_128_1.vqh +++ b/lib/books/res0_1024a_128_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_2.vqh b/lib/books/res0_1024a_128_2.vqh index b77e3ace..3b62cade 100644 --- a/lib/books/res0_1024a_128_2.vqh +++ b/lib/books/res0_1024a_128_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_3.vqh b/lib/books/res0_1024a_128_3.vqh index b570fe95..715b9db9 100644 --- a/lib/books/res0_1024a_128_3.vqh +++ b/lib/books/res0_1024a_128_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_4.vqh b/lib/books/res0_1024a_128_4.vqh index 8ccfc80d..e70b23b4 100644 --- a/lib/books/res0_1024a_128_4.vqh +++ b/lib/books/res0_1024a_128_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_5.vqh b/lib/books/res0_1024a_128_5.vqh index ab9798e7..458d4d11 100644 --- a/lib/books/res0_1024a_128_5.vqh +++ b/lib/books/res0_1024a_128_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_6.vqh b/lib/books/res0_1024a_128_6.vqh index 8b97c057..0f32f6dc 100644 --- a/lib/books/res0_1024a_128_6.vqh +++ b/lib/books/res0_1024a_128_6.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_7.vqh b/lib/books/res0_1024a_128_7.vqh index 71c40936..4ddab5a8 100644 --- a/lib/books/res0_1024a_128_7.vqh +++ b/lib/books/res0_1024a_128_7.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_8.vqh b/lib/books/res0_1024a_128_8.vqh index 87d67a2e..17742c7c 100644 --- a/lib/books/res0_1024a_128_8.vqh +++ b/lib/books/res0_1024a_128_8.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_128_9.vqh b/lib/books/res0_1024a_128_9.vqh index 10e8f01d..0f101023 100644 --- a/lib/books/res0_1024a_128_9.vqh +++ b/lib/books/res0_1024a_128_9.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_1.vqh b/lib/books/res0_1024a_160_1.vqh index ca4b4f01..42e5f4d8 100644 --- a/lib/books/res0_1024a_160_1.vqh +++ b/lib/books/res0_1024a_160_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_2.vqh b/lib/books/res0_1024a_160_2.vqh index 7b7f5392..68d6ec96 100644 --- a/lib/books/res0_1024a_160_2.vqh +++ b/lib/books/res0_1024a_160_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_3.vqh b/lib/books/res0_1024a_160_3.vqh index 680fcdb2..2217fbf7 100644 --- a/lib/books/res0_1024a_160_3.vqh +++ b/lib/books/res0_1024a_160_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_4.vqh b/lib/books/res0_1024a_160_4.vqh index a3bb4db3..5819b386 100644 --- a/lib/books/res0_1024a_160_4.vqh +++ b/lib/books/res0_1024a_160_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_5.vqh b/lib/books/res0_1024a_160_5.vqh index 6a298abc..cfaab4cf 100644 --- a/lib/books/res0_1024a_160_5.vqh +++ b/lib/books/res0_1024a_160_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_6.vqh b/lib/books/res0_1024a_160_6.vqh index dcc29f59..8aa9aec8 100644 --- a/lib/books/res0_1024a_160_6.vqh +++ b/lib/books/res0_1024a_160_6.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_7.vqh b/lib/books/res0_1024a_160_7.vqh index 6b7b7a1e..b538acc2 100644 --- a/lib/books/res0_1024a_160_7.vqh +++ b/lib/books/res0_1024a_160_7.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_8.vqh b/lib/books/res0_1024a_160_8.vqh index 576eae47..d29e52fb 100644 --- a/lib/books/res0_1024a_160_8.vqh +++ b/lib/books/res0_1024a_160_8.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_160_9.vqh b/lib/books/res0_1024a_160_9.vqh index e4b588e5..920f59b8 100644 --- a/lib/books/res0_1024a_160_9.vqh +++ b/lib/books/res0_1024a_160_9.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_192_1.vqh b/lib/books/res0_1024a_192_1.vqh index b639c1e6..8e38d985 100644 --- a/lib/books/res0_1024a_192_1.vqh +++ b/lib/books/res0_1024a_192_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_192_2.vqh b/lib/books/res0_1024a_192_2.vqh index 9710062c..e8723e8c 100644 --- a/lib/books/res0_1024a_192_2.vqh +++ b/lib/books/res0_1024a_192_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_192_3.vqh b/lib/books/res0_1024a_192_3.vqh index 9d45a29e..107e88c6 100644 --- a/lib/books/res0_1024a_192_3.vqh +++ b/lib/books/res0_1024a_192_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_192_4.vqh b/lib/books/res0_1024a_192_4.vqh index 5a1db68b..b153a088 100644 --- a/lib/books/res0_1024a_192_4.vqh +++ b/lib/books/res0_1024a_192_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_192_5.vqh b/lib/books/res0_1024a_192_5.vqh index cedaf24e..9d34cbac 100644 --- a/lib/books/res0_1024a_192_5.vqh +++ b/lib/books/res0_1024a_192_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_256_1.vqh b/lib/books/res0_1024a_256_1.vqh index da4dab88..c13527d0 100644 --- a/lib/books/res0_1024a_256_1.vqh +++ b/lib/books/res0_1024a_256_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_256_2.vqh b/lib/books/res0_1024a_256_2.vqh index bd4a525a..c048293b 100644 --- a/lib/books/res0_1024a_256_2.vqh +++ b/lib/books/res0_1024a_256_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_256_3.vqh b/lib/books/res0_1024a_256_3.vqh index a3d5ccd8..a356552e 100644 --- a/lib/books/res0_1024a_256_3.vqh +++ b/lib/books/res0_1024a_256_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_256_4.vqh b/lib/books/res0_1024a_256_4.vqh index bbc14a73..541f3af2 100644 --- a/lib/books/res0_1024a_256_4.vqh +++ b/lib/books/res0_1024a_256_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_256_5.vqh b/lib/books/res0_1024a_256_5.vqh index ebfe9500..18abe4b7 100644 --- a/lib/books/res0_1024a_256_5.vqh +++ b/lib/books/res0_1024a_256_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_350_1.vqh b/lib/books/res0_1024a_350_1.vqh index 0423f2c5..664fcd56 100644 --- a/lib/books/res0_1024a_350_1.vqh +++ b/lib/books/res0_1024a_350_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_350_2.vqh b/lib/books/res0_1024a_350_2.vqh index 0c6460ba..cd7408af 100644 --- a/lib/books/res0_1024a_350_2.vqh +++ b/lib/books/res0_1024a_350_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_350_3.vqh b/lib/books/res0_1024a_350_3.vqh index c888c259..23487f07 100644 --- a/lib/books/res0_1024a_350_3.vqh +++ b/lib/books/res0_1024a_350_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_350_4.vqh b/lib/books/res0_1024a_350_4.vqh index c0445625..d63d6424 100644 --- a/lib/books/res0_1024a_350_4.vqh +++ b/lib/books/res0_1024a_350_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_1024a_350_5.vqh b/lib/books/res0_1024a_350_5.vqh index af512870..e8d5361f 100644 --- a/lib/books/res0_1024a_350_5.vqh +++ b/lib/books/res0_1024a_350_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_128_1.vqh b/lib/books/res0_128a_128_1.vqh index e3f4320e..fb3f8783 100644 --- a/lib/books/res0_128a_128_1.vqh +++ b/lib/books/res0_128a_128_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_128_2.vqh b/lib/books/res0_128a_128_2.vqh index ede7f4cd..54170e10 100644 --- a/lib/books/res0_128a_128_2.vqh +++ b/lib/books/res0_128a_128_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_128_3.vqh b/lib/books/res0_128a_128_3.vqh index b4b2c8c3..82c40064 100644 --- a/lib/books/res0_128a_128_3.vqh +++ b/lib/books/res0_128a_128_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_128_4.vqh b/lib/books/res0_128a_128_4.vqh index 12f67b87..b23ce563 100644 --- a/lib/books/res0_128a_128_4.vqh +++ b/lib/books/res0_128a_128_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_128_5.vqh b/lib/books/res0_128a_128_5.vqh index 672be68c..b9e49b6a 100644 --- a/lib/books/res0_128a_128_5.vqh +++ b/lib/books/res0_128a_128_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_160_1.vqh b/lib/books/res0_128a_160_1.vqh index 52b60351..6213bf83 100644 --- a/lib/books/res0_128a_160_1.vqh +++ b/lib/books/res0_128a_160_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_160_2.vqh b/lib/books/res0_128a_160_2.vqh index e92f97a1..ef65b04a 100644 --- a/lib/books/res0_128a_160_2.vqh +++ b/lib/books/res0_128a_160_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_160_3.vqh b/lib/books/res0_128a_160_3.vqh index 4e074f02..ff02facd 100644 --- a/lib/books/res0_128a_160_3.vqh +++ b/lib/books/res0_128a_160_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_160_4.vqh b/lib/books/res0_128a_160_4.vqh index 408dcdfb..82b81e7c 100644 --- a/lib/books/res0_128a_160_4.vqh +++ b/lib/books/res0_128a_160_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_160_5.vqh b/lib/books/res0_128a_160_5.vqh index 1a796d2f..d8a577f6 100644 --- a/lib/books/res0_128a_160_5.vqh +++ b/lib/books/res0_128a_160_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_192_1.vqh b/lib/books/res0_128a_192_1.vqh index ccb4cfb5..8089ce71 100644 --- a/lib/books/res0_128a_192_1.vqh +++ b/lib/books/res0_128a_192_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_192_2.vqh b/lib/books/res0_128a_192_2.vqh index c42a275d..6eaf2c73 100644 --- a/lib/books/res0_128a_192_2.vqh +++ b/lib/books/res0_128a_192_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_192_3.vqh b/lib/books/res0_128a_192_3.vqh index e47deff9..83a85371 100644 --- a/lib/books/res0_128a_192_3.vqh +++ b/lib/books/res0_128a_192_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_192_4.vqh b/lib/books/res0_128a_192_4.vqh index 3174c0ad..367e6738 100644 --- a/lib/books/res0_128a_192_4.vqh +++ b/lib/books/res0_128a_192_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_192_5.vqh b/lib/books/res0_128a_192_5.vqh index bb159ba9..5654c1e4 100644 --- a/lib/books/res0_128a_192_5.vqh +++ b/lib/books/res0_128a_192_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_256_1.vqh b/lib/books/res0_128a_256_1.vqh index cd0f780f..87106e78 100644 --- a/lib/books/res0_128a_256_1.vqh +++ b/lib/books/res0_128a_256_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_256_2.vqh b/lib/books/res0_128a_256_2.vqh index 2e196c51..559e841c 100644 --- a/lib/books/res0_128a_256_2.vqh +++ b/lib/books/res0_128a_256_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_256_3.vqh b/lib/books/res0_128a_256_3.vqh index a1101014..7bb5d108 100644 --- a/lib/books/res0_128a_256_3.vqh +++ b/lib/books/res0_128a_256_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_256_4.vqh b/lib/books/res0_128a_256_4.vqh index 15f613c7..b3fe0e8f 100644 --- a/lib/books/res0_128a_256_4.vqh +++ b/lib/books/res0_128a_256_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_256_5.vqh b/lib/books/res0_128a_256_5.vqh index 9da503e4..8bb456d8 100644 --- a/lib/books/res0_128a_256_5.vqh +++ b/lib/books/res0_128a_256_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_350_1.vqh b/lib/books/res0_128a_350_1.vqh index 0d7d2ea1..249c9b09 100644 --- a/lib/books/res0_128a_350_1.vqh +++ b/lib/books/res0_128a_350_1.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_350_2.vqh b/lib/books/res0_128a_350_2.vqh index 05a019b4..f1a91806 100644 --- a/lib/books/res0_128a_350_2.vqh +++ b/lib/books/res0_128a_350_2.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_350_3.vqh b/lib/books/res0_128a_350_3.vqh index af61575e..788866f7 100644 --- a/lib/books/res0_128a_350_3.vqh +++ b/lib/books/res0_128a_350_3.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_350_4.vqh b/lib/books/res0_128a_350_4.vqh index 57995160..b8bfefb3 100644 --- a/lib/books/res0_128a_350_4.vqh +++ b/lib/books/res0_128a_350_4.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/res0_128a_350_5.vqh b/lib/books/res0_128a_350_5.vqh index 97bf8c6d..1ad0fe6c 100644 --- a/lib/books/res0_128a_350_5.vqh +++ b/lib/books/res0_128a_350_5.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_1024a_128.vqh b/lib/books/resaux0_1024a_128.vqh index a422ec05..109ab62e 100644 --- a/lib/books/resaux0_1024a_128.vqh +++ b/lib/books/resaux0_1024a_128.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_1024a_160.vqh b/lib/books/resaux0_1024a_160.vqh index ac8ff835..fa4232ff 100644 --- a/lib/books/resaux0_1024a_160.vqh +++ b/lib/books/resaux0_1024a_160.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_1024a_192.vqh b/lib/books/resaux0_1024a_192.vqh index ff5a4cf3..73e0d074 100644 --- a/lib/books/resaux0_1024a_192.vqh +++ b/lib/books/resaux0_1024a_192.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_1024a_256.vqh b/lib/books/resaux0_1024a_256.vqh index 4a3fd01e..a8d1c17a 100644 --- a/lib/books/resaux0_1024a_256.vqh +++ b/lib/books/resaux0_1024a_256.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_1024a_350.vqh b/lib/books/resaux0_1024a_350.vqh index 04441a61..2b9bf77c 100644 --- a/lib/books/resaux0_1024a_350.vqh +++ b/lib/books/resaux0_1024a_350.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_128a_128.vqh b/lib/books/resaux0_128a_128.vqh index 5f1255cd..d7b4f3af 100644 --- a/lib/books/resaux0_128a_128.vqh +++ b/lib/books/resaux0_128a_128.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_128a_160.vqh b/lib/books/resaux0_128a_160.vqh index 658d93da..dd7b47fa 100644 --- a/lib/books/resaux0_128a_160.vqh +++ b/lib/books/resaux0_128a_160.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_128a_192.vqh b/lib/books/resaux0_128a_192.vqh index f13cbc0c..de2a30e0 100644 --- a/lib/books/resaux0_128a_192.vqh +++ b/lib/books/resaux0_128a_192.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_128a_256.vqh b/lib/books/resaux0_128a_256.vqh index bbff2113..ab019751 100644 --- a/lib/books/resaux0_128a_256.vqh +++ b/lib/books/resaux0_128a_256.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/books/resaux0_128a_350.vqh b/lib/books/resaux0_128a_350.vqh index e1697d1b..290bf9d1 100644 --- a/lib/books/resaux0_128a_350.vqh +++ b/lib/books/resaux0_128a_350.vqh @@ -1,12 +1,12 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * - * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** diff --git a/lib/codebook.c b/lib/codebook.c index 18e75ec6..376d6cc8 100644 --- a/lib/codebook.c +++ b/lib/codebook.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c,v 1.18.2.2 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: codebook.c,v 1.18.2.3 2000/11/04 06:21:42 xiphmont Exp $ ********************************************************************/ diff --git a/lib/codebook.h b/lib/codebook.h index d0c94797..3e44996d 100644 --- a/lib/codebook.h +++ b/lib/codebook.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: basic shared codebook operations - last mod: $Id: codebook.h,v 1.1.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: codebook.h,v 1.1.2.2 2000/11/04 06:21:43 xiphmont Exp $ ********************************************************************/ diff --git a/lib/codec_internal.h b/lib/codec_internal.h index 842a1dd6..7f794acc 100644 --- a/lib/codec_internal.h +++ b/lib/codec_internal.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec_internal.h,v 1.1.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: codec_internal.h,v 1.1.2.2 2000/11/04 06:21:43 xiphmont Exp $ ********************************************************************/ diff --git a/lib/envelope.c b/lib/envelope.c index 58e234fd..f00a7d4a 100644 --- a/lib/envelope.c +++ b/lib/envelope.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.c,v 1.23.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: envelope.c,v 1.23.2.2 2000/11/04 06:21:43 xiphmont Exp $ Preecho calculation. diff --git a/lib/envelope.h b/lib/envelope.h new file mode 100644 index 00000000..85fdf197 --- /dev/null +++ b/lib/envelope.h @@ -0,0 +1,49 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: PCM data envelope analysis and manipulation + last mod: $Id: envelope.h,v 1.10.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_ENVELOPE_ +#define _V_ENVELOPE_ + +#include "iir.h" +#include "smallft.h" + +#define EORDER 16 + +typedef struct { + int ch; + int winlength; + int searchstep; + float minenergy; + + IIR_state *iir; + float **filtered; + long storage; + long current; + + drft_lookup drft; + float *window; +} envelope_lookup; + +extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); +extern void _ve_envelope_clear(envelope_lookup *e); +extern long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint); +extern void _ve_envelope_shift(envelope_lookup *e,long shift); + + +#endif + diff --git a/lib/floor0.c b/lib/floor0.c index b5d308ab..e4eef463 100644 --- a/lib/floor0.c +++ b/lib/floor0.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: floor backend 0 implementation - last mod: $Id: floor0.c,v 1.25.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: floor0.c,v 1.25.2.2 2000/11/04 06:21:44 xiphmont Exp $ ********************************************************************/ diff --git a/lib/iir.c b/lib/iir.c new file mode 100644 index 00000000..9806e27e --- /dev/null +++ b/lib/iir.c @@ -0,0 +1,302 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: Direct Form I, II IIR filters, plus some specializations + last mod: $Id: iir.c,v 1.2.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +/* LPC is actually a degenerate case of form I/II filters, but we need + both */ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include "iir.h" + +void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B){ + memset(s,0,sizeof(IIR_state)); + s->stages=stages; + s->gain=gain; + s->coeff_A=malloc(stages*sizeof(float)); + s->coeff_B=malloc((stages+1)*sizeof(float)); + s->z_A=calloc(stages*2,sizeof(float)); + s->z_B=calloc(stages*2,sizeof(float)); + + memcpy(s->coeff_A,A,stages*sizeof(float)); + memcpy(s->coeff_B,B,(stages+1)*sizeof(float)); +} + +void IIR_clear(IIR_state *s){ + if(s){ + free(s->coeff_A); + free(s->coeff_B); + free(s->z_A); + free(s->z_B); + memset(s,0,sizeof(IIR_state)); + } +} + +float IIR_filter(IIR_state *s,float in){ + int stages=s->stages,i; + float newA; + float newB=0; + float *zA=s->z_A+s->ring; + + newA=in/=s->gain; + for(i=0;i<stages;i++){ + newA+= s->coeff_A[i] * zA[i]; + newB+= s->coeff_B[i] * zA[i]; + } + newB+=newA*s->coeff_B[stages]; + + zA[0]=zA[stages]=newA; + if(++s->ring>=stages)s->ring=0; + + return(newB); +} + +/* this assumes the symmetrical structure of the feed-forward stage of + a Chebyshev bandpass to save multiplies */ +float IIR_filter_ChebBand(IIR_state *s,float in){ + int stages=s->stages,i; + float newA; + float newB=0; + float *zA=s->z_A+s->ring; + + newA=in/=s->gain; + + newA+= s->coeff_A[0] * zA[0]; + for(i=1;i<(stages>>1);i++){ + newA+= s->coeff_A[i] * zA[i]; + newB+= s->coeff_B[i] * (zA[i]-zA[stages-i]); + } + newB+= s->coeff_B[i] * zA[i]; + for(;i<stages;i++) + newA+= s->coeff_A[i] * zA[i]; + + newB+= newA-zA[0]; + + zA[0]=zA[stages]=newA; + if(++s->ring>=stages)s->ring=0; + + return(newB); +} + +#ifdef _V_SELFTEST + +/* z^-stage, z^-stage+1... */ +static float cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1}; +static float cheb_bandpass_A[]={-0.6665900311, + 1.0070146601, + -3.1262875409, + 3.5017171569, + -6.2779211945, + 5.2966481740, + -6.7570216587, + 4.0760335768, + -3.9134284363, + 1.3997338886}; + +static float data[128]={ + 0.0426331, + 0.0384521, + 0.0345764, + 0.0346069, + 0.0314636, + 0.0310059, + 0.0318604, + 0.0336304, + 0.036438, + 0.0348511, + 0.0354919, + 0.0343628, + 0.0325623, + 0.0318909, + 0.0263367, + 0.0225525, + 0.0195618, + 0.0160828, + 0.0168762, + 0.0145569, + 0.0126343, + 0.0127258, + 0.00820923, + 0.00787354, + 0.00558472, + 0.00204468, + 3.05176e-05, + -0.00357056, + -0.00570679, + -0.00991821, + -0.0101013, + -0.00881958, + -0.0108948, + -0.0110168, + -0.0119324, + -0.0161438, + -0.0194702, + -0.0229187, + -0.0260315, + -0.0282288, + -0.0306091, + -0.0330505, + -0.0364685, + -0.0385742, + -0.0428772, + -0.043457, + -0.0425415, + -0.0462341, + -0.0467529, + -0.0489807, + -0.0520325, + -0.0558167, + -0.0596924, + -0.0591431, + -0.0612793, + -0.0618591, + -0.0615845, + -0.0634155, + -0.0639648, + -0.0683594, + -0.0718079, + -0.0729675, + -0.0791931, + -0.0860901, + -0.0885315, + -0.088623, + -0.089386, + -0.0899353, + -0.0886841, + -0.0910645, + -0.0948181, + -0.0919495, + -0.0891418, + -0.0916443, + -0.096344, + -0.100464, + -0.105499, + -0.108612, + -0.112213, + -0.117676, + -0.120911, + -0.124329, + -0.122162, + -0.120605, + -0.12326, + -0.12619, + -0.128998, + -0.13205, + -0.134247, + -0.137939, + -0.143555, + -0.14389, + -0.14859, + -0.153717, + -0.159851, + -0.164551, + -0.162811, + -0.164276, + -0.156952, + -0.140564, + -0.123291, + -0.10321, + -0.0827637, + -0.0652466, + -0.053772, + -0.0509949, + -0.0577698, + -0.0818176, + -0.114929, + -0.148895, + -0.181122, + -0.200714, + -0.21048, + -0.203644, + -0.179413, + -0.145325, + -0.104492, + -0.0658264, + -0.0332031, + -0.0106201, + -0.00363159, + -0.00909424, + -0.0244141, + -0.0422058, + -0.0537415, + -0.0610046, + -0.0609741, + -0.0547791}; + +/* comparison test code from http://www-users.cs.york.ac.uk/~fisher/mkfilter/ + (the above page kicks ass, BTW)*/ + +#define NZEROS 10 +#define NPOLES 10 +#define GAIN 4.599477515e+02 + +static float xv[NZEROS+1], yv[NPOLES+1]; + +static float filterloop(float next){ + xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5]; + xv[5] = xv[6]; xv[6] = xv[7]; xv[7] = xv[8]; xv[8] = xv[9]; xv[9] = xv[10]; + xv[10] = next / GAIN; + yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = yv[5]; + yv[5] = yv[6]; yv[6] = yv[7]; yv[7] = yv[8]; yv[8] = yv[9]; yv[9] = yv[10]; + yv[10] = (xv[10] - xv[0]) + 5 * (xv[2] - xv[8]) + 10 * (xv[6] - xv[4]) + + ( -0.6665900311 * yv[0]) + ( 1.0070146601 * yv[1]) + + ( -3.1262875409 * yv[2]) + ( 3.5017171569 * yv[3]) + + ( -6.2779211945 * yv[4]) + ( 5.2966481740 * yv[5]) + + ( -6.7570216587 * yv[6]) + ( 4.0760335768 * yv[7]) + + ( -3.9134284363 * yv[8]) + ( 1.3997338886 * yv[9]); + return(yv[10]); +} + +#include <stdio.h> +int main(){ + + /* run the pregenerated Chebyshev filter, then our own distillation + through the generic and specialized code */ + float *work=malloc(128*sizeof(float)); + IIR_state iir; + int i; + + for(i=0;i<128;i++)work[i]=filterloop(data[i]); + { + FILE *out=fopen("IIR_ref.m","w"); + for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]); + fclose(out); + } + + IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B); + for(i=0;i<128;i++)work[i]=IIR_filter(&iir,data[i]); + { + FILE *out=fopen("IIR_gen.m","w"); + for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]); + fclose(out); + } + IIR_clear(&iir); + + IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B); + for(i=0;i<128;i++)work[i]=IIR_filter_ChebBand(&iir,data[i]); + { + FILE *out=fopen("IIR_cheb.m","w"); + for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]); + fclose(out); + } + IIR_clear(&iir); + + return(0); +} + +#endif diff --git a/lib/iir.h b/lib/iir.h new file mode 100644 index 00000000..9fee1437 --- /dev/null +++ b/lib/iir.h @@ -0,0 +1,37 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: Direct Form I, II IIR filters, plus some specializations + last mod: $Id: iir.h,v 1.2.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_IIR_H_ +#define _V_IIR_H_ + +typedef struct { + int stages; + float *coeff_A; + float *coeff_B; + float *z_A; + float *z_B; + int ring; + float gain; +} IIR_state; + +void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B); +void IIR_clear(IIR_state *s); +float IIR_filter(IIR_state *s,float in); +float IIR_filter_ChebBand(IIR_state *s,float in); + +#endif @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c,v 1.31.2.3 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: info.c,v 1.31.2.4 2000/11/04 06:21:44 xiphmont Exp $ ********************************************************************/ diff --git a/lib/lookup.c b/lib/lookup.c index 5589a1ed..6a2bb56b 100644 --- a/lib/lookup.c +++ b/lib/lookup.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: lookup based functions - last mod: $Id: lookup.c,v 1.2.2.1 2000/10/19 10:21:02 xiphmont Exp $ + last mod: $Id: lookup.c,v 1.2.2.2 2000/11/04 06:21:44 xiphmont Exp $ ********************************************************************/ diff --git a/lib/lookup.h b/lib/lookup.h new file mode 100644 index 00000000..8de26dc5 --- /dev/null +++ b/lib/lookup.h @@ -0,0 +1,33 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup based functions + last mod: $Id: lookup.h,v 1.2.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_LOOKUP_H_ + +#ifdef FLOAT_LOOKUP +extern float vorbis_coslook(float a); +extern float vorbis_invsqlook(float a); +extern float vorbis_invsq2explook(int a); +extern float vorbis_fromdBlook(float a); +#endif +#ifdef INT_LOOKUP +extern long vorbis_invsqlook_i(long a,long e); +extern long vorbis_coslook_i(long a); +extern float vorbis_fromdBlook_i(long a); +#endif + +#endif diff --git a/lib/lookup_data.h b/lib/lookup_data.h new file mode 100644 index 00000000..f0740ce8 --- /dev/null +++ b/lib/lookup_data.h @@ -0,0 +1,190 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup data; generated by lookups.pl; edit there + last mod: $Id: lookup_data.h,v 1.2.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_LOOKUP_DATA_H_ + +#ifdef FLOAT_LOOKUP +#define COS_LOOKUP_SZ 128 +static float COS_LOOKUP[COS_LOOKUP_SZ+1]={ + +1.0000000000000,+0.9996988186962,+0.9987954562052,+0.9972904566787, + +0.9951847266722,+0.9924795345987,+0.9891765099648,+0.9852776423889, + +0.9807852804032,+0.9757021300385,+0.9700312531945,+0.9637760657954, + +0.9569403357322,+0.9495281805930,+0.9415440651830,+0.9329927988347, + +0.9238795325113,+0.9142097557035,+0.9039892931234,+0.8932243011955, + +0.8819212643484,+0.8700869911087,+0.8577286100003,+0.8448535652497, + +0.8314696123025,+0.8175848131516,+0.8032075314806,+0.7883464276266, + +0.7730104533627,+0.7572088465065,+0.7409511253550,+0.7242470829515, + +0.7071067811865,+0.6895405447371,+0.6715589548470,+0.6531728429538, + +0.6343932841636,+0.6152315905806,+0.5956993044924,+0.5758081914178, + +0.5555702330196,+0.5349976198871,+0.5141027441932,+0.4928981922298, + +0.4713967368260,+0.4496113296546,+0.4275550934303,+0.4052413140050, + +0.3826834323651,+0.3598950365350,+0.3368898533922,+0.3136817403989, + +0.2902846772545,+0.2667127574749,+0.2429801799033,+0.2191012401569, + +0.1950903220161,+0.1709618887603,+0.1467304744554,+0.1224106751992, + +0.0980171403296,+0.0735645635997,+0.0490676743274,+0.0245412285229, + +0.0000000000000,-0.0245412285229,-0.0490676743274,-0.0735645635997, + -0.0980171403296,-0.1224106751992,-0.1467304744554,-0.1709618887603, + -0.1950903220161,-0.2191012401569,-0.2429801799033,-0.2667127574749, + -0.2902846772545,-0.3136817403989,-0.3368898533922,-0.3598950365350, + -0.3826834323651,-0.4052413140050,-0.4275550934303,-0.4496113296546, + -0.4713967368260,-0.4928981922298,-0.5141027441932,-0.5349976198871, + -0.5555702330196,-0.5758081914178,-0.5956993044924,-0.6152315905806, + -0.6343932841636,-0.6531728429538,-0.6715589548470,-0.6895405447371, + -0.7071067811865,-0.7242470829515,-0.7409511253550,-0.7572088465065, + -0.7730104533627,-0.7883464276266,-0.8032075314806,-0.8175848131516, + -0.8314696123025,-0.8448535652497,-0.8577286100003,-0.8700869911087, + -0.8819212643484,-0.8932243011955,-0.9039892931234,-0.9142097557035, + -0.9238795325113,-0.9329927988347,-0.9415440651830,-0.9495281805930, + -0.9569403357322,-0.9637760657954,-0.9700312531945,-0.9757021300385, + -0.9807852804032,-0.9852776423889,-0.9891765099648,-0.9924795345987, + -0.9951847266722,-0.9972904566787,-0.9987954562052,-0.9996988186962, + -1.0000000000000, +}; + +#define INVSQ_LOOKUP_SZ 32 +static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ + 1.414213562373,1.392621247646,1.371988681140,1.352246807566, + 1.333333333333,1.315191898443,1.297771369046,1.281025230441, + 1.264911064067,1.249390095109,1.234426799697,1.219988562661, + 1.206045378311,1.192569588000,1.179535649239,1.166919931983, + 1.154700538379,1.142857142857,1.131370849898,1.120224067222, + 1.109400392450,1.098884511590,1.088662107904,1.078719779941, + 1.069044967650,1.059625885652,1.050451462878,1.041511287847, + 1.032795558989,1.024295039463,1.016001016002,1.007905261358, + 1.000000000000, +}; + +#define INVSQ2EXP_LOOKUP_MIN -32 +#define INVSQ2EXP_LOOKUP_MAX 32 +static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ + INVSQ2EXP_LOOKUP_MIN+1]={ + 65536, 46340.95001, 32768, 23170.47501, + 16384, 11585.2375, 8192, 5792.618751, + 4096, 2896.309376, 2048, 1448.154688, + 1024, 724.0773439, 512, 362.038672, + 256, 181.019336, 128, 90.50966799, + 64, 45.254834, 32, 22.627417, + 16, 11.3137085, 8, 5.656854249, + 4, 2.828427125, 2, 1.414213562, + 1, 0.7071067812, 0.5, 0.3535533906, + 0.25, 0.1767766953, 0.125, 0.08838834765, + 0.0625, 0.04419417382, 0.03125, 0.02209708691, + 0.015625, 0.01104854346, 0.0078125, 0.005524271728, + 0.00390625, 0.002762135864, 0.001953125, 0.001381067932, + 0.0009765625, 0.000690533966, 0.00048828125, 0.000345266983, + 0.000244140625,0.0001726334915,0.0001220703125,8.631674575e-05, + 6.103515625e-05,4.315837288e-05,3.051757812e-05,2.157918644e-05, + 1.525878906e-05, +}; + +#endif + +#define FROMdB_LOOKUP_SZ 35 +#define FROMdB2_LOOKUP_SZ 32 +#define FROMdB_SHIFT 5 +#define FROMdB2_SHIFT 3 +#define FROMdB2_MASK 31 +static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ + 1, 0.6309573445, 0.3981071706, 0.2511886432, + 0.1584893192, 0.1, 0.06309573445, 0.03981071706, + 0.02511886432, 0.01584893192, 0.01, 0.006309573445, + 0.003981071706, 0.002511886432, 0.001584893192, 0.001, + 0.0006309573445,0.0003981071706,0.0002511886432,0.0001584893192, + 0.0001,6.309573445e-05,3.981071706e-05,2.511886432e-05, + 1.584893192e-05, 1e-05,6.309573445e-06,3.981071706e-06, + 2.511886432e-06,1.584893192e-06, 1e-06,6.309573445e-07, + 3.981071706e-07,2.511886432e-07,1.584893192e-07, +}; + +static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ + 0.9928302478, 0.9786445908, 0.9646616199, 0.9508784391, + 0.9372921937, 0.92390007, 0.9106992942, 0.8976871324, + 0.8848608897, 0.8722179097, 0.8597555737, 0.8474713009, + 0.835362547, 0.8234268041, 0.8116616003, 0.8000644989, + 0.7886330981, 0.7773650302, 0.7662579617, 0.755309592, + 0.7445176537, 0.7338799116, 0.7233941627, 0.7130582353, + 0.7028699885, 0.6928273125, 0.6829281272, 0.6731703824, + 0.6635520573, 0.6540711597, 0.6447257262, 0.6355138211, +}; + +#ifdef INT_LOOKUP + +#define INVSQ_LOOKUP_I_SHIFT 10 +#define INVSQ_LOOKUP_I_MASK 1023 +static long INVSQ_LOOKUP_I[64+1]={ + 92682, 91966, 91267, 90583, + 89915, 89261, 88621, 87995, + 87381, 86781, 86192, 85616, + 85051, 84497, 83953, 83420, + 82897, 82384, 81880, 81385, + 80899, 80422, 79953, 79492, + 79039, 78594, 78156, 77726, + 77302, 76885, 76475, 76072, + 75674, 75283, 74898, 74519, + 74146, 73778, 73415, 73058, + 72706, 72359, 72016, 71679, + 71347, 71019, 70695, 70376, + 70061, 69750, 69444, 69141, + 68842, 68548, 68256, 67969, + 67685, 67405, 67128, 66855, + 66585, 66318, 66054, 65794, + 65536, +}; + +#define COS_LOOKUP_I_SHIFT 9 +#define COS_LOOKUP_I_MASK 511 +#define COS_LOOKUP_I_SZ 128 +static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ + 16384, 16379, 16364, 16340, + 16305, 16261, 16207, 16143, + 16069, 15986, 15893, 15791, + 15679, 15557, 15426, 15286, + 15137, 14978, 14811, 14635, + 14449, 14256, 14053, 13842, + 13623, 13395, 13160, 12916, + 12665, 12406, 12140, 11866, + 11585, 11297, 11003, 10702, + 10394, 10080, 9760, 9434, + 9102, 8765, 8423, 8076, + 7723, 7366, 7005, 6639, + 6270, 5897, 5520, 5139, + 4756, 4370, 3981, 3590, + 3196, 2801, 2404, 2006, + 1606, 1205, 804, 402, + 0, -401, -803, -1204, + -1605, -2005, -2403, -2800, + -3195, -3589, -3980, -4369, + -4755, -5138, -5519, -5896, + -6269, -6638, -7004, -7365, + -7722, -8075, -8422, -8764, + -9101, -9433, -9759, -10079, + -10393, -10701, -11002, -11296, + -11584, -11865, -12139, -12405, + -12664, -12915, -13159, -13394, + -13622, -13841, -14052, -14255, + -14448, -14634, -14810, -14977, + -15136, -15285, -15425, -15556, + -15678, -15790, -15892, -15985, + -16068, -16142, -16206, -16260, + -16304, -16339, -16363, -16378, + -16383, +}; + +#endif + +#endif diff --git a/lib/lookups.pl b/lib/lookups.pl new file mode 100755 index 00000000..7ecb5640 --- /dev/null +++ b/lib/lookups.pl @@ -0,0 +1,143 @@ +#!/usr/bin/perl +print <<'EOD'; +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup data; generated by lookups.pl; edit there + last mod: $Id: lookups.pl,v 1.2.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_LOOKUP_DATA_H_ + +#ifdef FLOAT_LOOKUP +EOD + +$cos_sz=128; +$invsq_sz=32; +$invsq2exp_min=-32; +$invsq2exp_max=32; + +$fromdB_sz=35; +$fromdB_shift=5; +$fromdB2_shift=3; + +$invsq_i_shift=10; +$cos_i_shift=9; +$delta_shift=6; + +print "#define COS_LOOKUP_SZ $cos_sz\n"; +print "static float COS_LOOKUP[COS_LOOKUP_SZ+1]={\n"; + +for($i=0;$i<=$cos_sz;){ + print "\t"; + for($j=0;$j<4 && $i<=$cos_sz;$j++){ + printf "%+.13f,", cos(3.14159265358979323846*($i++)/$cos_sz) ; + } + print "\n"; +} +print "};\n\n"; + +print "#define INVSQ_LOOKUP_SZ $invsq_sz\n"; +print "static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={\n"; + +for($i=0;$i<=$invsq_sz;){ + print "\t"; + for($j=0;$j<4 && $i<=$invsq_sz;$j++){ + my$indexmap=$i++/$invsq_sz*.5+.5; + printf "%.12f,", 1./sqrt($indexmap); + } + print "\n"; +} +print "};\n\n"; + +print "#define INVSQ2EXP_LOOKUP_MIN $invsq2exp_min\n"; +print "#define INVSQ2EXP_LOOKUP_MAX $invsq2exp_max\n"; +print "static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\\\n". + " INVSQ2EXP_LOOKUP_MIN+1]={\n"; + +for($i=$invsq2exp_min;$i<=$invsq2exp_max;){ + print "\t"; + for($j=0;$j<4 && $i<=$invsq2exp_max;$j++){ + printf "%15.10g,", 2**($i++*-.5); + } + print "\n"; +} +print "};\n\n#endif\n\n"; + + +# 0 to -140 dB +$fromdB2_sz=1<<$fromdB_shift; +$fromdB_gran=1<<($fromdB_shift-$fromdB2_shift); +print "#define FROMdB_LOOKUP_SZ $fromdB_sz\n"; +print "#define FROMdB2_LOOKUP_SZ $fromdB2_sz\n"; +print "#define FROMdB_SHIFT $fromdB_shift\n"; +print "#define FROMdB2_SHIFT $fromdB2_shift\n"; +print "#define FROMdB2_MASK ".((1<<$fromdB_shift)-1)."\n"; + +print "static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={\n"; + +for($i=0;$i<$fromdB_sz;){ + print "\t"; + for($j=0;$j<4 && $i<$fromdB_sz;$j++){ + printf "%15.10g,", 10**(.05*(-$fromdB_gran*$i++)); + } + print "\n"; +} +print "};\n\n"; + +print "static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={\n"; + +for($i=0;$i<$fromdB2_sz;){ + print "\t"; + for($j=0;$j<4 && $i<$fromdB_sz;$j++){ + printf "%15.10g,", 10**(.05*(-$fromdB_gran/$fromdB2_sz*(.5+$i++))); + } + print "\n"; +} +print "};\n\n#ifdef INT_LOOKUP\n\n"; + + +$iisz=0x10000>>$invsq_i_shift; +print "#define INVSQ_LOOKUP_I_SHIFT $invsq_i_shift\n"; +print "#define INVSQ_LOOKUP_I_MASK ".(0x0ffff>>(16-$invsq_i_shift))."\n"; +print "static long INVSQ_LOOKUP_I[$iisz+1]={\n"; +for($i=0;$i<=$iisz;){ + print "\t"; + for($j=0;$j<4 && $i<=$iisz;$j++){ + my$indexmap=$i++/$iisz*.5+.5; + printf "%8d,", int(1./sqrt($indexmap)*65536.+.5); + } + print "\n"; +} +print "};\n\n"; + +$cisz=0x10000>>$cos_i_shift; +print "#define COS_LOOKUP_I_SHIFT $cos_i_shift\n"; +print "#define COS_LOOKUP_I_MASK ".(0x0ffff>>(16-$cos_i_shift))."\n"; +print "#define COS_LOOKUP_I_SZ $cisz\n"; +print "static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={\n"; + +for($i=0;$i<=$cisz;){ + print "\t"; + for($j=0;$j<4 && $i<=$cisz;$j++){ + printf "%8d,", int(cos(3.14159265358979323846*($i++)/$cos_sz)*16384.+.5) ; + } + print "\n"; +} +print "};\n\n"; + + +print "#endif\n\n#endif\n"; + + diff --git a/lib/lpc.c b/lib/lpc.c new file mode 100644 index 00000000..c66248d7 --- /dev/null +++ b/lib/lpc.c @@ -0,0 +1,200 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: LPC low level routines + last mod: $Id: lpc.c,v 1.26.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +/* Some of these routines (autocorrelator, LPC coefficient estimator) + are derived from code written by Jutta Degener and Carsten Bormann; + thus we include their copyright below. The entirety of this file + is freely redistributable on the condition that both of these + copyright notices are preserved without modification. */ + +/* Preserved Copyright: *********************************************/ + +/* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universita"t Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universita"t +Berlin are deemed to have made any representations as to the +suitability of this software for any purpose nor are held responsible +for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR +THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener +Carsten Bormann + +*********************************************************************/ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include "os.h" +#include "smallft.h" +#include "lpc.h" +#include "scales.h" +#include "misc.h" + +/* Autocorrelation LPC coeff generation algorithm invented by + N. Levinson in 1947, modified by J. Durbin in 1959. */ + +/* Input : n elements of time doamin data + Output: m lpc coefficients, excitation energy */ + +float vorbis_lpc_from_data(float *data,float *lpc,int n,int m){ + float *aut=alloca(sizeof(float)*(m+1)); + float error; + int i,j; + + /* autocorrelation, p+1 lag coefficients */ + + j=m+1; + while(j--){ + float d=0; + for(i=j;i<n;i++)d+=data[i]*data[i-j]; + aut[j]=d; + } + + /* Generate lpc coefficients from autocorr values */ + + error=aut[0]; + if(error==0){ + memset(lpc,0,m*sizeof(float)); + return 0; + } + + for(i=0;i<m;i++){ + float r=-aut[i+1]; + + /* Sum up this iteration's reflection coefficient; note that in + Vorbis we don't save it. If anyone wants to recycle this code + and needs reflection coefficients, save the results of 'r' from + each iteration. */ + + for(j=0;j<i;j++)r-=lpc[j]*aut[i-j]; + r/=error; + + /* Update LPC coefficients and total error */ + + lpc[i]=r; + for(j=0;j<i/2;j++){ + float tmp=lpc[j]; + lpc[j]+=r*lpc[i-1-j]; + lpc[i-1-j]+=r*tmp; + } + if(i%2)lpc[j]+=lpc[j]*r; + + error*=1.0-r*r; + } + + /* we need the error value to know how big an impulse to hit the + filter with later */ + + return error; +} + +/* Input : n element envelope spectral curve + Output: m lpc coefficients, excitation energy */ + +float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l){ + int n=l->ln; + int m=l->m; + float *work=alloca(sizeof(float)*(n+n)); + float fscale=.5/n; + int i,j; + + /* input is a real curve. make it complex-real */ + /* This mixes phase, but the LPC generation doesn't care. */ + for(i=0;i<n;i++){ + work[i*2]=curve[i]*fscale; + work[i*2+1]=0; + } + work[n*2-1]=curve[n-1]*fscale; + + n*=2; + drft_backward(&l->fft,work); + + /* The autocorrelation will not be circular. Shift, else we lose + most of the power in the edges. */ + + for(i=0,j=n/2;i<n/2;){ + float temp=work[i]; + work[i++]=work[j]; + work[j++]=temp; + } + + /* we *could* shave speed here by skimping on the edges (thus + speeding up the autocorrelation in vorbis_lpc_from_data) but we + don't right now. */ + + return(vorbis_lpc_from_data(work,lpc,n,m)); +} + +void lpc_init(lpc_lookup *l,long mapped, int m){ + memset(l,0,sizeof(lpc_lookup)); + + l->ln=mapped; + l->m=m; + + /* we cheat decoding the LPC spectrum via FFTs */ + drft_init(&l->fft,mapped*2); + +} + +void lpc_clear(lpc_lookup *l){ + if(l){ + drft_clear(&l->fft); + } +} + +void vorbis_lpc_predict(float *coeff,float *prime,int m, + float *data,long n){ + + /* in: coeff[0...m-1] LPC coefficients + prime[0...m-1] initial values (allocated size of n+m-1) + out: data[0...n-1] data samples */ + + long i,j,o,p; + float y; + float *work=alloca(sizeof(float)*(m+n)); + + if(!prime) + for(i=0;i<m;i++) + work[i]=0.; + else + for(i=0;i<m;i++) + work[i]=prime[i]; + + for(i=0;i<n;i++){ + y=0; + o=i; + p=m; + for(j=0;j<m;j++) + y-=work[o++]*coeff[--p]; + + data[i]=work[o]=y; + } +} + + + + + diff --git a/lib/lpc.h b/lib/lpc.h new file mode 100644 index 00000000..9d0e495e --- /dev/null +++ b/lib/lpc.h @@ -0,0 +1,44 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: LPC low level routines + last mod: $Id: lpc.h,v 1.14.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_LPC_H_ +#define _V_LPC_H_ + +#include "vorbis/codec.h" +#include "smallft.h" + +typedef struct lpclook{ + /* en/decode lookups */ + drft_lookup fft; + + int ln; + int m; + +} lpc_lookup; + +extern void lpc_init(lpc_lookup *l,long mapped, int m); +extern void lpc_clear(lpc_lookup *l); + +/* simple linear scale LPC code */ +extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m); +extern float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l); + +extern void vorbis_lpc_predict(float *coeff,float *prime,int m, + float *data,long n); + +#endif @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: LSP (also called LSF) conversion routines - last mod: $Id: lsp.c,v 1.10.2.3 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: lsp.c,v 1.10.2.4 2000/11/04 06:21:44 xiphmont Exp $ The LSP generation code is taken (with minimal modification) from "On the Computation of the LSP Frequencies" by Joseph Rothweiler diff --git a/lib/lsp.h b/lib/lsp.h new file mode 100644 index 00000000..c0ace13a --- /dev/null +++ b/lib/lsp.h @@ -0,0 +1,29 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: LSP (also called LSF) conversion routines + last mod: $Id: lsp.h,v 1.5.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + + +#ifndef _V_LSP_H_ +#define _V_LSP_H_ + +extern void vorbis_lpc_to_lsp(float *lpc,float *lsp,int m); + +extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln, + float *lsp,int m, + float amp,float ampoffset); + +#endif diff --git a/lib/mapping0.c b/lib/mapping0.c index fc594b8b..5860f2aa 100644 --- a/lib/mapping0.c +++ b/lib/mapping0.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c,v 1.16.2.1 2000/11/03 10:05:47 xiphmont Exp $ + last mod: $Id: mapping0.c,v 1.16.2.2 2000/11/04 06:21:44 xiphmont Exp $ ********************************************************************/ diff --git a/lib/masking.h b/lib/masking.h new file mode 100644 index 00000000..2fb39953 --- /dev/null +++ b/lib/masking.h @@ -0,0 +1,244 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: masking curve data for psychoacoustics + last mod: $Id: masking.h,v 1.5.2.1 2000/11/04 06:21:44 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_MASKING_H_ +#define _V_MASKING_H_ + +/* Not really an ATH, more a bottom curve to limit LSP dynamic range */ +float ATH_Bark_dB[]={ + 15, 15, 15, 15, 11, 10, 8, 7, 7, 7, + 6, 2, 0, 0, -3, -5, -6, -6, -4.5, 2.5, + 10, 15, 15, 15, 15, 15, 15}; + +/* The below masking curves are straight from the R. Ehmer + (J. Acoustical Society of America) papers ca 1958-59. I modified + them slightly as Ehmer does not correct for the Absolute Threshold + of Hearing, and the low dB portions of the curves are thus highly + suspect. */ + +/* Let's all do the Trek thing and just call them 'Ehmer curves' ;-) + Note these are octaves, not Bark scale. */ + +#define EHMER_OFFSET 16 +#define EHMER_MAX 56 + +float tone_125_40dB_SL[EHMER_MAX]={ + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 27, 26, 25, 23, 21, + 20, 18, 16, 14, 12, 11, 9, 7, 5, 3, 2, 0, -2, -4, -6, -8, + -10, -12, -14, -16, -18, -20, -23, -25, -28,-30,-34,-37,-40,-44,-48,-52, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_125_60dB_SL[EHMER_MAX]={ + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 47, 46, 45, 43, 41, + 40, 38, 36, 34, 32, 31, 29, 27, 25, 23, 22, 20, 18, 16, 14, 12, + 10, 8, 6, 4, 2, 0, -3, -5, -8,-10,-14,-17,-20,-24,-28,-32, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_125_80dB_SL[EHMER_MAX]={ + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 67, 66, 65, 63, 61, + 60, 58, 56, 54, 52, 51, 49, 47, 45, 43, 42, 40, 38, 36, 34, 32, + 30, 28, 26, 24, 22, 20, 17, 15, 12, 10, 6, 3, 0, -4, -8,-12, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_125_100dB_SL[EHMER_MAX]={ + 85, 85, 85, 85, 85, 85, 85, 85, 85, 84, 84, 83, 82, 81, 80, 79, + 78, 77, 75, 74, 73, 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, 60, + 58, 57, 55, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 31, 29, + 27, 24, 22, 20, 18, 15, 13, 11}; + +float tone_250_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -19, -13, -7, -1, 4, 9, 15, 20, + 22, 23, 22, 19, 18, 18, 16, 13, 9, 7, 3, 1, -1, -3, -6, -8, + -10, -13, -16, -19, -21, -24, -28, -32, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_250_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, -5, 1, 7, 13, 19, 25, 30, 33, + 36, 39, 38, 37, 38, 39, 39, 40, 38, 36, 35, 34, 33, 31, 29, 28, + 28, 28, 25, 20, 14, 10, 5, 0, -5,-10,-15,-20,-25,-30,-35,-40, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_250_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, 10, 17, 24, 30, 37, 41, 48, 49, + 50, 53, 54, 53, 53, 54, 55, 57, 57, 57, 58, 59, 60, 58, 57, 58, + 59, 58, 57, 54, 52, 50, 49, 47, 46, 47, 46, 44, 43, 42, 41, 40, + 38, 32, 27, 22, 17, 11, 6, 0}; +/* no data, just interpolated from 80 */ +float tone_250_100dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, 15, 25, 34, 40, 50, 56, 60, 70, + 70, 73, 74, 73, 73, 74, 75, 77, 77, 77, 78, 79, 80, 78, 77, 78, + 79, 78, 77, 74, 72, 70, 69, 67, 66, 67, 66, 64, 63, 62, 61, 60, + 58, 52, 47, 42, 37, 31, 26, 20}; + +float tone_500_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -40, -26, -20, -14, -8, -2, 4, 10, 17, + 23, 16, 12, 9, 6, 3, 0, -3, -7, -10, -13, -16, -20, -23, -26, -30, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_500_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -18, -12, -6, 0, 6, 13, 20, 30, + 39, 34, 31, 29, 29, 27, 24, 21, 18, 16, 13, 8, 6, 3, 1, -1, + -5, -2, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_500_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -22,-16,-10, 0, 10, 20, 32, 43, + 53, 52, 52, 50, 49, 50, 52, 55, 55, 54, 51, 49, 46, 44, 44, 42, + 38, 34, 32, 29, 29, 28, 25, 23, 20, 16, 10, 7, 4, 2, -1, -4, + -7, -10, -15, -20, -25, -30, -35, -40}; +float tone_500_100dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, -7, 2, 10, 19, 27, 35, 55, 56, + 62, 61, 60, 58, 57, 57, 59, 63, 65, 66, 62, 60, 57, 57, 58, 58, + 57, 56, 56, 56, 57, 57, 56, 57, 57, 54, 47, 41, 37, 28, 21, 16, + 10, 3, -3, -8, -13, -18, -23, -28}; + +float tone_1000_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -55, -40, -30, -20, -10, 0, 9, 20, + 27, 20, 13, 14, 13, 5, -1, -6, -11, -20, -30,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_1000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -43, -33,-23,-13, -3, 7, 17, 25, 37, + 42, 33, 25, 25, 23, 18, 13, 9, 4, -1, -7,-13,-18, -23, -28, -33, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_1000_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -35, -25,-14, -4, 6, 16, 27, 33, 50, + 59, 57, 47, 41, 40, 43, 47, 48, 47, 42, 39, 37, 37, 36, 35, 32, + 30, 27, 21, 15, 5, -2, -10, -18, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_1000_100dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900, -40, -30, -20,-10, 0, 10, 23, 33, 45, 60, + 70, 72, 55, 49, 43, 40, 44, 54, 59, 58, 49, 43, 52, 57, 57, 58, + 58, 54, 49, 47, 42, 39, 33, 28, 20, 15, 5, 0, -5,-15,-20,-25, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_2000_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -3, 5, 12, 20, + 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_2000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31, + 38, 34, 24, 17, 14, 13, 11, 7, 3, -2, -6, -10, -14, -20, -26, -32, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_2000_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 13, 28, 40, + 51, 51, 43, 35, 28, 29, 35, 37, 37, 35, 31, 28, 25, 22, 19, 15, + 11, 8, 6, 2, -6, -14, -22, -30, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_2000_100dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -10, 6, 25, 42, 60, + 66, 60, 53, 43, 35, 31, 34, 47, 58, 51, 43, 45, 54, 59, 59, 56, + 54, 51, 40, 29, 20, 11, 2, -8, -17, -26, -35,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_4000_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, 0, 3, 10, 18, + 24, 21, 14, 5, -5, -15, -25, -35, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_4000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -40, -30, -21, -12, -2, 8, 19, 31, + 38, 33, 28, 23, 19, 14, 11, 8, 3, -2, -7, -12, -17, -22, -27, -37, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_4000_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -60, -50, -40, -29, -12, 5, 19, 37, + 51, 49, 40, 35, 36, 36, 36, 33, 32, 24, 18, 8, -3, -12, -20, -29, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_4000_100dB_SL[EHMER_MAX]={ + -20, -12, -8, -4, 0, 4, 8, 11, 15, 22, 26, 28, 32, 36, 43, 52, + 62, 59, 50, 48, 50, 50, 45, 36, 45, 30, 20, 10, 0, -10, -19, -28, + -37,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_8000_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -50, -41, -30, -21, -12, 0, 3, 10, 18, + 23, 20, 16, 15, 16, 18, 21, 23, 25, 27, 29, 32, 35, 38, 41, 44, + 47, 50, 55, 60, 85,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, + -900,-900,-900,-900,-900,-900,-900,-900}; +float tone_8000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, -21, -18, -14, -10, 0, 3, 15, 30, + 43, 40, 36, 35, 36, 38, 41, 43, 45, 47, 49, 52, 55, 58, 61, 64, + 67, 70, 75, 80,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; +float tone_8000_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, -1, 2, 6, 10, 13, 19, 25, 35, + 63, 60, 56, 55, 56, 58, 61, 63, 65, 70, 75, 80, 85, 90, 95, 100, + 100, 100, 100, 100,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float tone_8000_100dB_SL[EHMER_MAX]={ + -18, -12, -7, -3, 0, 2, 6, 9, 12, 19, 22, 21, 19, 21, 40, 40, + 80, 60, 35, 25, 15, 5, -5, -15, -25, -35,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +#if 0 /* not used for the time being */ +float noise_500_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900, -20, -11, -2, 7, 16, 25, 34, 43, 52, 61, 66, + 69, 68, 58, 50, 44, 38, 32, 28, 25, 24, 20, 18, 17, 12, 10, 8, + 5, 0, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_500_80dB_SL[EHMER_MAX]={ +-900,-900,-900, -20, -10, -1, 8, 17, 26, 35, 44, 53, 62, 70, 79, 83, + 85, 85, 81, 77, 74, 71, 68, 63, 61, 59, 56, 55, 54, 52, 48, 47, + 45, 46, 45, 43, 40, 37, 33, 32, 35, 32, 30, 29, 20, 10, 0, -10, + -20, -30,-900,-900,-900,-900,-900,-900}; + +float noise_1000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900, -24, -15, -6, 3, 12, 21, 28, 34, 40, 48, 57, 60, + 61, 56, 54, 45, 36, 27, 21, 19, 17, 13, 10, 0, -10, -20, -20,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_1000_80dB_SL[EHMER_MAX]={ +-900, -26, -17, -8, 1, 10, 19, 28, 37, 41, 46, 51, 58, 68, 74, 81, + 80, 81, 70, 66, 58, 61, 59, 55, 54, 53, 52, 49, 48, 42, 38, 38, + 39, 34, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_2000_60dB_SL[EHMER_MAX]={ +-900,-900,-900, -34, -25, -16, -7, 2, 11, 18, 23, 30, 35, 42, 51, 58, + 58, 57, 50, 40,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_2000_80dB_SL[EHMER_MAX]={ +-900, -26, -17, -8, 1, 10, 19, 28, 33, 38, 43, 48, 53, 62, 70, 77, + 77, 75, 70, 67, 68, 66, 62, 61, 60, 59, 52, 47, 39, 35, 34, 35, + 35, 33, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_4000_60dB_SL[EHMER_MAX]={ +-900,-900,-900, -34, -25, -16, -7, 2, 11, 20, 25, 31, 37, 45, 56, 62, + 64, 61,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +float noise_4000_80dB_SL[EHMER_MAX]={ +-900, -26, -17, -8, 1, 10, 19, 26, 33, 39, 45, 50, 55, 65, 75, 82, + 84, 81, 78, 72, 70, 69, 66, 61, 50, 48, 46, 40, 35, 30, 25, 20, + 15, 10, 5, 0, -10, -20, -30,-900, -900,-900,-900,-900,-900,-900,-900,-900, +-900,-900,-900,-900,-900,-900,-900,-900}; + +#endif +#endif + + @@ -1,19 +1,19 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: normalized modified discrete cosine transform power of two length transform only [16 <= n ] - last mod: $Id: mdct.c,v 1.17.2.3 2000/10/20 06:41:27 jack Exp $ + last mod: $Id: mdct.c,v 1.17.2.4 2000/11/04 06:21:45 xiphmont Exp $ Algorithm adapted from _The use of multirate filter banks for coding of high quality digital audio_, by T. Sporer, K. Brandenburg and diff --git a/lib/mdct.h b/lib/mdct.h new file mode 100644 index 00000000..b798bae3 --- /dev/null +++ b/lib/mdct.h @@ -0,0 +1,50 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: modified discrete cosine transform prototypes + last mod: $Id: mdct.h,v 1.12.2.1 2000/11/04 06:21:45 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _OGG_mdct_H_ +#define _OGG_mdct_H_ + +#include "vorbis/codec.h" + +typedef struct { + int n; + int log2n; + + float *trig; + int *bitrev; + +} mdct_lookup; + +extern void mdct_init(mdct_lookup *lookup,int n); +extern void mdct_clear(mdct_lookup *l); +extern void mdct_forward(mdct_lookup *init, float *in, float *out); +extern void mdct_backward(mdct_lookup *init, float *in, float *out); + +#endif + + + + + + + + + + + + diff --git a/lib/misc.c b/lib/misc.c new file mode 100644 index 00000000..3652d5f3 --- /dev/null +++ b/lib/misc.c @@ -0,0 +1,107 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ********************************************************************/ + +#define HEAD_ALIGN 32 +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> +#include "vorbis/codec.h" +#define MISC_C +#include "misc.h" + +static pthread_mutex_t memlock=PTHREAD_MUTEX_INITIALIZER; +void **pointers=NULL; +long *insertlist=NULL; /* We can't embed this in the pointer list; + a pointer can have any value... */ +int ptop=0; +int palloced=0; +int pinsert=0; + +typedef struct { + char *file; + long line; + long ptr; +} head; + +static void *_insert(void *ptr,char *file,long line){ + ((head *)ptr)->file=file; + ((head *)ptr)->line=line; + ((head *)ptr)->ptr=pinsert; + + pthread_mutex_lock(&memlock); + if(pinsert>=palloced){ + palloced+=64; + if(pointers){ + pointers=(void **)realloc(pointers,sizeof(void **)*palloced); + insertlist=(long *)realloc(insertlist,sizeof(long *)*palloced); + }else{ + pointers=(void **)malloc(sizeof(void **)*palloced); + insertlist=(long *)malloc(sizeof(long *)*palloced); + } + } + + pointers[pinsert]=ptr; + + if(pinsert==ptop) + pinsert=++ptop; + else + pinsert=insertlist[pinsert]; + + pthread_mutex_unlock(&memlock); + return(ptr+HEAD_ALIGN); +} + +static void _ripremove(void *ptr){ + int insert; + pthread_mutex_lock(&memlock); + insert=((head *)ptr)->ptr; + insertlist[insert]=pinsert; + pinsert=insert; + pointers[insert]=NULL; + pthread_mutex_unlock(&memlock); +} + +void _VDBG_dump(void){ + int i; + pthread_mutex_lock(&memlock); + for(i=0;i<ptop;i++){ + head *ptr=pointers[i]; + if(ptr) + fprintf(stderr,"unfreed bytes from %s:%ld\n", + ptr->file,ptr->line); + } + + pthread_mutex_unlock(&memlock); +} + +extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){ + bytes+=HEAD_ALIGN; + if(ptr){ + ptr-=HEAD_ALIGN; + _ripremove(ptr); + ptr=realloc(ptr,bytes); + }else{ + ptr=malloc(bytes); + memset(ptr,0,bytes); + } + return _insert(ptr,file,line); +} + +extern void _VDBG_free(void *ptr,char *file,long line){ + if(ptr){ + ptr-=HEAD_ALIGN; + _ripremove(ptr); + free(ptr); + } +} + diff --git a/lib/misc.h b/lib/misc.h new file mode 100644 index 00000000..49405ccd --- /dev/null +++ b/lib/misc.h @@ -0,0 +1,44 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: miscellaneous prototypes + last mod: $Id: misc.h,v 1.5.2.1 2000/11/04 06:21:45 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_RANDOM_H_ +#define _V_RANDOM_H_ +#include "vorbis/codec.h" + +extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); +extern void _vorbis_block_ripcord(vorbis_block *vb); +extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB); + +#ifdef DEBUG_LEAKS +extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); +extern void _VDBG_free(void *ptr,char *file,long line); + +#ifndef MISC_C +#undef malloc +#undef calloc +#undef realloc +#undef free + +#define malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__) +#define calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__) +#define realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__) +#define free(x) _VDBG_free((x),__FILE__,__LINE__) +#endif +#endif + +#endif diff --git a/lib/modes/mode_A.h b/lib/modes/mode_A.h index ca5117ad..eb3f87c7 100644 --- a/lib/modes/mode_A.h +++ b/lib/modes/mode_A.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_A.h,v 1.1.2.2 2000/11/03 10:37:34 xiphmont Exp $ + last mod: $Id: mode_A.h,v 1.1.2.3 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ diff --git a/lib/modes/mode_B.h b/lib/modes/mode_B.h index adbb6b3e..e4b0e1db 100644 --- a/lib/modes/mode_B.h +++ b/lib/modes/mode_B.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_B.h,v 1.1.2.2 2000/11/03 10:37:34 xiphmont Exp $ + last mod: $Id: mode_B.h,v 1.1.2.3 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ diff --git a/lib/modes/mode_C.h b/lib/modes/mode_C.h index bbbfee40..3066317e 100644 --- a/lib/modes/mode_C.h +++ b/lib/modes/mode_C.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_C.h,v 1.1.2.2 2000/11/03 10:37:34 xiphmont Exp $ + last mod: $Id: mode_C.h,v 1.1.2.3 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ diff --git a/lib/modes/mode_D.h b/lib/modes/mode_D.h index 4736a51a..1b7e5c0a 100644 --- a/lib/modes/mode_D.h +++ b/lib/modes/mode_D.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_D.h,v 1.1.2.2 2000/11/03 10:37:34 xiphmont Exp $ + last mod: $Id: mode_D.h,v 1.1.2.3 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ diff --git a/lib/modes/mode_E.h b/lib/modes/mode_E.h index 0605521e..06a5cefd 100644 --- a/lib/modes/mode_E.h +++ b/lib/modes/mode_E.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_E.h,v 1.1.2.2 2000/11/03 10:37:35 xiphmont Exp $ + last mod: $Id: mode_E.h,v 1.1.2.3 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ diff --git a/lib/modes/modes.h b/lib/modes/modes.h index ca0658ac..85c21046 100644 --- a/lib/modes/modes.h +++ b/lib/modes/modes.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: predefined encoding modes - last mod: $Id: modes.h,v 1.1.2.1 2000/11/03 10:06:06 xiphmont Exp $ + last mod: $Id: modes.h,v 1.1.2.2 2000/11/04 06:22:08 xiphmont Exp $ ********************************************************************/ @@ -2,19 +2,19 @@ #define _OS_H /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os.h,v 1.10.2.2 2000/10/19 21:56:41 jack Exp $ + last mod: $Id: os.h,v 1.10.2.3 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.29.2.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: psy.c,v 1.29.2.2 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.15.2.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: psy.h,v 1.15.2.2 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ diff --git a/lib/psytune.c b/lib/psytune.c new file mode 100644 index 00000000..f9946eef --- /dev/null +++ b/lib/psytune.c @@ -0,0 +1,356 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: simple utility that runs audio through the psychoacoustics + without encoding + last mod: $Id: psytune.c,v 1.7.2.1 2000/11/04 06:21:45 xiphmont Exp $ + + ********************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "vorbis/codec.h" +#include "os.h" +#include "psy.h" +#include "mdct.h" +#include "window.h" +#include "scales.h" +#include "lpc.h" +#include "lsp.h" + +static vorbis_info_psy _psy_set0={ + 1,/*athp*/ + 1,/*decayp*/ + 1,/*smoothp*/ + 0,.2, + + -100., + -140., + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + + 1,/* tonemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*63*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*88*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*125*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*175*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*250*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*350*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*500*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*700*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*1400*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*2800*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*4000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*5600*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*8000*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*11500*/ + {-40.,-40.,-40.,-40.,-40.,-50.,-60.,-70.,-80.,-90.,-100.}, /*16000*/ + }, + + 1,/* peakattp */ + {{-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*63*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*88*/ + {-14.,-16.,-18.,-19.,-20.,-21.,-22.,-22.,-22.,-22.,-22.}, /*125*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-18.,-20.}, /*8000*/ + { -7., -8., -9.,-10.,-10.,-11.,-12.,-13.,-15.,-16.,-17.}, /*8000*/ + { -6., -7., -9., -9., -9., -9.,-10.,-11.,-12.,-13.,-14.}, /*11500*/ + { -6., -6., -9., -9., -9., -9., -9., -9.,-10.,-11.,-12.}, /*16000*/ + }, + + 1,/*noisemaskp */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + {{-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*63*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*88*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*125*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*175*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*250*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + {-99.,-99.,-99.,-99.,-99.,-99.,-99.,-199.,-199.,-199.,-199.}, /*350*/ + { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/ + { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/ + { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2000*/ + { -6., -6., -6., -6., -6., -6., -6., -6., -6., -6., -6.}, /*2800*/ + { -0., -0., -0., -0., -0., -0., -0., -0., -0., -0., -0.}, /*4000*/ + { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, /*5600*/ + { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*8000*/ + { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*11500*/ + { 4., 4., 4., 4., 4., 4., 4., 4., 4., 4., 4.}, /*16000*/ + }, + + 110., + + -0, -.005, /* attack/decay control */ +}; + +static int noisy=0; +void analysis(char *base,int i,float *v,int n,int bark,int dB){ + if(noisy){ + int j; + FILE *of; + char buffer[80]; + sprintf(buffer,"%s_%d.m",base,i); + of=fopen(buffer,"w"); + + for(j=0;j<n;j++){ + if(dB && v[j]==0) + fprintf(of,"\n\n"); + else{ + if(bark) + fprintf(of,"%g ",toBARK(22050.*j/n)); + else + fprintf(of,"%g ",(float)j); + + if(dB){ + fprintf(of,"%g\n",todB(fabs(v[j]))); + }else{ + fprintf(of,"%g\n",v[j]); + } + } + } + fclose(of); + } +} + +typedef struct { + long n; + int ln; + int m; + int *linearmap; + + vorbis_info_floor0 *vi; + lpc_lookup lpclook; +} vorbis_look_floor0; + +long granulepos=0; + +/* hacked from floor0.c */ +static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){ + int j; + float scale; + look->m=m; + look->n=n; + look->ln=ln; + lpc_init(&look->lpclook,look->ln,look->m); + + scale=look->ln/toBARK(22050.); + + look->linearmap=malloc(look->n*sizeof(int)); + for(j=0;j<look->n;j++){ + int val=floor( toBARK(22050./n*j) *scale); + if(val>look->ln)val=look->ln; + look->linearmap[j]=val; + } +} + +int main(int argc,char *argv[]){ + int eos=0; + float nonz=0.; + float acc=0.; + float tot=0.; + + int framesize=2048; + int order=32; + int map=256; + + float *pcm[2],*out[2],*window,*decay[2],*lpc,*floor; + signed char *buffer,*buffer2; + mdct_lookup m_look; + vorbis_look_psy p_look; + long i,j,k; + + vorbis_look_floor0 floorlook; + + int ath=0; + int decayp=0; + + argv++; + while(*argv){ + if(*argv[0]=='-'){ + /* option */ + if(argv[0][1]=='v'){ + noisy=0; + } + if(argv[0][1]=='A'){ + ath=0; + } + if(argv[0][1]=='D'){ + decayp=0; + } + if(argv[0][1]=='X'){ + ath=0; + decayp=0; + } + }else + if(*argv[0]=='+'){ + /* option */ + if(argv[0][1]=='v'){ + noisy=1; + } + if(argv[0][1]=='A'){ + ath=1; + } + if(argv[0][1]=='D'){ + decayp=1; + } + if(argv[0][1]=='X'){ + ath=1; + decayp=1; + } + }else + framesize=atoi(argv[0]); + argv++; + } + + pcm[0]=malloc(framesize*sizeof(float)); + pcm[1]=malloc(framesize*sizeof(float)); + out[0]=calloc(framesize/2,sizeof(float)); + out[1]=calloc(framesize/2,sizeof(float)); + decay[0]=calloc(framesize/2,sizeof(float)); + decay[1]=calloc(framesize/2,sizeof(float)); + floor=malloc(framesize*sizeof(float)); + lpc=malloc(order*sizeof(float)); + buffer=malloc(framesize*4); + buffer2=buffer+framesize*2; + window=_vorbis_window(0,framesize,framesize/2,framesize/2); + mdct_init(&m_look,framesize); + _vp_psy_init(&p_look,&_psy_set0,framesize/2,44100); + floorinit(&floorlook,framesize/2,order,map); + + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + analysis("Ptonecurve",i*100+j,p_look.tonecurves[i][j],EHMER_MAX,0,1); + + /* we cheat on the WAV header; we just bypass 44 bytes and never + verify that it matches 16bit/stereo/44.1kHz. */ + + fread(buffer,1,44,stdin); + fwrite(buffer,1,44,stdout); + memset(buffer,0,framesize*2); + + analysis("window",0,window,framesize,0,0); + + fprintf(stderr,"Processing for frame size %d...\n",framesize); + + while(!eos){ + long bytes=fread(buffer2,1,framesize*2,stdin); + if(bytes<framesize*2) + memset(buffer2+bytes,0,framesize*2-bytes); + + if(bytes!=0){ + + /* uninterleave samples */ + for(i=0;i<framesize;i++){ + pcm[0][i]=((buffer[i*4+1]<<8)| + (0x00ff&(int)buffer[i*4]))/32768.; + pcm[1][i]=((buffer[i*4+3]<<8)| + (0x00ff&(int)buffer[i*4+2]))/32768.; + } + + for(i=0;i<2;i++){ + float amp; + + analysis("pre",granulepos,pcm[i],framesize,0,0); + + /* do the psychacoustics */ + for(j=0;j<framesize;j++) + pcm[i][j]*=window[j]; + + mdct_forward(&m_look,pcm[i],pcm[i]); + + analysis("mdct",granulepos,pcm[i],framesize/2,1,1); + + _vp_compute_mask(&p_look,pcm[i],floor,decay[i]); + + analysis("floor",frameno,floor,framesize/2,1,1); + analysis("decay",frameno,decay[i],framesize/2,1,1); + + _vp_apply_floor(&p_look,pcm[i],floor); + /*r(j=0;j<framesize/2;j++) + if(fabs(pcm[i][j])<1.)pcm[i][j]=0;*/ + + analysis("quant",granulepos,pcm[i],framesize/2,1,1); + + /* re-add floor */ + for(j=0;j<framesize/2;j++){ + float val=rint(pcm[i][j]); + tot++; + if(val){ + nonz++; + acc+=log(fabs(val)*2.+1.)/log(2); + pcm[i][j]=val*floor[j]; + }else{ + pcm[i][j]=0; + } + } + + analysis("final",granulepos,pcm[i],framesize/2,1,1); + + /* take it back to time */ + mdct_backward(&m_look,pcm[i],pcm[i]); + for(j=0;j<framesize/2;j++) + out[i][j]+=pcm[i][j]*window[j]; + + granulepos++; + } + + /* write data. Use the part of buffer we're about to shift out */ + for(i=0;i<2;i++){ + char *ptr=buffer+i*2; + float *mono=out[i]; + for(j=0;j<framesize/2;j++){ + int val=mono[j]*32767.; + /* might as well guard against clipping */ + if(val>32767)val=32767; + if(val<-32768)val=-32768; + ptr[0]=val&0xff; + ptr[1]=(val>>8)&0xff; + ptr+=4; + } + } + + fprintf(stderr,"*"); + fwrite(buffer,1,framesize*2,stdout); + memmove(buffer,buffer2,framesize*2); + + for(i=0;i<2;i++){ + for(j=0,k=framesize/2;j<framesize/2;j++,k++) + out[i][j]=pcm[i][k]*window[k]; + } + }else + eos=1; + } + fprintf(stderr,"average raw bits of entropy: %.03g/sample\n",acc/tot); + fprintf(stderr,"average nonzero samples: %.03g/%d\n",nonz/tot*framesize/2, + framesize/2); + fprintf(stderr,"Done\n\n"); + return 0; +} diff --git a/lib/registry.c b/lib/registry.c new file mode 100644 index 00000000..cb17d97f --- /dev/null +++ b/lib/registry.c @@ -0,0 +1,46 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: registry for time, floor, res backends and channel mappings + last mod: $Id: registry.c,v 1.3.12.1 2000/11/04 06:21:45 xiphmont Exp $ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "registry.h" +#include "misc.h" + +/* seems like major overkill now; the backend numbers will grow into + the infrastructure soon enough */ + +extern vorbis_func_time time0_exportbundle; +extern vorbis_func_floor floor0_exportbundle; +extern vorbis_func_residue residue0_exportbundle; +extern vorbis_func_mapping mapping0_exportbundle; + +vorbis_func_time *_time_P[]={ + &time0_exportbundle, +}; + +vorbis_func_floor *_floor_P[]={ + &floor0_exportbundle, +}; + +vorbis_func_residue *_residue_P[]={ + &residue0_exportbundle, +}; + +vorbis_func_mapping *_mapping_P[]={ + &mapping0_exportbundle, +}; + diff --git a/lib/registry.h b/lib/registry.h index e7424df5..dd56b961 100644 --- a/lib/registry.h +++ b/lib/registry.h @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.h,v 1.2.14.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: registry.h,v 1.2.14.2 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: residue backend 0 implementation - last mod: $Id: res0.c,v 1.18.2.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: res0.c,v 1.18.2.2 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ diff --git a/lib/scales.h b/lib/scales.h new file mode 100644 index 00000000..e7ed7dd8 --- /dev/null +++ b/lib/scales.h @@ -0,0 +1,52 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: linear scale -> dB, Bark and Mel scales + last mod: $Id: scales.h,v 1.6.2.1 2000/11/04 06:21:45 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_SCALE_H_ +#define _V_SCALES_H_ + +#include <math.h> + +/* 20log10(x) */ +#define DYNAMIC_RANGE_dB 200. +#define todB(x) ((x)==0?-9.e38:log(fabs(x))*8.6858896) +#define todB_nn(x) ((x)==0?-9.e38:log(x)*8.6858896) +#define fromdB(x) (exp((x)*.11512925)) + + +/* The bark scale equations are approximations, since the original + table was somewhat hand rolled. The below are chosen to have the + best possible fit to the rolled tables, thus their somewhat odd + appearance (these are more accurate and over a longer range than + the oft-quoted bark equations found in the texts I have). The + approximations are valid from 0 - 30kHz (nyquist) or so. + + all f in Hz, z in Bark */ + +#define toBARK(f) (13.1*atan(.00074*(f))+2.24*atan((f)*(f)*1.85e-8)+1e-4*(f)) +#define fromBARK(z) (102.*(z)-2.*pow(z,2.)+.4*pow(z,3)+pow(1.46,z)-1.) +#define toMEL(f) (log(1.+(f)*.001)*1442.695) +#define fromMEL(m) (1000.*exp((m)/1442.695)-1000.) + +/* Frequency to octave. We arbitrarily declare 125.0 Hz to be octave + 0.0 */ + +#define toOC(f) (log(f)*1.442695-6.965784) +#define fromOC(o) (exp(((o)+6.965784)*.693147)) + +#endif + diff --git a/lib/sharedbook.c b/lib/sharedbook.c index b9657c68..8b5752c2 100644 --- a/lib/sharedbook.c +++ b/lib/sharedbook.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.c,v 1.9.2.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: sharedbook.c,v 1.9.2.2 2000/11/04 06:21:45 xiphmont Exp $ ********************************************************************/ diff --git a/lib/smallft.c b/lib/smallft.c new file mode 100644 index 00000000..d003f538 --- /dev/null +++ b/lib/smallft.c @@ -0,0 +1,1255 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: *unnormalized* fft transform + last mod: $Id: smallft.c,v 1.9.2.1 2000/11/04 06:21:46 xiphmont Exp $ + +********************************************************************/ + +/* FFT implementation from OggSquish, minus cosine transforms, + * minus all but radix 2/4 case. In Vorbis we only need this + * cut-down version. + * + * To do more than just power-of-two sized vectors, see the full + * version I wrote for NetLib. + * + * Note that the packing is a little strange; rather than the FFT r/i + * packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, + * it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the + * FORTRAN version + */ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include "smallft.h" +#include "misc.h" + +static void drfti1(int n, float *wa, int *ifac){ + static int ntryh[4] = { 4,2,3,5 }; + static float tpi = 6.28318530717958647692528676655900577; + float arg,argh,argld,fi; + int ntry=0,i,j=-1; + int k1, l1, l2, ib; + int ld, ii, ip, is, nq, nr; + int ido, ipm, nfm1; + int nl=n; + int nf=0; + + L101: + j++; + if (j < 4) + ntry=ntryh[j]; + else + ntry+=2; + + L104: + nq=nl/ntry; + nr=nl-ntry*nq; + if (nr!=0) goto L101; + + nf++; + ifac[nf+1]=ntry; + nl=nq; + if(ntry!=2)goto L107; + if(nf==1)goto L107; + + for (i=1;i<nf;i++){ + ib=nf-i+1; + ifac[ib+1]=ifac[ib]; + } + ifac[2] = 2; + + L107: + if(nl!=1)goto L104; + ifac[0]=n; + ifac[1]=nf; + argh=tpi/n; + is=0; + nfm1=nf-1; + l1=1; + + if(nfm1==0)return; + + for (k1=0;k1<nfm1;k1++){ + ip=ifac[k1+2]; + ld=0; + l2=l1*ip; + ido=n/l2; + ipm=ip-1; + + for (j=0;j<ipm;j++){ + ld+=l1; + i=is; + argld=(float)ld*argh; + fi=0.; + for (ii=2;ii<ido;ii+=2){ + fi+=1.; + arg=fi*argld; + wa[i++]=cos(arg); + wa[i++]=sin(arg); + } + is+=ido; + } + l1=l2; + } +} + +static void fdrffti(int n, float *wsave, int *ifac){ + + if (n == 1) return; + drfti1(n, wsave+n, ifac); +} + +static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ + int i,k; + float ti2,tr2; + int t0,t1,t2,t3,t4,t5,t6; + + t1=0; + t0=(t2=l1*ido); + t3=ido<<1; + for(k=0;k<l1;k++){ + ch[t1<<1]=cc[t1]+cc[t2]; + ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; + t1+=ido; + t2+=ido; + } + + if(ido<2)return; + if(ido==2)goto L105; + + t1=0; + t2=t0; + for(k=0;k<l1;k++){ + t3=t2; + t4=(t1<<1)+(ido<<1); + t5=t1; + t6=t1+t1; + for(i=2;i<ido;i+=2){ + t3+=2; + t4-=2; + t5+=2; + t6+=2; + tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; + ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; + ch[t6]=cc[t5]+ti2; + ch[t4]=ti2-cc[t5]; + ch[t6-1]=cc[t5-1]+tr2; + ch[t4-1]=cc[t5-1]-tr2; + } + t1+=ido; + t2+=ido; + } + + if(ido%2==1)return; + + L105: + t3=(t2=(t1=ido)-1); + t2+=t0; + for(k=0;k<l1;k++){ + ch[t1]=-cc[t2]; + ch[t1-1]=cc[t3]; + t1+=ido<<1; + t2+=ido; + t3+=ido; + } +} + +static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, + float *wa2,float *wa3){ + static float hsqt2 = .70710678118654752440084436210485; + int i,k,t0,t1,t2,t3,t4,t5,t6; + float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; + t0=l1*ido; + + t1=t0; + t4=t1<<1; + t2=t1+(t1<<1); + t3=0; + + for(k=0;k<l1;k++){ + tr1=cc[t1]+cc[t2]; + tr2=cc[t3]+cc[t4]; + + ch[t5=t3<<2]=tr1+tr2; + ch[(ido<<2)+t5-1]=tr2-tr1; + ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4]; + ch[t5]=cc[t2]-cc[t1]; + + t1+=ido; + t2+=ido; + t3+=ido; + t4+=ido; + } + + if(ido<2)return; + if(ido==2)goto L105; + + + t1=0; + for(k=0;k<l1;k++){ + t2=t1; + t4=t1<<2; + t5=(t6=ido<<1)+t4; + for(i=2;i<ido;i+=2){ + t3=(t2+=2); + t4+=2; + t5-=2; + + t3+=t0; + cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; + ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; + t3+=t0; + cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3]; + ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1]; + t3+=t0; + cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3]; + ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1]; + + tr1=cr2+cr4; + tr4=cr4-cr2; + ti1=ci2+ci4; + ti4=ci2-ci4; + + ti2=cc[t2]+ci3; + ti3=cc[t2]-ci3; + tr2=cc[t2-1]+cr3; + tr3=cc[t2-1]-cr3; + + ch[t4-1]=tr1+tr2; + ch[t4]=ti1+ti2; + + ch[t5-1]=tr3-ti4; + ch[t5]=tr4-ti3; + + ch[t4+t6-1]=ti4+tr3; + ch[t4+t6]=tr4+ti3; + + ch[t5+t6-1]=tr2-tr1; + ch[t5+t6]=ti1-ti2; + } + t1+=ido; + } + if(ido&1)return; + + L105: + + t2=(t1=t0+ido-1)+(t0<<1); + t3=ido<<2; + t4=ido; + t5=ido<<1; + t6=ido; + + for(k=0;k<l1;k++){ + ti1=-hsqt2*(cc[t1]+cc[t2]); + tr1=hsqt2*(cc[t1]-cc[t2]); + + ch[t4-1]=tr1+cc[t6-1]; + ch[t4+t5-1]=cc[t6-1]-tr1; + + ch[t4]=ti1-cc[t1+t0]; + ch[t4+t5]=ti1+cc[t1+t0]; + + t1+=ido; + t2+=ido; + t4+=t3; + t6+=ido; + } +} + +static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1, + float *c2,float *ch,float *ch2,float *wa){ + + static float tpi=6.28318530717958647692528676655900577; + int idij,ipph,i,j,k,l,ic,ik,is; + int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; + float dc2,ai1,ai2,ar1,ar2,ds2; + int nbd; + float dcp,arg,dsp,ar1h,ar2h; + int idp2,ipp2; + + arg=tpi/(float)ip; + dcp=cos(arg); + dsp=sin(arg); + ipph=(ip+1)>>1; + ipp2=ip; + idp2=ido; + nbd=(ido-1)>>1; + t0=l1*ido; + t10=ip*ido; + + if(ido==1)goto L119; + for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik]; + + t1=0; + for(j=1;j<ip;j++){ + t1+=t0; + t2=t1; + for(k=0;k<l1;k++){ + ch[t2]=c1[t2]; + t2+=ido; + } + } + + is=-ido; + t1=0; + if(nbd>l1){ + for(j=1;j<ip;j++){ + t1+=t0; + is+=ido; + t2= -ido+t1; + for(k=0;k<l1;k++){ + idij=is-1; + t2+=ido; + t3=t2; + for(i=2;i<ido;i+=2){ + idij+=2; + t3+=2; + ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; + ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; + } + } + } + }else{ + + for(j=1;j<ip;j++){ + is+=ido; + idij=is-1; + t1+=t0; + t2=t1; + for(i=2;i<ido;i+=2){ + idij+=2; + t2+=2; + t3=t2; + for(k=0;k<l1;k++){ + ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; + ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; + t3+=ido; + } + } + } + } + + t1=0; + t2=ipp2*t0; + if(nbd<l1){ + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for(i=2;i<ido;i+=2){ + t3+=2; + t4+=2; + t5=t3-ido; + t6=t4-ido; + for(k=0;k<l1;k++){ + t5+=ido; + t6+=ido; + c1[t5-1]=ch[t5-1]+ch[t6-1]; + c1[t6-1]=ch[t5]-ch[t6]; + c1[t5]=ch[t5]+ch[t6]; + c1[t6]=ch[t6-1]-ch[t5-1]; + } + } + } + }else{ + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for(k=0;k<l1;k++){ + t5=t3; + t6=t4; + for(i=2;i<ido;i+=2){ + t5+=2; + t6+=2; + c1[t5-1]=ch[t5-1]+ch[t6-1]; + c1[t6-1]=ch[t5]-ch[t6]; + c1[t5]=ch[t5]+ch[t6]; + c1[t6]=ch[t6-1]-ch[t5-1]; + } + t3+=ido; + t4+=ido; + } + } + } + +L119: + for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; + + t1=0; + t2=ipp2*idl1; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1-ido; + t4=t2-ido; + for(k=0;k<l1;k++){ + t3+=ido; + t4+=ido; + c1[t3]=ch[t3]+ch[t4]; + c1[t4]=ch[t4]-ch[t3]; + } + } + + ar1=1.; + ai1=0.; + t1=0; + t2=ipp2*idl1; + t3=(ip-1)*idl1; + for(l=1;l<ipph;l++){ + t1+=idl1; + t2-=idl1; + ar1h=dcp*ar1-dsp*ai1; + ai1=dcp*ai1+dsp*ar1; + ar1=ar1h; + t4=t1; + t5=t2; + t6=t3; + t7=idl1; + + for(ik=0;ik<idl1;ik++){ + ch2[t4++]=c2[ik]+ar1*c2[t7++]; + ch2[t5++]=ai1*c2[t6++]; + } + + dc2=ar1; + ds2=ai1; + ar2=ar1; + ai2=ai1; + + t4=idl1; + t5=(ipp2-1)*idl1; + for(j=2;j<ipph;j++){ + t4+=idl1; + t5-=idl1; + + ar2h=dc2*ar2-ds2*ai2; + ai2=dc2*ai2+ds2*ar2; + ar2=ar2h; + + t6=t1; + t7=t2; + t8=t4; + t9=t5; + for(ik=0;ik<idl1;ik++){ + ch2[t6++]+=ar2*c2[t8++]; + ch2[t7++]+=ai2*c2[t9++]; + } + } + } + + t1=0; + for(j=1;j<ipph;j++){ + t1+=idl1; + t2=t1; + for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++]; + } + + if(ido<l1)goto L132; + + t1=0; + t2=0; + for(k=0;k<l1;k++){ + t3=t1; + t4=t2; + for(i=0;i<ido;i++)cc[t4++]=ch[t3++]; + t1+=ido; + t2+=t10; + } + + goto L135; + + L132: + for(i=0;i<ido;i++){ + t1=i; + t2=i; + for(k=0;k<l1;k++){ + cc[t2]=ch[t1]; + t1+=ido; + t2+=t10; + } + } + + L135: + t1=0; + t2=ido<<1; + t3=0; + t4=ipp2*t0; + for(j=1;j<ipph;j++){ + + t1+=t2; + t3+=t0; + t4-=t0; + + t5=t1; + t6=t3; + t7=t4; + + for(k=0;k<l1;k++){ + cc[t5-1]=ch[t6]; + cc[t5]=ch[t7]; + t5+=t10; + t6+=ido; + t7+=ido; + } + } + + if(ido==1)return; + if(nbd<l1)goto L141; + + t1=-ido; + t3=0; + t4=0; + t5=ipp2*t0; + for(j=1;j<ipph;j++){ + t1+=t2; + t3+=t2; + t4+=t0; + t5-=t0; + t6=t1; + t7=t3; + t8=t4; + t9=t5; + for(k=0;k<l1;k++){ + for(i=2;i<ido;i+=2){ + ic=idp2-i; + cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1]; + cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1]; + cc[i+t7]=ch[i+t8]+ch[i+t9]; + cc[ic+t6]=ch[i+t9]-ch[i+t8]; + } + t6+=t10; + t7+=t10; + t8+=ido; + t9+=ido; + } + } + return; + + L141: + + t1=-ido; + t3=0; + t4=0; + t5=ipp2*t0; + for(j=1;j<ipph;j++){ + t1+=t2; + t3+=t2; + t4+=t0; + t5-=t0; + for(i=2;i<ido;i+=2){ + t6=idp2+t1-i; + t7=i+t3; + t8=i+t4; + t9=i+t5; + for(k=0;k<l1;k++){ + cc[t7-1]=ch[t8-1]+ch[t9-1]; + cc[t6-1]=ch[t8-1]-ch[t9-1]; + cc[t7]=ch[t8]+ch[t9]; + cc[t6]=ch[t9]-ch[t8]; + t6+=t10; + t7+=t10; + t8+=ido; + t9+=ido; + } + } + } +} + +static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){ + int i,k1,l1,l2; + int na,kh,nf; + int ip,iw,ido,idl1,ix2,ix3; + + nf=ifac[1]; + na=1; + l2=n; + iw=n; + + for(k1=0;k1<nf;k1++){ + kh=nf-k1; + ip=ifac[kh+1]; + l1=l2/ip; + ido=n/l2; + idl1=ido*l1; + iw-=(ip-1)*ido; + na=1-na; + + if(ip!=4)goto L102; + + ix2=iw+ido; + ix3=ix2+ido; + if(na!=0) + dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); + else + dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); + goto L110; + + L102: + if(ip!=2)goto L104; + if(na!=0)goto L103; + + dradf2(ido,l1,c,ch,wa+iw-1); + goto L110; + + L103: + dradf2(ido,l1,ch,c,wa+iw-1); + goto L110; + + L104: + if(ido==1)na=1-na; + if(na!=0)goto L109; + + dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); + na=1; + goto L110; + + L109: + dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); + na=0; + + L110: + l2=l1; + } + + if(na==1)return; + + for(i=0;i<n;i++)c[i]=ch[i]; +} + +static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){ + int i,k,t0,t1,t2,t3,t4,t5,t6; + float ti2,tr2; + + t0=l1*ido; + + t1=0; + t2=0; + t3=(ido<<1)-1; + for(k=0;k<l1;k++){ + ch[t1]=cc[t2]+cc[t3+t2]; + ch[t1+t0]=cc[t2]-cc[t3+t2]; + t2=(t1+=ido)<<1; + } + + if(ido<2)return; + if(ido==2)goto L105; + + t1=0; + t2=0; + for(k=0;k<l1;k++){ + t3=t1; + t5=(t4=t2)+(ido<<1); + t6=t0+t1; + for(i=2;i<ido;i+=2){ + t3+=2; + t4+=2; + t5-=2; + t6+=2; + ch[t3-1]=cc[t4-1]+cc[t5-1]; + tr2=cc[t4-1]-cc[t5-1]; + ch[t3]=cc[t4]-cc[t5]; + ti2=cc[t4]+cc[t5]; + ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2; + ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2; + } + t2=(t1+=ido)<<1; + } + + if(ido%2==1)return; + +L105: + t1=ido-1; + t2=ido-1; + for(k=0;k<l1;k++){ + ch[t1]=cc[t2]+cc[t2]; + ch[t1+t0]=-(cc[t2+1]+cc[t2+1]); + t1+=ido; + t2+=ido<<1; + } +} + +static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1, + float *wa2){ + static float taur = -.5; + static float taui = .86602540378443864676372317075293618; + int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; + float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2; + t0=l1*ido; + + t1=0; + t2=t0<<1; + t3=ido<<1; + t4=ido+(ido<<1); + t5=0; + for(k=0;k<l1;k++){ + tr2=cc[t3-1]+cc[t3-1]; + cr2=cc[t5]+(taur*tr2); + ch[t1]=cc[t5]+tr2; + ci3=taui*(cc[t3]+cc[t3]); + ch[t1+t0]=cr2-ci3; + ch[t1+t2]=cr2+ci3; + t1+=ido; + t3+=t4; + t5+=t4; + } + + if(ido==1)return; + + t1=0; + t3=ido<<1; + for(k=0;k<l1;k++){ + t7=t1+(t1<<1); + t6=(t5=t7+t3); + t8=t1; + t10=(t9=t1+t0)+t0; + + for(i=2;i<ido;i+=2){ + t5+=2; + t6-=2; + t7+=2; + t8+=2; + t9+=2; + t10+=2; + tr2=cc[t5-1]+cc[t6-1]; + cr2=cc[t7-1]+(taur*tr2); + ch[t8-1]=cc[t7-1]+tr2; + ti2=cc[t5]-cc[t6]; + ci2=cc[t7]+(taur*ti2); + ch[t8]=cc[t7]+ti2; + cr3=taui*(cc[t5-1]-cc[t6-1]); + ci3=taui*(cc[t5]+cc[t6]); + dr2=cr2-ci3; + dr3=cr2+ci3; + di2=ci2+cr3; + di3=ci2-cr3; + ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2; + ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2; + ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3; + ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3; + } + t1+=ido; + } +} + +static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, + float *wa2,float *wa3){ + static float sqrt2=1.4142135623730950488016887242097; + int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; + float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; + t0=l1*ido; + + t1=0; + t2=ido<<2; + t3=0; + t6=ido<<1; + for(k=0;k<l1;k++){ + t4=t3+t6; + t5=t1; + tr3=cc[t4-1]+cc[t4-1]; + tr4=cc[t4]+cc[t4]; + tr1=cc[t3]-cc[(t4+=t6)-1]; + tr2=cc[t3]+cc[t4-1]; + ch[t5]=tr2+tr3; + ch[t5+=t0]=tr1-tr4; + ch[t5+=t0]=tr2-tr3; + ch[t5+=t0]=tr1+tr4; + t1+=ido; + t3+=t2; + } + + if(ido<2)return; + if(ido==2)goto L105; + + t1=0; + for(k=0;k<l1;k++){ + t5=(t4=(t3=(t2=t1<<2)+t6))+t6; + t7=t1; + for(i=2;i<ido;i+=2){ + t2+=2; + t3+=2; + t4-=2; + t5-=2; + t7+=2; + ti1=cc[t2]+cc[t5]; + ti2=cc[t2]-cc[t5]; + ti3=cc[t3]-cc[t4]; + tr4=cc[t3]+cc[t4]; + tr1=cc[t2-1]-cc[t5-1]; + tr2=cc[t2-1]+cc[t5-1]; + ti4=cc[t3-1]-cc[t4-1]; + tr3=cc[t3-1]+cc[t4-1]; + ch[t7-1]=tr2+tr3; + cr3=tr2-tr3; + ch[t7]=ti2+ti3; + ci3=ti2-ti3; + cr2=tr1-tr4; + cr4=tr1+tr4; + ci2=ti1+ti4; + ci4=ti1-ti4; + + ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2; + ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2; + ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3; + ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3; + ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4; + ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4; + } + t1+=ido; + } + + if(ido%2 == 1)return; + + L105: + + t1=ido; + t2=ido<<2; + t3=ido-1; + t4=ido+(ido<<1); + for(k=0;k<l1;k++){ + t5=t3; + ti1=cc[t1]+cc[t4]; + ti2=cc[t4]-cc[t1]; + tr1=cc[t1-1]-cc[t4-1]; + tr2=cc[t1-1]+cc[t4-1]; + ch[t5]=tr2+tr2; + ch[t5+=t0]=sqrt2*(tr1-ti1); + ch[t5+=t0]=ti2+ti2; + ch[t5+=t0]=-sqrt2*(tr1+ti1); + + t3+=ido; + t1+=t2; + t4+=t2; + } +} + +static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1, + float *c2,float *ch,float *ch2,float *wa){ + static float tpi=6.28318530717958647692528676655900577; + int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10, + t11,t12; + float dc2,ai1,ai2,ar1,ar2,ds2; + int nbd; + float dcp,arg,dsp,ar1h,ar2h; + int ipp2; + + t10=ip*ido; + t0=l1*ido; + arg=tpi/(float)ip; + dcp=cos(arg); + dsp=sin(arg); + nbd=(ido-1)>>1; + ipp2=ip; + ipph=(ip+1)>>1; + if(ido<l1)goto L103; + + t1=0; + t2=0; + for(k=0;k<l1;k++){ + t3=t1; + t4=t2; + for(i=0;i<ido;i++){ + ch[t3]=cc[t4]; + t3++; + t4++; + } + t1+=ido; + t2+=t10; + } + goto L106; + + L103: + t1=0; + for(i=0;i<ido;i++){ + t2=t1; + t3=t1; + for(k=0;k<l1;k++){ + ch[t2]=cc[t3]; + t2+=ido; + t3+=t10; + } + t1++; + } + + L106: + t1=0; + t2=ipp2*t0; + t7=(t5=ido<<1); + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + t6=t5; + for(k=0;k<l1;k++){ + ch[t3]=cc[t6-1]+cc[t6-1]; + ch[t4]=cc[t6]+cc[t6]; + t3+=ido; + t4+=ido; + t6+=t10; + } + t5+=t7; + } + + if (ido == 1)goto L116; + if(nbd<l1)goto L112; + + t1=0; + t2=ipp2*t0; + t7=0; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + + t7+=(ido<<1); + t8=t7; + for(k=0;k<l1;k++){ + t5=t3; + t6=t4; + t9=t8; + t11=t8; + for(i=2;i<ido;i+=2){ + t5+=2; + t6+=2; + t9+=2; + t11-=2; + ch[t5-1]=cc[t9-1]+cc[t11-1]; + ch[t6-1]=cc[t9-1]-cc[t11-1]; + ch[t5]=cc[t9]-cc[t11]; + ch[t6]=cc[t9]+cc[t11]; + } + t3+=ido; + t4+=ido; + t8+=t10; + } + } + goto L116; + + L112: + t1=0; + t2=ipp2*t0; + t7=0; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + t7+=(ido<<1); + t8=t7; + t9=t7; + for(i=2;i<ido;i+=2){ + t3+=2; + t4+=2; + t8+=2; + t9-=2; + t5=t3; + t6=t4; + t11=t8; + t12=t9; + for(k=0;k<l1;k++){ + ch[t5-1]=cc[t11-1]+cc[t12-1]; + ch[t6-1]=cc[t11-1]-cc[t12-1]; + ch[t5]=cc[t11]-cc[t12]; + ch[t6]=cc[t11]+cc[t12]; + t5+=ido; + t6+=ido; + t11+=t10; + t12+=t10; + } + } + } + +L116: + ar1=1.; + ai1=0.; + t1=0; + t9=(t2=ipp2*idl1); + t3=(ip-1)*idl1; + for(l=1;l<ipph;l++){ + t1+=idl1; + t2-=idl1; + + ar1h=dcp*ar1-dsp*ai1; + ai1=dcp*ai1+dsp*ar1; + ar1=ar1h; + t4=t1; + t5=t2; + t6=0; + t7=idl1; + t8=t3; + for(ik=0;ik<idl1;ik++){ + c2[t4++]=ch2[t6++]+ar1*ch2[t7++]; + c2[t5++]=ai1*ch2[t8++]; + } + dc2=ar1; + ds2=ai1; + ar2=ar1; + ai2=ai1; + + t6=idl1; + t7=t9-idl1; + for(j=2;j<ipph;j++){ + t6+=idl1; + t7-=idl1; + ar2h=dc2*ar2-ds2*ai2; + ai2=dc2*ai2+ds2*ar2; + ar2=ar2h; + t4=t1; + t5=t2; + t11=t6; + t12=t7; + for(ik=0;ik<idl1;ik++){ + c2[t4++]+=ar2*ch2[t11++]; + c2[t5++]+=ai2*ch2[t12++]; + } + } + } + + t1=0; + for(j=1;j<ipph;j++){ + t1+=idl1; + t2=t1; + for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++]; + } + + t1=0; + t2=ipp2*t0; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for(k=0;k<l1;k++){ + ch[t3]=c1[t3]-c1[t4]; + ch[t4]=c1[t3]+c1[t4]; + t3+=ido; + t4+=ido; + } + } + + if(ido==1)goto L132; + if(nbd<l1)goto L128; + + t1=0; + t2=ipp2*t0; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for(k=0;k<l1;k++){ + t5=t3; + t6=t4; + for(i=2;i<ido;i+=2){ + t5+=2; + t6+=2; + ch[t5-1]=c1[t5-1]-c1[t6]; + ch[t6-1]=c1[t5-1]+c1[t6]; + ch[t5]=c1[t5]+c1[t6-1]; + ch[t6]=c1[t5]-c1[t6-1]; + } + t3+=ido; + t4+=ido; + } + } + goto L132; + + L128: + t1=0; + t2=ipp2*t0; + for(j=1;j<ipph;j++){ + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for(i=2;i<ido;i+=2){ + t3+=2; + t4+=2; + t5=t3; + t6=t4; + for(k=0;k<l1;k++){ + ch[t5-1]=c1[t5-1]-c1[t6]; + ch[t6-1]=c1[t5-1]+c1[t6]; + ch[t5]=c1[t5]+c1[t6-1]; + ch[t6]=c1[t5]-c1[t6-1]; + t5+=ido; + t6+=ido; + } + } + } + +L132: + if(ido==1)return; + + for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; + + t1=0; + for(j=1;j<ip;j++){ + t2=(t1+=t0); + for(k=0;k<l1;k++){ + c1[t2]=ch[t2]; + t2+=ido; + } + } + + if(nbd>l1)goto L139; + + is= -ido-1; + t1=0; + for(j=1;j<ip;j++){ + is+=ido; + t1+=t0; + idij=is; + t2=t1; + for(i=2;i<ido;i+=2){ + t2+=2; + idij+=2; + t3=t2; + for(k=0;k<l1;k++){ + c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; + c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; + t3+=ido; + } + } + } + return; + + L139: + is= -ido-1; + t1=0; + for(j=1;j<ip;j++){ + is+=ido; + t1+=t0; + t2=t1; + for(k=0;k<l1;k++){ + idij=is; + t3=t2; + for(i=2;i<ido;i+=2){ + idij+=2; + t3+=2; + c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; + c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; + } + t2+=ido; + } + } +} + +static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){ + int i,k1,l1,l2; + int na; + int nf,ip,iw,ix2,ix3,ido,idl1; + + nf=ifac[1]; + na=0; + l1=1; + iw=1; + + for(k1=0;k1<nf;k1++){ + ip=ifac[k1 + 2]; + l2=ip*l1; + ido=n/l2; + idl1=ido*l1; + if(ip!=4)goto L103; + ix2=iw+ido; + ix3=ix2+ido; + + if(na!=0) + dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); + else + dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); + na=1-na; + goto L115; + + L103: + if(ip!=2)goto L106; + + if(na!=0) + dradb2(ido,l1,ch,c,wa+iw-1); + else + dradb2(ido,l1,c,ch,wa+iw-1); + na=1-na; + goto L115; + + L106: + if(ip!=3)goto L109; + + ix2=iw+ido; + if(na!=0) + dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1); + else + dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1); + na=1-na; + goto L115; + + L109: +/* The radix five case can be translated later..... */ +/* if(ip!=5)goto L112; + + ix2=iw+ido; + ix3=ix2+ido; + ix4=ix3+ido; + if(na!=0) + dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); + else + dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); + na=1-na; + goto L115; + + L112:*/ + if(na!=0) + dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); + else + dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); + if(ido==1)na=1-na; + + L115: + l1=l2; + iw+=(ip-1)*ido; + } + + if(na==0)return; + + for(i=0;i<n;i++)c[i]=ch[i]; +} + +void drft_forward(drft_lookup *l,float *data){ + if(l->n==1)return; + drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +} + +void drft_backward(drft_lookup *l,float *data){ + if (l->n==1)return; + drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +} + +void drft_init(drft_lookup *l,int n){ + l->n=n; + l->trigcache=calloc(3*n,sizeof(float)); + l->splitcache=calloc(32,sizeof(int)); + fdrffti(n, l->trigcache, l->splitcache); +} + +void drft_clear(drft_lookup *l){ + if(l){ + if(l->trigcache)free(l->trigcache); + if(l->splitcache)free(l->splitcache); + memset(l,0,sizeof(drft_lookup)); + } +} diff --git a/lib/smallft.h b/lib/smallft.h new file mode 100644 index 00000000..0a4624a8 --- /dev/null +++ b/lib/smallft.h @@ -0,0 +1,35 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: fft transform + last mod: $Id: smallft.h,v 1.7.2.1 2000/11/04 06:21:46 xiphmont Exp $ + +********************************************************************/ + +#ifndef _V_SMFT_H_ +#define _V_SMFT_H_ + +#include "vorbis/codec.h" + +typedef struct { + int n; + float *trigcache; + int *splitcache; +} drft_lookup; + +extern void drft_forward(drft_lookup *l,float *data); +extern void drft_backward(drft_lookup *l,float *data); +extern void drft_init(drft_lookup *l,int n); +extern void drft_clear(drft_lookup *l); + +#endif diff --git a/lib/synthesis.c b/lib/synthesis.c index 5b06822d..fcfa2250 100644 --- a/lib/synthesis.c +++ b/lib/synthesis.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: single-block PCM synthesis - last mod: $Id: synthesis.c,v 1.18.2.2 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: synthesis.c,v 1.18.2.3 2000/11/04 06:21:46 xiphmont Exp $ ********************************************************************/ diff --git a/lib/time0.c b/lib/time0.c index b7164c2c..ad7f7011 100644 --- a/lib/time0.c +++ b/lib/time0.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: time backend 0 (dummy) - last mod: $Id: time0.c,v 1.6.2.1 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: time0.c,v 1.6.2.2 2000/11/04 06:21:46 xiphmont Exp $ ********************************************************************/ diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c index 451ce09b..5afac064 100644 --- a/lib/vorbisenc.c +++ b/lib/vorbisenc.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * - * THIS SOURCE. PLEASE READ THESE TERMS DISTRIBUTING. * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c,v 1.1.2.1 2000/11/03 10:34:04 xiphmont Exp $ + last mod: $Id: vorbisenc.c,v 1.1.2.2 2000/11/04 06:21:46 xiphmont Exp $ ********************************************************************/ diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index 08594930..ce6e3924 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.c,v 1.30.2.3 2000/11/03 10:05:48 xiphmont Exp $ + last mod: $Id: vorbisfile.c,v 1.30.2.4 2000/11/04 06:21:46 xiphmont Exp $ ********************************************************************/ diff --git a/lib/window.c b/lib/window.c new file mode 100644 index 00000000..79014cd6 --- /dev/null +++ b/lib/window.c @@ -0,0 +1,63 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: window functions + last mod: $Id: window.c,v 1.8.2.1 2000/11/04 06:21:46 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <math.h> +#include "os.h" +#include "misc.h" + +float *_vorbis_window(int type, int window,int left,int right){ + float *ret=calloc(window,sizeof(float)); + + switch(type){ + case 0: + /* The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi) */ + { + int leftbegin=window/4-left/2; + int rightbegin=window-window/4-right/2; + int i; + + for(i=0;i<left;i++){ + float x=(i+.5)/left*M_PI/2.; + x=sin(x); + x*=x; + x*=M_PI/2.; + x=sin(x); + ret[i+leftbegin]=x; + } + + for(i=leftbegin+left;i<rightbegin;i++) + ret[i]=1.; + + for(i=0;i<right;i++){ + float x=(right-i-.5)/right*M_PI/2.; + x=sin(x); + x*=x; + x*=M_PI/2.; + x=sin(x); + ret[i+rightbegin]=x; + } + } + break; + default: + free(ret); + return(NULL); + } + return(ret); +} + diff --git a/lib/window.h b/lib/window.h new file mode 100644 index 00000000..9f572d04 --- /dev/null +++ b/lib/window.h @@ -0,0 +1,25 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: window functions + last mod: $Id: window.h,v 1.4.2.1 2000/11/04 06:21:46 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_WINDOW_ +#define _V_WINDOW_ + +#define VI_WINDOWB 1 +extern float *_vorbis_window(int type,int window,int left,int right); + +#endif diff --git a/vq/bookutil.c b/vq/bookutil.c index e6b15d15..913b6001 100644 --- a/vq/bookutil.c +++ b/vq/bookutil.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: utility functions for loading .vqh and .vqd files - last mod: $Id: bookutil.c,v 1.17.2.3 2000/11/03 10:47:30 xiphmont Exp $ + last mod: $Id: bookutil.c,v 1.17.2.4 2000/11/04 06:22:09 xiphmont Exp $ ********************************************************************/ diff --git a/vq/bookutil.h b/vq/bookutil.h new file mode 100644 index 00000000..4ee41d67 --- /dev/null +++ b/vq/bookutil.h @@ -0,0 +1,44 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility functions for loading .vqh and .vqd files + last mod: $Id: bookutil.h,v 1.7.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_BOOKUTIL_H_ +#define _V_BOOKUTIL_H_ + +#include <stdio.h> +#include <sys/time.h> + +#include "vorbis/codebook.h" + +extern char *get_line(FILE *in); +extern char *setup_line(FILE *in); +extern int get_line_value(FILE *in,float *value); +extern int get_next_value(FILE *in,float *value); +extern int get_next_ivalue(FILE *in,long *ivalue); +extern void reset_next_value(void); +extern int get_vector(codebook *b,FILE *in,int start,int num,float *a); +extern char *find_seek_to(FILE *in,char *s); + +extern codebook *codebook_load(char *filename); +extern void write_codebook(FILE *out,char *name,const static_codebook *c); + +extern void spinnit(char *s,int n); +extern void build_tree_from_lengths(int vals, long *hist, long *lengths); +extern void build_tree_from_lengths0(int vals, long *hist, long *lengths); + +#endif + @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: utility main for building codebooks from training sets - last mod: $Id: build.c,v 1.15.2.1 2000/10/31 08:25:17 xiphmont Exp $ + last mod: $Id: build.c,v 1.15.2.2 2000/11/04 06:22:10 xiphmont Exp $ ********************************************************************/ diff --git a/vq/cascade.c b/vq/cascade.c new file mode 100644 index 00000000..84cf425c --- /dev/null +++ b/vq/cascade.c @@ -0,0 +1,94 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: function call to do simple data cascading + last mod: $Id: cascade.c,v 1.7.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +/* this one outputs residue to stdout. */ + +#include <stdlib.h> +#include <unistd.h> +#include <math.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "bookutil.h" + +/* set up metrics */ + +float count=0.; + + +void process_preprocess(codebook **bs,char *basename){ +} + +void process_postprocess(codebook **b,char *basename){ + fprintf(stderr,"Done. \n"); +} + +float process_one(codebook *b,float *a,int dim,int step,int addmul, + float base){ + int j; + + if(b->c->q_sequencep){ + float temp; + for(j=0;j<dim;j++){ + temp=a[j*step]; + a[j*step]-=base; + } + base=temp; + } + + vorbis_book_besterror(b,a,step,addmul); + + return base; +} + +void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){ + int i,bi=0; + int booknum=0; + + while(*bs){ + float base=0.; + codebook *b=*bs; + int dim=b->dim; + + if(inter){ + for(i=0;i<n/dim;i++) + base=process_one(b,a+i,dim,n/dim,addmul[bi],base); + }else{ + for(i=0;i<=n-dim;i+=dim) + base=process_one(b,a+i,dim,1,addmul[bi],base); + } + + bs++; + booknum++; + bi++; + } + + for(i=0;i<n;i++) + fprintf(stdout,"%f, ",a[i]); + fprintf(stdout,"\n"); + + if((long)(count++)%100)spinnit("working.... lines: ",count); +} + +void process_usage(void){ + fprintf(stderr, + "usage: vqcascade [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n" + " datafile.vqd [datafile.vqd]...\n\n" + " data can be taken on stdin. residual error data sent to\n" + " stdout.\n\n"); + +} diff --git a/vq/genericdata.c b/vq/genericdata.c new file mode 100644 index 00000000..112bbcfa --- /dev/null +++ b/vq/genericdata.c @@ -0,0 +1,62 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: generic euclidian distance metric for VQ codebooks + last mod: $Id: genericdata.c,v 1.6.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <math.h> +#include <stdio.h> +#include "vqgen.h" +#include "vqext.h" + +char *vqext_booktype="GENERICdata"; +int vqext_aux=0; +quant_meta q={0,0,0,0}; /* non sequence data; each scalar + independent */ + +void vqext_quantize(vqgen *v,quant_meta *q){ + vqgen_quantize(v,q); +} + +float *vqext_weight(vqgen *v,float *p){ + /*noop*/ + return(p); +} + + /* candidate,actual */ +float vqext_metric(vqgen *v,float *e, float *p){ + int i; + float acc=0.; + for(i=0;i<v->elements;i++){ + float val=p[i]-e[i]; + acc+=val*val; + } + return sqrt(acc/v->elements); +} + +void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ + vqgen_addpoint(v,b+start,NULL); +} + +void vqext_preprocess(vqgen *v){ + /* noop */ +} + + + + + + diff --git a/vq/huffbuild.c b/vq/huffbuild.c index 84ac8273..efc96e88 100644 --- a/vq/huffbuild.c +++ b/vq/huffbuild.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis 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.5.2.3 2000/11/03 10:47:30 xiphmont Exp $ + last mod: $Id: huffbuild.c,v 1.5.2.4 2000/11/04 06:22:10 xiphmont Exp $ ********************************************************************/ diff --git a/vq/latticebuild.c b/vq/latticebuild.c new file mode 100644 index 00000000..7d4b9eef --- /dev/null +++ b/vq/latticebuild.c @@ -0,0 +1,174 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility main for building codebooks from lattice descriptions + last mod: $Id: latticebuild.c,v 1.6.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <errno.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "bookutil.h" + +/* The purpose of this util is just to finish packaging the + description into a static codebook. It used to count hits for a + histogram, but I've divorced that out to add some flexibility (it + currently generates an equal probability codebook) + + command line: + latticebuild description.vql + + the lattice description file contains two lines: + + <n> <dim> <multiplicitavep> <sequentialp> + <value_0> <value_1> <value_2> ... <value_n-1> + + a threshmap (or pigeonmap) struct is generated by latticehint; + there are fun tricks one can do with the threshmap and cascades, + but the utils don't know them... + + entropy encoding is done by feeding an entry list collected from a + training set and feeding it to latticetune along with the book. + + latticebuild produces a codebook on stdout */ + +static int ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +int main(int argc,char *argv[]){ + codebook b; + static_codebook c; + float *quantlist; + long *hits; + + int entries=-1,dim=-1,quantvals=-1,addmul=-1,sequencep=0; + FILE *in=NULL; + char *line,*name; + long i,j; + + memset(&b,0,sizeof(b)); + memset(&c,0,sizeof(c)); + + if(argv[1]==NULL){ + fprintf(stderr,"Need a lattice description file on the command line.\n"); + exit(1); + } + + { + char *ptr; + char *filename=calloc(strlen(argv[1])+4,1); + + strcpy(filename,argv[1]); + in=fopen(filename,"r"); + if(!in){ + fprintf(stderr,"Could not open input file %s\n",filename); + exit(1); + } + + ptr=strrchr(filename,'.'); + if(ptr){ + *ptr='\0'; + name=strdup(filename); + }else{ + name=strdup(filename); + } + + } + + /* read the description */ + line=get_line(in); + if(sscanf(line,"%d %d %d %d",&quantvals,&dim,&addmul,&sequencep)!=4){ + if(sscanf(line,"%d %d %d",&quantvals,&dim,&addmul)!=3){ + fprintf(stderr,"Syntax error reading book file (line 1)\n"); + exit(1); + } + } + entries=pow(quantvals,dim); + c.dim=dim; + c.entries=entries; + c.lengthlist=malloc(entries*sizeof(long)); + c.maptype=1; + c.q_sequencep=sequencep; + c.quantlist=calloc(quantvals,sizeof(long)); + + quantlist=malloc(sizeof(long)*c.dim*c.entries); + hits=malloc(c.entries*sizeof(long)); + for(j=0;j<entries;j++)hits[j]=1; + for(j=0;j<entries;j++)c.lengthlist[j]=1; + + reset_next_value(); + setup_line(in); + for(j=0;j<quantvals;j++){ + if(get_line_value(in,quantlist+j)==-1){ + fprintf(stderr,"Ran out of data on line 2 of description file\n"); + exit(1); + } + } + + /* gen a real quant list from the more easily human-grokked input */ + { + float min=quantlist[0]; + float mindel=-1; + int fac=1; + for(j=1;j<quantvals;j++)if(quantlist[j]<min)min=quantlist[j]; + for(j=0;j<quantvals;j++) + for(i=j+1;i<quantvals;i++) + if(mindel==-1 || fabs(quantlist[j]-quantlist[i])<mindel) + mindel=fabs(quantlist[j]-quantlist[i]); + + j=0; + while(j<quantvals){ + for(j=0;j<quantvals;j++){ + float test=(quantlist[j]-min)/(mindel/fac); + if( fabs(rint(test)-test)>.000001) break; + } + if(j<quantvals)fac++; + } + + mindel/=fac; + fprintf(stderr,"min=%g mindel=%g\n",min,mindel); + + c.q_min=_float32_pack(min); + c.q_delta=_float32_pack(mindel); + c.q_quant=0; + + min=_float32_unpack(c.q_min); + mindel=_float32_unpack(c.q_delta); + for(j=0;j<quantvals;j++){ + c.quantlist[j]=rint((quantlist[j]-min)/mindel); + if(ilog(c.quantlist[j])>c.q_quant)c.q_quant=ilog(c.quantlist[j]); + } + } + + /* build the [default] codeword lengths */ + memset(c.lengthlist,0,sizeof(long)*entries); + for(i=0;i<entries;i++)hits[i]=1; + build_tree_from_lengths(entries,hits,c.lengthlist); + + /* save the book in C header form */ + write_codebook(stdout,name,&c); + fprintf(stderr,"\r " + "\nDone.\n"); + exit(0); +} diff --git a/vq/latticehint.c b/vq/latticehint.c new file mode 100644 index 00000000..9dc1feff --- /dev/null +++ b/vq/latticehint.c @@ -0,0 +1,418 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility main for building thresh/pigeonhole encode hints + last mod: $Id: latticehint.c,v 1.3.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <errno.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "../lib/scales.h" +#include "bookutil.h" +#include "vqgen.h" +#include "vqsplit.h" + +/* The purpose of this util is to build encode hints for lattice + codebooks so that brute forcing each codebook entry isn't needed. + Threshhold hints are for books in which each scalar in the vector + is independant (eg, residue) and pigeonhole lookups provide a + minimum error fit for words where the scalars are interdependant + (each affecting the fit of the next in sequence) as in an LSP + sequential book (or can be used along with a sparse threshhold map, + like a splitting tree that need not be trained) + + If the input book is non-sequential, a threshhold hint is built. + If the input book is sequential, a pigeonholing hist is built. + If the book is sparse, a pigeonholing hint is built, possibly in addition + to the threshhold hint + + command line: + latticehint book.vqh + + latticehint produces book.vqh on stdout */ + +static int longsort(const void *a, const void *b){ + return(**((long **)a)-**((long **)b)); +} + +static int addtosearch(int entry,long **tempstack,long *tempcount,int add){ + long *ptr=tempstack[entry]; + long i=tempcount[entry]; + + if(ptr){ + while(i--) + if(*ptr++==add)return(0); + tempstack[entry]=realloc(tempstack[entry], + (tempcount[entry]+1)*sizeof(long)); + }else{ + tempstack[entry]=malloc(sizeof(long)); + } + + tempstack[entry][tempcount[entry]++]=add; + return(1); +} + +static void setvals(int dim,encode_aux_pigeonhole *p, + long *temptrack,float *tempmin,float *tempmax, + int seqp){ + int i; + float last=0.; + for(i=0;i<dim;i++){ + tempmin[i]=(temptrack[i])*p->del+p->min+last; + tempmax[i]=tempmin[i]+p->del; + if(seqp)last=tempmin[i]; + } +} + +/* note that things are currently set up such that input fits that + quantize outside the pigeonmap are dropped and brute-forced. So we + can ignore the <0 and >=n boundary cases in min/max error */ + +static float minerror(int dim,float *a,encode_aux_pigeonhole *p, + long *temptrack,float *tempmin,float *tempmax){ + int i; + float err=0.; + for(i=0;i<dim;i++){ + float eval=0.; + if(a[i]<tempmin[i]){ + eval=tempmin[i]-a[i]; + }else if(a[i]>tempmax[i]){ + eval=a[i]-tempmax[i]; + } + err+=eval*eval; + } + return(err); +} + +static float maxerror(int dim,float *a,encode_aux_pigeonhole *p, + long *temptrack,float *tempmin,float *tempmax){ + int i; + float err=0.,eval; + for(i=0;i<dim;i++){ + if(a[i]<tempmin[i]){ + eval=tempmax[i]-a[i]; + }else if(a[i]>tempmax[i]){ + eval=a[i]-tempmin[i]; + }else{ + float t1=a[i]-tempmin[i]; + eval=tempmax[i]-a[i]; + if(t1>eval)eval=t1; + } + err+=eval*eval; + } + return(err); +} + +int main(int argc,char *argv[]){ + codebook *b; + static_codebook *c; + int entries=-1,dim=-1; + float min,del; + char *name; + long i,j; + long dB=0; + + if(argv[1]==NULL){ + fprintf(stderr,"Need a lattice book on the command line.\n"); + exit(1); + } + + if(argv[2])dB=1; + + { + char *ptr; + char *filename=strdup(argv[1]); + + b=codebook_load(filename); + c=(static_codebook *)(b->c); + + ptr=strrchr(filename,'.'); + if(ptr){ + *ptr='\0'; + name=strdup(filename); + }else{ + name=strdup(filename); + } + } + + if(c->maptype!=1){ + fprintf(stderr,"Provided book is not a latticebook.\n"); + exit(1); + } + + entries=b->entries; + dim=b->dim; + min=_float32_unpack(c->q_min); + del=_float32_unpack(c->q_delta); + + /* Do we want to gen a threshold hint? */ + if(c->q_sequencep==0){ + /* yes. Discard any preexisting threshhold hint */ + long quantvals=_book_maptype1_quantvals(c); + long **quantsort=alloca(quantvals*sizeof(long *)); + encode_aux_threshmatch *t=calloc(1,sizeof(encode_aux_threshmatch)); + c->thresh_tree=t; + + fprintf(stderr,"Adding threshold hint to %s...\n",name); + + /* simplest possible threshold hint only */ + t->quantthresh=calloc(quantvals-1,sizeof(float)); + t->quantmap=calloc(quantvals,sizeof(int)); + t->threshvals=quantvals; + t->quantvals=quantvals; + + /* the quantvals may not be in order; sort em first */ + for(i=0;i<quantvals;i++)quantsort[i]=c->quantlist+i; + qsort(quantsort,quantvals,sizeof(long *),longsort); + + /* ok, gen the map and thresholds */ + for(i=0;i<quantvals;i++)t->quantmap[i]=quantsort[i]-c->quantlist; + for(i=0;i<quantvals-1;i++){ + float v1=*(quantsort[i])*del+min; + float v2=*(quantsort[i+1])*del+min; + if(dB){ + if(fabs(v1)<.01)v1=(v1+v2)*.5; + if(fabs(v2)<.01)v2=(v1+v2)*.5; + t->quantthresh[i]=fromdB((todB(v1)+todB(v2))*.5); + if(v1<0 || v2<0)t->quantthresh[i]*=-1; + + }else{ + t->quantthresh[i]=(v1+v2)*.5; + } + } + } + + /* Do we want to gen a pigeonhole hint? */ + for(i=0;i<entries;i++)if(c->lengthlist[i]==0)break; + if(c->q_sequencep || i<entries){ + long **tempstack; + long *tempcount; + long *temptrack; + float *tempmin; + float *tempmax; + long totalstack=0; + long pigeons; + long subpigeons; + long quantvals=_book_maptype1_quantvals(c); + int changep=1,factor; + + encode_aux_pigeonhole *p=calloc(1,sizeof(encode_aux_pigeonhole)); + c->pigeon_tree=p; + + fprintf(stderr,"Adding pigeonhole hint to %s...\n",name); + + /* the idea is that we quantize uniformly, even in a nonuniform + lattice, so that quantization of one scalar has a predictable + result on the next sequential scalar in a greedy matching + algorithm. We generate a lookup based on the quantization of + the vector (pigeonmap groups quantized entries together) and + list the entries that could possible be the best fit for any + given member of that pigeonhole. The encode process then has a + much smaller list to brute force */ + + /* find our pigeonhole-specific quantization values, fill in the + quant value->pigeonhole map */ + factor=3; + p->del=del; + p->min=min; + p->quantvals=quantvals; + { + int max=0; + for(i=0;i<quantvals;i++)if(max<c->quantlist[i])max=c->quantlist[i]; + p->mapentries=max; + } + p->pigeonmap=malloc(p->mapentries*sizeof(long)); + p->quantvals=(quantvals+factor-1)/factor; + + /* pigeonhole roughly on the boundaries of the quantvals; the + exact pigeonhole grouping is an optimization issue, not a + correctness issue */ + for(i=0;i<p->mapentries;i++){ + float thisval=del*i+min; /* middle of the quant zone */ + int quant=0; + float err=fabs(c->quantlist[0]*del+min-thisval); + for(j=1;j<quantvals;j++){ + float thiserr=fabs(c->quantlist[j]*del+min-thisval); + if(thiserr<err){ + quant=j/factor; + err=thiserr; + } + } + p->pigeonmap[i]=quant; + } + + /* pigeonmap complete. Now do the grungy business of finding the + entries that could possibly be the best fit for a value appearing + in the pigeonhole. The trick that allows the below to work is the + uniform quantization; even though the scalars may be 'sequential' + (each a delta from the last), the uniform quantization means that + the error variance is *not* dependant. Given a pigeonhole and an + entry, we can find the minimum and maximum possible errors + (relative to the entry) for any point that could appear in the + pigeonhole */ + + /* must iterate over both pigeonholes and entries */ + /* temporarily (in order to avoid thinking hard), we grow each + pigeonhole seperately, the build a stack of 'em later */ + pigeons=1; + subpigeons=1; + for(i=0;i<dim;i++)subpigeons*=p->mapentries; + for(i=0;i<dim;i++)pigeons*=p->quantvals; + temptrack=calloc(dim,sizeof(long)); + tempmin=calloc(dim,sizeof(float)); + tempmax=calloc(dim,sizeof(float)); + tempstack=calloc(pigeons,sizeof(long *)); + tempcount=calloc(pigeons,sizeof(long)); + + while(1){ + float errorpost=-1; + char buffer[80]; + + /* map our current pigeonhole to a 'big pigeonhole' so we know + what list we're after */ + int entry=0; + for(i=dim-1;i>=0;i--)entry=entry*p->quantvals+p->pigeonmap[temptrack[i]]; + setvals(dim,p,temptrack,tempmin,tempmax,c->q_sequencep); + sprintf(buffer,"Building pigeonhole search list [%ld]...",totalstack); + + + /* Search all entries to find the one with the minimum possible + maximum error. Record that error */ + for(i=0;i<entries;i++){ + if(c->lengthlist[i]>0){ + float this=maxerror(dim,b->valuelist+i*dim,p, + temptrack,tempmin,tempmax); + if(errorpost==-1 || this<errorpost)errorpost=this; + spinnit(buffer,subpigeons); + } + } + + /* Our search list will contain all entries with a minimum + possible error <= our errorpost */ + for(i=0;i<entries;i++) + if(c->lengthlist[i]>0){ + spinnit(buffer,subpigeons); + if(minerror(dim,b->valuelist+i*dim,p, + temptrack,tempmin,tempmax)<errorpost) + totalstack+=addtosearch(entry,tempstack,tempcount,i); + } + + for(i=0;i<dim;i++){ + temptrack[i]++; + if(temptrack[i]<p->mapentries)break; + temptrack[i]=0; + } + if(i==dim)break; + subpigeons--; + } + + fprintf(stderr,"\r " + "\rTotal search list size (all entries): %ld\n",totalstack); + + /* pare the index of lists for improbable quantizations (where + improbable is determined by c->lengthlist; we assume that + pigeonholing is in sync with the codeword cells, which it is */ + /*for(i=0;i<entries;i++){ + float probability= 1./(1<<c->lengthlist[i]); + if(c->lengthlist[i]==0 || probability*entries<cutoff){ + totalstack-=tempcount[i]; + tempcount[i]=0; + } + }*/ + + /* pare the list of shortlists; merge contained and similar lists + together */ + p->fitmap=malloc(pigeons*sizeof(long)); + for(i=0;i<pigeons;i++)p->fitmap[i]=-1; + while(changep){ + char buffer[80]; + changep=0; + + for(i=0;i<pigeons;i++){ + if(p->fitmap[i]<0 && tempcount[i]){ + for(j=i+1;j<pigeons;j++){ + if(p->fitmap[j]<0 && tempcount[j]){ + /* is one list a superset, or are they sufficiently similar? */ + int amiss=0,bmiss=0,ii,jj; + for(ii=0;ii<tempcount[i];ii++){ + for(jj=0;jj<tempcount[j];jj++) + if(tempstack[i][ii]==tempstack[j][jj])break; + if(jj==tempcount[j])amiss++; + } + for(jj=0;jj<tempcount[j];jj++){ + for(ii=0;ii<tempcount[i];ii++) + if(tempstack[i][ii]==tempstack[j][jj])break; + if(ii==tempcount[i])bmiss++; + } + if(amiss==0 || + bmiss==0 || + (amiss*2<tempcount[i] && bmiss*2<tempcount[j] && + tempcount[i]+bmiss<entries/30)){ + + /*superset/similar Add all of one to the other. */ + for(jj=0;jj<tempcount[j];jj++) + totalstack+=addtosearch(i,tempstack,tempcount, + tempstack[j][jj]); + totalstack-=tempcount[j]; + p->fitmap[j]=i; + changep=1; + } + } + } + sprintf(buffer,"Consolidating [%ld total, %s]... ",totalstack, + changep?"reit":"nochange"); + spinnit(buffer,pigeons-i); + } + } + } + + /* repack the temp stack in final form */ + fprintf(stderr,"\r " + "\rFinal total list size: %ld\n",totalstack); + + + p->fittotal=totalstack; + p->fitlist=malloc((totalstack+1)*sizeof(long)); + p->fitlength=malloc(pigeons*sizeof(long)); + { + long usage=0; + for(i=0;i<pigeons;i++){ + if(p->fitmap[i]==-1){ + if(tempcount[i]) + memcpy(p->fitlist+usage,tempstack[i],tempcount[i]*sizeof(long)); + p->fitmap[i]=usage; + p->fitlength[i]=tempcount[i]; + usage+=tempcount[i]; + if(usage>totalstack){ + fprintf(stderr,"Internal error; usage>totalstack\n"); + exit(1); + } + }else{ + p->fitlength[i]=p->fitlength[p->fitmap[i]]; + p->fitmap[i]=p->fitmap[p->fitmap[i]]; + } + } + } + } + + write_codebook(stdout,name,c); + fprintf(stderr,"\r " + "\nDone.\n"); + exit(0); +} diff --git a/vq/latticepare.c b/vq/latticepare.c new file mode 100644 index 00000000..915cce33 --- /dev/null +++ b/vq/latticepare.c @@ -0,0 +1,598 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility for paring low hit count cells from lattice codebook + last mod: $Id: latticepare.c,v 1.5.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <errno.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "../lib/scales.h" +#include "bookutil.h" +#include "vqgen.h" +#include "vqsplit.h" +#include "../lib/os.h" + +/* Lattice codebooks have two strengths: important fetaures that are + poorly modelled by global error minimization training (eg, strong + peaks) are not neglected 2) compact quantized representation. + + A fully populated lattice codebook, however, swings point 1 too far + in the opposite direction; rare features need not be modelled quite + so religiously and as such, we waste bits unless we eliminate the + least common cells. The codebook rep supports unused cells, so we + need to tag such cells and build an auxiliary (non-thresh) search + mechanism to find the proper match quickly */ + +/* two basic steps; first is pare the cell for which dispersal creates + the least additional error. This will naturally choose + low-population cells and cells that have not taken on points from + neighboring paring (but does not result in the lattice collapsing + inward and leaving low population ares totally unmodelled). After + paring has removed the desired number of cells, we need to build an + auxiliary search for each culled point */ + +/* Although lattice books (due to threshhold-based matching) do not + actually use error to make cell selections (in fact, it need not + bear any relation), the 'secondbest' entry finder here is in fact + error/distance based, so latticepare is only useful on such books */ + +/* command line: + latticepare latticebook.vqh input_data.vqd <target_cells> + + produces a new output book on stdout +*/ + +static float _dist(int el,float *a, float *b){ + int i; + float acc=0.; + for(i=0;i<el;i++){ + float val=(a[i]-b[i]); + acc+=val*val; + } + return(acc); +} + +static float *pointlist; +static long points=0; + +void add_vector(codebook *b,float *vec,long n){ + int dim=b->dim,i,j; + int step=n/dim; + for(i=0;i<step;i++){ + for(j=i;j<n;j+=step){ + pointlist[points++]=vec[j]; + } + } +} + +static int bestm(codebook *b,float *vec){ + encode_aux_threshmatch *tt=b->c->thresh_tree; + int dim=b->dim; + int i,k,o; + int best=0; + + /* what would be the closest match if the codebook was fully + populated? */ + + for(k=0,o=dim-1;k<dim;k++,o--){ + int i; + for(i=0;i<tt->threshvals-1;i++) + if(vec[o]<tt->quantthresh[i])break; + best=(best*tt->quantvals)+tt->quantmap[i]; + } + return(best); +} + +static int closest(codebook *b,float *vec,int current){ + encode_aux_threshmatch *tt=b->c->thresh_tree; + int dim=b->dim; + int i,k,o; + + float bestmetric=0; + int bestentry=-1; + int best=bestm(b,vec); + + if(current<0 && b->c->lengthlist[best]>0)return best; + + for(i=0;i<b->entries;i++){ + if(b->c->lengthlist[i]>0 && i!=best && i!=current){ + float thismetric=_dist(dim, vec, b->valuelist+i*dim); + if(bestentry==-1 || thismetric<bestmetric){ + bestentry=i; + bestmetric=thismetric; + } + } + } + + return(bestentry); +} + +static float _heuristic(codebook *b,float *ppt,int secondbest){ + float *secondcell=b->valuelist+secondbest*b->dim; + int best=bestm(b,ppt); + float *firstcell=b->valuelist+best*b->dim; + float error=_dist(b->dim,firstcell,secondcell); + float *zero=alloca(b->dim*sizeof(float)); + float fromzero; + + memset(zero,0,b->dim*sizeof(float)); + fromzero=sqrt(_dist(b->dim,firstcell,zero)); + + return(error/fromzero); +} + +static int longsort(const void *a, const void *b){ + return **(long **)b-**(long **)a; +} + +void usage(void){ + fprintf(stderr,"Ogg/Vorbis lattice codebook paring utility\n\n" + "usage: latticepare book.vqh data.vqd <target_cells> <protected_cells> base\n" + "where <target_cells> is the desired number of final cells (or -1\n" + " for no change)\n" + " <protected_cells> is the number of highest-hit count cells\n" + " to protect from dispersal\n" + " base is the base name (not including .vqh) of the new\n" + " book\n\n"); + exit(1); +} + +int main(int argc,char *argv[]){ + char *basename; + codebook *b=NULL; + int entries=0; + int dim=0; + long i,j,target=-1,protect=-1; + FILE *out=NULL; + + int argnum=0; + + argv++; + if(*argv==NULL){ + usage(); + exit(1); + } + + while(*argv){ + if(*argv[0]=='-'){ + + argv++; + + }else{ + switch (argnum++){ + case 0:case 1: + { + /* yes, this is evil. However, it's very convenient to parse file + extentions */ + + /* input file. What kind? */ + char *dot; + char *ext=NULL; + char *name=strdup(*argv++); + dot=strrchr(name,'.'); + if(dot) + ext=dot+1; + else{ + ext=""; + + } + + + /* codebook */ + if(!strcmp(ext,"vqh")){ + + basename=strrchr(name,'/'); + if(basename) + basename=strdup(basename)+1; + else + basename=strdup(name); + dot=strrchr(basename,'.'); + if(dot)*dot='\0'; + + b=codebook_load(name); + dim=b->dim; + entries=b->entries; + } + + /* data file; we do actually need to suck it into memory */ + /* we're dealing with just one book, so we can de-interleave */ + if(!strcmp(ext,"vqd") && !points){ + int cols; + long lines=0; + char *line; + float *vec; + FILE *in=fopen(name,"r"); + if(!in){ + fprintf(stderr,"Could not open input file %s\n",name); + exit(1); + } + + reset_next_value(); + line=setup_line(in); + /* count cols before we start reading */ + { + char *temp=line; + while(*temp==' ')temp++; + for(cols=0;*temp;cols++){ + while(*temp>32)temp++; + while(*temp==' ')temp++; + } + } + vec=alloca(cols*sizeof(float)); + /* count, then load, to avoid fragmenting the hell out of + memory */ + while(line){ + lines++; + for(j=0;j<cols;j++) + if(get_line_value(in,vec+j)){ + fprintf(stderr,"Too few columns on line %ld in data file\n",lines); + exit(1); + } + if((lines&0xff)==0)spinnit("counting samples...",lines*cols); + line=setup_line(in); + } + pointlist=malloc((cols*lines+entries*dim)*sizeof(float)); + + rewind(in); + line=setup_line(in); + while(line){ + lines--; + for(j=0;j<cols;j++) + if(get_line_value(in,vec+j)){ + fprintf(stderr,"Too few columns on line %ld in data file\n",lines); + exit(1); + } + /* deinterleave, add to heap */ + add_vector(b,vec,cols); + if((lines&0xff)==0)spinnit("loading samples...",lines*cols); + + line=setup_line(in); + } + fclose(in); + } + } + break; + case 2: + target=atol(*argv++); + if(target==0)target=entries; + break; + case 3: + protect=atol(*argv++); + break; + case 4: + { + char *buff=alloca(strlen(*argv)+5); + sprintf(buff,"%s.vqh",*argv); + basename=*argv++; + + out=fopen(buff,"w"); + if(!out){ + fprintf(stderr,"unable ot open %s for output",buff); + exit(1); + } + } + break; + default: + usage(); + } + } + } + if(!entries || !points || !out)usage(); + if(target==-1)usage(); + + /* add guard points */ + for(i=0;i<entries;i++) + for(j=0;j<dim;j++) + pointlist[points++]=b->valuelist[i*dim+j]; + + points/=dim; + + /* set up auxiliary vectors for error tracking */ + { + encode_aux_nearestmatch *nt=NULL; + long pointssofar=0; + long *pointindex; + long indexedpoints=0; + long *entryindex; + long *reventry; + long *membership=malloc(points*sizeof(long)); + long *firsthead=malloc(entries*sizeof(long)); + long *secondary=malloc(points*sizeof(long)); + long *secondhead=malloc(entries*sizeof(long)); + + long *cellcount=calloc(entries,sizeof(long)); + long *cellcount2=calloc(entries,sizeof(long)); + float *cellerror=calloc(entries,sizeof(float)); + float *cellerrormax=calloc(entries,sizeof(float)); + long cellsleft=entries; + for(i=0;i<points;i++)membership[i]=-1; + for(i=0;i<entries;i++)firsthead[i]=-1; + for(i=0;i<points;i++)secondary[i]=-1; + for(i=0;i<entries;i++)secondhead[i]=-1; + + for(i=0;i<points;i++){ + /* assign vectors to the nearest cell. Also keep track of second + nearest for error statistics */ + float *ppt=pointlist+i*dim; + int firstentry=closest(b,ppt,-1); + int secondentry=closest(b,ppt,firstentry); + float firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt); + float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + + if(!(i&0xff))spinnit("initializing... ",points-i); + + membership[i]=firsthead[firstentry]; + firsthead[firstentry]=i; + secondary[i]=secondhead[secondentry]; + secondhead[secondentry]=i; + + if(i<points-entries){ + cellerror[firstentry]+=secondmetric-firstmetric; + cellerrormax[firstentry]=max(cellerrormax[firstentry], + _heuristic(b,ppt,secondentry)); + cellcount[firstentry]++; + cellcount2[secondentry]++; + } + } + + /* which cells are most heavily populated? Protect as many from + dispersal as the user has requested */ + { + long **countindex=calloc(entries,sizeof(long *)); + for(i=0;i<entries;i++)countindex[i]=cellcount+i; + qsort(countindex,entries,sizeof(long *),longsort); + for(i=0;i<protect;i++){ + int ptr=countindex[i]-cellcount; + cellerrormax[ptr]=9e50; + } + } + + { + fprintf(stderr,"\r"); + for(i=0;i<entries;i++){ + /* decompose index */ + int entry=i; + for(j=0;j<dim;j++){ + fprintf(stderr,"%d:",entry%b->c->thresh_tree->quantvals); + entry/=b->c->thresh_tree->quantvals; + } + + fprintf(stderr,":%ld/%ld, ",cellcount[i],cellcount2[i]); + } + fprintf(stderr,"\n"); + } + + /* do the automatic cull request */ + while(cellsleft>target){ + int bestcell=-1; + float besterror=0; + float besterror2=0; + long head=-1; + char spinbuf[80]; + sprintf(spinbuf,"cells left to eliminate: %ld : ",cellsleft-target); + + /* find the cell with lowest removal impact */ + for(i=0;i<entries;i++){ + if(b->c->lengthlist[i]>0){ + if(bestcell==-1 || cellerrormax[i]<=besterror2){ + if(bestcell==-1 || cellerrormax[i]<besterror2 || + besterror>cellerror[i]){ + besterror=cellerror[i]; + besterror2=cellerrormax[i]; + bestcell=i; + } + } + } + } + + fprintf(stderr,"\reliminating cell %d \n" + " dispersal error of %g max/%g total (%ld hits)\n", + bestcell,besterror2,besterror,cellcount[bestcell]); + + /* disperse it. move each point out, adding it (properly) to + the second best */ + b->c->lengthlist[bestcell]=0; + head=firsthead[bestcell]; + firsthead[bestcell]=-1; + while(head!=-1){ + /* head is a point number */ + float *ppt=pointlist+head*dim; + int firstentry=closest(b,ppt,-1); + int secondentry=closest(b,ppt,firstentry); + float firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt); + float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + long next=membership[head]; + + if(head<points-entries){ + cellcount[firstentry]++; + cellcount[bestcell]--; + cellerror[firstentry]+=secondmetric-firstmetric; + cellerrormax[firstentry]=max(cellerrormax[firstentry], + _heuristic(b,ppt,secondentry)); + } + + membership[head]=firsthead[firstentry]; + firsthead[firstentry]=head; + head=next; + if(cellcount[bestcell]%128==0) + spinnit(spinbuf,cellcount[bestcell]+cellcount2[bestcell]); + + } + + /* now see that all points that had the dispersed cell as second + choice have second choice reassigned */ + head=secondhead[bestcell]; + secondhead[bestcell]=-1; + while(head!=-1){ + float *ppt=pointlist+head*dim; + /* who are we assigned to now? */ + int firstentry=closest(b,ppt,-1); + /* what is the new second closest match? */ + int secondentry=closest(b,ppt,firstentry); + /* old second closest is the cell being disbanded */ + float oldsecondmetric=_dist(dim,b->valuelist+dim*bestcell,ppt); + /* new second closest error */ + float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + long next=secondary[head]; + + if(head<points-entries){ + cellcount2[secondentry]++; + cellcount2[bestcell]--; + cellerror[firstentry]+=secondmetric-oldsecondmetric; + cellerrormax[firstentry]=max(cellerrormax[firstentry], + _heuristic(b,ppt,secondentry)); + } + + secondary[head]=secondhead[secondentry]; + secondhead[secondentry]=head; + head=next; + + if(cellcount2[bestcell]%128==0) + spinnit(spinbuf,cellcount2[bestcell]); + } + + cellsleft--; + } + + /* paring is over. Build decision trees using points that now fall + through the thresh matcher. */ + /* we don't free membership; we flatten it in order to use in lp_split */ + + for(i=0;i<entries;i++){ + long head=firsthead[i]; + spinnit("rearranging membership cache... ",entries-i); + while(head!=-1){ + long next=membership[head]; + membership[head]=i; + head=next; + } + } + + free(secondhead); + free(firsthead); + free(cellerror); + free(cellerrormax); + free(secondary); + + pointindex=malloc(points*sizeof(long)); + /* make a point index of fall-through points */ + for(i=0;i<points;i++){ + int best=_best(b,pointlist+i*dim,1); + if(best==-1) + pointindex[indexedpoints++]=i; + spinnit("finding orphaned points... ",points-i); + } + + /* make an entry index */ + entryindex=malloc(entries*sizeof(long)); + target=0; + for(i=0;i<entries;i++){ + if(b->c->lengthlist[i]>0) + entryindex[target++]=i; + } + + /* make working space for a reverse entry index */ + reventry=malloc(entries*sizeof(long)); + + /* do the split */ + nt=b->c->nearest_tree= + calloc(1,sizeof(encode_aux_nearestmatch)); + + nt->alloc=4096; + nt->ptr0=malloc(sizeof(long)*nt->alloc); + nt->ptr1=malloc(sizeof(long)*nt->alloc); + nt->p=malloc(sizeof(long)*nt->alloc); + nt->q=malloc(sizeof(long)*nt->alloc); + nt->aux=0; + + fprintf(stderr,"Leaves added: %d \n", + lp_split(pointlist,points, + b,entryindex,target, + pointindex,indexedpoints, + membership,reventry, + 0,&pointssofar)); + free(membership); + free(reventry); + free(pointindex); + + /* hack alert. I should just change the damned splitter and + codebook writer */ + for(i=0;i<nt->aux;i++)nt->p[i]*=dim; + for(i=0;i<nt->aux;i++)nt->q[i]*=dim; + + /* recount hits. Build new lengthlist. reuse entryindex storage */ + for(i=0;i<entries;i++)entryindex[i]=1; + for(i=0;i<points-entries;i++){ + int best=_best(b,pointlist+i*dim,1); + float *a=pointlist+i*dim; + if(!(i&0xff))spinnit("counting hits...",i); + if(best==-1){ + fprintf(stderr,"\nINTERNAL ERROR; a point count not be matched to a\n" + "codebook entry. The new decision tree is broken.\n"); + exit(1); + } + entryindex[best]++; + } + for(i=0;i<nt->aux;i++)nt->p[i]/=dim; + for(i=0;i<nt->aux;i++)nt->q[i]/=dim; + + /* the lengthlist builder doesn't actually deal with 0 hit entries. + So, we pack the 'sparse' hit list into a dense list, then unpack + the lengths after the build */ + { + int upper=0; + long *lengthlist=calloc(entries,sizeof(long)); + for(i=0;i<entries;i++){ + if(b->c->lengthlist[i]>0) + entryindex[upper++]=entryindex[i]; + else{ + if(entryindex[i]>1){ + fprintf(stderr,"\nINTERNAL ERROR; _best matched to unused entry\n"); + exit(1); + } + } + } + + /* sanity check */ + if(upper != target){ + fprintf(stderr,"\nINTERNAL ERROR; packed the wrong number of entries\n"); + exit(1); + } + + build_tree_from_lengths(upper,entryindex,lengthlist); + + upper=0; + for(i=0;i<entries;i++){ + if(b->c->lengthlist[i]>0) + b->c->lengthlist[i]=lengthlist[upper++]; + } + + } + } + /* we're done. write it out. */ + write_codebook(out,basename,b->c); + + fprintf(stderr,"\r \nDone.\n"); + return(0); +} + + + + diff --git a/vq/latticetune.c b/vq/latticetune.c new file mode 100644 index 00000000..d260dd5a --- /dev/null +++ b/vq/latticetune.c @@ -0,0 +1,156 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility main for setting entropy encoding parameters + for lattice codebooks + last mod: $Id: latticetune.c,v 1.3.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <errno.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "bookutil.h" + +/* This util takes a training-collected file listing codewords used in + LSP fitting, then generates new codeword lengths for maximally + efficient integer-bits entropy encoding. + + command line: + latticetune book.vqh input.vqd [unused_entriesp] + + latticetune produces book.vqh on stdout */ + +int main(int argc,char *argv[]){ + codebook *b; + static_codebook *c; + long *lengths; + long *hits; + + int entries=-1,dim=-1,guard=1; + FILE *in=NULL; + char *line,*name; + long j; + + if(argv[1]==NULL){ + fprintf(stderr,"Need a lattice codebook on the command line.\n"); + exit(1); + } + if(argv[2]==NULL){ + fprintf(stderr,"Need a codeword data file on the command line.\n"); + exit(1); + } + if(argv[3]!=NULL)guard=0; + + { + char *ptr; + char *filename=strdup(argv[1]); + + b=codebook_load(filename); + c=(static_codebook *)(b->c); + + ptr=strrchr(filename,'.'); + if(ptr){ + *ptr='\0'; + name=strdup(filename); + }else{ + name=strdup(filename); + } + } + + if(c->maptype!=1){ + fprintf(stderr,"Provided book is not a latticebook.\n"); + exit(1); + } + + entries=b->entries; + dim=b->dim; + + hits=malloc(entries*sizeof(long)); + lengths=calloc(entries,sizeof(long)); + for(j=0;j<entries;j++)hits[j]=guard; + + in=fopen(argv[2],"r"); + if(!in){ + fprintf(stderr,"Could not open input file %s\n",argv[2]); + exit(1); + } + + if(!strcmp(argv[0],"latticetune")){ + long lines=0; + line=setup_line(in); + while(line){ + long code; + lines++; + if(!(lines&0xfff))spinnit("codewords so far...",lines); + + if(sscanf(line,"%ld",&code)==1) + hits[code]++; + + line=setup_line(in); + } + } + + if(!strcmp(argv[0],"restune")){ + long step; + long lines=0; + long cols=-1; + float *vec; + line=setup_line(in); + while(line){ + int code; + if(!(lines&0xfff))spinnit("codewords so far...",lines); + + if(cols==-1){ + char *temp=line; + while(*temp==' ')temp++; + for(cols=0;*temp;cols++){ + while(*temp>32)temp++; + while(*temp==' ')temp++; + } + vec=alloca(sizeof(float)*cols); + step=cols/dim; + } + + for(j=0;j<cols;j++) + if(get_line_value(in,vec+j)){ + fprintf(stderr,"Too few columns on line %ld in data file\n",lines); + exit(1); + } + + for(j=0;j<step;j++){ + lines++; + code=_best(b,vec+j,step); + hits[code]++; + } + + line=setup_line(in); + } + } + + fclose(in); + + /* build the codeword lengths */ + build_tree_from_lengths0(entries,hits,lengths); + + c->lengthlist=lengths; + write_codebook(stdout,name,c); + + fprintf(stderr,"\r " + "\nDone.\n"); + exit(0); +} diff --git a/vq/lspdata.c b/vq/lspdata.c index ee1bf989..669bbee3 100644 --- a/vq/lspdata.c +++ b/vq/lspdata.c @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: metrics and quantization code for LSP VQ codebooks - last mod: $Id: lspdata.c,v 1.13.2.1 2000/10/31 08:25:17 xiphmont Exp $ + last mod: $Id: lspdata.c,v 1.13.2.2 2000/11/04 06:22:10 xiphmont Exp $ ********************************************************************/ diff --git a/vq/metrics.c b/vq/metrics.c new file mode 100644 index 00000000..974fcf57 --- /dev/null +++ b/vq/metrics.c @@ -0,0 +1,298 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: function calls to collect codebook metrics + last mod: $Id: metrics.c,v 1.9.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + + +#include <stdlib.h> +#include <unistd.h> +#include <math.h> +#include "vorbis/codebook.h" +#include "../lib/sharedbook.h" +#include "bookutil.h" + +/* collect the following metrics: + + mean and mean squared amplitude + mean and mean squared error + mean and mean squared error (per sample) by entry + worst case fit by entry + entry cell size + hits by entry + total bits + total samples + (average bits per sample)*/ + + +/* set up metrics */ + +float meanamplitude_acc=0.; +float meanamplitudesq_acc=0.; +float meanerror_acc=0.; +float meanerrorsq_acc=0.; + +float **histogram=NULL; +float **histogram_error=NULL; +float **histogram_errorsq=NULL; +float **histogram_hi=NULL; +float **histogram_lo=NULL; +float bits=0.; +float count=0.; + +static float *_now(codebook *c, int i){ + return c->valuelist+i*c->c->dim; +} + +int books=0; + +void process_preprocess(codebook **bs,char *basename){ + int i; + while(bs[books])books++; + + if(books){ + histogram=calloc(books,sizeof(float *)); + histogram_error=calloc(books,sizeof(float *)); + histogram_errorsq=calloc(books,sizeof(float *)); + histogram_hi=calloc(books,sizeof(float *)); + histogram_lo=calloc(books,sizeof(float *)); + }else{ + fprintf(stderr,"Specify at least one codebook\n"); + exit(1); + } + + for(i=0;i<books;i++){ + codebook *b=bs[i]; + histogram[i]=calloc(b->entries,sizeof(float)); + histogram_error[i]=calloc(b->entries*b->dim,sizeof(float)); + histogram_errorsq[i]=calloc(b->entries*b->dim,sizeof(float)); + histogram_hi[i]=calloc(b->entries*b->dim,sizeof(float)); + histogram_lo[i]=calloc(b->entries*b->dim,sizeof(float)); + } +} + +static float _dist(int el,float *a, float *b){ + int i; + float acc=0.; + for(i=0;i<el;i++){ + float val=(a[i]-b[i]); + acc+=val*val; + } + return acc; +} + +void cell_spacing(codebook *c){ + int j,k; + float min=-1,max=-1,mean=0.,meansq=0.; + long total=0; + + /* minimum, maximum, mean, ms cell spacing */ + for(j=0;j<c->c->entries;j++){ + if(c->c->lengthlist[j]>0){ + float localmin=-1.; + for(k=0;k<c->c->entries;k++){ + if(c->c->lengthlist[k]>0){ + float this=_dist(c->c->dim,_now(c,j),_now(c,k)); + if(j!=k && + (localmin==-1 || this<localmin)) + localmin=this; + } + } + + if(min==-1 || localmin<min)min=localmin; + if(max==-1 || localmin>max)max=localmin; + mean+=sqrt(localmin); + meansq+=localmin; + total++; + } + } + + fprintf(stderr,"\tminimum cell spacing (closest side): %g\n",sqrt(min)); + fprintf(stderr,"\tmaximum cell spacing (closest side): %g\n",sqrt(max)); + fprintf(stderr,"\tmean closest side spacing: %g\n",mean/total); + fprintf(stderr,"\tmean sq closest side spacing: %g\n",sqrt(meansq/total)); +} + +void process_postprocess(codebook **bs,char *basename){ + int i,k,book; + char *buffer=alloca(strlen(basename)+80); + + fprintf(stderr,"Done. Processed %ld data points:\n\n", + (long)count); + + fprintf(stderr,"Global statistics:******************\n\n"); + + fprintf(stderr,"\ttotal samples: %ld\n",(long)count); + fprintf(stderr,"\ttotal bits required to code: %ld\n",(long)bits); + fprintf(stderr,"\taverage bits per sample: %g\n\n",bits/count); + + fprintf(stderr,"\tmean sample amplitude: %g\n", + meanamplitude_acc/count); + fprintf(stderr,"\tmean squared sample amplitude: %g\n\n", + sqrt(meanamplitudesq_acc/count)); + + fprintf(stderr,"\tmean code error: %g\n", + meanerror_acc/count); + fprintf(stderr,"\tmean squared code error: %g\n\n", + sqrt(meanerrorsq_acc/count)); + + for(book=0;book<books;book++){ + FILE *out; + codebook *b=bs[book]; + int n=b->c->entries; + int dim=b->c->dim; + + fprintf(stderr,"Book %d statistics:------------------\n",book); + + cell_spacing(b); + + sprintf(buffer,"%s-%d-mse.m",basename,book); + out=fopen(buffer,"w"); + if(!out){ + fprintf(stderr,"Could not open file %s for writing\n",buffer); + exit(1); + } + + for(i=0;i<n;i++){ + for(k=0;k<dim;k++){ + fprintf(out,"%d, %g, %g\n", + i*dim+k,(b->valuelist+i*dim)[k], + sqrt((histogram_errorsq[book]+i*dim)[k]/histogram[book][i])); + } + } + fclose(out); + + sprintf(buffer,"%s-%d-me.m",basename,book); + out=fopen(buffer,"w"); + if(!out){ + fprintf(stderr,"Could not open file %s for writing\n",buffer); + exit(1); + } + + for(i=0;i<n;i++){ + for(k=0;k<dim;k++){ + fprintf(out,"%d, %g, %g\n", + i*dim+k,(b->valuelist+i*dim)[k], + (histogram_error[book]+i*dim)[k]/histogram[book][i]); + } + } + fclose(out); + + sprintf(buffer,"%s-%d-worst.m",basename,book); + out=fopen(buffer,"w"); + if(!out){ + fprintf(stderr,"Could not open file %s for writing\n",buffer); + exit(1); + } + + for(i=0;i<n;i++){ + for(k=0;k<dim;k++){ + fprintf(out,"%d, %g, %g, %g\n", + i*dim+k,(b->valuelist+i*dim)[k], + (b->valuelist+i*dim)[k]+(histogram_lo[book]+i*dim)[k], + (b->valuelist+i*dim)[k]+(histogram_hi[book]+i*dim)[k]); + } + } + fclose(out); + } +} + +float process_one(codebook *b,int book,float *a,int dim,int step,int addmul, + float base){ + int j,entry; + float amplitude=0.; + + if(book==0){ + float last=base; + for(j=0;j<dim;j++){ + amplitude=a[j*step]-(b->c->q_sequencep?last:0); + meanamplitude_acc+=fabs(amplitude); + meanamplitudesq_acc+=amplitude*amplitude; + count++; + last=a[j*step]; + } + } + + if(b->c->q_sequencep){ + float temp; + for(j=0;j<dim;j++){ + temp=a[j*step]; + a[j*step]-=base; + } + base=temp; + } + + entry=vorbis_book_besterror(b,a,step,addmul); + + if(entry==-1){ + fprintf(stderr,"Internal error: _best returned -1.\n"); + exit(1); + } + + histogram[book][entry]++; + bits+=vorbis_book_codelen(b,entry); + + for(j=0;j<dim;j++){ + float error=a[j*step]; + + if(book==books-1){ + meanerror_acc+=fabs(error); + meanerrorsq_acc+=error*error; + } + histogram_errorsq[book][entry*dim+j]+=error*error; + histogram_error[book][entry*dim+j]+=fabs(error); + if(histogram[book][entry]==0 || histogram_hi[book][entry*dim+j]<error) + histogram_hi[book][entry*dim+j]=error; + if(histogram[book][entry]==0 || histogram_lo[book][entry*dim+j]>error) + histogram_lo[book][entry*dim+j]=error; + } + return base; +} + + +void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){ + int bi; + int i; + + for(bi=0;bi<books;bi++){ + codebook *b=bs[bi]; + int dim=b->dim; + float base=0.; + + if(inter){ + for(i=0;i<n/dim;i++) + base=process_one(b,bi,a+i,dim,n/dim,addmul[bi],base); + }else{ + for(i=0;i<=n-dim;i+=dim) + base=process_one(b,bi,a+i,dim,1,addmul[bi],base); + } + } + + if((long)(count)%100)spinnit("working.... samples: ",count); +} + +void process_usage(void){ + fprintf(stderr, + "usage: vqmetrics [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n" + " datafile.vqd [datafile.vqd]...\n\n" + " data can be taken on stdin. -i indicates interleaved coding.\n" + " Output goes to output files:\n" + " basename-me.m: gnuplot: mean error by entry value\n" + " basename-mse.m: gnuplot: mean square error by entry value\n" + " basename-worst.m: gnuplot: worst error by entry value\n" + " basename-distance.m: gnuplot file showing distance probability\n" + "\n"); + +} diff --git a/vq/residuedata.c b/vq/residuedata.c new file mode 100644 index 00000000..71849217 --- /dev/null +++ b/vq/residuedata.c @@ -0,0 +1,162 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: metrics and quantization code for residue VQ codebooks + last mod: $Id: residuedata.c,v 1.4.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <math.h> +#include <stdio.h> +#include <string.h> +#include "vqgen.h" +#include "bookutil.h" +#include "../lib/sharedbook.h" +#include "../lib/scales.h" +#include "vqext.h" + +float scalequant=3.; +char *vqext_booktype="RESdata"; +quant_meta q={0,0,0,0}; /* set sequence data */ +int vqext_aux=0; + +static float *quant_save=NULL; + +float *vqext_weight(vqgen *v,float *p){ + return p; +} + +/* quantize aligned on unit boundaries. Because our grid is likely + very coarse, play 'shuffle the blocks'; don't allow multiple + entries to fill the same spot as is nearly certain to happen. */ + +void vqext_quantize(vqgen *v,quant_meta *q){ + int j,k; + long dim=v->elements; + long n=v->entries; + float max=-1; + float *test=alloca(sizeof(float)*dim); + int moved=0; + + + /* allow movement only to unoccupied coordinates on the coarse grid */ + for(j=0;j<n;j++){ + for(k=0;k<dim;k++){ + float val=_now(v,j)[k]; + float norm=rint(fabs(val)/scalequant); + if(norm>max)max=norm; + test[k]=norm; + } + + /* allow move only if unoccupied */ + if(quant_save){ + for(k=0;k<n;k++) + if(j!=k && memcmp(test,quant_save+dim*k,dim*sizeof(float))==0) + break; + if(k==n){ + if(memcmp(test,quant_save+dim*j,dim*sizeof(float))) + moved++; + memcpy(quant_save+dim*j,test,sizeof(float)*dim); + } + }else{ + memcpy(_now(v,j),test,sizeof(float)*dim); + } + } + + /* unlike the other trainers, we fill in our quantization + information (as we know granularity beforehand and don't need to + maximize it) */ + + q->min=_float32_pack(0.); + q->delta=_float32_pack(scalequant); + q->quant=_ilog(max); + + if(quant_save){ + memcpy(_now(v,0),quant_save,sizeof(float)*dim*n); + fprintf(stderr,"cells shifted this iteration: %d\n",moved); + } +} + + /* candidate,actual */ +float vqext_metric(vqgen *v,float *e, float *p){ + int i; + float acc=0.; + for(i=0;i<v->elements;i++){ + float val=p[i]-e[i]; + acc+=val*val; + } + return sqrt(acc); +} + +/* We don't interleave here; we assume that the interleave is provided + for us by residuesplit in vorbis/huff/ */ +void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ + vqgen_addpoint(v,b+start,NULL); +} + +/* need to reseed because of the coarse quantization we tend to use on + residuals (which causes lots & lots of dupes) */ +void vqext_preprocess(vqgen *v){ + long i,j,k,l; + float *test=alloca(sizeof(float)*v->elements); + scalequant=q.quant; + + vqext_quantize(v,&q); + vqgen_unquantize(v,&q); + + /* if there are any dupes, reseed */ + for(k=0;k<v->entries;k++){ + for(l=0;l<k;l++){ + if(memcmp(_now(v,k),_now(v,l),sizeof(float)*v->elements)==0) + break; + } + if(l<k)break; + } + + if(k<v->entries){ + fprintf(stderr,"reseeding with quantization....\n"); + + /* seed the inputs to input points, but points on unit boundaries, + ignoring quantbits for now, making sure each seed is unique */ + + for(i=0,j=0;i<v->points && j<v->entries;i++){ + for(k=0;k<v->elements;k++){ + float val=_point(v,i)[k]; + test[k]=rint(val/scalequant)*scalequant; + } + + for(l=0;l<j;l++){ + for(k=0;k<v->elements;k++) + if(test[k]!=_now(v,l)[k]) + break; + if(k==v->elements)break; + } + if(l==j){ + memcpy(_now(v,j),test,v->elements*sizeof(float)); + j++; + } + } + + if(j<v->elements){ + fprintf(stderr,"Not enough unique entries after prequantization\n"); + exit(1); + } + } + vqext_quantize(v,&q); + quant_save=malloc(sizeof(float)*v->elements*v->entries); + memcpy(quant_save,_now(v,0),sizeof(float)*v->elements*v->entries); + vqgen_unquantize(v,&q); + +} + diff --git a/vq/residuesplit.c b/vq/residuesplit.c new file mode 100644 index 00000000..aa7c55b8 --- /dev/null +++ b/vq/residuesplit.c @@ -0,0 +1,240 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: residue backend 0 partitioner/classifier + last mod: $Id: residuesplit.c,v 1.5.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <stdio.h> +#include "../vq/bookutil.h" +#include "../lib/sharedbook.h" + +/* does not guard against invalid settings; eg, a subn of 16 and a + subgroup request of 32. Max subn of 128 */ +static void _testhack(float *vec,int n,float *entropy){ + int i,j=0; + float max=0.; + float temp[128]; + + /* setup */ + for(i=0;i<n;i++)temp[i]=fabs(vec[i]); + + /* handle case subgrp==1 outside */ + for(i=0;i<n;i++) + if(temp[i]>max)max=temp[i]; + + for(i=0;i<n;i++)temp[i]=rint(temp[i]); + + while(1){ + entropy[j]=max; + n>>=1; + j++; + + if(n<=0)break; + for(i=0;i<n;i++){ + temp[i]+=temp[i+n]; + } + max=0.; + for(i=0;i<n;i++) + if(temp[i]>max)max=temp[i]; + } +} + +static FILE *of; +static FILE **or; + +/* we evaluate the the entropy measure for each interleaved subgroup */ +/* This is currently a bit specific to/hardwired for mapping 0; things + will need to change in the future when we get real multichannel + mappings */ +int quantaux(float *res,int n,float *ebound,float *mbound,int *subgrp,int parts, int subn){ + long i,j; + float entropy[8]; + int aux; + + for(i=0;i<=n-subn;i+=subn){ + float max=0.; + + _testhack(res+i,subn,entropy); + for(j=0;j<subn;j++) + if(fabs(res[i+j])>max)max=fabs(res[i+j]); + + for(j=0;j<parts-1;j++) + if(entropy[subgrp[j]]<=ebound[j] && + max<=mbound[j]) + break; + aux=j; + + fprintf(of,"%d, ",aux); + + for(j=0;j<subn;j++) + fprintf(or[aux],"%g, ",res[j+i]); + + fprintf(or[aux],"\n"); + } + + fprintf(of,"\n"); + + return(0); +} + +static int getline(FILE *in,float *vec,int begin,int n){ + int i,next=0; + + reset_next_value(); + if(get_next_value(in,vec))return(0); + if(begin){ + for(i=1;i<begin;i++) + get_line_value(in,vec); + next=0; + }else{ + next=1; + } + + for(i=next;i<n;i++) + if(get_line_value(in,vec+i)){ + fprintf(stderr,"ran out of columns in input data\n"); + exit(1); + } + + return(1); +} + +static void usage(){ + fprintf(stderr, + "usage:\n" + "residuesplit <res> <begin,n,group> <baseout> <ent,peak,sub> [<ent,peak,sub>]...\n" + " where begin,n,group is first scalar, \n" + " number of scalars of each in line,\n" + " number of scalars in a group\n" + " ent is the maximum entropy value allowed for membership in a group\n" + " peak is the maximum amplitude value allowed for membership in a group\n" + " subn is the maximum entropy value allowed for membership in a group\n" + + "eg: residuesplit mask.vqd floor.vqd 0,1024,16 res 0,.5,16 3,1.5,8 \n" + "produces resaux.vqd and res_0...n.vqd\n\n"); + exit(1); +} + +int main(int argc, char *argv[]){ + char *buffer; + char *base; + int i,parts,begin,n,subn,*subgrp; + FILE *res; + float *ebound,*mbound,*vec; + long c=0; + if(argc<5)usage(); + + base=strdup(argv[3]); + buffer=alloca(strlen(base)+20); + { + 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); + } + } + + /* how many parts?... */ + parts=argc-3; + + ebound=malloc(sizeof(float)*parts); + mbound=malloc(sizeof(float)*parts); + subgrp=malloc(sizeof(int)*parts); + + for(i=0;i<parts-1;i++){ + char *pos=strchr(argv[4+i],','); + if(*argv[4+i]==',') + ebound[i]=1e50; + else + ebound[i]=atof(argv[4+i]); + + if(!pos){ + mbound[i]=1e50; + subgrp[i]=_ilog(subn)-1; + }else{ + if(*(pos+1)==',') + mbound[i]=1e50; + else + mbound[i]=atof(pos+1); + pos=strchr(pos+1,','); + + if(!pos){ + subgrp[i]=_ilog(subn)-1; + }else{ + subgrp[i]=_ilog(atoi(pos+1))-1; + } + } + } + + ebound[i]=1e50; + mbound[i]=1e50; + subgrp[i]=_ilog(subn)-1; + + res=fopen(argv[1],"r"); + if(!res){ + fprintf(stderr,"Could not open file %s\n",argv[1]); + exit(1); + } + + or=alloca(parts*sizeof(FILE*)); + sprintf(buffer,"%saux.vqd",base); + of=fopen(buffer,"w"); + if(!of){ + fprintf(stderr,"Could not open file %s for writing\n",buffer); + exit(1); + } + for(i=0;i<parts;i++){ + sprintf(buffer,"%s_%d.vqd",base,i); + or[i]=fopen(buffer,"w"); + if(!or[i]){ + fprintf(stderr,"Could not open file %s for writing\n",buffer); + exit(1); + } + } + + vec=malloc(sizeof(float)*n); + /* get the input line by line and process it */ + while(!feof(res)){ + if(getline(res,vec,begin,n)) + quantaux(vec,n,ebound,mbound,subgrp,parts,subn); + c++; + if(!(c&0xf)){ + spinnit("kB so far...",(int)(ftell(res)/1024)); + } + } + fclose(res); + fclose(of); + for(i=0;i<parts;i++) + fclose(or[i]); + fprintf(stderr,"\rDone \n"); + return(0); +} + + + + diff --git a/vq/run.c b/vq/run.c new file mode 100644 index 00000000..4152d016 --- /dev/null +++ b/vq/run.c @@ -0,0 +1,217 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: utility main for loading and operating on codebooks + last mod: $Id: run.c,v 1.11.2.1 2000/11/04 06:22:10 xiphmont Exp $ + + ********************************************************************/ + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <fcntl.h> + +#include "bookutil.h" + +/* command line: + utilname [-i] +|* input_book.vqh [+|* input_book.vqh] + input_data.vqd [input_data.vqd] + + produces output data on stdout + (may also take input data from stdin) + + */ + +extern void process_preprocess(codebook **b,char *basename); +extern void process_postprocess(codebook **b,char *basename); +extern void process_vector(codebook **b,int *addmul, int inter,float *a,int n); +extern void process_usage(void); + +int main(int argc,char *argv[]){ + char *basename; + codebook **b=calloc(1,sizeof(codebook *)); + int *addmul=calloc(1,sizeof(int)); + int books=0; + int input=0; + int interleave=0; + int j; + int start=0; + int num=-1; + argv++; + + if(*argv==NULL){ + process_usage(); + exit(1); + } + + /* yes, this is evil. However, it's very convenient to parse file + extentions */ + + while(*argv){ + if(*argv[0]=='-'){ + /* option */ + if(argv[0][1]=='s'){ + /* subvector */ + if(sscanf(argv[1],"%d,%d",&start,&num)!=2){ + num= -1; + if(sscanf(argv[1],"%d",&start)!=1){ + fprintf(stderr,"Syntax error using -s\n"); + exit(1); + } + } + argv+=2; + } + if(argv[0][1]=='i'){ + /* interleave */ + interleave=1; + argv+=1; + } + }else{ + /* input file. What kind? */ + char *dot; + char *ext=NULL; + char *name=strdup(*argv++); + dot=strrchr(name,'.'); + if(dot) + ext=dot+1; + else + ext=""; + + /* codebook */ + if(!strcmp(ext,"vqh")){ + int multp=0; + if(input){ + fprintf(stderr,"specify all input data (.vqd) files following\n" + "codebook header (.vqh) files\n"); + exit(1); + } + /* is it additive or multiplicative? */ + if(name[0]=='*'){ + multp=1; + name++; + } + if(name[0]=='+')name++; + + basename=strrchr(name,'/'); + if(basename) + basename=strdup(basename)+1; + else + basename=strdup(name); + dot=strrchr(basename,'.'); + if(dot)*dot='\0'; + + b=realloc(b,sizeof(codebook *)*(books+2)); + b[books]=codebook_load(name); + addmul=realloc(addmul,sizeof(int)*(books+1)); + addmul[books++]=multp; + b[books]=NULL; + } + + /* data file */ + if(!strcmp(ext,"vqd")){ + int cols; + long lines=0; + char *line; + float *vec; + FILE *in=fopen(name,"r"); + if(!in){ + fprintf(stderr,"Could not open input file %s\n",name); + exit(1); + } + + if(!input){ + process_preprocess(b,basename); + input++; + } + + reset_next_value(); + line=setup_line(in); + /* count cols before we start reading */ + { + char *temp=line; + while(*temp==' ')temp++; + for(cols=0;*temp;cols++){ + while(*temp>32)temp++; + while(*temp==' ')temp++; + } + } + vec=alloca(cols*sizeof(float)); + while(line){ + lines++; + for(j=0;j<cols;j++) + if(get_line_value(in,vec+j)){ + fprintf(stderr,"Too few columns on line %ld in data file\n",lines); + exit(1); + } + /* ignores -s for now */ + process_vector(b,addmul,interleave,vec,cols); + + line=setup_line(in); + } + fclose(in); + } + } + } + + /* take any data from stdin */ + { + struct stat st; + if(fstat(STDIN_FILENO,&st)==-1){ + fprintf(stderr,"Could not stat STDIN\n"); + exit(1); + } + if((S_IFIFO|S_IFREG|S_IFSOCK)&st.st_mode){ + int cols; + char *line; + long lines=0; + float *vec; + if(!input){ + process_preprocess(b,basename); + input++; + } + + line=setup_line(stdin); + /* count cols before we start reading */ + { + char *temp=line; + while(*temp==' ')temp++; + for(cols=0;*temp;cols++){ + while(*temp>32)temp++; + while(*temp==' ')temp++; + } + } + vec=alloca(cols*sizeof(float)); + while(line){ + lines++; + for(j=0;j<cols;j++) + if(get_line_value(stdin,vec+j)){ + fprintf(stderr,"Too few columns on line %ld in data file\n",lines); + exit(1); + } + /* ignores -s for now */ + process_vector(b,addmul,interleave,vec,cols); + + line=setup_line(stdin); + } + } + } + + process_postprocess(b,basename); + + return 0; +} @@ -1,18 +1,18 @@ /******************************************************************** * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * THIS FILE IS PART OF THE OggVorbis 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 GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * * http://www.xiph.org/ * * * ******************************************************************** function: utility main for training codebooks - last mod: $Id: train.c,v 1.19.2.1 2000/10/31 08:25:17 xiphmont Exp $ + last mod: $Id: train.c,v 1.19.2.2 2000/11/04 06:22:10 xiphmont Exp $ ********************************************************************/ diff --git a/vq/vqext.h b/vq/vqext.h new file mode 100644 index 00000000..ddebb4ea --- /dev/null +++ b/vq/vqext.h @@ -0,0 +1,35 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: prototypes for extermal metrics specific to data type + last mod: $Id: vqext.h,v 1.10.2.1 2000/11/04 06:22:11 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_VQEXT_ +#define _V_VQEXT_ + +#include "vqgen.h" + +extern char *vqext_booktype; +extern quant_meta q; +extern int vqext_aux; + +extern float vqext_metric(vqgen *v,float *e, float *p); +extern float *vqext_weight(vqgen *v,float *p); +extern void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num); +extern void vqext_preprocess(vqgen *v); +extern void vqext_quantize(vqgen *v,quant_meta *); + + +#endif diff --git a/vq/vqgen.c b/vq/vqgen.c new file mode 100644 index 00000000..528c231d --- /dev/null +++ b/vq/vqgen.c @@ -0,0 +1,570 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: train a VQ codebook + last mod: $Id: vqgen.c,v 1.34.2.1 2000/11/04 06:22:11 xiphmont Exp $ + + ********************************************************************/ + +/* This code is *not* part of libvorbis. It is used to generate + trained codebooks offline and then spit the results into a + pregenerated codebook that is compiled into libvorbis. It is an + expensive (but good) algorithm. Run it on big iron. */ + +/* There are so many optimizations to explore in *both* stages that + considering the undertaking is almost withering. For now, we brute + force it all */ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> + +#include "vqgen.h" +#include "bookutil.h" +#include "../lib/sharedbook.h" + +/* Codebook generation happens in two steps: + + 1) Train the codebook with data collected from the encoder: We use + one of a few error metrics (which represent the distance between a + given data point and a candidate point in the training set) to + divide the training set up into cells representing roughly equal + probability of occurring. + + 2) Generate the codebook and auxiliary data from the trained data set +*/ + +/* Codebook training **************************************************** + * + * The basic idea here is that a VQ codebook is like an m-dimensional + * foam with n bubbles. The bubbles compete for space/volume and are + * 'pressurized' [biased] according to some metric. The basic alg + * iterates through allowing the bubbles to compete for space until + * they converge (if the damping is dome properly) on a steady-state + * solution. Individual input points, collected from libvorbis, are + * used to train the algorithm monte-carlo style. */ + +/* internal helpers *****************************************************/ +#define vN(data,i) (data+v->elements*i) + +/* default metric; squared 'distance' from desired value. */ +float _dist(vqgen *v,float *a, float *b){ + int i; + int el=v->elements; + float acc=0.; + for(i=0;i<el;i++){ + float val=(a[i]-b[i]); + acc+=val*val; + } + return sqrt(acc); +} + +float *_weight_null(vqgen *v,float *a){ + return a; +} + +/* *must* be beefed up. */ +void _vqgen_seed(vqgen *v){ + long i; + for(i=0;i<v->entries;i++) + memcpy(_now(v,i),_point(v,i),sizeof(float)*v->elements); + v->seeded=1; +} + +int directdsort(const void *a, const void *b){ + float av=*((float *)a); + float bv=*((float *)b); + if(av>bv)return(-1); + return(1); +} + +void vqgen_cellmetric(vqgen *v){ + int j,k; + float min=-1.,max=-1.,mean=0.,acc=0.; + long dup=0,unused=0; + #ifdef NOISY + int i; + char buff[80]; + float spacings[v->entries]; + int count=0; + FILE *cells; + sprintf(buff,"cellspace%d.m",v->it); + cells=fopen(buff,"w"); +#endif + + /* minimum, maximum, cell spacing */ + for(j=0;j<v->entries;j++){ + float localmin=-1.; + + for(k=0;k<v->entries;k++){ + if(j!=k){ + float this=_dist(v,_now(v,j),_now(v,k)); + if(this>0){ + if(v->assigned[k] && (localmin==-1 || this<localmin)) + localmin=this; + }else{ + if(k<j){ + dup++; + break; + } + } + } + } + if(k<v->entries)continue; + + if(v->assigned[j]==0){ + unused++; + continue; + } + + localmin=v->max[j]+localmin/2; /* this gives us rough diameter */ + if(min==-1 || localmin<min)min=localmin; + if(max==-1 || localmin>max)max=localmin; + mean+=localmin; + acc++; +#ifdef NOISY + spacings[count++]=localmin; +#endif + } + + fprintf(stderr,"cell diameter: %.03g::%.03g::%.03g (%ld unused/%ld dup)\n", + min,mean/acc,max,unused,dup); + +#ifdef NOISY + qsort(spacings,count,sizeof(float),directdsort); + for(i=0;i<count;i++) + fprintf(cells,"%g\n",spacings[i]); + fclose(cells); +#endif + +} + +/* External calls *******************************************************/ + +/* We have two forms of quantization; in the first, each vector + element in the codebook entry is orthogonal. Residues would use this + quantization for example. + + In the second, we have a sequence of monotonically increasing + values that we wish to quantize as deltas (to save space). We + still need to quantize so that absolute values are accurate. For + example, LSP quantizes all absolute values, but the book encodes + distance between values because each successive value is larger + than the preceeding value. Thus the desired quantibits apply to + the encoded (delta) values, not abs positions. This requires minor + additional encode-side trickery. */ + +void vqgen_quantize(vqgen *v,quant_meta *q){ + + float maxdel; + float mindel; + + float delta; + float maxquant=((1<<q->quant)-1); + + int j,k; + + mindel=maxdel=_now(v,0)[0]; + + for(j=0;j<v->entries;j++){ + float last=0.; + for(k=0;k<v->elements;k++){ + if(mindel>_now(v,j)[k]-last)mindel=_now(v,j)[k]-last; + if(maxdel<_now(v,j)[k]-last)maxdel=_now(v,j)[k]-last; + if(q->sequencep)last=_now(v,j)[k]; + } + } + + + /* first find the basic delta amount from the maximum span to be + encoded. Loosen the delta slightly to allow for additional error + during sequence quantization */ + + delta=(maxdel-mindel)/((1<<q->quant)-1.5); + + q->min=_float32_pack(mindel); + q->delta=_float32_pack(delta); + + mindel=_float32_unpack(q->min); + delta=_float32_unpack(q->delta); + + for(j=0;j<v->entries;j++){ + float last=0; + for(k=0;k<v->elements;k++){ + float val=_now(v,j)[k]; + float now=rint((val-last-mindel)/delta); + + _now(v,j)[k]=now; + if(now<0){ + /* be paranoid; this should be impossible */ + fprintf(stderr,"fault; quantized value<0\n"); + exit(1); + } + + if(now>maxquant){ + /* be paranoid; this should be impossible */ + fprintf(stderr,"fault; quantized value>max\n"); + exit(1); + } + if(q->sequencep)last=(now*delta)+mindel+last; + } + } +} + +/* much easier :-). Unlike in the codebook, we don't un-log log + scales; we just make sure they're properly offset. */ +void vqgen_unquantize(vqgen *v,quant_meta *q){ + long j,k; + float mindel=_float32_unpack(q->min); + float delta=_float32_unpack(q->delta); + + for(j=0;j<v->entries;j++){ + float last=0.; + for(k=0;k<v->elements;k++){ + float now=_now(v,j)[k]; + now=fabs(now)*delta+last+mindel; + if(q->sequencep)last=now; + _now(v,j)[k]=now; + } + } +} + +void vqgen_init(vqgen *v,int elements,int aux,int entries,float mindist, + float (*metric)(vqgen *,float *, float *), + float *(*weight)(vqgen *,float *),int centroid){ + memset(v,0,sizeof(vqgen)); + + v->centroid=centroid; + v->elements=elements; + v->aux=aux; + v->mindist=mindist; + v->allocated=32768; + v->pointlist=malloc(v->allocated*(v->elements+v->aux)*sizeof(float)); + + v->entries=entries; + v->entrylist=malloc(v->entries*v->elements*sizeof(float)); + v->assigned=malloc(v->entries*sizeof(long)); + v->bias=calloc(v->entries,sizeof(float)); + v->max=calloc(v->entries,sizeof(float)); + if(metric) + v->metric_func=metric; + else + v->metric_func=_dist; + if(weight) + v->weight_func=weight; + else + v->weight_func=_weight_null; + + v->asciipoints=tmpfile(); + +} + +void vqgen_addpoint(vqgen *v, float *p,float *a){ + int k; + for(k=0;k<v->elements;k++) + fprintf(v->asciipoints,"%.12g\n",p[k]); + for(k=0;k<v->aux;k++) + fprintf(v->asciipoints,"%.12g\n",a[k]); + + if(v->points>=v->allocated){ + v->allocated*=2; + v->pointlist=realloc(v->pointlist,v->allocated*(v->elements+v->aux)* + sizeof(float)); + } + + memcpy(_point(v,v->points),p,sizeof(float)*v->elements); + if(v->aux)memcpy(_point(v,v->points)+v->elements,a,sizeof(float)*v->aux); + + /* quantize to the density mesh if it's selected */ + if(v->mindist>0.){ + /* quantize to the mesh */ + for(k=0;k<v->elements+v->aux;k++) + _point(v,v->points)[k]= + rint(_point(v,v->points)[k]/v->mindist)*v->mindist; + } + v->points++; + if(!(v->points&0xff))spinnit("loading... ",v->points); +} + +/* yes, not threadsafe. These utils aren't */ +static int sortit=0; +static int sortsize=0; +static int meshcomp(const void *a,const void *b){ + if(((sortit++)&0xfff)==0)spinnit("sorting mesh...",sortit); + return(memcmp(a,b,sortsize)); +} + +void vqgen_sortmesh(vqgen *v){ + sortit=0; + if(v->mindist>0.){ + long i,march=1; + + /* sort to make uniqueness detection trivial */ + sortsize=(v->elements+v->aux)*sizeof(float); + qsort(v->pointlist,v->points,sortsize,meshcomp); + + /* now march through and eliminate dupes */ + for(i=1;i<v->points;i++){ + if(memcmp(_point(v,i),_point(v,i-1),sortsize)){ + /* a new, unique entry. march it down */ + if(i>march)memcpy(_point(v,march),_point(v,i),sortsize); + march++; + } + spinnit("eliminating density... ",v->points-i); + } + + /* we're done */ + fprintf(stderr,"\r%ld training points remining out of %ld" + " after density mesh (%ld%%)\n",march,v->points,march*100/v->points); + v->points=march; + + } + v->sorted=1; +} + +float vqgen_iterate(vqgen *v,int biasp){ + long i,j,k; + + float fdesired; + long desired; + long desired2; + + float asserror=0.; + float meterror=0.; + float *new; + float *new2; + long *nearcount; + float *nearbias; + #ifdef NOISY + char buff[80]; + FILE *assig; + FILE *bias; + FILE *cells; + sprintf(buff,"cells%d.m",v->it); + cells=fopen(buff,"w"); + sprintf(buff,"assig%d.m",v->it); + assig=fopen(buff,"w"); + sprintf(buff,"bias%d.m",v->it); + bias=fopen(buff,"w"); + #endif + + + if(v->entries<2){ + fprintf(stderr,"generation requires at least two entries\n"); + exit(1); + } + + if(!v->sorted)vqgen_sortmesh(v); + if(!v->seeded)_vqgen_seed(v); + + fdesired=(float)v->points/v->entries; + desired=fdesired; + desired2=desired*2; + new=malloc(sizeof(float)*v->entries*v->elements); + new2=malloc(sizeof(float)*v->entries*v->elements); + nearcount=malloc(v->entries*sizeof(long)); + nearbias=malloc(v->entries*desired2*sizeof(float)); + + /* fill in nearest points for entry biasing */ + /*memset(v->bias,0,sizeof(float)*v->entries);*/ + memset(nearcount,0,sizeof(long)*v->entries); + memset(v->assigned,0,sizeof(long)*v->entries); + if(biasp){ + for(i=0;i<v->points;i++){ + float *ppt=v->weight_func(v,_point(v,i)); + float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0]; + float secondmetric=v->metric_func(v,_now(v,1),ppt)+v->bias[1]; + long firstentry=0; + long secondentry=1; + + if(!(i&0xff))spinnit("biasing... ",v->points+v->points+v->entries-i); + + if(firstmetric>secondmetric){ + float temp=firstmetric; + firstmetric=secondmetric; + secondmetric=temp; + firstentry=1; + secondentry=0; + } + + for(j=2;j<v->entries;j++){ + float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; + if(thismetric<secondmetric){ + if(thismetric<firstmetric){ + secondmetric=firstmetric; + secondentry=firstentry; + firstmetric=thismetric; + firstentry=j; + }else{ + secondmetric=thismetric; + secondentry=j; + } + } + } + + j=firstentry; + for(j=0;j<v->entries;j++){ + + float thismetric,localmetric; + float *nearbiasptr=nearbias+desired2*j; + long k=nearcount[j]; + + localmetric=v->metric_func(v,_now(v,j),ppt); + /* 'thismetric' is to be the bias value necessary in the current + arrangement for entry j to capture point i */ + if(firstentry==j){ + /* use the secondary entry as the threshhold */ + thismetric=secondmetric-localmetric; + }else{ + /* use the primary entry as the threshhold */ + thismetric=firstmetric-localmetric; + } + + /* support the idea of 'minimum distance'... if we want the + cells in a codebook to be roughly some minimum size (as with + the low resolution residue books) */ + + /* a cute two-stage delayed sorting hack */ + if(k<desired){ + nearbiasptr[k]=thismetric; + k++; + if(k==desired){ + spinnit("biasing... ",v->points+v->points+v->entries-i); + qsort(nearbiasptr,desired,sizeof(float),directdsort); + } + + }else if(thismetric>nearbiasptr[desired-1]){ + nearbiasptr[k]=thismetric; + k++; + if(k==desired2){ + spinnit("biasing... ",v->points+v->points+v->entries-i); + qsort(nearbiasptr,desired2,sizeof(float),directdsort); + k=desired; + } + } + nearcount[j]=k; + } + } + + /* inflate/deflate */ + + for(i=0;i<v->entries;i++){ + float *nearbiasptr=nearbias+desired2*i; + + spinnit("biasing... ",v->points+v->entries-i); + + /* due to the delayed sorting, we likely need to finish it off....*/ + if(nearcount[i]>desired) + qsort(nearbiasptr,nearcount[i],sizeof(float),directdsort); + + v->bias[i]=nearbiasptr[desired-1]; + + } + }else{ + memset(v->bias,0,v->entries*sizeof(float)); + } + + /* Now assign with new bias and find new midpoints */ + for(i=0;i<v->points;i++){ + float *ppt=v->weight_func(v,_point(v,i)); + float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0]; + long firstentry=0; + + if(!(i&0xff))spinnit("centering... ",v->points-i); + + for(j=0;j<v->entries;j++){ + float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; + if(thismetric<firstmetric){ + firstmetric=thismetric; + firstentry=j; + } + } + + j=firstentry; + +#ifdef NOISY + fprintf(cells,"%g %g\n%g %g\n\n", + _now(v,j)[0],_now(v,j)[1], + ppt[0],ppt[1]); +#endif + + firstmetric-=v->bias[j]; + meterror+=firstmetric; + + if(v->centroid==0){ + /* set up midpoints for next iter */ + if(v->assigned[j]++){ + for(k=0;k<v->elements;k++) + vN(new,j)[k]+=ppt[k]; + if(firstmetric>v->max[j])v->max[j]=firstmetric; + }else{ + for(k=0;k<v->elements;k++) + vN(new,j)[k]=ppt[k]; + v->max[j]=firstmetric; + } + }else{ + /* centroid */ + if(v->assigned[j]++){ + for(k=0;k<v->elements;k++){ + if(vN(new,j)[k]>ppt[k])vN(new,j)[k]=ppt[k]; + if(vN(new2,j)[k]<ppt[k])vN(new2,j)[k]=ppt[k]; + } + if(firstmetric>v->max[firstentry])v->max[j]=firstmetric; + }else{ + for(k=0;k<v->elements;k++){ + vN(new,j)[k]=ppt[k]; + vN(new2,j)[k]=ppt[k]; + } + v->max[firstentry]=firstmetric; + } + } + } + + /* assign midpoints */ + + for(j=0;j<v->entries;j++){ +#ifdef NOISY + fprintf(assig,"%ld\n",v->assigned[j]); + fprintf(bias,"%g\n",v->bias[j]); +#endif + asserror+=fabs(v->assigned[j]-fdesired); + if(v->assigned[j]){ + if(v->centroid==0){ + for(k=0;k<v->elements;k++) + _now(v,j)[k]=vN(new,j)[k]/v->assigned[j]; + }else{ + for(k=0;k<v->elements;k++) + _now(v,j)[k]=(vN(new,j)[k]+vN(new2,j)[k])/2.; + } + } + } + + asserror/=(v->entries*fdesired); + + fprintf(stderr,"Pass #%d... ",v->it); + fprintf(stderr,": dist %g(%g) metric error=%g \n", + asserror,fdesired,meterror/v->points); + v->it++; + + free(new); + free(nearcount); + free(nearbias); +#ifdef NOISY + fclose(assig); + fclose(bias); + fclose(cells); +#endif + return(asserror); +} + diff --git a/vq/vqgen.h b/vq/vqgen.h new file mode 100644 index 00000000..87dc3d06 --- /dev/null +++ b/vq/vqgen.h @@ -0,0 +1,86 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: build a VQ codebook + last mod: $Id: vqgen.h,v 1.15.2.1 2000/11/04 06:22:11 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _VQGEN_H_ +#define _VQGEN_H_ + +typedef struct vqgen{ + int seeded; + int sorted; + + int it; + int elements; + + int aux; + float mindist; + int centroid; + + /* point cache */ + float *pointlist; + long points; + long allocated; + + /* entries */ + float *entrylist; + long *assigned; + float *bias; + long entries; + float *max; + + float (*metric_func) (struct vqgen *v,float *entry,float *point); + float *(*weight_func) (struct vqgen *v,float *point); + + FILE *asciipoints; +} vqgen; + +typedef struct { + long min; /* packed 24 bit float */ + long delta; /* packed 24 bit float */ + int quant; /* 0 < quant <= 16 */ + int sequencep; /* bitflag */ +} quant_meta; + +static inline float *_point(vqgen *v,long ptr){ + return v->pointlist+((v->elements+v->aux)*ptr); +} + +static inline float *_aux(vqgen *v,long ptr){ + return _point(v,ptr)+v->aux; +} + +static inline float *_now(vqgen *v,long ptr){ + return v->entrylist+(v->elements*ptr); +} + +extern void vqgen_init(vqgen *v, + int elements,int aux,int entries,float mindist, + float (*metric)(vqgen *,float *, float *), + float *(*weight)(vqgen *,float *),int centroid); +extern void vqgen_addpoint(vqgen *v, float *p,float *aux); + +extern float vqgen_iterate(vqgen *v,int biasp); +extern void vqgen_unquantize(vqgen *v,quant_meta *q); +extern void vqgen_quantize(vqgen *v,quant_meta *q); +extern void vqgen_cellmetric(vqgen *v); + +#endif + + + + + diff --git a/vq/vqsplit.c b/vq/vqsplit.c new file mode 100644 index 00000000..9e345423 --- /dev/null +++ b/vq/vqsplit.c @@ -0,0 +1,614 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: build a VQ codebook and the encoding decision 'tree' + last mod: $Id: vqsplit.c,v 1.20.2.1 2000/11/04 06:22:11 xiphmont Exp $ + + ********************************************************************/ + +/* This code is *not* part of libvorbis. It is used to generate + trained codebooks offline and then spit the results into a + pregenerated codebook that is compiled into libvorbis. It is an + expensive (but good) algorithm. Run it on big iron. */ + +/* There are so many optimizations to explore in *both* stages that + considering the undertaking is almost withering. For now, we brute + force it all */ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <string.h> +#include <sys/time.h> + +#include "vqgen.h" +#include "vqsplit.h" +#include "bookutil.h" +#include "../lib/sharedbook.h" + +/* Codebook generation happens in two steps: + + 1) Train the codebook with data collected from the encoder: We use + one of a few error metrics (which represent the distance between a + given data point and a candidate point in the training set) to + divide the training set up into cells representing roughly equal + probability of occurring. + + 2) Generate the codebook and auxiliary data from the trained data set +*/ + +/* Building a codebook from trained set ********************************** + + The codebook in raw form is technically finished once it's trained. + However, we want to finalize the representative codebook values for + each entry and generate auxiliary information to optimize encoding. + We generate the auxiliary coding tree using collected data, + probably the same data as in the original training */ + +/* At each recursion, the data set is split in half. Cells with data + points on side A go into set A, same with set B. The sets may + overlap. If the cell overlaps the deviding line only very slightly + (provided parameter), we may choose to ignore the overlap in order + to pare the tree down */ + +long *isortvals; +int iascsort(const void *a,const void *b){ + long av=isortvals[*((long *)a)]; + long bv=isortvals[*((long *)b)]; + return(av-bv); +} + +static float _Ndist(int el,float *a, float *b){ + int i; + float acc=0.; + for(i=0;i<el;i++){ + float val=(a[i]-b[i]); + acc+=val*val; + } + return sqrt(acc); +} + +#define _Npoint(i) (pointlist+dim*(i)) +#define _Nnow(i) (entrylist+dim*(i)) + + +/* goes through the split, but just counts it and returns a metric*/ +int vqsp_count(float *entrylist,float *pointlist,int dim, + long *membership,long *reventry, + long *entryindex,long entries, + long *pointindex,long points,int splitp, + long *entryA,long *entryB, + long besti,long bestj, + long *entriesA,long *entriesB,long *entriesC){ + long i,j; + long A=0,B=0,C=0; + long pointsA=0; + long pointsB=0; + long *temppointsA=NULL; + long *temppointsB=NULL; + + if(splitp){ + temppointsA=malloc(points*sizeof(long)); + temppointsB=malloc(points*sizeof(long)); + } + + memset(entryA,0,sizeof(long)*entries); + memset(entryB,0,sizeof(long)*entries); + + /* Do the points belonging to this cell occur on sideA, sideB or + both? */ + + for(i=0;i<points;i++){ + float *ppt=_Npoint(pointindex[i]); + long firstentry=membership[pointindex[i]]; + + if(firstentry==besti){ + entryA[reventry[firstentry]]=1; + if(splitp)temppointsA[pointsA++]=pointindex[i]; + continue; + } + if(firstentry==bestj){ + entryB[reventry[firstentry]]=1; + if(splitp)temppointsB[pointsB++]=pointindex[i]; + continue; + } + { + float distA=_Ndist(dim,ppt,_Nnow(besti)); + float distB=_Ndist(dim,ppt,_Nnow(bestj)); + if(distA<distB){ + entryA[reventry[firstentry]]=1; + if(splitp)temppointsA[pointsA++]=pointindex[i]; + }else{ + entryB[reventry[firstentry]]=1; + if(splitp)temppointsB[pointsB++]=pointindex[i]; + } + } + } + + /* The entry splitting isn't total, so that storage has to be + allocated for recursion. Reuse the entryA/entryB vectors */ + /* keep the entries in ascending order (relative to the original + list); we rely on that stability when ordering p/q choice */ + for(j=0;j<entries;j++){ + if(entryA[j] && entryB[j])C++; + if(entryA[j])entryA[A++]=entryindex[j]; + if(entryB[j])entryB[B++]=entryindex[j]; + } + *entriesA=A; + *entriesB=B; + *entriesC=C; + if(splitp){ + memcpy(pointindex,temppointsA,sizeof(long)*pointsA); + memcpy(pointindex+pointsA,temppointsB,sizeof(long)*pointsB); + free(temppointsA); + free(temppointsB); + } + return(pointsA); +} + +int lp_split(float *pointlist,long totalpoints, + codebook *b, + long *entryindex,long entries, + long *pointindex,long points, + long *membership,long *reventry, + long depth, long *pointsofar){ + + encode_aux_nearestmatch *t=b->c->nearest_tree; + + /* The encoder, regardless of book, will be using a straight + euclidian distance-to-point metric to determine closest point. + Thus we split the cells using the same (we've already trained the + codebook set spacing and distribution using special metrics and + even a midpoint division won't disturb the basic properties) */ + + int dim=b->dim; + float *entrylist=b->valuelist; + long ret; + long *entryA=calloc(entries,sizeof(long)); + long *entryB=calloc(entries,sizeof(long)); + long entriesA=0; + long entriesB=0; + long entriesC=0; + long pointsA=0; + long i,j,k; + + long besti=-1; + long bestj=-1; + + char spinbuf[80]; + sprintf(spinbuf,"splitting [%ld left]... ",totalpoints-*pointsofar); + + /* one reverse index needed */ + for(i=0;i<b->entries;i++)reventry[i]=-1; + for(i=0;i<entries;i++)reventry[entryindex[i]]=i; + + /* We need to find the dividing hyperplane. find the median of each + axis as the centerpoint and the normal facing farthest point */ + + /* more than one way to do this part. For small sets, we can brute + force it. */ + + if(entries<8 || (float)points*entries*entries<16.*1024*1024){ + /* try every pair possibility */ + float best=0; + float this; + for(i=0;i<entries-1;i++){ + for(j=i+1;j<entries;j++){ + spinnit(spinbuf,entries-i); + vqsp_count(b->valuelist,pointlist,dim, + membership,reventry, + entryindex,entries, + pointindex,points,0, + entryA,entryB, + entryindex[i],entryindex[j], + &entriesA,&entriesB,&entriesC); + this=(entriesA-entriesC)*(entriesB-entriesC); + + /* when choosing best, we also want some form of stability to + make sure more branches are pared later; secondary + weighting isn;t needed as the entry lists are in ascending + order, and we always try p/q in the same sequence */ + + if( (besti==-1) || + (this>best) ){ + + best=this; + besti=entryindex[i]; + bestj=entryindex[j]; + + } + } + } + }else{ + float *p=alloca(dim*sizeof(float)); + float *q=alloca(dim*sizeof(float)); + float best=0.; + + /* try COG/normal and furthest pairs */ + /* meanpoint */ + /* eventually, we want to select the closest entry and figure n/c + from p/q (because storing n/c is too large */ + for(k=0;k<dim;k++){ + spinnit(spinbuf,entries); + + p[k]=0.; + for(j=0;j<entries;j++) + p[k]+=b->valuelist[entryindex[j]*dim+k]; + p[k]/=entries; + + } + + /* we go through the entries one by one, looking for the entry on + the other side closest to the point of reflection through the + center */ + + for(i=0;i<entries;i++){ + float *ppi=_Nnow(entryindex[i]); + float ref_best=0.; + float ref_j=-1; + float this; + spinnit(spinbuf,entries-i); + + for(k=0;k<dim;k++) + q[k]=2*p[k]-ppi[k]; + + for(j=0;j<entries;j++){ + if(j!=i){ + float this=_Ndist(dim,q,_Nnow(entryindex[j])); + if(ref_j==-1 || this<=ref_best){ /* <=, not <; very important */ + ref_best=this; + ref_j=entryindex[j]; + } + } + } + + vqsp_count(b->valuelist,pointlist,dim, + membership,reventry, + entryindex,entries, + pointindex,points,0, + entryA,entryB, + entryindex[i],ref_j, + &entriesA,&entriesB,&entriesC); + this=(entriesA-entriesC)*(entriesB-entriesC); + + /* when choosing best, we also want some form of stability to + make sure more branches are pared later; secondary + weighting isn;t needed as the entry lists are in ascending + order, and we always try p/q in the same sequence */ + + if( (besti==-1) || + (this>best) ){ + + best=this; + besti=entryindex[i]; + bestj=ref_j; + + } + } + if(besti>bestj){ + long temp=besti; + besti=bestj; + bestj=temp; + } + + } + + /* find cells enclosing points */ + /* count A/B points */ + + pointsA=vqsp_count(b->valuelist,pointlist,dim, + membership,reventry, + entryindex,entries, + pointindex,points,1, + entryA,entryB, + besti,bestj, + &entriesA,&entriesB,&entriesC); + + /* fprintf(stderr,"split: total=%ld depth=%ld set A=%ld:%ld:%ld=B\n", + entries,depth,entriesA-entriesC,entriesC,entriesB-entriesC);*/ + { + long thisaux=t->aux++; + if(t->aux>=t->alloc){ + t->alloc*=2; + t->ptr0=realloc(t->ptr0,sizeof(long)*t->alloc); + t->ptr1=realloc(t->ptr1,sizeof(long)*t->alloc); + t->p=realloc(t->p,sizeof(long)*t->alloc); + t->q=realloc(t->q,sizeof(long)*t->alloc); + } + + t->p[thisaux]=besti; + t->q[thisaux]=bestj; + + if(entriesA==1){ + ret=1; + t->ptr0[thisaux]=entryA[0]; + *pointsofar+=pointsA; + }else{ + t->ptr0[thisaux]= -t->aux; + ret=lp_split(pointlist,totalpoints,b,entryA,entriesA,pointindex,pointsA, + membership,reventry,depth+1,pointsofar); + } + if(entriesB==1){ + ret++; + t->ptr1[thisaux]=entryB[0]; + *pointsofar+=points-pointsA; + }else{ + t->ptr1[thisaux]= -t->aux; + ret+=lp_split(pointlist,totalpoints,b,entryB,entriesB,pointindex+pointsA, + points-pointsA,membership,reventry, + depth+1,pointsofar); + } + } + free(entryA); + free(entryB); + return(ret); +} + +static int _node_eq(encode_aux_nearestmatch *v, long a, long b){ + long Aptr0=v->ptr0[a]; + long Aptr1=v->ptr1[a]; + long Bptr0=v->ptr0[b]; + long Bptr1=v->ptr1[b]; + + /* the possibility of choosing the same p and q, but switched, can;t + happen because we always look for the best p/q in the same search + order and the search is stable */ + + if(Aptr0==Bptr0 && Aptr1==Bptr1) + return(1); + + return(0); +} + +void vqsp_book(vqgen *v, codebook *b, long *quantlist){ + long i,j; + static_codebook *c=(static_codebook *)b->c; + encode_aux_nearestmatch *t; + + memset(b,0,sizeof(codebook)); + memset(c,0,sizeof(static_codebook)); + b->c=c; + t=c->nearest_tree=calloc(1,sizeof(encode_aux_nearestmatch)); + c->maptype=2; + + /* make sure there are no duplicate entries and that every + entry has points */ + + for(i=0;i<v->entries;){ + /* duplicate? if so, eliminate */ + for(j=0;j<i;j++){ + if(_Ndist(v->elements,_now(v,i),_now(v,j))==0.){ + fprintf(stderr,"found a duplicate entry! removing...\n"); + v->entries--; + memcpy(_now(v,i),_now(v,v->entries),sizeof(float)*v->elements); + memcpy(quantlist+i*v->elements,quantlist+v->entries*v->elements, + sizeof(long)*v->elements); + break; + } + } + if(j==i)i++; + } + + { + v->assigned=calloc(v->entries,sizeof(long)); + for(i=0;i<v->points;i++){ + float *ppt=_point(v,i); + float firstmetric=_Ndist(v->elements,_now(v,0),ppt); + long firstentry=0; + + if(!(i&0xff))spinnit("checking... ",v->points-i); + + for(j=0;j<v->entries;j++){ + float thismetric=_Ndist(v->elements,_now(v,j),ppt); + if(thismetric<firstmetric){ + firstmetric=thismetric; + firstentry=j; + } + } + + v->assigned[firstentry]++; + } + + for(j=0;j<v->entries;){ + if(v->assigned[j]==0){ + fprintf(stderr,"found an unused entry! removing...\n"); + v->entries--; + memcpy(_now(v,j),_now(v,v->entries),sizeof(float)*v->elements); + v->assigned[j]=v->assigned[v->elements]; + memcpy(quantlist+j*v->elements,quantlist+v->entries*v->elements, + sizeof(long)*v->elements); + continue; + } + j++; + } + } + + fprintf(stderr,"Building a book with %ld unique entries...\n",v->entries); + + { + long *entryindex=malloc(v->entries*sizeof(long *)); + long *pointindex=malloc(v->points*sizeof(long)); + long *membership=malloc(v->points*sizeof(long)); + long *reventry=malloc(v->entries*sizeof(long)); + long pointssofar=0; + + for(i=0;i<v->entries;i++)entryindex[i]=i; + for(i=0;i<v->points;i++)pointindex[i]=i; + + t->alloc=4096; + t->ptr0=malloc(sizeof(long)*t->alloc); + t->ptr1=malloc(sizeof(long)*t->alloc); + t->p=malloc(sizeof(long)*t->alloc); + t->q=malloc(sizeof(long)*t->alloc); + t->aux=0; + c->dim=v->elements; + c->entries=v->entries; + c->lengthlist=calloc(c->entries,sizeof(long)); + b->valuelist=v->entrylist; /* temporary; replaced later */ + b->dim=c->dim; + b->entries=c->entries; + + for(i=0;i<v->points;i++)membership[i]=-1; + for(i=0;i<v->points;i++){ + float *ppt=_point(v,i); + long firstentry=0; + float firstmetric=_Ndist(v->elements,_now(v,0),ppt); + + if(!(i&0xff))spinnit("assigning... ",v->points-i); + + for(j=1;j<v->entries;j++){ + if(v->assigned[j]!=-1){ + float thismetric=_Ndist(v->elements,_now(v,j),ppt); + if(thismetric<=firstmetric){ + firstmetric=thismetric; + firstentry=j; + } + } + } + + membership[i]=firstentry; + } + + fprintf(stderr,"Leaves added: %d \n", + lp_split(v->pointlist,v->points, + b,entryindex,v->entries, + pointindex,v->points, + membership,reventry, + 0,&pointssofar)); + + free(pointindex); + free(membership); + free(reventry); + + fprintf(stderr,"Paring/rerouting redundant branches... "); + + /* The tree is likely big and redundant. Pare and reroute branches */ + { + int changedflag=1; + + while(changedflag){ + changedflag=0; + + /* span the tree node by node; list unique decision nodes and + short circuit redundant branches */ + + for(i=0;i<t->aux;){ + int k; + + /* check list of unique decisions */ + for(j=0;j<i;j++) + if(_node_eq(t,i,j))break; + + if(j<i){ + /* a redundant entry; find all higher nodes referencing it and + short circuit them to the previously noted unique entry */ + changedflag=1; + for(k=0;k<t->aux;k++){ + if(t->ptr0[k]==-i)t->ptr0[k]=-j; + if(t->ptr1[k]==-i)t->ptr1[k]=-j; + } + + /* Now, we need to fill in the hole from this redundant + entry in the listing. Insert the last entry in the list. + Fix the forward pointers to that last entry */ + t->aux--; + t->ptr0[i]=t->ptr0[t->aux]; + t->ptr1[i]=t->ptr1[t->aux]; + t->p[i]=t->p[t->aux]; + t->q[i]=t->q[t->aux]; + for(k=0;k<t->aux;k++){ + if(t->ptr0[k]==-t->aux)t->ptr0[k]=-i; + if(t->ptr1[k]==-t->aux)t->ptr1[k]=-i; + } + /* hole plugged */ + + }else + i++; + } + + fprintf(stderr,"\rParing/rerouting redundant branches... " + "%ld remaining ",t->aux); + } + fprintf(stderr,"\n"); + } + } + + /* run all training points through the decision tree to get a final + probability count */ + { + long *probability=malloc(c->entries*sizeof(long)); + for(i=0;i<c->entries;i++)probability[i]=1; /* trivial guard */ + b->dim=c->dim; + + /* sigh. A necessary hack */ + for(i=0;i<t->aux;i++)t->p[i]*=c->dim; + for(i=0;i<t->aux;i++)t->q[i]*=c->dim; + + for(i=0;i<v->points;i++){ + /* we use the linear matcher regardless becuase the trainer + doesn't convert log to linear */ + int ret=_best(b,v->pointlist+i*v->elements,1); + probability[ret]++; + if(!(i&0xff))spinnit("counting hits... ",v->points-i); + } + for(i=0;i<t->aux;i++)t->p[i]/=c->dim; + for(i=0;i<t->aux;i++)t->q[i]/=c->dim; + + build_tree_from_lengths(c->entries,probability,c->lengthlist); + + free(probability); + } + + /* Sort the entries by codeword length, short to long (eases + assignment and packing to do it now) */ + { + long *wordlen=c->lengthlist; + long *index=malloc(c->entries*sizeof(long)); + long *revindex=malloc(c->entries*sizeof(long)); + int k; + for(i=0;i<c->entries;i++)index[i]=i; + isortvals=c->lengthlist; + qsort(index,c->entries,sizeof(long),iascsort); + + /* rearrange storage; ptr0/1 first as it needs a reverse index */ + /* n and c stay unchanged */ + for(i=0;i<c->entries;i++)revindex[index[i]]=i; + for(i=0;i<t->aux;i++){ + if(!(i&0x3f))spinnit("sorting... ",t->aux-i); + + if(t->ptr0[i]>=0)t->ptr0[i]=revindex[t->ptr0[i]]; + if(t->ptr1[i]>=0)t->ptr1[i]=revindex[t->ptr1[i]]; + t->p[i]=revindex[t->p[i]]; + t->q[i]=revindex[t->q[i]]; + } + free(revindex); + + /* map lengthlist and vallist with index */ + c->lengthlist=calloc(c->entries,sizeof(long)); + b->valuelist=malloc(sizeof(float)*c->entries*c->dim); + c->quantlist=malloc(sizeof(long)*c->entries*c->dim); + for(i=0;i<c->entries;i++){ + long e=index[i]; + for(k=0;k<c->dim;k++){ + b->valuelist[i*c->dim+k]=v->entrylist[e*c->dim+k]; + c->quantlist[i*c->dim+k]=quantlist[e*c->dim+k]; + } + c->lengthlist[i]=wordlen[e]; + } + + free(wordlen); + } + + fprintf(stderr,"Done. \n\n"); +} + diff --git a/vq/vqsplit.h b/vq/vqsplit.h new file mode 100644 index 00000000..604b9135 --- /dev/null +++ b/vq/vqsplit.h @@ -0,0 +1,38 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * + * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty <monty@xiph.org> and the XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: build a VQ codebook decision tree + last mod: $Id: vqsplit.h,v 1.3.2.1 2000/11/04 06:22:11 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _VQSPL_H_ +#define _VQSPL_H_ + +#include "vorbis/codebook.h" + +extern void vqsp_book(vqgen *v,codebook *b,long *quantlist); +extern int vqenc_entry(codebook *b,float *val); +extern int lp_split(float *pointlist,long totalpoints, + codebook *b, + long *entryindex,long entries, + long *pointindex,long points, + long *membership,long *reventry, + long depth, long *pointsofar); + +#endif + + + + + |