From b1ab109c9a700c85aafde936a4ac9cdcaff045bf Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 12 Oct 2000 03:13:02 +0000 Subject: [PATCH] Merging the postbeta2 branch onto the mainline. Monty svn path=/trunk/vorbis/; revision=729 --- .cvsignore | 13 + COPYING.LIB | 515 -------- Makefile.am | 13 + Makefile.in | 33 - README | 66 +- autogen.sh | 47 + configure | 1829 ++++++++++++++++++----------- configure.guess | 951 --------------- configure.in | 201 ++-- configure.sub | 955 --------------- doc/.cvsignore | 2 + doc/Makefile.am | 10 + examples/.cvsignore | 8 + examples/Makefile.am | 23 + examples/Makefile.in | 87 -- examples/chaining_example.c | 7 +- examples/decoder_example.c | 16 +- examples/encoder_example.c | 18 +- examples/seeking_example.c | 2 +- examples/vorbisfile_example.c | 6 +- include/.cvsignore | 2 + include/Makefile.am | 5 + include/vorbis/.cvsignore | 2 + include/vorbis/Makefile.am | 11 + include/vorbis/backends.h | 18 +- include/vorbis/book/.cvsignore | 2 + include/vorbis/book/Makefile.am | 30 + include/vorbis/book/res0_1024a_128_1.vqh | 2 +- include/vorbis/book/res0_1024a_128_2.vqh | 2 +- include/vorbis/book/res0_1024a_128_3.vqh | 2 +- include/vorbis/book/res0_1024a_128_4.vqh | 2 +- include/vorbis/book/res0_1024a_128_5.vqh | 2 +- include/vorbis/book/res0_1024a_128_6.vqh | 2 +- include/vorbis/book/res0_1024a_128_7.vqh | 2 +- include/vorbis/book/res0_1024a_128_8.vqh | 2 +- include/vorbis/book/res0_1024a_128_9.vqh | 2 +- include/vorbis/book/res0_1024a_160_1.vqh | 2 +- include/vorbis/book/res0_1024a_160_2.vqh | 2 +- include/vorbis/book/res0_1024a_160_3.vqh | 2 +- include/vorbis/book/res0_1024a_160_4.vqh | 2 +- include/vorbis/book/res0_1024a_160_5.vqh | 2 +- include/vorbis/book/res0_1024a_160_6.vqh | 2 +- include/vorbis/book/res0_1024a_160_7.vqh | 2 +- include/vorbis/book/res0_1024a_160_8.vqh | 2 +- include/vorbis/book/res0_1024a_160_9.vqh | 2 +- include/vorbis/book/res0_1024a_192_1.vqh | 2 +- include/vorbis/book/res0_1024a_192_2.vqh | 2 +- include/vorbis/book/res0_1024a_192_3.vqh | 2 +- include/vorbis/book/res0_1024a_192_4.vqh | 2 +- include/vorbis/book/res0_1024a_192_5.vqh | 2 +- include/vorbis/book/res0_1024a_256_1.vqh | 2 +- include/vorbis/book/res0_1024a_256_2.vqh | 2 +- include/vorbis/book/res0_1024a_256_3.vqh | 2 +- include/vorbis/book/res0_1024a_256_4.vqh | 2 +- include/vorbis/book/res0_1024a_256_5.vqh | 2 +- include/vorbis/book/res0_1024a_350_1.vqh | 2 +- include/vorbis/book/res0_1024a_350_2.vqh | 2 +- include/vorbis/book/res0_1024a_350_3.vqh | 2 +- include/vorbis/book/res0_1024a_350_4.vqh | 2 +- include/vorbis/book/res0_1024a_350_5.vqh | 2 +- include/vorbis/book/res0_128a_128_1.vqh | 2 +- include/vorbis/book/res0_128a_128_2.vqh | 2 +- include/vorbis/book/res0_128a_128_3.vqh | 2 +- include/vorbis/book/res0_128a_128_4.vqh | 2 +- include/vorbis/book/res0_128a_128_5.vqh | 2 +- include/vorbis/book/res0_128a_160_1.vqh | 2 +- include/vorbis/book/res0_128a_160_2.vqh | 2 +- include/vorbis/book/res0_128a_160_3.vqh | 2 +- include/vorbis/book/res0_128a_160_4.vqh | 2 +- include/vorbis/book/res0_128a_160_5.vqh | 2 +- include/vorbis/book/res0_128a_192_1.vqh | 2 +- include/vorbis/book/res0_128a_192_2.vqh | 2 +- include/vorbis/book/res0_128a_192_3.vqh | 2 +- include/vorbis/book/res0_128a_192_4.vqh | 2 +- include/vorbis/book/res0_128a_192_5.vqh | 2 +- include/vorbis/book/res0_128a_256_1.vqh | 2 +- include/vorbis/book/res0_128a_256_2.vqh | 2 +- include/vorbis/book/res0_128a_256_3.vqh | 2 +- include/vorbis/book/res0_128a_256_4.vqh | 2 +- include/vorbis/book/res0_128a_256_5.vqh | 2 +- include/vorbis/book/res0_128a_350_1.vqh | 2 +- include/vorbis/book/res0_128a_350_2.vqh | 2 +- include/vorbis/book/res0_128a_350_3.vqh | 2 +- include/vorbis/book/res0_128a_350_4.vqh | 2 +- include/vorbis/book/res0_128a_350_5.vqh | 2 +- include/vorbis/codebook.h | 14 +- include/vorbis/codec.h | 156 +-- include/vorbis/mode_D.h | 2 +- include/vorbis/mode_E.h | 2 +- include/vorbis/os_types.h.in | 57 - include/vorbis/vorbisfile.h | 2 +- install.sh | 0 lib/.cvsignore | 6 + lib/Makefile.am | 24 + lib/Makefile.in | 469 ++++++-- lib/analysis.c | 30 +- lib/bitwise.c | 410 ------- lib/bitwise.h | 39 - lib/block.c | 89 +- lib/bookinternal.h | 14 +- lib/codebook.c | 189 ++- lib/envelope.c | 60 +- lib/envelope.h | 8 +- lib/floor0.c | 158 +-- lib/iir.c | 42 +- lib/iir.h | 18 +- lib/info.c | 166 +-- lib/lookup.c | 92 ++ include/vorbis/internal.h => lib/lookup.h | 35 +- lib/lookup_data.h | 190 +++ lib/lookups.pl | 143 +++ lib/lpc.c | 37 +- lib/lpc.h | 11 +- lib/lsp.c | 305 ++++- lib/lsp.h | 11 +- lib/mapping0.c | 78 +- lib/masking.h | 76 +- lib/mdct.c | 98 +- lib/mdct.h | 8 +- lib/misc.h | 4 +- lib/os.h | 9 +- lib/psy.c | 284 ++--- lib/psy.h | 20 +- lib/psytune.c | 67 +- lib/res0.c | 99 +- lib/scales.h | 5 +- lib/sharedbook.c | 97 +- lib/sharedbook.h | 14 +- lib/smallft.c | 80 +- lib/smallft.h | 8 +- lib/spectrum.h | 32 - lib/synthesis.c | 20 +- lib/time0.c | 23 +- lib/tone.c | 32 + lib/vorbisfile.c | 77 +- lib/window.c | 10 +- lib/window.h | 4 +- vorbis.spec => libvorbis.spec | 0 vq/bookutil.c | 20 +- vq/bookutil.h | 8 +- vq/build.c | 6 +- vq/cascade.c | 14 +- vq/genericdata.c | 12 +- vq/huffbuild.c | 2 +- vq/latticebuild.c | 10 +- vq/latticehint.c | 50 +- vq/latticepare.c | 68 +- vq/latticetune.c | 6 +- vq/lspdata.c | 46 +- vq/metrics.c | 74 +- vq/residuedata.c | 44 +- vq/residuesplit.c | 24 +- vq/run.c | 12 +- vq/train.c | 12 +- vq/vqext.h | 8 +- vq/vqgen.c | 128 +- vq/vqgen.h | 32 +- vq/vqsplit.c | 60 +- vq/vqsplit.h | 6 +- 159 files changed, 4014 insertions(+), 5540 deletions(-) create mode 100644 .cvsignore delete mode 100644 COPYING.LIB create mode 100644 Makefile.am delete mode 100644 Makefile.in create mode 100755 autogen.sh delete mode 100755 configure.guess delete mode 100755 configure.sub create mode 100644 examples/.cvsignore create mode 100644 examples/Makefile.am delete mode 100644 examples/Makefile.in create mode 100644 include/.cvsignore create mode 100644 include/Makefile.am create mode 100644 include/vorbis/.cvsignore create mode 100644 include/vorbis/Makefile.am create mode 100644 include/vorbis/book/.cvsignore create mode 100644 include/vorbis/book/Makefile.am delete mode 100644 include/vorbis/os_types.h.in delete mode 100644 install.sh create mode 100644 lib/.cvsignore create mode 100644 lib/Makefile.am delete mode 100644 lib/bitwise.c delete mode 100644 lib/bitwise.h create mode 100644 lib/lookup.c rename include/vorbis/internal.h => lib/lookup.h (65%) create mode 100644 lib/lookup_data.h create mode 100755 lib/lookups.pl delete mode 100644 lib/spectrum.h create mode 100644 lib/tone.c rename vorbis.spec => libvorbis.spec (100%) diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..9a6264c --- /dev/null +++ b/.cvsignore @@ -0,0 +1,13 @@ +aclocal.m4 +config.h.in +Makefile.in +Makefile +config.status +libtool +config.cache +config.log +configure +*.gz +.libs +.deps +*.ogg diff --git a/COPYING.LIB b/COPYING.LIB deleted file mode 100644 index c4792dd..0000000 --- a/COPYING.LIB +++ /dev/null @@ -1,515 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. -^L - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. -^L - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. -^L - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. -^L - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. -^L - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. -^L - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. -^L - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS -^L - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper -mail. - -You should also get your employer (if you work as a programmer) or -your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James -Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e0eca51 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,13 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign dist-zip + +SUBDIRS = lib include doc examples + +EXTRA_DIST = README COPYING todo.txt libvorbis.spec + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 36ef9bb..0000000 --- a/Makefile.in +++ /dev/null @@ -1,33 +0,0 @@ -# vorbis makefile configured for use with gcc on any platform - -# $Id: Makefile.in,v 1.11 2000/08/24 01:10:02 kcarnold Exp $ - -############################################################################### -# # -# To build a production vorbis (preferrably using gmake), just type 'make'. # -# To build with debugging or profiling information, use 'make debug' or # -# 'make profile' respectively. 'make clean' is a good idea between builds # -# with different target names, or before a final build. # -# # -############################################################################### - - -# DO NOT EDIT BELOW! ########################################################## -# (unless, of course, you know what you are doing :) ########################## - -@SET_MAKE@ - -SUBDIRS = lib examples # vorbis-tools cmdline xmms vq huff kmpg - -# configure changes items in these, so get distclean to remove them. -DCLEAN_DIRS = vorbis-tools cmdline xmms vq huff kmpg - -all debug profile selftest target clean: - echo $(MAKECMDGOALS) - @for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $(MFLAGS) $(MAKECMDGOALS)) || exit 1; done - -rm -f *~ - -distclean: - @for dir in $(SUBDIRS) $(DCLEAN_DIRS); do (cd $$dir && $(MAKE) $(MFLAGS) $(MAKECMDGOALS)) || exit 1; done - -rm -f Makefile config.* - diff --git a/README b/README index 4f593e1..3e2b2d3 100644 --- a/README +++ b/README @@ -2,8 +2,8 @@ * * * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * -* THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * -* PLEASE READ THESE TERMS DISTRIBUTING. * +* THE GNU LESSER/LIBRARY PUBLIC LICENSE 2, WHICH IS INCLUDED WITH * +* THIS SOURCE. PLEASE READ THESE TERMS DISTRIBUTING. * * * * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * * by Monty and The XIPHOPHORUS Company * @@ -11,9 +11,24 @@ * * ******************************************************************** +NEW AND IMPORTANT: + +If you're used to the source distribution from the first two beta +relaeases, things are now rearranged a bit. Specifically, the +'vorbis' CVS module contains only the libvorbis and libvorbisfile +libraries. Because Ogg bitstreams are to be used by other Ogg codecs, +Ogg framing and streaming functionality is now in libogg (the 'ogg' +CVS module). Vorbis utilities are in 'vorbis-tools' and various +player plugins are in 'vorbis-plugins'. For now, you'll need to check +out these other modules seperately. + +Secondly, the Ogg/Vorbis build systems now use automake. Instead of +'./configure;make', the proper build sequence (in each module) is +'./autogen.sh;make'. + WHAT'S HERE: -This source distribution includes libvorbis, a full-featured example +This source distribution includes libvorbis and an example encoder/player to demonstrate use of libvorbis and documentation on the Ogg Vorbis audio coding format. @@ -23,11 +38,20 @@ Directory: the public domain OggSquish Vorbis audio encoding format. -./cmdline A full-featured command line encoder/decoder/player - utility ('vorbis') that demonstrates programmatic use - of libvorbis. +./include Library API headers and codebooks + +./debian Rules/spec files for building Debian .deb packages + +./doc Vorbis specification documents + +./examples Example code illustrating programmatic use of libogg, + libvorbis, libvorbisfile and libvorbisenc -./docs Vorbis specification documents +./mac Codewarrior project files and build tweaks for MacOS. + + +./vq Internal utilities for training/building new LSP/residue + and auxiliary codebooks. WHAT IS VORBIS: @@ -40,11 +64,21 @@ All the technical details are published and documented, and any software entity may make full use of the format without royalty or patent concerns. -This package contains libvorbis, an LGPLed software implementation of +This package contains: + +.) libvorbis, an LGPLed software implementation of the Vorbis specification by the Xiphophorus company -(http://www.xiph.org/), vorbisfile, an LGPLed convenience library +(http://www.xiph.org/) + +.) libvorbisfile, an LGPLed convenience library built on Vorbis designed to simplify common uses and a number of GPL -example programs, utilities and player plugins. +example programs + +.) libvorbisenc, an LGPL library that provides a simple, programmatic +encoding setup interface + +.) example code making use of libogg, libvorbis, libvorbisfile and +libvorbisenc CONTACT: @@ -57,17 +91,17 @@ BUILD: A standard build should consist of nothing more than: -./configure +./autogen.sh make and as root if desired : make install -This will install the ogg vorbis commandline encoder/player ('ogg') -into /usr/local/bin, the ogg player and libvorbis manpages into -/usr/local/man/ and libvorbis.a into /usr/local/lib. +This will install the vorbis libraries (static and shared) into +/usr/local/lib, includes into /usr/local/include and API manpages +(once we write some) into /usr/local/man. -Monty , +Monty -$Id: README,v 1.4 2000/05/12 21:42:04 xiphmont Exp $ +$Id: README,v 1.5 2000/10/12 03:12:36 xiphmont Exp $ diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..1e6fa11 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. +# (basically ripped directly from enlightenment's autogen.sh) + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +cd "$srcdir" +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile libvorbis." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to compile libvorbis." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." +fi + +echo "Generating configuration files for libvorbis, please wait...." + +echo " aclocal $ACLOCAL_FLAGS" +aclocal $ACLOCAL_FLAGS +echo " autoheader" +autoheader +echo " automake --add-missing" +automake --add-missing +echo " autoconf" +autoconf + +$srcdir/configure "$@" && echo diff --git a/configure b/configure index d6aedd3..dcfff27 100755 --- a/configure +++ b/configure @@ -11,6 +11,18 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-ogg=DIR Set where the Ogg library is located" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -521,11 +533,6 @@ else fi -#AC_CONFIG_HEADER(config.h) - -cp configure.guess config.guess -cp configure.sub config.sub - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -545,100 +552,260 @@ ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:568: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:621: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:556: checking host system type" >&5 +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:678: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 +PACKAGE=libvorbis +VERSION=1.0.0 -case $host in - *-*-irix*) - if test -z "$CC"; then - CC=cc - fi - echo $ac_n "checking for ALwritesamps in -laudio""... $ac_c" 1>&6 -echo "configure:583: checking for ALwritesamps in -laudio" >&5 -ac_lib_var=`echo audio'_'ALwritesamps | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-laudio $LIBS" -cat > conftest.$ac_ext <&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:724: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 fi -rm -f conftest* -LIBS="$ac_save_LIBS" +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:737: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo audio | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <&6 +echo "configure:750: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:763: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 else - echo "$ac_t""no" 1>&6 + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 fi - ;; -# BeOS does not use -lm -# *-*-beos) -# LIBS="" -# ;; -# added better check below +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:776: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + + +V_LIB_CURRENT=0 +V_LIB_REVISION=0 +V_LIB_AGE=0 +VF_LIB_CURRENT=0 +VF_LIB_REVISION=0 +VF_LIB_AGE=0 + + + + + + -esac cflags_save="$CFLAGS" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:642: checking for $ac_word" >&5 +echo "configure:809: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -668,7 +835,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:672: checking for $ac_word" >&5 +echo "configure:839: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -719,7 +886,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:723: checking for $ac_word" >&5 +echo "configure:890: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -751,7 +918,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:755: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -762,12 +929,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 766 "configure" +#line 933 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -793,12 +960,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:964: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:802: checking whether we are using GNU C" >&5 +echo "configure:969: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -807,7 +974,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -826,7 +993,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:830: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:997: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -836,32 +1003,555 @@ if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then else ac_cv_prog_cc_g=no fi -rm -f conftest* +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +CFLAGS="$cflags_save" + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=yes +fi + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes +fi + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_fast_install=yes +fi + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:1106: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:1127: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1147: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1186: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1210: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1213: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$ac_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1248: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 + + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1264: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi +fi + +NM="$ac_cv_path_NM" +echo "$ac_t""$NM" 1>&6 + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1300: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : +fi + +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 1349 "configure"' > conftest.$ac_ext + if { (eval echo configure:1350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:1371: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f conftest* +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + + +esac + + +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } + +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log + + + +# Check whether --with-ogg or --without-ogg was given. +if test "${with_ogg+set}" = set; then + withval="$with_ogg" + : +fi + + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:1501: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +if test -z "$GCC"; then + case $host in + *-*-irix*) + if test -z "$CC"; then + CC=cc + fi + DEBUG="-g -signed" + CFLAGS="-O2 -w -signed" + PROFILE="-p -g3 -O2 -signed" ;; + sparc-sun-solaris*) + DEBUG="-v -g" + CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" + PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; + *) + DEBUG="-g" + CFLAGS="-O" + PROFILE="-g -p" ;; + esac else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -# because AC_PROG_CC likes to set -g -CFLAGS="$cflags_save" + case $host in + *86-*-linux*) + DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char" +# PROFILE="-Wall -W -pg -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static" + PROFILE="-Wall -W -pg -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static" + + # glibc < 2.1.3 has a serious FP bug in the math inline header + # that will cripple Vorbis. Look to see if the magic FP stack + # clobber is missing in the mathinline header, thus indicating + # the buggy version -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:865: checking how to run the C preprocessor" >&5 + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1555: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -876,13 +1566,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -893,13 +1583,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -910,13 +1600,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -940,170 +1630,8 @@ else fi echo "$ac_t""$CPP" 1>&6 -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:947: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:977: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="ar" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AR="$ac_cv_prog_AR" -if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Extract the first word of "install", so it can be a program name with args. -set dummy install; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1006: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_INSTALL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$INSTALL"; then - ac_cv_prog_INSTALL="$INSTALL" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_INSTALL="install" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -INSTALL="$ac_cv_prog_INSTALL" -if test -n "$INSTALL"; then - echo "$ac_t""$INSTALL" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -#not everyone uses libm (eg, BeOS) -#AC_CHECK_LIB(m, cos, LIBS="-lm"; AC_DEFINE(HAVE_LIBM), LIBS="") -# We no longer use config.h -echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6 -echo "configure:1037: checking for cos in -lm" >&5 -ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LIBS="-lm" -else - echo "$ac_t""no" 1>&6 -LIBS="" -fi - - -if test -z "$GCC"; then - case $host in - *-*-irix*) - DEBUG="-g -signed" - OPT="-O2 -w -signed" - PROFILE="-p -g3 -O2 -signed" ;; - sparc-sun-solaris*) - DEBUG="-v -g" - OPT="-xO4 -fast -w -fsimple -native -xcg92" - PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; - *) - DEBUG="-g" - OPT="-O" - PROFILE="-g -p" ;; - esac -else - - case $host in - *86-*-linux*) - DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char" - PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char" - - # glibc < 2.1.3 has a serious FP bug in the math inline header - # that will cripple Vorbis. Look to see if the magic FP stack - # clobber is missing in the mathinline header, thus indicating - # the buggy version - - cat > conftest.$ac_ext < conftest.$ac_ext <&2 echo "configure: warning: " 1>&2 - OPT=${OPT}" -D__NO_MATH_INLINES" + CFLAGS=${OPT}" -D__NO_MATH_INLINES" PROFILE=${PROFILE}" -D__NO_MATH_INLINES" fi;; *-*-linux*) DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char" + CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char" PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";; sparc-sun-*) DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8" - OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8" + CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8" PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;; *) DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; esac fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1183: checking for ANSI C header files" >&5 +echo "configure:1711: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1192,7 +1720,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1209,7 +1737,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1227,7 +1755,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1248,7 +1776,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1259,7 +1787,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1288,7 +1816,7 @@ fi # pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :) # We no longer use config.h echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1292: checking for pthread_create in -lpthread" >&5 +echo "configure:1820: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1296,7 +1824,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1376,7 +1904,7 @@ dummy="__noconf" # behind the times on type madness echo $ac_n "checking for int16_t""... $ac_c" 1>&6 -echo "configure:1380: checking for int16_t" >&5 +echo "configure:1908: checking for int16_t" >&5 if eval "test \"`echo '$''{'has_int16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1385,7 +1913,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then has_int16_t=yes else @@ -1413,7 +1941,7 @@ fi echo "$ac_t""$has_int16_t" 1>&6 echo $ac_n "checking for int32_t""... $ac_c" 1>&6 -echo "configure:1417: checking for int32_t" >&5 +echo "configure:1945: checking for int32_t" >&5 if eval "test \"`echo '$''{'has_int32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1422,7 +1950,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then has_int32_t=yes else @@ -1450,7 +1978,7 @@ fi echo "$ac_t""$has_int32_t" 1>&6 echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 -echo "configure:1454: checking for uint32_t" >&5 +echo "configure:1982: checking for uint32_t" >&5 if eval "test \"`echo '$''{'has_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1459,7 +1987,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then has_uint32_t=yes else @@ -1487,7 +2015,7 @@ fi echo "$ac_t""$has_uint32_t" 1>&6 echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 -echo "configure:1491: checking for u_int32_t" >&5 +echo "configure:2019: checking for u_int32_t" >&5 if eval "test \"`echo '$''{'has_u_int32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1496,7 +2024,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then has_u_int32_t=yes else @@ -1524,7 +2052,7 @@ fi echo "$ac_t""$has_u_int32_t" 1>&6 echo $ac_n "checking for int64_t""... $ac_c" 1>&6 -echo "configure:1528: checking for int64_t" >&5 +echo "configure:2056: checking for int64_t" >&5 if eval "test \"`echo '$''{'has_int64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1533,7 +2061,7 @@ else else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then has_int64_t=yes else @@ -1561,7 +2089,7 @@ fi echo "$ac_t""$has_int64_t" 1>&6 echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1565: checking size of short" >&5 +echo "configure:2093: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1569,7 +2097,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1580,7 +2108,7 @@ main() exit(0); } EOF -if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1600,7 +2128,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1604: checking size of int" >&5 +echo "configure:2132: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1608,7 +2136,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1619,7 +2147,7 @@ main() exit(0); } EOF -if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1639,7 +2167,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1643: checking size of long" >&5 +echo "configure:2171: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1647,7 +2175,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1658,7 +2186,7 @@ main() exit(0); } EOF -if { (eval echo configure:1662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1678,7 +2206,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1682: checking size of long long" >&5 +echo "configure:2210: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1686,7 +2214,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1697,7 +2225,7 @@ main() exit(0); } EOF -if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -1727,383 +2255,311 @@ else esac fi -if test x$has_int32_t = "xyes" ; then - SIZE32="int32_t" -else - case 4 in - $ac_cv_sizeof_short) SIZE32="short";; - $ac_cv_sizeof_int) SIZE32="int";; - $ac_cv_sizeof_long) SIZE32="long";; - esac -fi -if test x$has_uint32_t = "xyes" ; then - USIZE32="uint32_t" +ac_safe=`echo "memory.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for memory.h""... $ac_c" 1>&6 +echo "configure:2262: checking for memory.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - if test x$has_u_int32_t = "xyes" ; then - USIZE32="u_int32_t" - else - case 4 in - $ac_cv_sizeof_short) USIZE32="unsigned short";; - $ac_cv_sizeof_int) USIZE32="unsigned int";; - $ac_cv_sizeof_long) USIZE32="unsigned long";; - esac - fi -fi - -if test x$has_int64_t = "xyes" ; then - SIZE64="int64_t" + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" else -case 8 in - $ac_cv_sizeof_int) SIZE64="int";; - $ac_cv_sizeof_long) SIZE64="long";; - $ac_cv_sizeof_long_long) SIZE64="long long";; -esac -fi - -if test -z "$SIZE16"; then - { echo "configure: error: No 16 bit type found on this platform!" 1>&2; exit 1; } -fi -if test -z "$SIZE32"; then - { echo "configure: error: No 32 bit type found on this platform!" 1>&2; exit 1; } + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi -if test -z "$USIZE32"; then - { echo "configure: error: No unsigned 32 bit type found on this platform!" 1>&2; exit 1; } +rm -f conftest* fi -if test -z "$SIZE64"; then - echo "configure: warning: No 64 bit type found on this platform!" 1>&2 +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + CFLAGS="$CFLAGS -DUSE_MEMORY_H" +else + echo "$ac_t""no" 1>&6 +: fi - -#AC_CHECK_HEADER(alloca.h,AC_DEFINE(USE_ALLOCA_H),:) -#AC_CHECK_HEADER(memory.h,AC_DEFINE(USE_MEMORY_H),:) -# We no longer use config.h -ac_safe=`echo "alloca.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for alloca.h""... $ac_c" 1>&6 -echo "configure:1783: checking for alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + + + + + +echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6 +echo "configure:2299: checking for cos in -lm" >&5 +ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cos(); + +int main() { +cos() +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then +if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - CFLAGS="$CFLAGS -DUSE_ALLOCA_H" + LIBS="-lm" else echo "$ac_t""no" 1>&6 -: +LIBS="" fi -ac_safe=`echo "memory.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for memory.h""... $ac_c" 1>&6 -echo "configure:1817: checking for memory.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:2340: checking for pthread_create in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create(); + +int main() { +pthread_create() +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then +if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" + eval "ac_cv_lib_$ac_lib_var=yes" else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - CFLAGS="$CFLAGS -DUSE_MEMORY_H" + pthread_lib="-lpthread" else echo "$ac_t""no" 1>&6 : fi -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1851: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then +if test -n $with_ogg; then + CFLAGS="$CFLAGS -I$with_ogg/include -L$with_ogg/lib" +fi +echo $ac_n "checking for oggpack_read in -logg""... $ac_c" 1>&6 +echo "configure:2385: checking for oggpack_read in -logg" >&5 +ac_lib_var=`echo ogg'_'oggpack_read | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - +oggpack_read() ; return 0; } EOF -if { (eval echo configure:1905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - ac_cv_c_const=yes + eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_c_const=no + eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -logg" +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: You must have libogg to compile vorbis!!!" 1>&2; exit 1; } fi -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF -fi -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1926: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:2430: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -#include -#include +#include int main() { -struct tm *tp; +void *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - ac_cv_header_time=yes + ac_cv_header_alloca_h=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_time=no + ac_cv_header_alloca_h=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 +#define HAVE_ALLOCA_H 1 EOF fi -echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1961: checking whether struct tm is in sys/time.h or time.h" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:2463: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -#include + +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + int main() { -struct tm *tp; tp->tm_sec; +char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - ac_cv_struct_tm=time.h + ac_cv_func_alloca_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_struct_tm=sys/time.h + ac_cv_func_alloca_works=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_struct_tm" 1>&6 -if test $ac_cv_struct_tm = sys/time.h; then +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then cat >> confdefs.h <<\EOF -#define TM_IN_SYS_TIME 1 +#define HAVE_ALLOCA 1 EOF fi - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1996: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2023: checking for 8-bit clean memcmp" >&5 -if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_memcmp_clean=no -else - cat > conftest.$ac_ext <> confdefs.h <<\EOF +#define C_ALLOCA 1 EOF -if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_memcmp_clean=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_memcmp_clean=no -fi -rm -fr conftest* -fi - -fi -echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 -test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2059: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:2528: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -#include -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); +#if defined(CRAY) && ! defined(CRAY2) +webecray #else -void (*signal ()) (); +wenotbecray #endif -int main() { -int i; -; return 0; } EOF -if { (eval echo configure:2081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then rm -rf conftest* - ac_cv_type_signal=void + ac_cv_os_cray=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_type_signal=int + ac_cv_os_cray=no fi rm -f conftest* -fi - -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <&6 -echo "configure:2102: checking for $ac_func" >&5 +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2558: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2140,32 +2596,109 @@ fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi + done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:2613: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2662: checking for 8-bit clean memcmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_clean=no +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_memcmp_clean=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_memcmp_clean=no +fi +rm -fr conftest* +fi +fi +echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" -#AC_SUBST(XOGG) -#AC_SUBST(LIBGTKDIR) -subdirs="vorbis-tools/libao" trap '' 1 2 15 @@ -2279,10 +2812,9 @@ do done ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\ - vorbis-tools/Makefile\ - vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile lib/Makefile doc/Makefile include/Makefile include/vorbis/Makefile include/vorbis/book/Makefile examples/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -2413,6 +2959,10 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac echo creating "$ac_file" rm -f "$ac_file" @@ -2428,6 +2978,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* @@ -2444,97 +2995,3 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 -if test "$no_recursion" != yes; then - - # Remove --cache-file and --srcdir arguments so they do not pile up. - ac_sub_configure_args= - ac_prev= - for ac_arg in $ac_configure_args; do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case "$ac_arg" in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; - esac - done - - for ac_config_dir in vorbis-tools/libao; do - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - if test ! -d $srcdir/$ac_config_dir; then - continue - fi - - echo configuring in $ac_config_dir - - case "$srcdir" in - .) ;; - *) - if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; - else - { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } - fi - ;; - esac - - ac_popdir=`pwd` - cd $ac_config_dir - - # A "../" for each directory in /$ac_config_dir. - ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` - - case "$srcdir" in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - /*) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_config_dir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure; then - ac_sub_configure=$ac_sub_srcdir/configure - elif test -f $ac_sub_srcdir/configure.in; then - ac_sub_configure=$ac_configure - else - echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - - # Make the cache file name correct relative to the subdirectory. - case "$cache_file" in - /*) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file="$ac_dots$cache_file" ;; - esac - - echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" - # The eval makes quoting arguments work. - if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir - then : - else - { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } - fi - fi - - cd $ac_popdir - done -fi - - diff --git a/configure.guess b/configure.guess deleted file mode 100755 index 2960d6e..0000000 --- a/configure.guess +++ /dev/null @@ -1,951 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Written by Per Bothner . -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=4.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) - sed 's/^ //' << EOF >dummy.c - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` - rm -f dummy.c dummy - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i?86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >dummy.c < -main(argc, argv) - int argc; - char *argv[]; -{ -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} - exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i?86:LynxOS:2.*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/configure.in b/configure.in index a6438f7..e8c0ed3 100644 --- a/configure.in +++ b/configure.in @@ -1,59 +1,70 @@ -# $Id: configure.in,v 1.23 2000/08/31 03:28:43 xiphmont Exp $ +dnl Process this file with autoconf to produce a configure script -AC_INIT(lib/mdct.c) -#AC_CONFIG_HEADER(config.h) - -cp configure.guess config.guess -cp configure.sub config.sub - -AC_CANONICAL_HOST - -dnl If we're on IRIX, we wanna use cc even if gcc is there (unless the user -dnl has overriden us)... -case $host in - *-*-irix*) - if test -z "$CC"; then - CC=cc - fi - AC_CHECK_LIB(audio, ALwritesamps) - ;; -# BeOS does not use -lm -# *-*-beos) -# LIBS="" -# ;; -# added better check below - -esac +dnl ------------------------------------------------ +dnl Initialization and Versioning +dnl ------------------------------------------------ +AC_INIT(lib/mdct.c) +AM_INIT_AUTOMAKE(libvorbis,1.0.0) + +dnl Library versioning + +V_LIB_CURRENT=0 +V_LIB_REVISION=0 +V_LIB_AGE=0 +VF_LIB_CURRENT=0 +VF_LIB_REVISION=0 +VF_LIB_AGE=0 +AC_SUBST(V_LIB_CURRENT) +AC_SUBST(V_LIB_REVISION) +AC_SUBST(V_LIB_AGE) +AC_SUBST(VF_LIB_CURRENT) +AC_SUBST(VF_LIB_REVISION) +AC_SUBST(VF_LIB_AGE) + +dnl -------------------------------------------------- +dnl Check for programs +dnl -------------------------------------------------- + +dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" +dnl if $CFLAGS is blank cflags_save="$CFLAGS" AC_PROG_CC -# because AC_PROG_CC likes to set -g CFLAGS="$cflags_save" -AC_PROG_CPP -AC_PROG_RANLIB -AC_CHECK_PROG(AR,ar,ar) -AC_CHECK_PROG(INSTALL,install,install) +AM_PROG_LIBTOOL -#not everyone uses libm (eg, BeOS) -#AC_CHECK_LIB(m, cos, LIBS="-lm"; AC_DEFINE(HAVE_LIBM), LIBS="") -# We no longer use config.h -AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="") +dnl -------------------------------------------------- +dnl Additional arguments +dnl -------------------------------------------------- + +AC_ARG_WITH(ogg, [ --with-ogg=DIR Set where the Ogg library is located]) + +dnl -------------------------------------------------- +dnl Set build flags based on environment +dnl -------------------------------------------------- + +AC_CANONICAL_HOST dnl Set some target options if test -z "$GCC"; then case $host in *-*-irix*) + dnl If we're on IRIX, we wanna use cc even if gcc + dnl is there (unless the user has overriden us)... + if test -z "$CC"; then + CC=cc + fi DEBUG="-g -signed" - OPT="-O2 -w -signed" + CFLAGS="-O2 -w -signed" PROFILE="-p -g3 -O2 -signed" ;; sparc-sun-solaris*) DEBUG="-v -g" - OPT="-xO4 -fast -w -fsimple -native -xcg92" + CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; *) DEBUG="-g" - OPT="-O" + CFLAGS="-O" PROFILE="-g -p" ;; esac else @@ -61,9 +72,10 @@ else case $host in *86-*-linux*) DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char" - PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char" - + CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char" +# PROFILE="-Wall -W -pg -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static" + PROFILE="-Wall -W -pg -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static" + # glibc < 2.1.3 has a serious FP bug in the math inline header # that will cripple Vorbis. Look to see if the magic FP stack # clobber is missing in the mathinline header, thus indicating @@ -100,20 +112,20 @@ else AC_MSG_WARN([********************************************************]) AC_MSG_WARN([ ]) - OPT=${OPT}" -D__NO_MATH_INLINES" + CFLAGS=${OPT}" -D__NO_MATH_INLINES" PROFILE=${PROFILE}" -D__NO_MATH_INLINES" fi;; *-*-linux*) DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char" + CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char" PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";; sparc-sun-*) DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8" - OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8" + CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8" PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;; *) DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" - OPT="-O20 -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; esac fi @@ -274,85 +286,46 @@ else esac fi -if test x$has_int32_t = "xyes" ; then - SIZE32="int32_t" -else - case 4 in - $ac_cv_sizeof_short) SIZE32="short";; - $ac_cv_sizeof_int) SIZE32="int";; - $ac_cv_sizeof_long) SIZE32="long";; - esac -fi +dnl -------------------------------------------------- +dnl Check for headers +dnl -------------------------------------------------- -if test x$has_uint32_t = "xyes" ; then - USIZE32="uint32_t" -else - if test x$has_u_int32_t = "xyes" ; then - USIZE32="u_int32_t" - else - case 4 in - $ac_cv_sizeof_short) USIZE32="unsigned short";; - $ac_cv_sizeof_int) USIZE32="unsigned int";; - $ac_cv_sizeof_long) USIZE32="unsigned long";; - esac - fi -fi +AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:) -if test x$has_int64_t = "xyes" ; then - SIZE64="int64_t" -else -case 8 in - $ac_cv_sizeof_int) SIZE64="int";; - $ac_cv_sizeof_long) SIZE64="long";; - $ac_cv_sizeof_long_long) SIZE64="long long";; -esac -fi +dnl -------------------------------------------------- +dnl Check for typedefs, structures, etc +dnl -------------------------------------------------- -if test -z "$SIZE16"; then - AC_MSG_ERROR(No 16 bit type found on this platform!) -fi -if test -z "$SIZE32"; then - AC_MSG_ERROR(No 32 bit type found on this platform!) -fi -if test -z "$USIZE32"; then - AC_MSG_ERROR(No unsigned 32 bit type found on this platform!) -fi -if test -z "$SIZE64"; then - AC_MSG_WARN(No 64 bit type found on this platform!) -fi - -#AC_CHECK_HEADER(alloca.h,AC_DEFINE(USE_ALLOCA_H),:) -#AC_CHECK_HEADER(memory.h,AC_DEFINE(USE_MEMORY_H),:) -# We no longer use config.h -AC_CHECK_HEADER(alloca.h,CFLAGS="$CFLAGS -DUSE_ALLOCA_H",:) -AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:) +dnl none + +dnl -------------------------------------------------- +dnl Check for libraries +dnl -------------------------------------------------- + +AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="") +AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :) -AC_C_CONST -AC_HEADER_TIME -AC_STRUCT_TM +dnl Check for libogg +if test -n $with_ogg; then + CFLAGS="$CFLAGS -I$with_ogg/include -L$with_ogg/lib" +fi +AC_CHECK_LIB(ogg, oggpack_read, LIBS="$LIBS -logg", AC_MSG_ERROR([You must have libogg to compile vorbis!!!])) -AC_PROG_MAKE_SET +dnl -------------------------------------------------- +dnl Check for library functions +dnl -------------------------------------------------- + +AC_FUNC_ALLOCA AC_FUNC_MEMCMP -AC_TYPE_SIGNAL -AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction) - -AC_SUBST(SIZE16) -AC_SUBST(SIZE32) -AC_SUBST(USIZE32) -AC_SUBST(SIZE64) -AC_SUBST(OPT) + +dnl -------------------------------------------------- +dnl Do substitutions +dnl -------------------------------------------------- + AC_SUBST(LIBS) AC_SUBST(DEBUG) AC_SUBST(PROFILE) AC_SUBST(CC) -AC_SUBST(RANLIB) -#AC_SUBST(XOGG) -#AC_SUBST(LIBGTKDIR) AC_SUBST(pthread_lib) -AC_CONFIG_SUBDIRS(vorbis-tools/libao) - -AC_OUTPUT(Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\ - vorbis-tools/Makefile\ - vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile) - +AC_OUTPUT(Makefile lib/Makefile doc/Makefile include/Makefile include/vorbis/Makefile include/vorbis/book/Makefile examples/Makefile) diff --git a/configure.sub b/configure.sub deleted file mode 100755 index 00bea6e..0000000 --- a/configure.sub +++ /dev/null @@ -1,955 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - linux-gnu*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) - os= - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) - basic_machine=$basic_machine-unknown - ;; - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - os=-mvs - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[34567]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[34567]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[34567]86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - miniframe) - basic_machine=m68000-convergent - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - np1) - basic_machine=np1-gould - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | nexen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | k6 | 6x86) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | nexen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -xenix) - os=-xenix - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-semi) - os=-aout - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f301-fujitsu) - os=-uxpv - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -hpux*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/doc/.cvsignore b/doc/.cvsignore index e69de29..282522d 100644 --- a/doc/.cvsignore +++ b/doc/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/doc/Makefile.am b/doc/Makefile.am index e69de29..4d0108d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -0,0 +1,10 @@ +## Process this with automake to create Makefile.in + +AUTOMAKE_OPTIONS = foreign + +docdir = $(prefix)/doc/$(PACKAGE)-$(VERSION) + +doc_DATA = v-comment.html vorbisword2.png white-ogg.png programming.html\ + vorbis.html wait.png white-xifish.png + +EXTRA_DIST = $(doc_DATA) diff --git a/examples/.cvsignore b/examples/.cvsignore new file mode 100644 index 0000000..f775f1d --- /dev/null +++ b/examples/.cvsignore @@ -0,0 +1,8 @@ +Makefile +Makefile.in +.libs +.deps +encoder_example +decoder_example +chaining_example +vorbisfile_example diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..ee645eb --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,23 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include + +noinst_PROGRAMS = decoder_example encoder_example chaining_example\ + vorbisfile_example + +LDADD = $(top_srcdir)/lib/.libs/libvorbis.a + +decoder_example_SOURCES = decoder_example.c +encoder_example_SOURCES = encoder_example.c +chaining_example_SOURCES = chaining_example.c +chaining_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a +vorbisfile_example_SOURCES = vorbisfile_example.c +vorbisfile_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/examples/Makefile.in b/examples/Makefile.in deleted file mode 100644 index 8683e27..0000000 --- a/examples/Makefile.in +++ /dev/null @@ -1,87 +0,0 @@ -# vorbis makefile configured for use with gcc on any platform - -# $Id: Makefile.in,v 1.13 2000/08/15 11:53:18 xiphmont Exp $ - -############################################################################### -# # -# To build a production vorbis (preferrably using gmake), just type 'make'. # -# To build with debugging or profiling information, use 'make debug' or # -# 'make profile' respectively. 'make clean' is a good idea between builds # -# with different target names, or before a final build. # -# # -############################################################################### - - -# DO NOT EDIT BELOW! ########################################################## -# (unless, of course, you know what you are doing :) ########################## - -@SET_MAKE@ -FLAGS=-I. -I../include @CFLAGS@ -OPT=@OPT@ $(FLAGS) -DEBUG=@DEBUG@ $(FLAGS) -PROFILE=@PROFILE@ $(FLAGS) -CC=@CC@ -LD=@CC@ -LDFLAGS=@LDFLAGS@ $(FLAGS) -AR=@AR@ -RANLIB=@RANLIB@ -LIBS=@LIBS@ - -HFILES = ../include/vorbis/codec.h ../include/vorbis/vorbisfile.h \ - ../include/vorbis/internal.h ../include/vorbis/backends.h \ - ../include/vorbis/codebook.h -OFILES = encoder_example.o decoder_example.o chaining_example.o \ - vorbisfile_example.o seeking_test.o -BINFILES = encoder_example decoder_example chaining_example \ - vorbisfile_example seeking_test - -all: - $(MAKE) target CFLAGS="$(OPT)" - -debug: - $(MAKE) target CFLAGS="$(DEBUG)" - -profile: - $(MAKE) target CFLAGS="$(PROFILE)" - -target: $(BINFILES) - -encoder_example.o: ../include/vorbis/modes.h - -encoder_example: $(OFILES) ../lib/libvorbis.a - $(CC) $(CFLAGS) $(LDFLAGS) encoder_example.o ../lib/libvorbis.a -o \ - encoder_example $(LIBS) - -decoder_example: $(OFILES) ../lib/libvorbis.a - $(CC) $(CFLAGS) $(LDFLAGS) decoder_example.o ../lib/libvorbis.a -o \ - decoder_example $(LIBS) - -chaining_example: $(OFILES) ../lib/libvorbis.a ../lib/vorbisfile.a - $(CC) $(CFLAGS) $(LDFLAGS) chaining_example.o \ - ../lib/vorbisfile.a ../lib/libvorbis.a \ - -o chaining_example $(LIBS) -vorbisfile_example: $(OFILES) ../lib/libvorbis.a ../lib/vorbisfile.a - $(CC) $(CFLAGS) $(LDFLAGS) vorbisfile_example.o \ - ../lib/vorbisfile.a ../lib/libvorbis.a \ - -o vorbisfile_example $(LIBS) - -seeking_test: $(OFILES) ../lib/libvorbis.a ../lib/vorbisfile.a - $(CC) $(CFLAGS) $(LDFLAGS) seeking_test.o \ - ../lib/vorbisfile.a ../lib/libvorbis.a \ - -o seeking_test $(LIBS) - -selftest: - -$(OFILES): $(HFILES) - -.c.o: - $(CC) $(CFLAGS) -c $< - -clean: - -rm -f *.o *.a test* *~ *.out ogg config.* \ - encoder_example decoder_example chaining_example \ - vorbisfile_example seeking_test - -distclean: clean - -rm -f Makefile - diff --git a/examples/chaining_example.c b/examples/chaining_example.c index 445c9a3..c9d7245 100644 --- a/examples/chaining_example.c +++ b/examples/chaining_example.c @@ -12,13 +12,12 @@ ******************************************************************** function: illustrate simple use of chained bitstream and vorbisfile.a - last mod: $Id: chaining_example.c,v 1.5 2000/06/14 10:13:35 xiphmont Exp $ + last mod: $Id: chaining_example.c,v 1.6 2000/10/12 03:12:39 xiphmont Exp $ ********************************************************************/ -#include "vorbis/codec.h" -#include "vorbis/vorbisfile.h" -#include "../lib/misc.h" +#include +#include int main(){ OggVorbis_File ov; diff --git a/examples/decoder_example.c b/examples/decoder_example.c index a8b6a19..7d7571e 100644 --- a/examples/decoder_example.c +++ b/examples/decoder_example.c @@ -12,7 +12,7 @@ ******************************************************************** function: simple example decoder - last mod: $Id: decoder_example.c,v 1.12 2000/08/30 06:09:21 xiphmont Exp $ + last mod: $Id: decoder_example.c,v 1.13 2000/10/12 03:12:39 xiphmont Exp $ ********************************************************************/ @@ -25,7 +25,7 @@ #include #include #include -#include "vorbis/codec.h" +#include #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ #include @@ -216,14 +216,14 @@ int main(int argc, char **argv){ /* no reason to complain; already complained above */ }else{ /* we have a packet. Decode it */ - double **pcm; + float **pcm; int samples; if(vorbis_synthesis(&vb,&op)==0) /* test for success! */ vorbis_synthesis_blockin(&vd,&vb); /* - **pcm is a multichannel double vector. In stereo, for + **pcm is a multichannel float vector. In stereo, for example, pcm[0] is left, and pcm[1] is right. samples is the size of each channel. Convert the float values (-1.<=range<=1.) to whatever PCM format and write it out */ @@ -233,13 +233,17 @@ int main(int argc, char **argv){ int clipflag=0; int bout=(samples32767){ val=32767; diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 63ec66e..01dcff7 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -12,7 +12,7 @@ ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.13 2000/08/15 14:01:02 xiphmont Exp $ + last mod: $Id: encoder_example.c,v 1.14 2000/10/12 03:12:39 xiphmont Exp $ ********************************************************************/ @@ -25,7 +25,7 @@ #include #include #include -#include "vorbis/mode_C.h" +#include #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ #include @@ -113,7 +113,17 @@ int main(){ ogg_stream_packetin(&os,&header_comm); ogg_stream_packetin(&os,&header_code); - /* no need to write out here. We'll get to that in the main loop */ + /* We don't have to write out here, but doing so makes streaming + * much easier, so we do, flushing ALL pages. This ensures the actual + * audio data will start on a new page + */ + while(!eos){ + int result=ogg_stream_flush(&os,&og); + if(result==0)break; + fwrite(og.header,1,og.header_len,stdout); + fwrite(og.body,1,og.body_len,stdout); + } + } while(!eos){ @@ -131,7 +141,7 @@ int main(){ /* data to encode */ /* expose the buffer to submit data */ - double **buffer=vorbis_analysis_buffer(&vd,READ); + float **buffer=vorbis_analysis_buffer(&vd,READ); /* uninterleave samples */ for(i=0;i #include #include -#include "vorbis/codec.h" -#include "vorbis/vorbisfile.h" +#include +#include #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ #include diff --git a/include/.cvsignore b/include/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/include/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..756b65f --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = vorbis diff --git a/include/vorbis/.cvsignore b/include/vorbis/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/include/vorbis/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/include/vorbis/Makefile.am b/include/vorbis/Makefile.am new file mode 100644 index 0000000..7740234 --- /dev/null +++ b/include/vorbis/Makefile.am @@ -0,0 +1,11 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +includedir = $(prefix)/include/vorbis + +include_HEADERS = backends.h codec.h mode_B.h mode_D.h modes.h\ + codebook.h mode_A.h mode_C.h mode_E.h vorbisfile.h + +SUBDIRS = book + diff --git a/include/vorbis/backends.h b/include/vorbis/backends.h index 1a7cadd..557ba6a 100644 --- a/include/vorbis/backends.h +++ b/include/vorbis/backends.h @@ -13,7 +13,7 @@ function: libvorbis backend and mapping structures; needed for static mode headers - last mod: $Id: backends.h,v 1.11 2000/07/12 09:36:17 xiphmont Exp $ + last mod: $Id: backends.h,v 1.12 2000/10/12 03:12:40 xiphmont Exp $ ********************************************************************/ @@ -39,9 +39,9 @@ typedef struct{ void (*free_info) (vorbis_info_time *); void (*free_look) (vorbis_look_time *); int (*forward) (struct vorbis_block *,vorbis_look_time *, - double *,double *); + float *,float *); int (*inverse) (struct vorbis_block *,vorbis_look_time *, - double *,double *); + float *,float *); } vorbis_func_time; typedef struct{ @@ -57,9 +57,9 @@ typedef struct{ void (*free_info) (vorbis_info_floor *); void (*free_look) (vorbis_look_floor *); int (*forward) (struct vorbis_block *,vorbis_look_floor *, - double *,double *); + float *,float *); int (*inverse) (struct vorbis_block *,vorbis_look_floor *, - double *); + float *); } vorbis_func_floor; typedef struct{ @@ -83,9 +83,9 @@ typedef struct{ void (*free_info) (vorbis_info_residue *); void (*free_look) (vorbis_look_residue *); int (*forward) (struct vorbis_block *,vorbis_look_residue *, - double **,int); + float **,int); int (*inverse) (struct vorbis_block *,vorbis_look_residue *, - double **,int); + float **,int); } vorbis_func_residue; typedef struct vorbis_info_residue0{ @@ -101,8 +101,8 @@ typedef struct vorbis_info_residue0{ int booklist[256]; /* list of second stage books */ /* encode-only heuristic settings */ - double entmax[64]; /* book entropy threshholds*/ - double ampmax[64]; /* book amp threshholds*/ + float entmax[64]; /* book entropy threshholds*/ + float ampmax[64]; /* book amp threshholds*/ int subgrp[64]; /* book heuristic subgroup size */ int blimit[64]; /* subgroup position limits */ diff --git a/include/vorbis/book/.cvsignore b/include/vorbis/book/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ b/include/vorbis/book/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/include/vorbis/book/Makefile.am b/include/vorbis/book/Makefile.am new file mode 100644 index 0000000..bd7c445 --- /dev/null +++ b/include/vorbis/book/Makefile.am @@ -0,0 +1,30 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +includedir = $(prefix)/include/vorbis/book + +include_HEADERS = lsp12_0.vqh res0_1024a_192_5.vqh res0_128a_192_4.vqh \ + lsp30_0.vqh res0_1024a_256_1.vqh res0_128a_192_5.vqh \ + res0_1024a_128_1.vqh res0_1024a_256_2.vqh res0_128a_256_1.vqh \ + res0_1024a_128_2.vqh res0_1024a_256_3.vqh res0_128a_256_2.vqh \ + res0_1024a_128_3.vqh res0_1024a_256_4.vqh res0_128a_256_3.vqh \ + res0_1024a_128_4.vqh res0_1024a_256_5.vqh res0_128a_256_4.vqh \ + res0_1024a_128_5.vqh res0_1024a_350_1.vqh res0_128a_256_5.vqh \ + res0_1024a_128_6.vqh res0_1024a_350_2.vqh res0_128a_350_1.vqh \ + res0_1024a_128_7.vqh res0_1024a_350_3.vqh res0_128a_350_2.vqh \ + res0_1024a_128_8.vqh res0_1024a_350_4.vqh res0_128a_350_3.vqh \ + res0_1024a_128_9.vqh res0_1024a_350_5.vqh res0_128a_350_4.vqh \ + res0_1024a_160_1.vqh res0_128a_128_1.vqh res0_128a_350_5.vqh \ + res0_1024a_160_2.vqh res0_128a_128_2.vqh resaux0_1024a_128.vqh \ + res0_1024a_160_3.vqh res0_128a_128_3.vqh resaux0_1024a_160.vqh \ + res0_1024a_160_4.vqh res0_128a_128_4.vqh resaux0_1024a_192.vqh \ + res0_1024a_160_5.vqh res0_128a_128_5.vqh resaux0_1024a_256.vqh \ + res0_1024a_160_6.vqh res0_128a_160_1.vqh resaux0_1024a_350.vqh \ + res0_1024a_160_7.vqh res0_128a_160_2.vqh resaux0_128a_128.vqh \ + res0_1024a_160_8.vqh res0_128a_160_3.vqh resaux0_128a_160.vqh \ + res0_1024a_160_9.vqh res0_128a_160_4.vqh resaux0_128a_192.vqh \ + res0_1024a_192_1.vqh res0_128a_160_5.vqh resaux0_128a_256.vqh \ + res0_1024a_192_2.vqh res0_128a_192_1.vqh resaux0_128a_350.vqh \ + res0_1024a_192_3.vqh res0_128a_192_2.vqh res0_1024a_192_4.vqh \ + res0_128a_192_3.vqh diff --git a/include/vorbis/book/res0_1024a_128_1.vqh b/include/vorbis/book/res0_1024a_128_1.vqh index 03d13fc..5c5929f 100644 --- a/include/vorbis/book/res0_1024a_128_1.vqh +++ b/include/vorbis/book/res0_1024a_128_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_1024a_128_1[] = { 14, }; -static double _vq_quantthresh_res0_1024a_128_1[] = { +static float _vq_quantthresh_res0_1024a_128_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_1024a_128_2.vqh b/include/vorbis/book/res0_1024a_128_2.vqh index 2f9947b..fce8c60 100644 --- a/include/vorbis/book/res0_1024a_128_2.vqh +++ b/include/vorbis/book/res0_1024a_128_2.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_1024a_128_2[] = { 9, }; -static double _vq_quantthresh_res0_1024a_128_2[] = { +static float _vq_quantthresh_res0_1024a_128_2[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_1024a_128_3.vqh b/include/vorbis/book/res0_1024a_128_3.vqh index 5489461..87d9ef8 100644 --- a/include/vorbis/book/res0_1024a_128_3.vqh +++ b/include/vorbis/book/res0_1024a_128_3.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_128_3[] = { 21, }; -static double _vq_quantthresh_res0_1024a_128_3[] = { +static float _vq_quantthresh_res0_1024a_128_3[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_128_4.vqh b/include/vorbis/book/res0_1024a_128_4.vqh index b872fcf..e4b49a5 100644 --- a/include/vorbis/book/res0_1024a_128_4.vqh +++ b/include/vorbis/book/res0_1024a_128_4.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_128_4[] = { 17, }; -static double _vq_quantthresh_res0_1024a_128_4[] = { +static float _vq_quantthresh_res0_1024a_128_4[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_128_5.vqh b/include/vorbis/book/res0_1024a_128_5.vqh index 5621fac..61a9f6e 100644 --- a/include/vorbis/book/res0_1024a_128_5.vqh +++ b/include/vorbis/book/res0_1024a_128_5.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_1024a_128_5[] = { 0, }; -static double _vq_quantthresh_res0_1024a_128_5[] = { +static float _vq_quantthresh_res0_1024a_128_5[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_1024a_128_6.vqh b/include/vorbis/book/res0_1024a_128_6.vqh index b97a1e6..28fc527 100644 --- a/include/vorbis/book/res0_1024a_128_6.vqh +++ b/include/vorbis/book/res0_1024a_128_6.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_1024a_128_6[] = { 0, }; -static double _vq_quantthresh_res0_1024a_128_6[] = { +static float _vq_quantthresh_res0_1024a_128_6[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_1024a_128_7.vqh b/include/vorbis/book/res0_1024a_128_7.vqh index 833db7f..caf231a 100644 --- a/include/vorbis/book/res0_1024a_128_7.vqh +++ b/include/vorbis/book/res0_1024a_128_7.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_1024a_128_7[] = { 13,14,14,15,11,13,14,14,15, }; -static double _vq_quantthresh_res0_1024a_128_7[] = { +static float _vq_quantthresh_res0_1024a_128_7[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_1024a_128_8.vqh b/include/vorbis/book/res0_1024a_128_8.vqh index b50a0e6..cf1f680 100644 --- a/include/vorbis/book/res0_1024a_128_8.vqh +++ b/include/vorbis/book/res0_1024a_128_8.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_1024a_128_8[] = { 12, }; -static double _vq_quantthresh_res0_1024a_128_8[] = { +static float _vq_quantthresh_res0_1024a_128_8[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_1024a_128_9.vqh b/include/vorbis/book/res0_1024a_128_9.vqh index 45f0926..f3a3de9 100644 --- a/include/vorbis/book/res0_1024a_128_9.vqh +++ b/include/vorbis/book/res0_1024a_128_9.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_1024a_128_9[] = { 0, }; -static double _vq_quantthresh_res0_1024a_128_9[] = { +static float _vq_quantthresh_res0_1024a_128_9[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_1024a_160_1.vqh b/include/vorbis/book/res0_1024a_160_1.vqh index 74e5e31..2523190 100644 --- a/include/vorbis/book/res0_1024a_160_1.vqh +++ b/include/vorbis/book/res0_1024a_160_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_1024a_160_1[] = { 15, }; -static double _vq_quantthresh_res0_1024a_160_1[] = { +static float _vq_quantthresh_res0_1024a_160_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_1024a_160_2.vqh b/include/vorbis/book/res0_1024a_160_2.vqh index 493fc7c..52d70eb 100644 --- a/include/vorbis/book/res0_1024a_160_2.vqh +++ b/include/vorbis/book/res0_1024a_160_2.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_1024a_160_2[] = { 9, }; -static double _vq_quantthresh_res0_1024a_160_2[] = { +static float _vq_quantthresh_res0_1024a_160_2[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_1024a_160_3.vqh b/include/vorbis/book/res0_1024a_160_3.vqh index d5d0510..33f699e 100644 --- a/include/vorbis/book/res0_1024a_160_3.vqh +++ b/include/vorbis/book/res0_1024a_160_3.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_160_3[] = { 20, }; -static double _vq_quantthresh_res0_1024a_160_3[] = { +static float _vq_quantthresh_res0_1024a_160_3[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_160_4.vqh b/include/vorbis/book/res0_1024a_160_4.vqh index 685c260..fd61655 100644 --- a/include/vorbis/book/res0_1024a_160_4.vqh +++ b/include/vorbis/book/res0_1024a_160_4.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_160_4[] = { 16, }; -static double _vq_quantthresh_res0_1024a_160_4[] = { +static float _vq_quantthresh_res0_1024a_160_4[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_160_5.vqh b/include/vorbis/book/res0_1024a_160_5.vqh index 8e4db71..0915c2c 100644 --- a/include/vorbis/book/res0_1024a_160_5.vqh +++ b/include/vorbis/book/res0_1024a_160_5.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_1024a_160_5[] = { 0, }; -static double _vq_quantthresh_res0_1024a_160_5[] = { +static float _vq_quantthresh_res0_1024a_160_5[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_1024a_160_6.vqh b/include/vorbis/book/res0_1024a_160_6.vqh index 403a803..353d6ce 100644 --- a/include/vorbis/book/res0_1024a_160_6.vqh +++ b/include/vorbis/book/res0_1024a_160_6.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_1024a_160_6[] = { 18, }; -static double _vq_quantthresh_res0_1024a_160_6[] = { +static float _vq_quantthresh_res0_1024a_160_6[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_1024a_160_7.vqh b/include/vorbis/book/res0_1024a_160_7.vqh index c5b5a77..70d1352 100644 --- a/include/vorbis/book/res0_1024a_160_7.vqh +++ b/include/vorbis/book/res0_1024a_160_7.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_1024a_160_7[] = { 11,13,13,14,10,11,12,13,14, }; -static double _vq_quantthresh_res0_1024a_160_7[] = { +static float _vq_quantthresh_res0_1024a_160_7[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_1024a_160_8.vqh b/include/vorbis/book/res0_1024a_160_8.vqh index 219c490..afa7787 100644 --- a/include/vorbis/book/res0_1024a_160_8.vqh +++ b/include/vorbis/book/res0_1024a_160_8.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_1024a_160_8[] = { 13, }; -static double _vq_quantthresh_res0_1024a_160_8[] = { +static float _vq_quantthresh_res0_1024a_160_8[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_1024a_160_9.vqh b/include/vorbis/book/res0_1024a_160_9.vqh index 745f2f6..eb5eb1b 100644 --- a/include/vorbis/book/res0_1024a_160_9.vqh +++ b/include/vorbis/book/res0_1024a_160_9.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_1024a_160_9[] = { 0, }; -static double _vq_quantthresh_res0_1024a_160_9[] = { +static float _vq_quantthresh_res0_1024a_160_9[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_1024a_192_1.vqh b/include/vorbis/book/res0_1024a_192_1.vqh index 5a32ba9..1d9916d 100644 --- a/include/vorbis/book/res0_1024a_192_1.vqh +++ b/include/vorbis/book/res0_1024a_192_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_1024a_192_1[] = { 11, }; -static double _vq_quantthresh_res0_1024a_192_1[] = { +static float _vq_quantthresh_res0_1024a_192_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_1024a_192_2.vqh b/include/vorbis/book/res0_1024a_192_2.vqh index d97f1d5..f192b65 100644 --- a/include/vorbis/book/res0_1024a_192_2.vqh +++ b/include/vorbis/book/res0_1024a_192_2.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_192_2[] = { 14, }; -static double _vq_quantthresh_res0_1024a_192_2[] = { +static float _vq_quantthresh_res0_1024a_192_2[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_192_3.vqh b/include/vorbis/book/res0_1024a_192_3.vqh index e6adea7..b851487 100644 --- a/include/vorbis/book/res0_1024a_192_3.vqh +++ b/include/vorbis/book/res0_1024a_192_3.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_1024a_192_3[] = { 19, }; -static double _vq_quantthresh_res0_1024a_192_3[] = { +static float _vq_quantthresh_res0_1024a_192_3[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_1024a_192_4.vqh b/include/vorbis/book/res0_1024a_192_4.vqh index 9c8472b..04b81ea 100644 --- a/include/vorbis/book/res0_1024a_192_4.vqh +++ b/include/vorbis/book/res0_1024a_192_4.vqh @@ -40,7 +40,7 @@ static long _vq_lengthlist_res0_1024a_192_4[] = { 11, }; -static double _vq_quantthresh_res0_1024a_192_4[] = { +static float _vq_quantthresh_res0_1024a_192_4[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; diff --git a/include/vorbis/book/res0_1024a_192_5.vqh b/include/vorbis/book/res0_1024a_192_5.vqh index ba12a3d..1dd6d39 100644 --- a/include/vorbis/book/res0_1024a_192_5.vqh +++ b/include/vorbis/book/res0_1024a_192_5.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_1024a_192_5[] = { 0, }; -static double _vq_quantthresh_res0_1024a_192_5[] = { +static float _vq_quantthresh_res0_1024a_192_5[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_1024a_256_1.vqh b/include/vorbis/book/res0_1024a_256_1.vqh index 5b07388..dc6a3f4 100644 --- a/include/vorbis/book/res0_1024a_256_1.vqh +++ b/include/vorbis/book/res0_1024a_256_1.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_256_1[] = { 16, }; -static double _vq_quantthresh_res0_1024a_256_1[] = { +static float _vq_quantthresh_res0_1024a_256_1[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_256_2.vqh b/include/vorbis/book/res0_1024a_256_2.vqh index 9fd433c..64627b5 100644 --- a/include/vorbis/book/res0_1024a_256_2.vqh +++ b/include/vorbis/book/res0_1024a_256_2.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_1024a_256_2[] = { 10,10,11,11, 9,10,10,11,11, }; -static double _vq_quantthresh_res0_1024a_256_2[] = { +static float _vq_quantthresh_res0_1024a_256_2[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_1024a_256_3.vqh b/include/vorbis/book/res0_1024a_256_3.vqh index 589b87b..e88c9c8 100644 --- a/include/vorbis/book/res0_1024a_256_3.vqh +++ b/include/vorbis/book/res0_1024a_256_3.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_1024a_256_3[] = { 12, }; -static double _vq_quantthresh_res0_1024a_256_3[] = { +static float _vq_quantthresh_res0_1024a_256_3[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_1024a_256_4.vqh b/include/vorbis/book/res0_1024a_256_4.vqh index 0ee7e51..89e2a79 100644 --- a/include/vorbis/book/res0_1024a_256_4.vqh +++ b/include/vorbis/book/res0_1024a_256_4.vqh @@ -67,7 +67,7 @@ static long _vq_lengthlist_res0_1024a_256_4[] = { 12,13,14,14,14,14,14,15,17, }; -static double _vq_quantthresh_res0_1024a_256_4[] = { +static float _vq_quantthresh_res0_1024a_256_4[] = { -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, diff --git a/include/vorbis/book/res0_1024a_256_5.vqh b/include/vorbis/book/res0_1024a_256_5.vqh index 6084889..19e00ae 100644 --- a/include/vorbis/book/res0_1024a_256_5.vqh +++ b/include/vorbis/book/res0_1024a_256_5.vqh @@ -98,7 +98,7 @@ static long _vq_lengthlist_res0_1024a_256_5[] = { 15, 0, 0, 0,16,16, 0,16,16, }; -static double _vq_quantthresh_res0_1024a_256_5[] = { +static float _vq_quantthresh_res0_1024a_256_5[] = { -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_1024a_350_1.vqh b/include/vorbis/book/res0_1024a_350_1.vqh index 48fb9ec..d9e36dc 100644 --- a/include/vorbis/book/res0_1024a_350_1.vqh +++ b/include/vorbis/book/res0_1024a_350_1.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_1024a_350_1[] = { 14, }; -static double _vq_quantthresh_res0_1024a_350_1[] = { +static float _vq_quantthresh_res0_1024a_350_1[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_1024a_350_2.vqh b/include/vorbis/book/res0_1024a_350_2.vqh index 52d243e..9e8990f 100644 --- a/include/vorbis/book/res0_1024a_350_2.vqh +++ b/include/vorbis/book/res0_1024a_350_2.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_1024a_350_2[] = { 9, 9, 9,10, 8, 9, 9, 9,10, }; -static double _vq_quantthresh_res0_1024a_350_2[] = { +static float _vq_quantthresh_res0_1024a_350_2[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_1024a_350_3.vqh b/include/vorbis/book/res0_1024a_350_3.vqh index 08fa579..d7790b0 100644 --- a/include/vorbis/book/res0_1024a_350_3.vqh +++ b/include/vorbis/book/res0_1024a_350_3.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_1024a_350_3[] = { 12, }; -static double _vq_quantthresh_res0_1024a_350_3[] = { +static float _vq_quantthresh_res0_1024a_350_3[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_1024a_350_4.vqh b/include/vorbis/book/res0_1024a_350_4.vqh index 9ec3f25..292d7b5 100644 --- a/include/vorbis/book/res0_1024a_350_4.vqh +++ b/include/vorbis/book/res0_1024a_350_4.vqh @@ -67,7 +67,7 @@ static long _vq_lengthlist_res0_1024a_350_4[] = { 11,12,12,12,12,13,13,13,15, }; -static double _vq_quantthresh_res0_1024a_350_4[] = { +static float _vq_quantthresh_res0_1024a_350_4[] = { -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, diff --git a/include/vorbis/book/res0_1024a_350_5.vqh b/include/vorbis/book/res0_1024a_350_5.vqh index 645956b..bdc68bf 100644 --- a/include/vorbis/book/res0_1024a_350_5.vqh +++ b/include/vorbis/book/res0_1024a_350_5.vqh @@ -98,7 +98,7 @@ static long _vq_lengthlist_res0_1024a_350_5[] = { 13,13,14,14,15,15,16,16,12, }; -static double _vq_quantthresh_res0_1024a_350_5[] = { +static float _vq_quantthresh_res0_1024a_350_5[] = { -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_128a_128_1.vqh b/include/vorbis/book/res0_128a_128_1.vqh index 3f77bce..ca49a37 100644 --- a/include/vorbis/book/res0_128a_128_1.vqh +++ b/include/vorbis/book/res0_128a_128_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_128a_128_1[] = { 12, }; -static double _vq_quantthresh_res0_128a_128_1[] = { +static float _vq_quantthresh_res0_128a_128_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_128a_128_2.vqh b/include/vorbis/book/res0_128a_128_2.vqh index 909401a..81da615 100644 --- a/include/vorbis/book/res0_128a_128_2.vqh +++ b/include/vorbis/book/res0_128a_128_2.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_128a_128_2[] = { 0, }; -static double _vq_quantthresh_res0_128a_128_2[] = { +static float _vq_quantthresh_res0_128a_128_2[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_128a_128_3.vqh b/include/vorbis/book/res0_128a_128_3.vqh index de58bdd..3dcc010 100644 --- a/include/vorbis/book/res0_128a_128_3.vqh +++ b/include/vorbis/book/res0_128a_128_3.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_128a_128_3[] = { 0, }; -static double _vq_quantthresh_res0_128a_128_3[] = { +static float _vq_quantthresh_res0_128a_128_3[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_128a_128_4.vqh b/include/vorbis/book/res0_128a_128_4.vqh index c2a5204..23ec180 100644 --- a/include/vorbis/book/res0_128a_128_4.vqh +++ b/include/vorbis/book/res0_128a_128_4.vqh @@ -40,7 +40,7 @@ static long _vq_lengthlist_res0_128a_128_4[] = { 14, }; -static double _vq_quantthresh_res0_128a_128_4[] = { +static float _vq_quantthresh_res0_128a_128_4[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; diff --git a/include/vorbis/book/res0_128a_128_5.vqh b/include/vorbis/book/res0_128a_128_5.vqh index 21b4ad0..36a69ac 100644 --- a/include/vorbis/book/res0_128a_128_5.vqh +++ b/include/vorbis/book/res0_128a_128_5.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_128a_128_5[] = { 0, }; -static double _vq_quantthresh_res0_128a_128_5[] = { +static float _vq_quantthresh_res0_128a_128_5[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_128a_160_1.vqh b/include/vorbis/book/res0_128a_160_1.vqh index 92e63d9..5393e8b 100644 --- a/include/vorbis/book/res0_128a_160_1.vqh +++ b/include/vorbis/book/res0_128a_160_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_128a_160_1[] = { 9, }; -static double _vq_quantthresh_res0_128a_160_1[] = { +static float _vq_quantthresh_res0_128a_160_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_128a_160_2.vqh b/include/vorbis/book/res0_128a_160_2.vqh index 193259d..f62117b 100644 --- a/include/vorbis/book/res0_128a_160_2.vqh +++ b/include/vorbis/book/res0_128a_160_2.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_128a_160_2[] = { 17, }; -static double _vq_quantthresh_res0_128a_160_2[] = { +static float _vq_quantthresh_res0_128a_160_2[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_128a_160_3.vqh b/include/vorbis/book/res0_128a_160_3.vqh index af1fae6..7e9a27b 100644 --- a/include/vorbis/book/res0_128a_160_3.vqh +++ b/include/vorbis/book/res0_128a_160_3.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_128a_160_3[] = { 0, }; -static double _vq_quantthresh_res0_128a_160_3[] = { +static float _vq_quantthresh_res0_128a_160_3[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_128a_160_4.vqh b/include/vorbis/book/res0_128a_160_4.vqh index 9825893..1e33866 100644 --- a/include/vorbis/book/res0_128a_160_4.vqh +++ b/include/vorbis/book/res0_128a_160_4.vqh @@ -40,7 +40,7 @@ static long _vq_lengthlist_res0_128a_160_4[] = { 13, }; -static double _vq_quantthresh_res0_128a_160_4[] = { +static float _vq_quantthresh_res0_128a_160_4[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; diff --git a/include/vorbis/book/res0_128a_160_5.vqh b/include/vorbis/book/res0_128a_160_5.vqh index 2bb0475..e5c7ffd 100644 --- a/include/vorbis/book/res0_128a_160_5.vqh +++ b/include/vorbis/book/res0_128a_160_5.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_128a_160_5[] = { 0, }; -static double _vq_quantthresh_res0_128a_160_5[] = { +static float _vq_quantthresh_res0_128a_160_5[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_128a_192_1.vqh b/include/vorbis/book/res0_128a_192_1.vqh index 74e6314..7b7718c 100644 --- a/include/vorbis/book/res0_128a_192_1.vqh +++ b/include/vorbis/book/res0_128a_192_1.vqh @@ -34,7 +34,7 @@ static long _vq_lengthlist_res0_128a_192_1[] = { 8, }; -static double _vq_quantthresh_res0_128a_192_1[] = { +static float _vq_quantthresh_res0_128a_192_1[] = { -0.5, 0.5, }; diff --git a/include/vorbis/book/res0_128a_192_2.vqh b/include/vorbis/book/res0_128a_192_2.vqh index 9790293..ca3f962 100644 --- a/include/vorbis/book/res0_128a_192_2.vqh +++ b/include/vorbis/book/res0_128a_192_2.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_128a_192_2[] = { 16, }; -static double _vq_quantthresh_res0_128a_192_2[] = { +static float _vq_quantthresh_res0_128a_192_2[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_128a_192_3.vqh b/include/vorbis/book/res0_128a_192_3.vqh index b254c82..def392f 100644 --- a/include/vorbis/book/res0_128a_192_3.vqh +++ b/include/vorbis/book/res0_128a_192_3.vqh @@ -183,7 +183,7 @@ static long _vq_lengthlist_res0_128a_192_3[] = { 0, }; -static double _vq_quantthresh_res0_128a_192_3[] = { +static float _vq_quantthresh_res0_128a_192_3[] = { -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, }; diff --git a/include/vorbis/book/res0_128a_192_4.vqh b/include/vorbis/book/res0_128a_192_4.vqh index a9458bf..f0b1e54 100644 --- a/include/vorbis/book/res0_128a_192_4.vqh +++ b/include/vorbis/book/res0_128a_192_4.vqh @@ -40,7 +40,7 @@ static long _vq_lengthlist_res0_128a_192_4[] = { 12, }; -static double _vq_quantthresh_res0_128a_192_4[] = { +static float _vq_quantthresh_res0_128a_192_4[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; diff --git a/include/vorbis/book/res0_128a_192_5.vqh b/include/vorbis/book/res0_128a_192_5.vqh index ee1071e..058c9fd 100644 --- a/include/vorbis/book/res0_128a_192_5.vqh +++ b/include/vorbis/book/res0_128a_192_5.vqh @@ -82,7 +82,7 @@ static long _vq_lengthlist_res0_128a_192_5[] = { 0, }; -static double _vq_quantthresh_res0_128a_192_5[] = { +static float _vq_quantthresh_res0_128a_192_5[] = { -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_128a_256_1.vqh b/include/vorbis/book/res0_128a_256_1.vqh index 74cc676..c3093e9 100644 --- a/include/vorbis/book/res0_128a_256_1.vqh +++ b/include/vorbis/book/res0_128a_256_1.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_128a_256_1[] = { 14, }; -static double _vq_quantthresh_res0_128a_256_1[] = { +static float _vq_quantthresh_res0_128a_256_1[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_128a_256_2.vqh b/include/vorbis/book/res0_128a_256_2.vqh index c7fa222..c0003e0 100644 --- a/include/vorbis/book/res0_128a_256_2.vqh +++ b/include/vorbis/book/res0_128a_256_2.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_128a_256_2[] = { 11,11,11,12,10,11,11,11,12, }; -static double _vq_quantthresh_res0_128a_256_2[] = { +static float _vq_quantthresh_res0_128a_256_2[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_128a_256_3.vqh b/include/vorbis/book/res0_128a_256_3.vqh index 596df5e..69ddeda 100644 --- a/include/vorbis/book/res0_128a_256_3.vqh +++ b/include/vorbis/book/res0_128a_256_3.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_128a_256_3[] = { 10, }; -static double _vq_quantthresh_res0_128a_256_3[] = { +static float _vq_quantthresh_res0_128a_256_3[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_128a_256_4.vqh b/include/vorbis/book/res0_128a_256_4.vqh index 3ad345f..f68f49a 100644 --- a/include/vorbis/book/res0_128a_256_4.vqh +++ b/include/vorbis/book/res0_128a_256_4.vqh @@ -67,7 +67,7 @@ static long _vq_lengthlist_res0_128a_256_4[] = { 12,13,13,12,12,12,13,13,16, }; -static double _vq_quantthresh_res0_128a_256_4[] = { +static float _vq_quantthresh_res0_128a_256_4[] = { -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, diff --git a/include/vorbis/book/res0_128a_256_5.vqh b/include/vorbis/book/res0_128a_256_5.vqh index ed32a2b..354835a 100644 --- a/include/vorbis/book/res0_128a_256_5.vqh +++ b/include/vorbis/book/res0_128a_256_5.vqh @@ -98,7 +98,7 @@ static long _vq_lengthlist_res0_128a_256_5[] = { 14, 0, 0, 0, 0, 0, 0, 0, 0, }; -static double _vq_quantthresh_res0_128a_256_5[] = { +static float _vq_quantthresh_res0_128a_256_5[] = { -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/book/res0_128a_350_1.vqh b/include/vorbis/book/res0_128a_350_1.vqh index 98660fe..b3332ef 100644 --- a/include/vorbis/book/res0_128a_350_1.vqh +++ b/include/vorbis/book/res0_128a_350_1.vqh @@ -70,7 +70,7 @@ static long _vq_lengthlist_res0_128a_350_1[] = { 0, }; -static double _vq_quantthresh_res0_128a_350_1[] = { +static float _vq_quantthresh_res0_128a_350_1[] = { -1.5, -0.5, 0.5, 1.5, }; diff --git a/include/vorbis/book/res0_128a_350_2.vqh b/include/vorbis/book/res0_128a_350_2.vqh index 119727c..5ed1753 100644 --- a/include/vorbis/book/res0_128a_350_2.vqh +++ b/include/vorbis/book/res0_128a_350_2.vqh @@ -44,7 +44,7 @@ static long _vq_lengthlist_res0_128a_350_2[] = { 9, 9, 9, 9, 8, 8, 9, 8, 9, }; -static double _vq_quantthresh_res0_128a_350_2[] = { +static float _vq_quantthresh_res0_128a_350_2[] = { -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, }; diff --git a/include/vorbis/book/res0_128a_350_3.vqh b/include/vorbis/book/res0_128a_350_3.vqh index af4b921..38d6402 100644 --- a/include/vorbis/book/res0_128a_350_3.vqh +++ b/include/vorbis/book/res0_128a_350_3.vqh @@ -55,7 +55,7 @@ static long _vq_lengthlist_res0_128a_350_3[] = { 10, }; -static double _vq_quantthresh_res0_128a_350_3[] = { +static float _vq_quantthresh_res0_128a_350_3[] = { -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, }; diff --git a/include/vorbis/book/res0_128a_350_4.vqh b/include/vorbis/book/res0_128a_350_4.vqh index 07ca74d..72215cd 100644 --- a/include/vorbis/book/res0_128a_350_4.vqh +++ b/include/vorbis/book/res0_128a_350_4.vqh @@ -67,7 +67,7 @@ static long _vq_lengthlist_res0_128a_350_4[] = { 12,12,12,12,12,12,12,12,13, }; -static double _vq_quantthresh_res0_128a_350_4[] = { +static float _vq_quantthresh_res0_128a_350_4[] = { -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, diff --git a/include/vorbis/book/res0_128a_350_5.vqh b/include/vorbis/book/res0_128a_350_5.vqh index 632c9cd..c8c5dff 100644 --- a/include/vorbis/book/res0_128a_350_5.vqh +++ b/include/vorbis/book/res0_128a_350_5.vqh @@ -98,7 +98,7 @@ static long _vq_lengthlist_res0_128a_350_5[] = { 16,15,15,14,17,16, 0, 0, 0, }; -static double _vq_quantthresh_res0_128a_350_5[] = { +static float _vq_quantthresh_res0_128a_350_5[] = { -75.5, -54, -38.5, -27.5, -19.5, -13.5, -9.5, -7, -5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 5, 7, 9.5, 13.5, 19.5, 27.5, 38.5, diff --git a/include/vorbis/codebook.h b/include/vorbis/codebook.h index 7f1950a..cb23f70 100644 --- a/include/vorbis/codebook.h +++ b/include/vorbis/codebook.h @@ -12,7 +12,7 @@ ******************************************************************** function: codebook types - last mod: $Id: codebook.h,v 1.6 2000/07/17 12:55:35 xiphmont Exp $ + last mod: $Id: codebook.h,v 1.7 2000/10/12 03:12:41 xiphmont Exp $ ********************************************************************/ @@ -73,15 +73,15 @@ typedef struct encode_aux_nearestmatch{ /* assumes a maptype of 1; encode side only, so that's OK */ typedef struct encode_aux_threshmatch{ - double *quantthresh; + float *quantthresh; long *quantmap; int quantvals; int threshvals; } encode_aux_threshmatch; typedef struct encode_aux_pigeonhole{ - double min; - double del; + float min; + float del; int mapentries; int quantvals; @@ -94,6 +94,10 @@ typedef struct encode_aux_pigeonhole{ } encode_aux_pigeonhole; typedef struct decode_aux{ + long *tab; + int *tabl; + int tabn; + long *ptr0; long *ptr1; long aux; /* number of tree entries */ @@ -104,7 +108,7 @@ typedef struct codebook{ long entries; /* codebook entries */ const static_codebook *c; - double *valuelist; /* list of dim*entries actual entry values */ + float *valuelist; /* list of dim*entries actual entry values */ long *codelist; /* list of bitstream codewords for each entry */ struct decode_aux *decode_tree; diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h index 38e24fc..221c5d6 100644 --- a/include/vorbis/codec.h +++ b/include/vorbis/codec.h @@ -12,7 +12,7 @@ ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec.h,v 1.29 2000/08/30 07:09:46 xiphmont Exp $ + last mod: $Id: codec.h,v 1.30 2000/10/12 03:12:41 xiphmont Exp $ ********************************************************************/ @@ -26,9 +26,8 @@ extern "C" #define MAX_BARK 27 -#include "os_types.h" +#include #include "vorbis/codebook.h" -#include "vorbis/internal.h" typedef void vorbis_look_transform; typedef void vorbis_info_time; @@ -58,29 +57,29 @@ typedef struct vorbis_info_psy{ int smoothp; int noisecullp; - double noisecull_barkwidth; + float noisecull_barkwidth; - double ath_adjatt; - double ath_maxatt; + float ath_adjatt; + float ath_maxatt; /* 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 */ int tonemaskp; - double toneatt[P_BANDS][P_LEVELS]; + float toneatt[P_BANDS][P_LEVELS]; int peakattp; - double peakatt[P_BANDS][P_LEVELS]; + float peakatt[P_BANDS][P_LEVELS]; int noisemaskp; - double noiseatt[P_BANDS][P_LEVELS]; + float noiseatt[P_BANDS][P_LEVELS]; - double max_curve_dB; + float max_curve_dB; /* decay setup */ - double attack_coeff; - double decay_coeff; + float attack_coeff; + float decay_coeff; } vorbis_info_psy; /* vorbis_info contains all the setup information specific to the @@ -145,86 +144,11 @@ typedef struct vorbis_info{ /* for block long/sort tuning; encode only */ int envelopesa; - double preecho_thresh; - double preecho_clamp; - double preecho_minenergy; + float preecho_thresh; + float preecho_clamp; + float preecho_minenergy; } vorbis_info; -/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ - -typedef struct { - unsigned char *header; - long header_len; - unsigned char *body; - long body_len; -} ogg_page; - -/* ogg_stream_state contains the current encode/decode state of a logical - Ogg bitstream **********************************************************/ - -typedef struct { - unsigned char *body_data; /* bytes from packet bodies */ - long body_storage; /* storage elements allocated */ - long body_fill; /* elements stored; fill mark */ - long body_returned; /* elements of fill returned */ - - - int *lacing_vals; /* The values that will go to the segment table */ - ogg_int64_t *pcm_vals; /* pcm_pos values for headers. Not compact - this way, but it is simple coupled to the - lacing fifo */ - long lacing_storage; - long lacing_fill; - long lacing_packet; - long lacing_returned; - - unsigned char header[282]; /* working space for header encode */ - int header_fill; - - int e_o_s; /* set when we have buffered the last packet in the - logical bitstream */ - int b_o_s; /* set after we've written the initial page - of a logical bitstream */ - long serialno; - int pageno; - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ - ogg_int64_t pcmpos; - -} ogg_stream_state; - -/* ogg_packet is used to encapsulate the data and metadata belonging - to a single raw Ogg/Vorbis packet *************************************/ - -typedef struct { - unsigned char *packet; - long bytes; - long b_o_s; - long e_o_s; - - ogg_int64_t frameno; - ogg_int64_t packetno; /* sequence number for decode; the framing - knows where there's a hole in the data, - but we need coupling so that the codec - (which is in a seperate abstraction - layer) also knows about the gap */ - -} ogg_packet; - -typedef struct { - unsigned char *data; - int storage; - int fill; - int returned; - - int unsynced; - int headerbytes; - int bodybytes; -} ogg_sync_state; - /* vorbis_dsp_state buffers the current vorbis audio analysis/synthesis state. The DSP state belongs to a specific logical bitstream ****************************************************/ @@ -233,8 +157,8 @@ typedef struct vorbis_dsp_state{ vorbis_info *vi; int modebits; - double **pcm; - double **pcmret; + float **pcm; + float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; @@ -247,7 +171,7 @@ typedef struct vorbis_dsp_state{ long nW; long centerW; - ogg_int64_t frameno; + ogg_int64_t granulepos; ogg_int64_t sequence; ogg_int64_t glue_bits; @@ -257,7 +181,7 @@ typedef struct vorbis_dsp_state{ /* local lookup storage */ void *ve; /* envelope lookup */ - double **window[2][2][2]; /* block, leadin, leadout, type */ + float **window[2][2][2]; /* block, leadin, leadout, type */ vorbis_look_transform **transform[2]; /* block, type */ codebook *fullbooks; /* backend lookups are tied to the mode, not the backend or naked mapping */ @@ -285,7 +209,7 @@ struct alloc_chain{ typedef struct vorbis_block{ /* necessary stream state for linking to the framing abstraction */ - double **pcm; /* this is a pointer into local storage */ + float **pcm; /* this is a pointer into local storage */ oggpack_buffer opb; long lW; @@ -295,7 +219,7 @@ typedef struct vorbis_block{ int mode; int eofflag; - ogg_int64_t frameno; + ogg_int64_t granulepos; ogg_int64_t sequence; vorbis_dsp_state *vd; /* For read-only access of configuration */ @@ -348,42 +272,6 @@ typedef struct vorbis_comment{ packetization aren't necessary as they're provided by the transport and the streaming layer is not used */ -/* OggSquish BITSREAM PRIMITIVES: encoding **************************/ - -extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); -extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); - -/* OggSquish BITSREAM PRIMITIVES: decoding **************************/ - -extern int ogg_sync_init(ogg_sync_state *oy); -extern int ogg_sync_clear(ogg_sync_state *oy); -extern int ogg_sync_destroy(ogg_sync_state *oy); -extern int ogg_sync_reset(ogg_sync_state *oy); - -extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); -extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); -extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); -extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); -extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); - -/* OggSquish BITSREAM PRIMITIVES: general ***************************/ - -extern int ogg_stream_init(ogg_stream_state *os,int serialno); -extern int ogg_stream_clear(ogg_stream_state *os); -extern int ogg_stream_reset(ogg_stream_state *os); -extern int ogg_stream_destroy(ogg_stream_state *os); -extern int ogg_stream_eof(ogg_stream_state *os); - -extern int ogg_page_version(ogg_page *og); -extern int ogg_page_continued(ogg_page *og); -extern int ogg_page_bos(ogg_page *og); -extern int ogg_page_eos(ogg_page *og); -extern ogg_int64_t ogg_page_frameno(ogg_page *og); -extern int ogg_page_serialno(ogg_page *og); -extern int ogg_page_pageno(ogg_page *og); - /* Vorbis PRIMITIVES: general ***************************************/ extern void vorbis_info_init(vorbis_info *vi); @@ -408,7 +296,7 @@ extern int vorbis_analysis_headerout(vorbis_dsp_state *v, ogg_packet *op, ogg_packet *op_comm, ogg_packet *op_code); -extern double **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); +extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); @@ -420,7 +308,7 @@ extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); -extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,double ***pcm); +extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); #ifdef __cplusplus diff --git a/include/vorbis/mode_D.h b/include/vorbis/mode_D.h index 9588fb7..c04e94d 100644 --- a/include/vorbis/mode_D.h +++ b/include/vorbis/mode_D.h @@ -12,7 +12,7 @@ ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_D.h,v 1.4 2000/09/01 07:49:52 msmith Exp $ + last mod: $Id: mode_D.h,v 1.5 2000/10/12 03:12:41 xiphmont Exp $ ********************************************************************/ diff --git a/include/vorbis/mode_E.h b/include/vorbis/mode_E.h index fc8d4a8..6e1c6cc 100644 --- a/include/vorbis/mode_E.h +++ b/include/vorbis/mode_E.h @@ -12,7 +12,7 @@ ******************************************************************** function: predefined encoding modes - last mod: $Id: mode_E.h,v 1.2 2000/09/01 07:49:53 msmith Exp $ + last mod: $Id: mode_E.h,v 1.3 2000/10/12 03:12:41 xiphmont Exp $ ********************************************************************/ diff --git a/include/vorbis/os_types.h.in b/include/vorbis/os_types.h.in deleted file mode 100644 index f4638a6..0000000 --- a/include/vorbis/os_types.h.in +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _OS_TYPES_H -#define _OS_TYPES_H -/******************************************************************** - * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * - * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * - * PLEASE READ THESE TERMS DISTRIBUTING. * - * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty and The XIPHOPHORUS Company * - * http://www.xiph.org/ * - * * - ******************************************************************** - - function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h.in,v 1.3 2000/08/30 07:09:46 xiphmont Exp $ - - ********************************************************************/ - -#if defined (_WIN32) -#if !defined(__GNUC__) - -/* MSVC/Borland */ -typedef __int64 ogg_int64_t; -typedef __int32 ogg_int32_t; -typedef unsigned __int32 ogg_uint32_t; -typedef __int16 ogg_int16_t; - -#else - -/* Cygwin */ -#include <_G_config.h> -typedef _G_int64_t ogg_int64_t; -typedef _G_int32_t ogg_int32_t; -typedef unsigned _G_int32_t ogg_uint32_t; -typedef _G_int16_t ogg_int16_t; -#endif -#else - -#ifdef __BEOS__ -/* Be */ -#include -#endif - -#include - -/* filled in by configure */ -typedef @SIZE16@ ogg_int16_t; -typedef @SIZE32@ ogg_int32_t; -typedef @USIZE32@ ogg_uint32_t; -typedef @SIZE64@ ogg_int64_t; - -#endif - -#endif - diff --git a/include/vorbis/vorbisfile.h b/include/vorbis/vorbisfile.h index 854972a..001689b 100644 --- a/include/vorbis/vorbisfile.h +++ b/include/vorbis/vorbisfile.h @@ -12,7 +12,7 @@ ******************************************************************** function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h,v 1.7 2000/08/30 06:09:21 xiphmont Exp $ + last mod: $Id: vorbisfile.h,v 1.8 2000/10/12 03:12:41 xiphmont Exp $ ********************************************************************/ diff --git a/install.sh b/install.sh deleted file mode 100644 index e69de29..0000000 diff --git a/lib/.cvsignore b/lib/.cvsignore new file mode 100644 index 0000000..0839b71 --- /dev/null +++ b/lib/.cvsignore @@ -0,0 +1,6 @@ +*.la +*.lo +.libs +.deps +Makefile +Makefile.in diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000..50fd60a --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,24 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include + +lib_LTLIBRARIES = libvorbis.la libvorbisfile.la + +libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c lpc.c\ + analysis.c synthesis.c psy.c info.c time0.c floor0.c\ + res0.c mapping0.c registry.c codebook.c sharedbook.c\ + iir.c\ + envelope.h lpc.h lsp.h bookinternal.h misc.h psy.h\ + masking.h sharedbook.h iir.h os.h +libvorbis_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@ + +libvorbisfile_la_SOURCES = vorbisfile.c +libvorbisfile_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@ + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/lib/Makefile.in b/lib/Makefile.in index 160ae16..d52d8c7 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,100 +1,371 @@ -# vorbis makefile configured for use with gcc on any platform -# $Id: Makefile.in,v 1.34 2000/08/30 06:09:21 xiphmont Exp $ - -############################################################################### -# # -# To build a production vorbis (preferrably using gmake), just type 'make'. # -# To build with debugging or profiling information, use 'make debug' or # -# 'make profile' respectively. 'make clean' is a good idea between builds # -# with different target names, or before a final build. # -# # -############################################################################### - - -# DO NOT EDIT BELOW! ########################################################## -# (unless, of course, you know what you are doing :) ########################## - -@SET_MAKE@ -FLAGS=-I. -I../include @CFLAGS@ -OPT=@OPT@ $(FLAGS) -DEBUG=@DEBUG@ $(FLAGS) -PROFILE=@PROFILE@ $(FLAGS) -CC=@CC@ -LD=@CC@ -LDFLAGS=@LDFLAGS@ $(FLAGS) -AR=@AR@ -RANLIB=@RANLIB@ -LIBS=@LIBS@ - -HFILES = ../include/vorbis/codec.h \ - ../include/vorbis/internal.h ../include/vorbis/backends.h \ - ../include/vorbis/codebook.h \ - bitwise.h envelope.h lpc.h lsp.h bookinternal.h misc.h\ - psy.h smallft.h window.h scales.h os.h mdct.h registry.h\ - masking.h sharedbook.h iir.h -LFILES = framing.o mdct.o smallft.o block.o envelope.o window.o\ - lsp.o lpc.o analysis.o synthesis.o psy.o info.o bitwise.o\ - time0.o floor0.o res0.o mapping0.o registry.o\ - codebook.o sharedbook.o iir.o -VF_HFILES = ../include/vorbis/vorbisfile.h ../include/vorbis/codec.h \ - ../include/vorbis/internal.h ../include/vorbis/codebook.h \ - os.h misc.h -VF_LFILES = vorbisfile.o - -PSY_FILES = mdct.o psy.o lpc.o smallft.o window.o psytune.o floor0.o \ - bitwise.o lsp.o codebook.o sharedbook.o - -all: - $(MAKE) target CFLAGS="$(OPT)" - -debug: - $(MAKE) target CFLAGS="$(DEBUG)" - -analysis: - $(MAKE) target CFLAGS="$(DEBUG) -DANALYSIS" - -profile: - $(MAKE) target CFLAGS="$(PROFILE)" - -target: libvorbis.a vorbisfile.a psytune - -selftest: - $(MAKE) clean - $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST framing.c -o test_framing - $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST bitwise.c\ - -o test_bitwise $(LIBS) - $(CC) $(DEBUG) $(LDFLAGS) -c bitwise.c - $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST sharedbook.c\ - -o test_sharedbook $(LIBS) - $(CC) $(DEBUG) $(LDFLAGS) -c sharedbook.c - $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST codebook.c \ - sharedbook.o bitwise.o -o test_codebook $(LIBS) - @echo - @./test_framing - @./test_bitwise - @./test_sharedbook - @./test_codebook - -libvorbis.a: $(LFILES) - $(AR) -r libvorbis.a $(LFILES) - $(RANLIB) libvorbis.a - -vorbisfile.a: $(VF_LFILES) - $(AR) -r vorbisfile.a $(VF_LFILES) - $(RANLIB) vorbisfile.a - -psytune: $(PSY_FILES) - $(CC) $(CFLAGS) $(LDFLAGS) $(PSY_FILES) -o $@ $(LIBS) - -$(LFILES): $(HFILES) -$(VF_LFILES): $(VF_HFILES) - -.c.o: - $(CC) $(CFLAGS) -c $< - -clean: - -rm -f *.o *.a test* *~ *.out ogg config.* tone psytune - -distclean: clean - -rm -f Makefile +# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CC = @CC@ +DEBUG = @DEBUG@ +DLLTOOL = @DLLTOOL@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +PROFILE = @PROFILE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +VF_LIB_AGE = @VF_LIB_AGE@ +VF_LIB_CURRENT = @VF_LIB_CURRENT@ +VF_LIB_REVISION = @VF_LIB_REVISION@ +V_LIB_AGE = @V_LIB_AGE@ +V_LIB_CURRENT = @V_LIB_CURRENT@ +V_LIB_REVISION = @V_LIB_REVISION@ +pthread_lib = @pthread_lib@ + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include + +lib_LTLIBRARIES = libvorbis.la libvorbisfile.la + +libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c lpc.c analysis.c synthesis.c psy.c info.c time0.c floor0.c res0.c mapping0.c registry.c codebook.c sharedbook.c iir.c envelope.h lpc.h lsp.h bookinternal.h misc.h psy.h masking.h sharedbook.h iir.h os.h + +libvorbis_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@ + +libvorbisfile_la_SOURCES = vorbisfile.c +libvorbisfile_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@ +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +libvorbis_la_LIBADD = +libvorbis_la_OBJECTS = mdct.lo smallft.lo block.lo envelope.lo \ +window.lo lsp.lo lpc.lo analysis.lo synthesis.lo psy.lo info.lo \ +time0.lo floor0.lo res0.lo mapping0.lo registry.lo codebook.lo \ +sharedbook.lo iir.lo +libvorbisfile_la_LIBADD = +libvorbisfile_la_OBJECTS = vorbisfile.lo +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +DEP_FILES = .deps/analysis.P .deps/block.P .deps/codebook.P \ +.deps/envelope.P .deps/floor0.P .deps/iir.P .deps/info.P .deps/lpc.P \ +.deps/lsp.P .deps/mapping0.P .deps/mdct.P .deps/psy.P .deps/registry.P \ +.deps/res0.P .deps/sharedbook.P .deps/smallft.P .deps/synthesis.P \ +.deps/time0.P .deps/vorbisfile.P .deps/window.P +SOURCES = $(libvorbis_la_SOURCES) $(libvorbisfile_la_SOURCES) +OBJECTS = $(libvorbis_la_OBJECTS) $(libvorbisfile_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLTLIBRARIES: + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + +distclean-libLTLIBRARIES: + +maintainer-clean-libLTLIBRARIES: + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libvorbis.la: $(libvorbis_la_OBJECTS) $(libvorbis_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libvorbis_la_LDFLAGS) $(libvorbis_la_OBJECTS) $(libvorbis_la_LIBADD) $(LIBS) + +libvorbisfile.la: $(libvorbisfile_la_OBJECTS) $(libvorbisfile_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libvorbisfile_la_LDFLAGS) $(libvorbisfile_la_OBJECTS) $(libvorbisfile_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = lib + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign lib/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-libLTLIBRARIES +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-libLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ +clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ +uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/analysis.c b/lib/analysis.c index e24a66b..2cc2be8 100644 --- a/lib/analysis.c +++ b/lib/analysis.c @@ -12,15 +12,15 @@ ******************************************************************** function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c,v 1.33 2000/08/15 09:09:42 xiphmont Exp $ + last mod: $Id: analysis.c,v 1.34 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ #include #include #include +#include #include "vorbis/codec.h" -#include "bitwise.h" #include "registry.h" #include "scales.h" #include "os.h" @@ -38,9 +38,9 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){ vb->res_bits=0; /* first things first. Make sure encode is ready */ - _oggpack_reset(&vb->opb); + oggpack_reset(&vb->opb); /* Encode the packet type */ - _oggpack_write(&vb->opb,0,1); + oggpack_write(&vb->opb,0,1); /* currently lazy. Short block dispatches to 0, long to 1. */ @@ -49,32 +49,32 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){ vb->mode=mode; /* Encode frame mode, pre,post windowsize, then dispatch */ - _oggpack_write(&vb->opb,mode,vd->modebits); + oggpack_write(&vb->opb,mode,vd->modebits); if(vb->W){ - _oggpack_write(&vb->opb,vb->lW,1); - _oggpack_write(&vb->opb,vb->nW,1); - /*fprintf(stderr,"*"); - }else{ - fprintf(stderr,".");*/ - } + oggpack_write(&vb->opb,vb->lW,1); + oggpack_write(&vb->opb,vb->nW,1); + /*fprintf(stderr,"*");*/ + }/*else{ + fprintf(stderr,"."); + }*/ if(_mapping_P[type]->forward(vb,vd->mode[mode])) return(-1); /* set up the packet wrapper */ - op->packet=_oggpack_buffer(&vb->opb); - op->bytes=_oggpack_bytes(&vb->opb); + op->packet=oggpack_get_buffer(&vb->opb); + op->bytes=oggpack_bytes(&vb->opb); op->b_o_s=0; op->e_o_s=vb->eofflag; - op->frameno=vb->frameno; + op->granulepos=vb->granulepos; op->packetno=vb->sequence; /* for sake of completeness */ return(0); } /* there was no great place to put this.... */ -void _analysis_output(char *base,int i,double *v,int n,int bark,int dB){ +void _analysis_output(char *base,int i,float *v,int n,int bark,int dB){ #ifdef ANALYSIS int j; FILE *of; diff --git a/lib/bitwise.c b/lib/bitwise.c deleted file mode 100644 index 1655708..0000000 --- a/lib/bitwise.c +++ /dev/null @@ -1,410 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * - * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * - * PLEASE READ THESE TERMS DISTRIBUTING. * - * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty and The XIPHOPHORUS Company * - * http://www.xiph.org/ * - * * - ******************************************************************** - - function: packing variable sized words into an octet stream - last mod: $Id: bitwise.c,v 1.12 2000/07/07 01:41:43 xiphmont Exp $ - - ********************************************************************/ - -/* We're 'LSb' endian; if we write a word but read individual bits, - then we'll read the lsb first */ - -#include -#include -#include "bitwise.h" -#include "misc.h" -#include "os.h" - -#define BUFFER_INCREMENT 256 - -static unsigned long mask[]= -{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, - 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, - 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, - 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff, - 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff, - 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff, - 0x3fffffff,0x7fffffff,0xffffffff }; - -void _oggpack_writeinit(oggpack_buffer *b){ - memset(b,0,sizeof(oggpack_buffer)); - b->ptr=b->buffer=malloc(BUFFER_INCREMENT); - b->buffer[0]='\0'; - b->storage=BUFFER_INCREMENT; -} - -void _oggpack_reset(oggpack_buffer *b){ - b->ptr=b->buffer; - b->buffer[0]=0; - b->endbit=b->endbyte=0; -} - -void _oggpack_writeclear(oggpack_buffer *b){ - free(b->buffer); - memset(b,0,sizeof(oggpack_buffer)); -} - -void _oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){ - memset(b,0,sizeof(oggpack_buffer)); - b->buffer=b->ptr=buf; - b->storage=bytes; -} - -/* Takes only up to 32 bits. */ -void _oggpack_write(oggpack_buffer *b,unsigned long value,int bits){ - if(b->endbyte+4>=b->storage){ - b->buffer=realloc(b->buffer,b->storage+BUFFER_INCREMENT); - b->storage+=BUFFER_INCREMENT; - b->ptr=b->buffer+b->endbyte; - } - - value&=mask[bits]; - bits+=b->endbit; - - b->ptr[0]|=value<endbit; - - if(bits>=8){ - b->ptr[1]=value>>(8-b->endbit); - if(bits>=16){ - b->ptr[2]=value>>(16-b->endbit); - if(bits>=24){ - b->ptr[3]=value>>(24-b->endbit); - if(bits>=32){ - if(b->endbit) - b->ptr[4]=value>>(32-b->endbit); - else - b->ptr[4]=0; - } - } - } - } - - b->endbyte+=bits/8; - b->ptr+=bits/8; - b->endbit=bits&7; -} - -/* Read in bits without advancing the bitptr; bits <= 32 */ -long _oggpack_look(oggpack_buffer *b,int bits){ - unsigned long ret; - unsigned long m=mask[bits]; - - bits+=b->endbit; - - if(b->endbyte+4>=b->storage){ - /* not the main path */ - if(b->endbyte+(bits-1)/8>=b->storage)return(-1); - } - - ret=b->ptr[0]>>b->endbit; - if(bits>8){ - ret|=b->ptr[1]<<(8-b->endbit); - if(bits>16){ - ret|=b->ptr[2]<<(16-b->endbit); - if(bits>24){ - ret|=b->ptr[3]<<(24-b->endbit); - if(bits>32 && b->endbit) - ret|=b->ptr[4]<<(32-b->endbit); - } - } - } - return(m&ret); -} - -long _oggpack_look1(oggpack_buffer *b){ - if(b->endbyte>=b->storage)return(-1); - return((b->ptr[0]>>b->endbit)&1); -} - -void _oggpack_adv(oggpack_buffer *b,int bits){ - bits+=b->endbit; - b->ptr+=bits/8; - b->endbyte+=bits/8; - b->endbit=bits&7; -} - -void _oggpack_adv1(oggpack_buffer *b){ - if(++(b->endbit)>7){ - b->endbit=0; - b->ptr++; - b->endbyte++; - } -} - -/* bits <= 32 */ -long _oggpack_read(oggpack_buffer *b,int bits){ - unsigned long ret; - unsigned long m=mask[bits]; - - bits+=b->endbit; - - if(b->endbyte+4>=b->storage){ - /* not the main path */ - ret=-1; - if(b->endbyte+(bits-1)/8>=b->storage)goto overflow; - } - - ret=b->ptr[0]>>b->endbit; - if(bits>8){ - ret|=b->ptr[1]<<(8-b->endbit); - if(bits>16){ - ret|=b->ptr[2]<<(16-b->endbit); - if(bits>24){ - ret|=b->ptr[3]<<(24-b->endbit); - if(bits>32 && b->endbit){ - ret|=b->ptr[4]<<(32-b->endbit); - } - } - } - } - ret&=m; - - overflow: - - b->ptr+=bits/8; - b->endbyte+=bits/8; - b->endbit=bits&7; - return(ret); -} - -long _oggpack_read1(oggpack_buffer *b){ - unsigned long ret; - - if(b->endbyte>=b->storage){ - /* not the main path */ - ret=-1; - goto overflow; - } - - ret=(b->ptr[0]>>b->endbit)&1; - - overflow: - - b->endbit++; - if(b->endbit>7){ - b->endbit=0; - b->ptr++; - b->endbyte++; - } - return(ret); -} - -long _oggpack_bytes(oggpack_buffer *b){ - return(b->endbyte+(b->endbit+7)/8); -} - -long _oggpack_bits(oggpack_buffer *b){ - return(b->endbyte*8+b->endbit); -} - -unsigned char *_oggpack_buffer(oggpack_buffer *b){ - return(b->buffer); -} - -/* Self test of the bitwise routines; everything else is based on - them, so they damned well better be solid. */ - -#ifdef _V_SELFTEST -#include - -static int ilog(unsigned int v){ - int ret=0; - while(v){ - ret++; - v>>=1; - } - return(ret); -} - -oggpack_buffer o; -oggpack_buffer r; - -void report(char *in){ - fprintf(stderr,"%s",in); - exit(1); -} - -void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){ - long bytes,i; - unsigned char *buffer; - - _oggpack_reset(&o); - for(i=0;i and The XIPHOPHORUS Company * - * http://www.xiph.org/ * - * * - ******************************************************************** - - function: packing variable sized words into an octet stream - last mod: $Id: bitwise.h,v 1.6 2000/07/07 01:41:43 xiphmont Exp $ - - ********************************************************************/ - -#ifndef _V_BITW_H_ -#define _V_BITW_H_ - -#include "vorbis/codec.h" - -extern void _oggpack_writeinit(oggpack_buffer *b); -extern void _oggpack_reset(oggpack_buffer *b); -extern void _oggpack_writeclear(oggpack_buffer *b); -extern void _oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); -extern void _oggpack_write(oggpack_buffer *b,unsigned long value,int bits); -extern long _oggpack_look(oggpack_buffer *b,int bits); -extern long _oggpack_look1(oggpack_buffer *b); -extern void _oggpack_adv(oggpack_buffer *b,int bits); -extern void _oggpack_adv1(oggpack_buffer *b); -extern long _oggpack_read(oggpack_buffer *b,int bits); -extern long _oggpack_read1(oggpack_buffer *b); -extern long _oggpack_bytes(oggpack_buffer *b); -extern long _oggpack_bits(oggpack_buffer *b); -extern unsigned char *_oggpack_buffer(oggpack_buffer *b); - -#endif diff --git a/lib/block.c b/lib/block.c index 7e53406..e71bf5d 100644 --- a/lib/block.c +++ b/lib/block.c @@ -12,7 +12,7 @@ ******************************************************************** function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c,v 1.38 2000/08/27 07:59:19 msmith Exp $ + last mod: $Id: block.c,v 1.39 2000/10/12 03:12:52 xiphmont Exp $ Handle windowing, overlap-add, etc of the PCM vectors. This is made more amusing by Vorbis' current two allowed block sizes. @@ -26,13 +26,13 @@ #include #include #include +#include #include "vorbis/codec.h" #include "window.h" #include "envelope.h" #include "mdct.h" #include "lpc.h" -#include "bitwise.h" #include "registry.h" #include "sharedbook.h" #include "bookinternal.h" @@ -98,7 +98,7 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ vb->localalloc=0; vb->localstore=NULL; if(v->analysisp) - _oggpack_writeinit(&vb->opb); + oggpack_writeinit(&vb->opb); return(0); } @@ -152,7 +152,7 @@ void _vorbis_block_ripcord(vorbis_block *vb){ int vorbis_block_clear(vorbis_block *vb){ if(vb->vd) if(vb->vd->analysisp) - _oggpack_writeclear(&vb->opb); + oggpack_writeclear(&vb->opb); _vorbis_block_ripcord(vb); if(vb->localstore)free(vb->localstore); @@ -181,14 +181,14 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ mdct_init(v->transform[0][0],vi->blocksizes[0]); mdct_init(v->transform[1][0],vi->blocksizes[1]); - v->window[0][0][0]=calloc(VI_WINDOWB,sizeof(double *)); + v->window[0][0][0]=calloc(VI_WINDOWB,sizeof(float *)); v->window[0][0][1]=v->window[0][0][0]; v->window[0][1][0]=v->window[0][0][0]; v->window[0][1][1]=v->window[0][0][0]; - v->window[1][0][0]=calloc(VI_WINDOWB,sizeof(double *)); - v->window[1][0][1]=calloc(VI_WINDOWB,sizeof(double *)); - v->window[1][1][0]=calloc(VI_WINDOWB,sizeof(double *)); - v->window[1][1][1]=calloc(VI_WINDOWB,sizeof(double *)); + v->window[1][0][0]=calloc(VI_WINDOWB,sizeof(float *)); + v->window[1][0][1]=calloc(VI_WINDOWB,sizeof(float *)); + v->window[1][1][0]=calloc(VI_WINDOWB,sizeof(float *)); + v->window[1][1][1]=calloc(VI_WINDOWB,sizeof(float *)); for(i=0;iwindow[0][0][0][i]= @@ -222,12 +222,12 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ v->pcm_storage=8192; /* we'll assume later that we have a minimum of twice the blocksize of accumulated samples in analysis */ - v->pcm=malloc(vi->channels*sizeof(double *)); - v->pcmret=malloc(vi->channels*sizeof(double *)); + v->pcm=malloc(vi->channels*sizeof(float *)); + v->pcmret=malloc(vi->channels*sizeof(float *)); { int i; for(i=0;ichannels;i++) - v->pcm[i]=calloc(v->pcm_storage,sizeof(double)); + v->pcm[i]=calloc(v->pcm_storage,sizeof(float)); } /* all 1 (large block) or 0 (small block) */ @@ -328,7 +328,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ } } -double **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ +float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ int i; vorbis_info *vi=v->vi; @@ -344,7 +344,7 @@ double **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ v->pcm_storage=v->pcm_current+vals*2; for(i=0;ichannels;i++){ - v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(double)); + v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float)); } } @@ -357,8 +357,8 @@ double **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ static void _preextrapolate_helper(vorbis_dsp_state *v){ int i; int order=32; - double *lpc=alloca(order*sizeof(double)); - double *work=alloca(v->pcm_current*sizeof(double)); + float *lpc=alloca(order*sizeof(float)); + float *work=alloca(v->pcm_current*sizeof(float)); long j; v->preextrapolate=1; @@ -391,7 +391,7 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ if(vals<=0){ int order=32; int i; - double *lpc=alloca(order*sizeof(double)); + float *lpc=alloca(order*sizeof(float)); /* if it wasn't done earlier (very short sample) */ if(!v->preextrapolate) @@ -425,7 +425,7 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ guarding the overlap, but bulletproof in case that assumtion goes away). zeroes will do. */ memset(v->pcm[i]+v->eofflag,0, - (v->pcm_current-v->eofflag)*sizeof(double)); + (v->pcm_current-v->eofflag)*sizeof(float)); } } @@ -512,15 +512,15 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ } vb->vd=v; vb->sequence=v->sequence; - vb->frameno=v->frameno; + vb->granulepos=v->granulepos; vb->pcmend=vi->blocksizes[v->W]; /* copy the vectors; this uses the local storage in vb */ { - vb->pcm=_vorbis_block_alloc(vb,sizeof(double *)*vi->channels); + vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels); for(i=0;ichannels;i++){ - vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(double)); - memcpy(vb->pcm[i],v->pcm[i]+beginW,vi->blocksizes[v->W]*sizeof(double)); + vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float)); + memcpy(vb->pcm[i],v->pcm[i]+beginW,vi->blocksizes[v->W]*sizeof(float)); } } @@ -546,7 +546,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ for(i=0;ichannels;i++) memmove(v->pcm[i],v->pcm[i]+movementW, - v->pcm_current*sizeof(double)); + v->pcm_current*sizeof(float)); v->lW=v->W; @@ -559,12 +559,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ v->eofflag-=movementW; /* do not add padding to end of stream! */ if(v->centerW>=v->eofflag){ - v->frameno+=movementW-(v->centerW-v->eofflag); + v->granulepos+=movementW-(v->centerW-v->eofflag); }else{ - v->frameno+=movementW; + v->granulepos+=movementW; } }else{ - v->frameno+=movementW; + v->granulepos+=movementW; } } @@ -578,13 +578,13 @@ int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ /* Adjust centerW to allow an easier mechanism for determining output */ v->pcm_returned=v->centerW; v->centerW-= vi->blocksizes[v->W]/4+vi->blocksizes[v->lW]/4; - v->frameno=-1; + v->granulepos=-1; v->sequence=-1; return(0); } -/* Unike in analysis, the window is only partially applied for each +/* Unlike in analysis, the window is only partially applied for each block. The time domain envelope is not yet handled at the point of calling (as it relies on the previous block). */ @@ -609,7 +609,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ int i; for(i=0;ichannels;i++) memmove(v->pcm[i],v->pcm[i]+shiftPCM, - v->pcm_current*sizeof(double)); + v->pcm_current*sizeof(float)); } } @@ -622,7 +622,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ v->floor_bits+=vb->floor_bits; v->res_bits+=vb->res_bits; - if(v->sequence+1 != vb->sequence)v->frameno=-1; /* out of sequence; + if(v->sequence+1 != vb->sequence)v->granulepos=-1; /* out of sequence; lose count */ v->sequence=vb->sequence; @@ -642,7 +642,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ v->pcm_storage=endW+vi->blocksizes[1]; for(i=0;ichannels;i++) - v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(double)); + v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float)); } /* overlap/add PCM */ @@ -659,20 +659,21 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ } for(j=0;jchannels;j++){ - double *pcm=v->pcm[j]+beginW; - + float *pcm=v->pcm[j]+beginW; + float *p=vb->pcm[j]; + /* the overlap/add section */ for(i=beginSl;ipcm[j][i]; + pcm[i]+=p[i]; /* the remaining section */ for(;ipcm[j][i]; + pcm[i]=p[i]; } /* track the frame number... This is for convenience, but also making sure our last packet doesn't end with added padding. If the last packet is partial, the number of samples we'll have to - return will be past the vb->frameno. + return will be past the vb->granulepos. This is not foolproof! It will be confused if we begin decoding at the last page after a seek or hole. In that case, @@ -680,17 +681,17 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ is. For this reason, vorbisfile will always try to make sure it reads the last two marked pages in proper sequence */ - if(v->frameno==-1) - v->frameno=vb->frameno; + if(v->granulepos==-1) + v->granulepos=vb->granulepos; else{ - v->frameno+=(centerW-v->centerW); - if(vb->frameno!=-1 && v->frameno!=vb->frameno){ - if(v->frameno>vb->frameno && vb->eofflag){ + v->granulepos+=(centerW-v->centerW); + if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ + if(v->granulepos>vb->granulepos && vb->eofflag){ /* partial last frame. Strip the padding off */ - centerW-=(v->frameno-vb->frameno); + centerW-=(v->granulepos-vb->granulepos); }/* else{ Shouldn't happen *unless* the bitstream is out of spec. Either way, believe the bitstream } */ - v->frameno=vb->frameno; + v->granulepos=vb->granulepos; } } @@ -706,7 +707,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ } /* pcm==NULL indicates we just want the pending samples, no more */ -int vorbis_synthesis_pcmout(vorbis_dsp_state *v,double ***pcm){ +int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){ vorbis_info *vi=v->vi; if(v->pcm_returnedcenterW){ if(pcm){ diff --git a/lib/bookinternal.h b/lib/bookinternal.h index 72caec3..532838b 100644 --- a/lib/bookinternal.h +++ b/lib/bookinternal.h @@ -12,28 +12,30 @@ ******************************************************************** function: basic codebook pack/unpack/code/decode operations - last mod: $Id: bookinternal.h,v 1.8 2000/06/14 01:38:31 xiphmont Exp $ + last mod: $Id: bookinternal.h,v 1.9 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ #ifndef _V_INT_CODEBOOK_H_ #define _V_INT_CODEBOOK_H_ +#include #include "vorbis/codebook.h" -#include "bitwise.h" extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b); extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b); -extern int vorbis_book_errorv(codebook *book, double *a); -extern int vorbis_book_encodev(codebook *book, int best,double *a, +extern int vorbis_book_errorv(codebook *book, float *a); +extern int vorbis_book_encodev(codebook *book, int best,float *a, oggpack_buffer *b); -extern int vorbis_book_encodevs(codebook *book, double *a, oggpack_buffer *b, +extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b, int step,int stagetype); extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); -extern long vorbis_book_decodevs(codebook *book, double *a, oggpack_buffer *b, +extern long vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b, int step,int stagetype); +extern long s_vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b, + int step,int stagetype); #endif diff --git a/lib/codebook.c b/lib/codebook.c index b7b6f83..3e0bea6 100644 --- a/lib/codebook.c +++ b/lib/codebook.c @@ -12,16 +12,16 @@ ******************************************************************** function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c,v 1.17 2000/07/07 01:37:00 xiphmont Exp $ + last mod: $Id: codebook.c,v 1.18 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ #include #include #include +#include #include "vorbis/codec.h" #include "vorbis/codebook.h" -#include "bitwise.h" #include "scales.h" #include "sharedbook.h" #include "bookinternal.h" @@ -35,9 +35,9 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ int ordered=0; /* first the basic parameters */ - _oggpack_write(opb,0x564342,24); - _oggpack_write(opb,c->dim,16); - _oggpack_write(opb,c->entries,24); + oggpack_write(opb,0x564342,24); + oggpack_write(opb,c->dim,16); + oggpack_write(opb,c->entries,24); /* pack the codewords. There are two packings; length ordered and length random. Decide between the two now. */ @@ -52,25 +52,25 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ deterministically */ long count=0; - _oggpack_write(opb,1,1); /* ordered */ - _oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */ + oggpack_write(opb,1,1); /* ordered */ + oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */ for(i=1;ientries;i++){ long this=c->lengthlist[i]; long last=c->lengthlist[i-1]; if(this>last){ for(j=last;jentries-count)); + oggpack_write(opb,i-count,_ilog(c->entries-count)); count=i; } } } - _oggpack_write(opb,i-count,_ilog(c->entries-count)); + oggpack_write(opb,i-count,_ilog(c->entries-count)); }else{ /* length random. Again, we don't code the codeword itself, just the length. This time, though, we have to encode each length */ - _oggpack_write(opb,0,1); /* unordered */ + oggpack_write(opb,0,1); /* unordered */ /* algortihmic mapping has use for 'unused entries', which we tag here. The algorithmic mapping happens as usual, but the unused @@ -79,17 +79,17 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ if(c->lengthlist[i]==0)break; if(i==c->entries){ - _oggpack_write(opb,0,1); /* no unused entries */ + oggpack_write(opb,0,1); /* no unused entries */ for(i=0;ientries;i++) - _oggpack_write(opb,c->lengthlist[i]-1,5); + oggpack_write(opb,c->lengthlist[i]-1,5); }else{ - _oggpack_write(opb,1,1); /* we have unused entries; thus we tag */ + oggpack_write(opb,1,1); /* we have unused entries; thus we tag */ for(i=0;ientries;i++){ if(c->lengthlist[i]==0){ - _oggpack_write(opb,0,1); + oggpack_write(opb,0,1); }else{ - _oggpack_write(opb,1,1); - _oggpack_write(opb,c->lengthlist[i]-1,5); + oggpack_write(opb,1,1); + oggpack_write(opb,c->lengthlist[i]-1,5); } } } @@ -97,7 +97,7 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ /* is the entry number the desired return value, or do we have a mapping? If we have a mapping, what type? */ - _oggpack_write(opb,c->maptype,4); + oggpack_write(opb,c->maptype,4); switch(c->maptype){ case 0: /* no mapping */ @@ -112,10 +112,10 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ } /* values that define the dequantization */ - _oggpack_write(opb,c->q_min,32); - _oggpack_write(opb,c->q_delta,32); - _oggpack_write(opb,c->q_quant-1,4); - _oggpack_write(opb,c->q_sequencep,1); + oggpack_write(opb,c->q_min,32); + oggpack_write(opb,c->q_delta,32); + oggpack_write(opb,c->q_quant-1,4); + oggpack_write(opb,c->q_sequencep,1); { int quantvals; @@ -133,7 +133,7 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ /* quantized values */ for(i=0;iquantlist[i]),c->q_quant); + oggpack_write(opb,labs(c->quantlist[i]),c->q_quant); } break; @@ -152,26 +152,26 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ memset(s,0,sizeof(static_codebook)); /* make sure alignment is correct */ - if(_oggpack_read(opb,24)!=0x564342)goto _eofout; + if(oggpack_read(opb,24)!=0x564342)goto _eofout; /* first the basic parameters */ - s->dim=_oggpack_read(opb,16); - s->entries=_oggpack_read(opb,24); + s->dim=oggpack_read(opb,16); + s->entries=oggpack_read(opb,24); if(s->entries==-1)goto _eofout; /* codeword ordering.... length ordered or unordered? */ - switch(_oggpack_read(opb,1)){ + switch(oggpack_read(opb,1)){ case 0: /* unordered */ s->lengthlist=malloc(sizeof(long)*s->entries); /* allocated but unused entries? */ - if(_oggpack_read(opb,1)){ + if(oggpack_read(opb,1)){ /* yes, unused entries */ for(i=0;ientries;i++){ - if(_oggpack_read(opb,1)){ - long num=_oggpack_read(opb,5); + if(oggpack_read(opb,1)){ + long num=oggpack_read(opb,5); if(num==-1)goto _eofout; s->lengthlist[i]=num+1; }else @@ -180,7 +180,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ }else{ /* all entries used; no tagging */ for(i=0;ientries;i++){ - long num=_oggpack_read(opb,5); + long num=oggpack_read(opb,5); if(num==-1)goto _eofout; s->lengthlist[i]=num+1; } @@ -190,11 +190,11 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ case 1: /* ordered */ { - long length=_oggpack_read(opb,5)+1; + long length=oggpack_read(opb,5)+1; s->lengthlist=malloc(sizeof(long)*s->entries); for(i=0;ientries;){ - long num=_oggpack_read(opb,_ilog(s->entries-i)); + long num=oggpack_read(opb,_ilog(s->entries-i)); if(num==-1)goto _eofout; for(j=0;jlengthlist[i]=length; @@ -208,7 +208,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ } /* Do we have a mapping to unpack? */ - switch((s->maptype=_oggpack_read(opb,4))){ + switch((s->maptype=oggpack_read(opb,4))){ case 0: /* no mapping */ break; @@ -216,10 +216,10 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ /* implicitly populated value mapping */ /* explicitly populated value mapping */ - s->q_min=_oggpack_read(opb,32); - s->q_delta=_oggpack_read(opb,32); - s->q_quant=_oggpack_read(opb,4)+1; - s->q_sequencep=_oggpack_read(opb,1); + s->q_min=oggpack_read(opb,32); + s->q_delta=oggpack_read(opb,32); + s->q_quant=oggpack_read(opb,4)+1; + s->q_sequencep=oggpack_read(opb,1); { int quantvals; @@ -233,9 +233,9 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ } /* quantized values */ - s->quantlist=malloc(sizeof(double)*quantvals); + s->quantlist=malloc(sizeof(float)*quantvals); for(i=0;iquantlist[i]=_oggpack_read(opb,s->q_quant); + s->quantlist[i]=oggpack_read(opb,s->q_quant); if(s->quantlist[quantvals-1]==-1)goto _eofout; } @@ -255,7 +255,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ /* returns the number of bits ************************************************/ int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){ - _oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); + oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); return(book->c->lengthlist[a]); } @@ -268,13 +268,13 @@ and doesn't change. Residue0 encoding interleaves, uses multiple stages, and each stage peels of a specific amount of resolution from a lattice (thus we want -to match by threshhold, not nearest match). Residue doesn't *have* to +to match by threshold, not nearest match). Residue doesn't *have* to be encoded that way, but to change it, one will need to add more infrastructure on the encode side (decode side is specced and simpler) */ /* floor0 LSP (single stage, non interleaved, nearest match) */ /* returns entry number and *modifies a* to the quantization value *****/ -int vorbis_book_errorv(codebook *book,double *a){ +int vorbis_book_errorv(codebook *book,float *a){ int dim=book->dim,k; int best=_best(book,a,1); for(k=0;kdim; for(k=0;kvaluelist+best*dim)[k]; @@ -292,7 +292,7 @@ int vorbis_book_encodev(codebook *book,int best,double *a,oggpack_buffer *b){ /* res0 (multistage, interleave, lattice) */ /* returns the number of bits and *modifies a* to the remainder value ********/ -int vorbis_book_encodevs(codebook *book,double *a,oggpack_buffer *b, +int vorbis_book_encodevs(codebook *book,float *a,oggpack_buffer *b, int step,int addmul){ int best=vorbis_book_besterror(book,a,step,addmul); @@ -309,16 +309,25 @@ int vorbis_book_encodevs(codebook *book,double *a,oggpack_buffer *b, Cascades may be additive or multiplicitive; this is not inherent in the codebook, but set in the code using the codebook. Like interleaving, it's easiest to do it here. - stage==0 -> declarative (set the value) - stage==1 -> additive - stage==2 -> multiplicitive */ + addmul==0 -> declarative (set the value) + addmul==1 -> additive + addmul==2 -> multiplicitive */ /* returns the entry number or -1 on eof *************************************/ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ long ptr=0; decode_aux *t=book->decode_tree; + int lok = oggpack_look(b, t->tabn); + + if (lok >= 0) { + ptr = t->tab[lok]; + oggpack_adv(b, t->tabl[lok]); + if (ptr <= 0) + return -ptr; + } + do{ - switch(_oggpack_read1(b)){ + switch(oggpack_read1(b)){ case 0: ptr=t->ptr0[ptr]; break; @@ -333,26 +342,78 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ } /* returns the entry number or -1 on eof *************************************/ -long vorbis_book_decodevs(codebook *book,double *a,oggpack_buffer *b, +long vorbis_book_decodevs(codebook *book,float *a,oggpack_buffer *b, int step,int addmul){ long entry=vorbis_book_decode(book,b); int i,o; + float *t; if(entry==-1)return(-1); + t = book->valuelist+entry*book->dim; + switch(addmul){ + case -1: + for(i=0,o=0;idim-3;i+=4,o+=4*step) { + a[o]=t[i]; + a[o+step]=t[i+1]; + a[o+2*step]=t[i+2]; + a[o+3*step]=t[i+3]; + } + for(;idim;i++,o+=step) + a[o]=t[i]; + break; + case 0: + for(i=0,o=0;idim-3;i+=4,o+=4*step) { + a[o]+=t[i]; + a[o+step]+=t[i+1]; + a[o+2*step]+=t[i+2]; + a[o+3*step]+=t[i+3]; + } + for(;idim;i++,o+=step) + a[o]+=t[i]; + break; + case 1: + for(i=0,o=0;idim-3;i+=4,o+=4*step) { + a[o]*=t[i]; + a[o+step]*=t[i+1]; + a[o+2*step]*=t[i+2]; + a[o+3*step]*=t[i+3]; + } + for(;idim;i++,o+=step) + a[o]*=t[i]; + break; + } + return(entry); +} + +/* returns 0 on OK or -1 on eof *************************************/ +long s_vorbis_book_decodevs(codebook *book,float *a,oggpack_buffer *b, + int step,int addmul){ + long *entry = alloca(sizeof(long)*step); + float **t = alloca(sizeof(float)*step); + int i,j,o; + + for (i = 0; i < step; i++) { + entry[i]=vorbis_book_decode(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; + } switch(addmul){ case -1: for(i=0,o=0;idim;i++,o+=step) - a[o]=(book->valuelist+entry*book->dim)[i]; + for (j=0;jdim;i++,o+=step) - a[o]+=(book->valuelist+entry*book->dim)[i]; + for (j=0;jdim;i++,o+=step) - a[o]*=(book->valuelist+entry*book->dim)[i]; + for (j=0;j #include #include +#include #include "vorbis/codec.h" #include "os.h" #include "scales.h" #include "envelope.h" -#include "bitwise.h" #include "misc.h" /* We use a Chebyshev bandbass for the preecho trigger bandpass; it's @@ -40,9 +40,9 @@ #if 0 static int cheb_bandpass_stages=10; -static double cheb_bandpass_gain=5.589612458e+01; -static double cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1}; -static double cheb_bandpass_A[]={ +static float cheb_bandpass_gain=5.589612458e+01; +static float cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1}; +static float cheb_bandpass_A[]={ -0.1917409386, 0.0078657069, -0.7126903444, @@ -56,10 +56,10 @@ static double cheb_bandpass_A[]={ #endif static int cheb_highpass_stages=10; -static double cheb_highpass_gain= 5.291963434e+01; +static float cheb_highpass_gain= 5.291963434e+01; /* z^-stage, z^-stage+1... */ -static double cheb_highpass_B[]={1,-10,45,-120,210,-252,210,-120,45,-10,1}; -static double cheb_highpass_A[]={ +static float cheb_highpass_B[]={1,-10,45,-120,210,-252,210,-120,45,-10,1}; +static float cheb_highpass_A[]={ -0.1247628029, 0.1334086523, -0.3997715614, @@ -78,17 +78,17 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ e->winlength=window; e->minenergy=fromdB(vi->preecho_minenergy); e->iir=calloc(ch,sizeof(IIR_state)); - e->filtered=calloc(ch,sizeof(double *)); + e->filtered=calloc(ch,sizeof(float *)); e->ch=ch; e->storage=128; for(i=0;iiir+i,cheb_highpass_stages,cheb_highpass_gain, cheb_highpass_A,cheb_highpass_B); - e->filtered[i]=calloc(e->storage,sizeof(double)); + e->filtered[i]=calloc(e->storage,sizeof(float)); } drft_init(&e->drft,window); - e->window=malloc(e->winlength*sizeof(double)); + e->window=malloc(e->winlength*sizeof(float)); /* We just use a straight sin(x) window for this */ for(i=0;iwinlength;i++) e->window[i]=sin((i+.5)/e->winlength*M_PI); @@ -106,25 +106,25 @@ void _ve_envelope_clear(envelope_lookup *e){ memset(e,0,sizeof(envelope_lookup)); } -static double _ve_deltai(envelope_lookup *ve,IIR_state *iir, - double *pre,double *post){ +static float _ve_deltai(envelope_lookup *ve,IIR_state *iir, + float *pre,float *post){ long n2=ve->winlength*2; long n=ve->winlength; - double *workA=alloca(sizeof(double)*n2),A=0.; - double *workB=alloca(sizeof(double)*n2),B=0.; + float *workA=alloca(sizeof(float)*n2),A=0.; + float *workB=alloca(sizeof(float)*n2),B=0.; long i; - /*_analysis_output("A",frameno,pre,n,0,0); - _analysis_output("B",frameno,post,n,0,0);*/ + /*_analysis_output("A",granulepos,pre,n,0,0); + _analysis_output("B",granulepos,post,n,0,0);*/ for(i=0;iwindow[i]; workB[i]=post[i]*ve->window[i]; } - /*_analysis_output("Awin",frameno,workA,n,0,0); - _analysis_output("Bwin",frameno,workB,n,0,0);*/ + /*_analysis_output("Awin",granulepos,workA,n,0,0); + _analysis_output("Bwin",granulepos,workB,n,0,0);*/ drft_forward(&ve->drft,workA); drft_forward(&ve->drft,workB); @@ -133,15 +133,15 @@ static double _ve_deltai(envelope_lookup *ve,IIR_state *iir, basing blocks on quantization noise that outweighs the signal itself (for low power signals) */ { - double min=ve->minenergy; + float min=ve->minenergy; for(i=0;ipcm_storage>ve->storage){ ve->storage=v->pcm_storage; for(i=0;ich;i++) - ve->filtered[i]=realloc(ve->filtered[i],ve->storage*sizeof(double)); + ve->filtered[i]=realloc(ve->filtered[i],ve->storage*sizeof(float)); } /* catch up the highpass to match the pcm */ for(i=0;ich;i++){ - double *filtered=ve->filtered[i]; - double *pcm=v->pcm[i]; + float *filtered=ve->filtered[i]; + float *pcm=v->pcm[i]; IIR_state *iir=ve->iir+i; for(j=ve->current;jpcm_current;j++) @@ -186,15 +186,15 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){ while(j+ve->winlength<=v->pcm_current){ for(i=0;ich;i++){ - double *filtered=ve->filtered[i]+j; + float *filtered=ve->filtered[i]+j; IIR_state *iir=ve->iir+i; - double m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered); + float m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered); if(m>vi->preecho_thresh){ - /*frameno++;*/ + /*granulepos++;*/ return(0); } - /*frameno++;*/ + /*granulepos++;*/ } j+=vi->blocksizes[0]/2; @@ -208,7 +208,7 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){ int i; for(i=0;ich;i++) memmove(e->filtered[i],e->filtered[i]+shift,(e->current-shift)* - sizeof(double)); + sizeof(float)); e->current-=shift; } diff --git a/lib/envelope.h b/lib/envelope.h index dc43a7e..1f214e9 100644 --- a/lib/envelope.h +++ b/lib/envelope.h @@ -12,7 +12,7 @@ ******************************************************************** function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.h,v 1.9 2000/08/15 09:09:42 xiphmont Exp $ + last mod: $Id: envelope.h,v 1.10 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ @@ -28,15 +28,15 @@ typedef struct { int ch; int winlength; int searchstep; - double minenergy; + float minenergy; IIR_state *iir; - double **filtered; + float **filtered; long storage; long current; drft_lookup drft; - double *window; + float *window; } envelope_lookup; extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); diff --git a/lib/floor0.c b/lib/floor0.c index 0eb83db..bfcee0f 100644 --- a/lib/floor0.c +++ b/lib/floor0.c @@ -12,15 +12,15 @@ ******************************************************************** function: floor backend 0 implementation - last mod: $Id: floor0.c,v 1.24 2000/08/31 08:01:34 xiphmont Exp $ + last mod: $Id: floor0.c,v 1.25 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ #include #include #include +#include #include "vorbis/codec.h" -#include "bitwise.h" #include "registry.h" #include "lpc.h" #include "lsp.h" @@ -41,19 +41,19 @@ typedef struct { vorbis_info_floor0 *vi; lpc_lookup lpclook; - double *lsp_look; + float *lsp_look; } vorbis_look_floor0; /* infrastructure for finding fit */ static long _f0_fit(codebook *book, - double *orig, - double *workfit, + float *orig, + float *workfit, int cursor){ int dim=book->dim; - double norm,base=0.; + float norm,base=0.; int i,best=0; - double *lsp=workfit+cursor; + float *lsp=workfit+cursor; if(cursor)base=workfit[cursor-1]; norm=orig[cursor+dim-1]-base; @@ -62,7 +62,7 @@ static long _f0_fit(codebook *book, lsp[i]=(orig[i+cursor]-base); best=_best(book,lsp,1); - memcpy(lsp,book->valuelist+best*dim,dim*sizeof(double)); + memcpy(lsp,book->valuelist+best*dim,dim*sizeof(float)); for(i=0;ilinearmap)free(look->linearmap); @@ -88,28 +88,28 @@ static void free_look(vorbis_look_floor *i){ } } -static void pack (vorbis_info_floor *i,oggpack_buffer *opb){ +static void floor0_pack (vorbis_info_floor *i,oggpack_buffer *opb){ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; int j; - _oggpack_write(opb,info->order,8); - _oggpack_write(opb,info->rate,16); - _oggpack_write(opb,info->barkmap,16); - _oggpack_write(opb,info->ampbits,6); - _oggpack_write(opb,info->ampdB,8); - _oggpack_write(opb,info->numbooks-1,4); + oggpack_write(opb,info->order,8); + oggpack_write(opb,info->rate,16); + oggpack_write(opb,info->barkmap,16); + oggpack_write(opb,info->ampbits,6); + oggpack_write(opb,info->ampdB,8); + oggpack_write(opb,info->numbooks-1,4); for(j=0;jnumbooks;j++) - _oggpack_write(opb,info->books[j],8); + oggpack_write(opb,info->books[j],8); } -static vorbis_info_floor *unpack (vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ int j; vorbis_info_floor0 *info=malloc(sizeof(vorbis_info_floor0)); - info->order=_oggpack_read(opb,8); - info->rate=_oggpack_read(opb,16); - info->barkmap=_oggpack_read(opb,16); - info->ampbits=_oggpack_read(opb,6); - info->ampdB=_oggpack_read(opb,8); - info->numbooks=_oggpack_read(opb,4)+1; + info->order=oggpack_read(opb,8); + info->rate=oggpack_read(opb,16); + info->barkmap=oggpack_read(opb,16); + info->ampbits=oggpack_read(opb,6); + info->ampdB=oggpack_read(opb,8); + info->numbooks=oggpack_read(opb,4)+1; if(info->order<1)goto err_out; if(info->rate<1)goto err_out; @@ -117,12 +117,12 @@ static vorbis_info_floor *unpack (vorbis_info *vi,oggpack_buffer *opb){ if(info->numbooks<1)goto err_out; for(j=0;jnumbooks;j++){ - info->books[j]=_oggpack_read(opb,8); + info->books[j]=oggpack_read(opb,8); if(info->books[j]<0 || info->books[j]>=vi->books)goto err_out; } return(info); err_out: - free_info(info); + floor0_free_info(info); return(NULL); } @@ -134,10 +134,10 @@ static vorbis_info_floor *unpack (vorbis_info *vi,oggpack_buffer *opb){ Note that the scale depends on the sampling rate as well as the linear block and mapping sizes */ -static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi, +static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi, vorbis_info_floor *i){ int j; - double scale; + float scale; vorbis_info *vi=vd->vi; vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; vorbis_look_floor0 *look=calloc(1,sizeof(vorbis_look_floor0)); @@ -160,15 +160,16 @@ static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi, the encoder may do what it wishes in filling them. They're necessary in some mapping combinations to keep the scale spacing accurate */ - look->linearmap=malloc(look->n*sizeof(int)); + look->linearmap=malloc((look->n+1)*sizeof(int)); for(j=0;jn;j++){ int val=floor( toBARK((info->rate/2.)/look->n*j) *scale); /* bark numbers represent band edges */ if(val>look->ln)val=look->ln; /* guard against the approximation */ look->linearmap[j]=val; } + look->linearmap[j]=-1; - look->lsp_look=malloc(look->ln*sizeof(double)); + look->lsp_look=malloc(look->ln*sizeof(float)); for(j=0;jln;j++) look->lsp_look[j]=2*cos(M_PI/look->ln*j); @@ -178,16 +179,16 @@ static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi, /* less efficient than the decode side (written for clarity). We're not bottlenecked here anyway */ -double _curve_to_lpc(double *curve,double *lpc, - vorbis_look_floor0 *l,long frameno){ +float _curve_to_lpc(float *curve,float *lpc, + vorbis_look_floor0 *l){ /* map the input curve to a bark-scale curve for encoding */ int mapped=l->ln; - double *work=alloca(sizeof(double)*mapped); + float *work=alloca(sizeof(float)*mapped); int i,j,last=0; int bark=0; - memset(work,0,sizeof(double)*mapped); + memset(work,0,sizeof(float)*mapped); /* Only the decode side is behavior-specced; for now in the encoder, we select the maximum value of each band as representative (this @@ -211,7 +212,7 @@ double _curve_to_lpc(double *curve,double *lpc, /* we'll always have a bin zero, so we don't need to guard init */ long span=bark-last; for(j=1;jlpclook)); } /* generate the whole freq response curve of an LSP IIR filter */ - -void _lsp_to_curve(double *curve,double *lsp,double amp, - vorbis_look_floor0 *l,char *name,long frameno){ - /* l->m+1 must be less than l->ln, but guard in case we get a bad stream */ - double *lcurve=alloca(sizeof(double)*l->ln); - int i; - - if(amp==0){ - memset(curve,0,sizeof(double)*l->n); - return; - } - vorbis_lsp_to_curve(lcurve,l->ln,lsp,l->m,amp,l->lsp_look); - - for(i=0;in;i++)curve[i]=lcurve[l->linearmap[i]]; - -} - -static long seq=0; -static int forward(vorbis_block *vb,vorbis_look_floor *i, - double *in,double *out){ +static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i, + float *in,float *out){ long j; vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; - double *work=alloca((look->ln+look->n)*sizeof(double)); - double amp; + float *work=alloca((look->ln+look->n)*sizeof(float)); + float amp; long bits=0; #ifdef TRAIN_LSP @@ -289,7 +258,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, /* use 'out' as temp storage */ /* Convert our floor to a set of lpc coefficients */ - amp=sqrt(_curve_to_lpc(work,out,look,seq)); + amp=sqrt(_curve_to_lpc(work,out,look)); /* amp is in the range (0. to ampdB]. Encode that range using ampbits bits */ @@ -302,7 +271,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, if(val<0)val=0; /* likely */ if(val>maxval)val=maxval; /* not bloody likely */ - _oggpack_write(&vb->opb,val,info->ampbits); + oggpack_write(&vb->opb,val,info->ampbits); if(val>0) amp=(float)val/maxval*info->ampdB; else @@ -314,7 +283,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, /* the spec supports using one of a number of codebooks. Right now, encode using this lib supports only one */ codebook *b=vb->vd->fullbooks+info->books[0]; - _oggpack_write(&vb->opb,0,_ilog(info->numbooks)); + oggpack_write(&vb->opb,0,_ilog(info->numbooks)); /* LSP <-> LPC is orthogonal and LSP quantizes more stably */ vorbis_lpc_to_lsp(out,out,look->m); @@ -322,7 +291,7 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, #if 1 #ifdef TRAIN_LSP { - double last=0.; + float last=0.; for(j=0;jm;j++){ fprintf(of,"%.12g, ",out[j]-last); last=out[j]; @@ -349,13 +318,12 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, #ifdef ANALYSIS { - double last=0; + float last=0; for(j=0;jm;j++){ out[j]=work[j]-last; last=work[j]; } } - _analysis_output("lsp",seq,out,look->m,0,0); #endif @@ -364,56 +332,56 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, #endif /* take the coefficients back to a spectral envelope curve */ - _lsp_to_curve(out,work,amp,look,"Ffloor",seq++); - for(j=0;jn;j++)out[j]= fromdB(out[j]-info->ampdB); + vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln, + work,look->m,amp,info->ampdB); return(1); } - memset(out,0,sizeof(double)*look->n); - seq++; + memset(out,0,sizeof(float)*look->n); return(0); } -static int inverse(vorbis_block *vb,vorbis_look_floor *i,double *out){ +static int floor0_inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; int j,k; - int ampraw=_oggpack_read(&vb->opb,info->ampbits); + int ampraw=oggpack_read(&vb->opb,info->ampbits); if(ampraw>0){ /* also handles the -1 out of data case */ long maxval=(1<ampbits)-1; - double amp=(float)ampraw/maxval*info->ampdB; - int booknum=_oggpack_read(&vb->opb,_ilog(info->numbooks)); + float amp=(float)ampraw/maxval*info->ampdB; + int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks)); + float *lsp=alloca(sizeof(float)*look->m); if(booknum!=-1){ codebook *b=vb->vd->fullbooks+info->books[booknum]; - double last=0.; + float last=0.; memset(out,0,sizeof(double)*look->m); for(j=0;jm;j+=b->dim) - if(vorbis_book_decodevs(b,out+j,&vb->opb,1,-1)==-1)goto eop; + if(vorbis_book_decodevs(b,lsp+j,&vb->opb,1,-1)==-1)goto eop; for(j=0;jm;){ - for(k=0;kdim;k++,j++)out[j]+=last; - last=out[j-1]; + for(k=0;kdim;k++,j++)lsp[j]+=last; + last=lsp[j-1]; } /* take the coefficients back to a spectral envelope curve */ - _lsp_to_curve(out,out,amp,look,"",0); - - for(j=0;jn;j++)out[j]=fromdB(out[j]-info->ampdB); + vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln, + lsp,look->m,amp,info->ampdB); return(1); } } eop: - memset(out,0,sizeof(double)*look->n); + memset(out,0,sizeof(float)*look->n); return(0); } /* export hooks */ vorbis_func_floor floor0_exportbundle={ - &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse + &floor0_pack,&floor0_unpack,&floor0_look,&floor0_free_info, + &floor0_free_look,&floor0_forward,&floor0_inverse }; diff --git a/lib/iir.c b/lib/iir.c index b4a7a9e..57dcb36 100644 --- a/lib/iir.c +++ b/lib/iir.c @@ -12,7 +12,7 @@ ******************************************************************** function: Direct Form I, II IIR filters, plus some specializations - last mod: $Id: iir.c,v 1.1 2000/07/12 09:36:18 xiphmont Exp $ + last mod: $Id: iir.c,v 1.2 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ @@ -24,17 +24,17 @@ #include #include "iir.h" -void IIR_init(IIR_state *s,int stages,double gain, double *A, double *B){ +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(double)); - s->coeff_B=malloc((stages+1)*sizeof(double)); - s->z_A=calloc(stages*2,sizeof(double)); - s->z_B=calloc(stages*2,sizeof(double)); + 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(double)); - memcpy(s->coeff_B,B,(stages+1)*sizeof(double)); + memcpy(s->coeff_A,A,stages*sizeof(float)); + memcpy(s->coeff_B,B,(stages+1)*sizeof(float)); } void IIR_clear(IIR_state *s){ @@ -47,11 +47,11 @@ void IIR_clear(IIR_state *s){ } } -double IIR_filter(IIR_state *s,double in){ +float IIR_filter(IIR_state *s,float in){ int stages=s->stages,i; - double newA; - double newB=0; - double *zA=s->z_A+s->ring; + float newA; + float newB=0; + float *zA=s->z_A+s->ring; newA=in/=s->gain; for(i=0;istages,i; - double newA; - double newB=0; - double *zA=s->z_A+s->ring; + float newA; + float newB=0; + float *zA=s->z_A+s->ring; newA=in/=s->gain; @@ -96,8 +96,8 @@ double IIR_filter_ChebBand(IIR_state *s,double in){ #ifdef _V_SELFTEST /* z^-stage, z^-stage+1... */ -static double cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1}; -static double cheb_bandpass_A[]={-0.6665900311, +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, @@ -108,7 +108,7 @@ static double cheb_bandpass_A[]={-0.6665900311, -3.9134284363, 1.3997338886}; -static double data[128]={ +static float data[128]={ 0.0426331, 0.0384521, 0.0345764, @@ -247,7 +247,7 @@ static double data[128]={ static float xv[NZEROS+1], yv[NPOLES+1]; -static double filterloop(double next){ +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; @@ -267,7 +267,7 @@ int main(){ /* run the pregenerated Chebyshev filter, then our own distillation through the generic and specialized code */ - double *work=malloc(128*sizeof(double)); + float *work=malloc(128*sizeof(float)); IIR_state iir; int i; diff --git a/lib/iir.h b/lib/iir.h index 22e10db..befb4ce 100644 --- a/lib/iir.h +++ b/lib/iir.h @@ -12,7 +12,7 @@ ******************************************************************** function: Direct Form I, II IIR filters, plus some specializations - last mod: $Id: iir.h,v 1.1 2000/07/12 09:36:18 xiphmont Exp $ + last mod: $Id: iir.h,v 1.2 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ @@ -21,17 +21,17 @@ typedef struct { int stages; - double *coeff_A; - double *coeff_B; - double *z_A; - double *z_B; + float *coeff_A; + float *coeff_B; + float *z_A; + float *z_B; int ring; - double gain; + float gain; } IIR_state; -void IIR_init(IIR_state *s,int stages,double gain, double *A, double *B); +void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B); void IIR_clear(IIR_state *s); -double IIR_filter(IIR_state *s,double in); -double IIR_filter_ChebBand(IIR_state *s,double in); +float IIR_filter(IIR_state *s,float in); +float IIR_filter_ChebBand(IIR_state *s,float in); #endif diff --git a/lib/info.c b/lib/info.c index 410a6c3..8418535 100644 --- a/lib/info.c +++ b/lib/info.c @@ -12,7 +12,7 @@ ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c,v 1.30 2000/08/15 09:09:43 xiphmont Exp $ + last mod: $Id: info.c,v 1.31 2000/10/12 03:12:52 xiphmont Exp $ ********************************************************************/ @@ -22,9 +22,9 @@ #include #include #include +#include #include "vorbis/codec.h" #include "vorbis/backends.h" -#include "bitwise.h" #include "sharedbook.h" #include "bookinternal.h" #include "registry.h" @@ -45,13 +45,13 @@ static int ilog2(unsigned int v){ static void _v_writestring(oggpack_buffer *o,char *s){ while(*s){ - _oggpack_write(o,*s++,8); + oggpack_write(o,*s++,8); } } static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){ while(bytes--){ - *buf++=_oggpack_read(o,8); + *buf++=oggpack_read(o,8); } } @@ -189,25 +189,25 @@ void vorbis_info_clear(vorbis_info *vi){ /* Header packing/unpacking ********************************************/ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ - vi->version=_oggpack_read(opb,32); + vi->version=oggpack_read(opb,32); if(vi->version!=0)return(-1); - vi->channels=_oggpack_read(opb,8); - vi->rate=_oggpack_read(opb,32); + vi->channels=oggpack_read(opb,8); + vi->rate=oggpack_read(opb,32); - vi->bitrate_upper=_oggpack_read(opb,32); - vi->bitrate_nominal=_oggpack_read(opb,32); - vi->bitrate_lower=_oggpack_read(opb,32); + vi->bitrate_upper=oggpack_read(opb,32); + vi->bitrate_nominal=oggpack_read(opb,32); + vi->bitrate_lower=oggpack_read(opb,32); - vi->blocksizes[0]=1<<_oggpack_read(opb,4); - vi->blocksizes[1]=1<<_oggpack_read(opb,4); + vi->blocksizes[0]=1<blocksizes[1]=1<rate<1)goto err_out; if(vi->channels<1)goto err_out; if(vi->blocksizes[0]<8)goto err_out; if(vi->blocksizes[1]blocksizes[0])goto err_out; - if(_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ return(0); err_out: @@ -217,23 +217,23 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ int i; - int vendorlen=_oggpack_read(opb,32); + int vendorlen=oggpack_read(opb,32); if(vendorlen<0)goto err_out; vc->vendor=calloc(vendorlen+1,1); _v_readstring(opb,vc->vendor,vendorlen); - vc->comments=_oggpack_read(opb,32); + vc->comments=oggpack_read(opb,32); if(vc->comments<0)goto err_out; vc->user_comments=calloc(vc->comments+1,sizeof(char **)); vc->comment_lengths=calloc(vc->comments+1, sizeof(int)); for(i=0;icomments;i++){ - int len=_oggpack_read(opb,32); + int len=oggpack_read(opb,32); if(len<0)goto err_out; vc->comment_lengths[i]=len; vc->user_comments[i]=calloc(len+1,1); _v_readstring(opb,vc->user_comments[i],len); } - if(_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ return(0); err_out: @@ -247,7 +247,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ int i; /* codebooks */ - vi->books=_oggpack_read(opb,8)+1; + vi->books=oggpack_read(opb,8)+1; /*vi->book_param=calloc(vi->books,sizeof(static_codebook *));*/ for(i=0;ibooks;i++){ vi->book_param[i]=calloc(1,sizeof(static_codebook)); @@ -255,65 +255,65 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ } /* time backend settings */ - vi->times=_oggpack_read(opb,6)+1; + vi->times=oggpack_read(opb,6)+1; /*vi->time_type=malloc(vi->times*sizeof(int));*/ /*vi->time_param=calloc(vi->times,sizeof(void *));*/ for(i=0;itimes;i++){ - vi->time_type[i]=_oggpack_read(opb,16); + vi->time_type[i]=oggpack_read(opb,16); if(vi->time_type[i]<0 || vi->time_type[i]>=VI_TIMEB)goto err_out; vi->time_param[i]=_time_P[vi->time_type[i]]->unpack(vi,opb); if(!vi->time_param[i])goto err_out; } /* floor backend settings */ - vi->floors=_oggpack_read(opb,6)+1; + vi->floors=oggpack_read(opb,6)+1; /*vi->floor_type=malloc(vi->floors*sizeof(int));*/ /*vi->floor_param=calloc(vi->floors,sizeof(void *));*/ for(i=0;ifloors;i++){ - vi->floor_type[i]=_oggpack_read(opb,16); + vi->floor_type[i]=oggpack_read(opb,16); if(vi->floor_type[i]<0 || vi->floor_type[i]>=VI_FLOORB)goto err_out; vi->floor_param[i]=_floor_P[vi->floor_type[i]]->unpack(vi,opb); if(!vi->floor_param[i])goto err_out; } /* residue backend settings */ - vi->residues=_oggpack_read(opb,6)+1; + vi->residues=oggpack_read(opb,6)+1; /*vi->residue_type=malloc(vi->residues*sizeof(int));*/ /*vi->residue_param=calloc(vi->residues,sizeof(void *));*/ for(i=0;iresidues;i++){ - vi->residue_type[i]=_oggpack_read(opb,16); + vi->residue_type[i]=oggpack_read(opb,16); if(vi->residue_type[i]<0 || vi->residue_type[i]>=VI_RESB)goto err_out; vi->residue_param[i]=_residue_P[vi->residue_type[i]]->unpack(vi,opb); if(!vi->residue_param[i])goto err_out; } /* map backend settings */ - vi->maps=_oggpack_read(opb,6)+1; + vi->maps=oggpack_read(opb,6)+1; /*vi->map_type=malloc(vi->maps*sizeof(int));*/ /*vi->map_param=calloc(vi->maps,sizeof(void *));*/ for(i=0;imaps;i++){ - vi->map_type[i]=_oggpack_read(opb,16); + vi->map_type[i]=oggpack_read(opb,16); if(vi->map_type[i]<0 || vi->map_type[i]>=VI_MAPB)goto err_out; vi->map_param[i]=_mapping_P[vi->map_type[i]]->unpack(vi,opb); if(!vi->map_param[i])goto err_out; } /* mode settings */ - vi->modes=_oggpack_read(opb,6)+1; + vi->modes=oggpack_read(opb,6)+1; /*vi->mode_param=calloc(vi->modes,sizeof(void *));*/ for(i=0;imodes;i++){ vi->mode_param[i]=calloc(1,sizeof(vorbis_info_mode)); - vi->mode_param[i]->blockflag=_oggpack_read(opb,1); - vi->mode_param[i]->windowtype=_oggpack_read(opb,16); - vi->mode_param[i]->transformtype=_oggpack_read(opb,16); - vi->mode_param[i]->mapping=_oggpack_read(opb,8); + vi->mode_param[i]->blockflag=oggpack_read(opb,1); + vi->mode_param[i]->windowtype=oggpack_read(opb,16); + vi->mode_param[i]->transformtype=oggpack_read(opb,16); + vi->mode_param[i]->mapping=oggpack_read(opb,8); if(vi->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out; if(vi->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out; if(vi->mode_param[i]->mapping>=vi->maps)goto err_out; } - if(_oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */ + if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */ return(0); err_out: @@ -330,13 +330,13 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op) oggpack_buffer opb; if(op){ - _oggpack_readinit(&opb,op->packet,op->bytes); + oggpack_readinit(&opb,op->packet,op->bytes); /* Which of the three types of header is this? */ /* Also verify header-ness, vorbis */ { char buffer[6]; - int packtype=_oggpack_read(&opb,8); + int packtype=oggpack_read(&opb,8); memset(buffer,0,6); _v_readstring(&opb,buffer,6); if(memcmp(buffer,"vorbis",6)){ @@ -386,21 +386,21 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op) static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ /* preamble */ - _oggpack_write(opb,0x01,8); + oggpack_write(opb,0x01,8); _v_writestring(opb,"vorbis"); /* basic information about the stream */ - _oggpack_write(opb,0x00,32); - _oggpack_write(opb,vi->channels,8); - _oggpack_write(opb,vi->rate,32); + oggpack_write(opb,0x00,32); + oggpack_write(opb,vi->channels,8); + oggpack_write(opb,vi->rate,32); - _oggpack_write(opb,vi->bitrate_upper,32); - _oggpack_write(opb,vi->bitrate_nominal,32); - _oggpack_write(opb,vi->bitrate_lower,32); + oggpack_write(opb,vi->bitrate_upper,32); + oggpack_write(opb,vi->bitrate_nominal,32); + oggpack_write(opb,vi->bitrate_lower,32); - _oggpack_write(opb,ilog2(vi->blocksizes[0]),4); - _oggpack_write(opb,ilog2(vi->blocksizes[1]),4); - _oggpack_write(opb,1,1); + oggpack_write(opb,ilog2(vi->blocksizes[0]),4); + oggpack_write(opb,ilog2(vi->blocksizes[1]),4); + oggpack_write(opb,1,1); return(0); } @@ -409,79 +409,79 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ char temp[]="Xiphophorus libVorbis I 20000508"; /* preamble */ - _oggpack_write(opb,0x03,8); + oggpack_write(opb,0x03,8); _v_writestring(opb,"vorbis"); /* vendor */ - _oggpack_write(opb,strlen(temp),32); + oggpack_write(opb,strlen(temp),32); _v_writestring(opb,temp); /* comments */ - _oggpack_write(opb,vc->comments,32); + oggpack_write(opb,vc->comments,32); if(vc->comments){ int i; for(i=0;icomments;i++){ if(vc->user_comments[i]){ - _oggpack_write(opb,vc->comment_lengths[i],32); + oggpack_write(opb,vc->comment_lengths[i],32); _v_writestring(opb,vc->user_comments[i]); }else{ - _oggpack_write(opb,0,32); + oggpack_write(opb,0,32); } } } - _oggpack_write(opb,1,1); + oggpack_write(opb,1,1); return(0); } static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){ int i; - _oggpack_write(opb,0x05,8); + oggpack_write(opb,0x05,8); _v_writestring(opb,"vorbis"); /* books */ - _oggpack_write(opb,vi->books-1,8); + oggpack_write(opb,vi->books-1,8); for(i=0;ibooks;i++) if(vorbis_staticbook_pack(vi->book_param[i],opb))goto err_out; /* times */ - _oggpack_write(opb,vi->times-1,6); + oggpack_write(opb,vi->times-1,6); for(i=0;itimes;i++){ - _oggpack_write(opb,vi->time_type[i],16); + oggpack_write(opb,vi->time_type[i],16); _time_P[vi->time_type[i]]->pack(vi->time_param[i],opb); } /* floors */ - _oggpack_write(opb,vi->floors-1,6); + oggpack_write(opb,vi->floors-1,6); for(i=0;ifloors;i++){ - _oggpack_write(opb,vi->floor_type[i],16); + oggpack_write(opb,vi->floor_type[i],16); _floor_P[vi->floor_type[i]]->pack(vi->floor_param[i],opb); } /* residues */ - _oggpack_write(opb,vi->residues-1,6); + oggpack_write(opb,vi->residues-1,6); for(i=0;iresidues;i++){ - _oggpack_write(opb,vi->residue_type[i],16); + oggpack_write(opb,vi->residue_type[i],16); _residue_P[vi->residue_type[i]]->pack(vi->residue_param[i],opb); } /* maps */ - _oggpack_write(opb,vi->maps-1,6); + oggpack_write(opb,vi->maps-1,6); for(i=0;imaps;i++){ - _oggpack_write(opb,vi->map_type[i],16); + oggpack_write(opb,vi->map_type[i],16); _mapping_P[vi->map_type[i]]->pack(vi,vi->map_param[i],opb); } /* modes */ - _oggpack_write(opb,vi->modes-1,6); + oggpack_write(opb,vi->modes-1,6); for(i=0;imodes;i++){ - _oggpack_write(opb,vi->mode_param[i]->blockflag,1); - _oggpack_write(opb,vi->mode_param[i]->windowtype,16); - _oggpack_write(opb,vi->mode_param[i]->transformtype,16); - _oggpack_write(opb,vi->mode_param[i]->mapping,8); + oggpack_write(opb,vi->mode_param[i]->blockflag,1); + oggpack_write(opb,vi->mode_param[i]->windowtype,16); + oggpack_write(opb,vi->mode_param[i]->transformtype,16); + oggpack_write(opb,vi->mode_param[i]->mapping,8); } - _oggpack_write(opb,1,1); + oggpack_write(opb,1,1); return(0); err_out: @@ -498,51 +498,51 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, /* first header packet **********************************************/ - _oggpack_writeinit(&opb); + oggpack_writeinit(&opb); if(_vorbis_pack_info(&opb,vi))goto err_out; /* build the packet */ if(v->header)free(v->header); - v->header=malloc(_oggpack_bytes(&opb)); - memcpy(v->header,opb.buffer,_oggpack_bytes(&opb)); + v->header=malloc(oggpack_bytes(&opb)); + memcpy(v->header,opb.buffer,oggpack_bytes(&opb)); op->packet=v->header; - op->bytes=_oggpack_bytes(&opb); + op->bytes=oggpack_bytes(&opb); op->b_o_s=1; op->e_o_s=0; - op->frameno=0; + op->granulepos=0; /* second header packet (comments) **********************************/ - _oggpack_reset(&opb); + oggpack_reset(&opb); if(_vorbis_pack_comment(&opb,vc))goto err_out; if(v->header1)free(v->header1); - v->header1=malloc(_oggpack_bytes(&opb)); - memcpy(v->header1,opb.buffer,_oggpack_bytes(&opb)); + v->header1=malloc(oggpack_bytes(&opb)); + memcpy(v->header1,opb.buffer,oggpack_bytes(&opb)); op_comm->packet=v->header1; - op_comm->bytes=_oggpack_bytes(&opb); + op_comm->bytes=oggpack_bytes(&opb); op_comm->b_o_s=0; op_comm->e_o_s=0; - op_comm->frameno=0; + op_comm->granulepos=0; /* third header packet (modes/codebooks) ****************************/ - _oggpack_reset(&opb); + oggpack_reset(&opb); if(_vorbis_pack_books(&opb,vi))goto err_out; if(v->header2)free(v->header2); - v->header2=malloc(_oggpack_bytes(&opb)); - memcpy(v->header2,opb.buffer,_oggpack_bytes(&opb)); + v->header2=malloc(oggpack_bytes(&opb)); + memcpy(v->header2,opb.buffer,oggpack_bytes(&opb)); op_code->packet=v->header2; - op_code->bytes=_oggpack_bytes(&opb); + op_code->bytes=oggpack_bytes(&opb); op_code->b_o_s=0; op_code->e_o_s=0; - op_code->frameno=0; + op_code->granulepos=0; - _oggpack_writeclear(&opb); + oggpack_writeclear(&opb); return(0); err_out: - _oggpack_writeclear(&opb); + oggpack_writeclear(&opb); memset(op,0,sizeof(ogg_packet)); memset(op_comm,0,sizeof(ogg_packet)); memset(op_code,0,sizeof(ogg_packet)); diff --git a/lib/lookup.c b/lib/lookup.c new file mode 100644 index 0000000..ec533b5 --- /dev/null +++ b/lib/lookup.c @@ -0,0 +1,92 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * + * PLEASE READ THESE TERMS DISTRIBUTING. * + * * + * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty and The XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup based functions + last mod: $Id: lookup.c,v 1.2 2000/10/12 03:12:53 xiphmont Exp $ + + ********************************************************************/ + +#include +#include "lookup.h" +#include "lookup_data.h" + +#ifdef FLOAT_LOOKUP + +/* interpolated lookup based cos function, domain 0 to PI only */ +float vorbis_coslook(float a){ + float d=a*(.31830989*(float)COS_LOOKUP_SZ); + int i=d; + return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]); +} + +/* interpolated 1./sqrt(p) where .5 <= p < 1. */ +float vorbis_invsqlook(float a){ + float d=a*(2.*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ; + int i=d; + return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]); +} + +/* interpolated 1./sqrt(p) where .5 <= p < 1. */ +float vorbis_invsq2explook(int a){ + return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN]; +} + +#include +/* interpolated lookup based fromdB function, domain -140dB to 0dB only */ +float vorbis_fromdBlook(float a){ + int i=a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); +} + +#endif + +#ifdef INT_LOOKUP +/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in + 16.16 format + + returns in m.8 format */ +long vorbis_invsqlook_i(long a,long e){ + long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); + long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */ + long val=INVSQ_LOOKUP_I[i]- /* 1.16 */ + (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */ + d)>>16); /* result 1.16 */ + + e+=32; + if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */ + e=(e>>1)-8; + + return(val>>e); +} + +/* interpolated lookup based fromdB function, domain -140dB to 0dB only */ +/* a is in n.12 format */ +float vorbis_fromdBlook_i(long a){ + int i=(-a)>>(12-FROMdB2_SHIFT); + return (i<0)?1.: + ((i>=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); +} + +/* interpolated lookup based cos function, domain 0 to PI only */ +/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */ +long vorbis_coslook_i(long a){ + int i=a>>COS_LOOKUP_I_SHIFT; + int d=a&COS_LOOKUP_I_MASK; + return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>> + COS_LOOKUP_I_SHIFT); +} + +#endif diff --git a/include/vorbis/internal.h b/lib/lookup.h similarity index 65% rename from include/vorbis/internal.h rename to lib/lookup.h index 100df51..8f55d5a 100644 --- a/include/vorbis/internal.h +++ b/lib/lookup.h @@ -11,30 +11,23 @@ * * ******************************************************************** - function: libvorbis codec internal types. These structures are - 'visible', but generally uninteresting to the developer - last mod: $Id: internal.h,v 1.7 2000/07/12 09:36:17 xiphmont Exp $ + function: lookup based functions + last mod: $Id: lookup.h,v 1.2 2000/10/12 03:12:53 xiphmont Exp $ ********************************************************************/ -#ifndef _vorbis_internal_h_ -#define _vorbis_internal_h_ - -/* structures for various internal data abstractions ********************/ - -typedef struct { - long endbyte; - int endbit; - - unsigned char *buffer; - unsigned char *ptr; - long storage; - -} oggpack_buffer; +#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 0000000..d9f4e76 --- /dev/null +++ b/lib/lookup_data.h @@ -0,0 +1,190 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * + * PLEASE READ THESE TERMS DISTRIBUTING. * + * * + * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty 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 2000/10/12 03:12:53 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 0000000..dbd7f71 --- /dev/null +++ b/lib/lookups.pl @@ -0,0 +1,143 @@ +#!/usr/bin/perl +print <<'EOD'; +/******************************************************************** + * * + * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * + * PLEASE READ THESE TERMS DISTRIBUTING. * + * * + * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * + * by Monty 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 2000/10/12 03:12:53 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 index ab7946a..a1b8c29 100644 --- a/lib/lpc.c +++ b/lib/lpc.c @@ -12,7 +12,7 @@ ******************************************************************** function: LPC low level routines - last mod: $Id: lpc.c,v 1.25 2000/08/23 10:16:57 xiphmont Exp $ + last mod: $Id: lpc.c,v 1.26 2000/10/12 03:12:53 xiphmont Exp $ ********************************************************************/ @@ -59,16 +59,16 @@ Carsten Bormann /* Input : n elements of time doamin data Output: m lpc coefficients, excitation energy */ -double vorbis_lpc_from_data(double *data,double *lpc,int n,int m){ - double *aut=alloca(sizeof(double)*(m+1)); - double error; +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--){ - double d=0; + float d=0; for(i=j;iln; int m=l->m; - double *work=alloca(sizeof(double)*(n+n)); - double fscale=.5/n; + float *work=alloca(sizeof(float)*(n+n)); + float fscale=.5/n; int i,j; /* input is a real curve. make it complex-real */ @@ -136,7 +136,7 @@ double vorbis_lpc_from_curve(double *curve,double *lpc,lpc_lookup *l){ most of the power in the edges. */ for(i=0,j=n/2;i @@ -38,26 +38,191 @@ #include "lsp.h" #include "os.h" #include "misc.h" +#include "lookup.h" +#include "scales.h" -void vorbis_lsp_to_curve(double *curve,int n,double *lsp,int m,double amp, - double *w){ - int i,j,k; - double *coslsp=alloca(m*sizeof(double)); - for(i=0;i>25])) + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; + pi=(pi>>shift)*labs(ilsp[j]-wi); + qi=(qi>>shift)*labs(ilsp[j+1]-wi); + qexp+=shift; } - curve[k]=amp/sqrt(p*p*(1.+ *w*.5)+q*q*(1.- *w*.5)); - w++; + if(!(shift=MLOOP_1[(pi|qi)>>25])) + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; + pi>>=shift; + qi>>=shift; + qexp+=shift-7*m; + + /* pi,qi normalized collectively, both tracked using qexp */ + + /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't + worth tracking step by step */ + + pi=((pi*pi)>>16); + qi=((qi*qi)>>16); + qexp=qexp*2+m; + + qi*=(1<<14)-wi; + pi*=(1<<14)+wi; + + qi=(qi+pi)>>14; + + /* we've let the normalization drift because it wasn't important; + however, for the lookup, things must be normalized again. We + need at most one right shift or a number of left shifts */ + + if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */ + qi>>=1; qexp++; + }else + while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/ + qi<<=1; qexp--; + } + + amp=vorbis_fromdBlook_i(ampi* /* n.4 */ + vorbis_invsqlook_i(qi,qexp)- + /* m.8, m+n<=8 */ + ampoffseti); /* 8.12[0] */ + + curve[i]=amp; + while(map[++i]==k)curve[i]=amp; + } +} + +#else + +/* old, nonoptimized but simple version for any poor sap who needs to + figure out what the hell this code does, or wants the other tiny + fraction of a dB precision */ + +/* side effect: changes *lsp to cosines of lsp */ +void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, + float amp,float ampoffset){ + int i; + float wdel=M_PI/ln; + for(i=0;i 1.e-12; ) { - error = 0; - for( i=0; i1.e-20){ + error=0; + + for(i=0; i= 0; k--) { - val = val * rooti + a[k]; - if (k != i) p *= rooti - r[k]; + + pp= pp* rooti + p; + p = p * rooti+ a[k]; + if (k != i) ac += 1./(rooti - root[k]); } - delta = val/p; - r[i] -= delta; + ac=p*ac; + + delta = p/(pp-ac); + + /* don't allow the correction to scream off into infinity if we + happened to polish right at a local mini/maximum */ + if(delta<-3)delta=-3; + if(delta>3.)delta=3.; /* 3 is not a random choice; it's large + enough to make sure the first pass + can't accidentally limit two poles to + the same value in a fatal nonelastic + collision. */ + + root[i] -= delta; error += delta*delta; } + + if(maxiter && count>maxiter && error>=besterror)break; + + /* anything to help out the polisher; converge using doubles */ + if(!count || error100)maxiter=100; + } + } + + count++; } - + /* Replaced the original bubble sort with a real sort. With your help, we can eliminate the bubble sort in our lifetime. --Monty */ - qsort(r,ord,sizeof(double),comp); + qsort(r,ord,sizeof(float),comp); } /* Convert lpc coefficients to lsp coefficients */ -void vorbis_lpc_to_lsp(double *lpc,double *lsp,int m){ +void vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){ int order2=m/2; - double *g1=alloca(sizeof(double)*(order2+1)); - double *g2=alloca(sizeof(double)*(order2+1)); - double *g1r=alloca(sizeof(double)*(order2+1)); - double *g2r=alloca(sizeof(double)*(order2+1)); + float *g1=alloca(sizeof(float)*(order2+1)); + float *g2=alloca(sizeof(float)*(order2+1)); + float *g1r=alloca(sizeof(float)*(order2+1)); + float *g2r=alloca(sizeof(float)*(order2+1)); int i; /* Compute the lengths of the x polynomials. */ @@ -136,8 +355,8 @@ void vorbis_lpc_to_lsp(double *lpc,double *lsp,int m){ /* Find the roots of the 2 even polynomials.*/ - cacm283(g1,order2,g1r); - cacm283(g2,order2,g2r); + Newton_Raphson_Maehly(g1,order2,g1r); + Newton_Raphson_Maehly(g2,order2,g2r); for(i=0;i #include #include +#include #include "vorbis/codec.h" #include "vorbis/backends.h" -#include "bitwise.h" #include "bookinternal.h" #include "registry.h" #include "psy.h" @@ -51,19 +51,19 @@ typedef struct { vorbis_func_residue **residue_func; int ch; - double **decay; + float **decay; long lastframe; /* if a different mode is called, we need to invalidate decay */ } vorbis_look_mapping0; -static void free_info(vorbis_info_mapping *i){ +static void mapping0_free_info(vorbis_info_mapping *i){ if(i){ memset(i,0,sizeof(vorbis_info_mapping0)); free(i); } } -static void free_look(vorbis_look_mapping *look){ +static void mapping0_free_look(vorbis_look_mapping *look){ int i; vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look; if(l){ @@ -93,7 +93,7 @@ static void free_look(vorbis_look_mapping *look){ } } -static vorbis_look_mapping *look(vorbis_dsp_state *vd,vorbis_info_mode *vm, +static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, vorbis_info_mapping *m){ int i; vorbis_info *vi=vd->vi; @@ -135,75 +135,72 @@ static vorbis_look_mapping *look(vorbis_dsp_state *vd,vorbis_info_mode *vm, look->ch=vi->channels; if(vi->psys){ - look->decay=calloc(vi->channels,sizeof(double *)); + look->decay=calloc(vi->channels,sizeof(float *)); for(i=0;ichannels;i++) - look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(double)); + look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(float)); } return(look); } -static void pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer *opb){ +static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer *opb){ int i; vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm; - _oggpack_write(opb,info->submaps-1,4); + oggpack_write(opb,info->submaps-1,4); /* we don't write the channel submappings if we only have one... */ if(info->submaps>1){ for(i=0;ichannels;i++) - _oggpack_write(opb,info->chmuxlist[i],4); + oggpack_write(opb,info->chmuxlist[i],4); } for(i=0;isubmaps;i++){ - _oggpack_write(opb,info->timesubmap[i],8); - _oggpack_write(opb,info->floorsubmap[i],8); - _oggpack_write(opb,info->residuesubmap[i],8); + oggpack_write(opb,info->timesubmap[i],8); + oggpack_write(opb,info->floorsubmap[i],8); + oggpack_write(opb,info->residuesubmap[i],8); } } /* also responsible for range checking */ -static vorbis_info_mapping *unpack(vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ int i; vorbis_info_mapping0 *info=calloc(1,sizeof(vorbis_info_mapping0)); memset(info,0,sizeof(vorbis_info_mapping0)); - info->submaps=_oggpack_read(opb,4)+1; + info->submaps=oggpack_read(opb,4)+1; if(info->submaps>1){ for(i=0;ichannels;i++){ - info->chmuxlist[i]=_oggpack_read(opb,4); + info->chmuxlist[i]=oggpack_read(opb,4); if(info->chmuxlist[i]>=info->submaps)goto err_out; } } for(i=0;isubmaps;i++){ - info->timesubmap[i]=_oggpack_read(opb,8); + info->timesubmap[i]=oggpack_read(opb,8); if(info->timesubmap[i]>=vi->times)goto err_out; - info->floorsubmap[i]=_oggpack_read(opb,8); + info->floorsubmap[i]=oggpack_read(opb,8); if(info->floorsubmap[i]>=vi->floors)goto err_out; - info->residuesubmap[i]=_oggpack_read(opb,8); + info->residuesubmap[i]=oggpack_read(opb,8); if(info->residuesubmap[i]>=vi->residues)goto err_out; } return info; err_out: - free_info(info); + mapping0_free_info(info); return(NULL); } -#include #include "os.h" #include "lpc.h" #include "lsp.h" #include "envelope.h" #include "mdct.h" #include "psy.h" -#include "bitwise.h" -#include "spectrum.h" #include "scales.h" /* no time mapping implementation for now */ static long seq=0; -static int forward(vorbis_block *vb,vorbis_look_mapping *l){ +static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; @@ -211,9 +208,9 @@ static int forward(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_info_mode *mode=look->mode; int n=vb->pcmend; int i,j; - double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype]; + float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype]; - double **pcmbundle=alloca(sizeof(double *)*vi->channels); + float **pcmbundle=alloca(sizeof(float *)*vi->channels); int *nonzero=alloca(sizeof(int)*vi->channels); /* time domain pre-window: NONE IMPLEMENTED */ @@ -221,7 +218,7 @@ static int forward(vorbis_block *vb,vorbis_look_mapping *l){ /* window the PCM data: takes PCM vector, vb; modifies PCM vector */ for(i=0;ichannels;i++){ - double *pcm=vb->pcm[i]; + float *pcm=vb->pcm[i]; for(j=0;jchannels;i++){ - double *pcm=vb->pcm[i]; + float *pcm=vb->pcm[i]; mdct_forward(vd->transform[vb->W][0],pcm,pcm); } { - double *floor=_vorbis_block_alloc(vb,n*sizeof(double)/2); + float *floor=_vorbis_block_alloc(vb,n*sizeof(float)/2); for(i=0;ichannels;i++){ - double *pcm=vb->pcm[i]; - double *decay=look->decay[i]; + float *pcm=vb->pcm[i]; + float *decay=look->decay[i]; int submap=info->chmuxlist[i]; /* if some other mode/mapping was called last frame, our decay accumulator is out of date. Clear it. */ if(look->lastframe+1 != vb->sequence) - memset(decay,0,n*sizeof(double)/2); + memset(decay,0,n*sizeof(float)/2); /* perform psychoacoustics; do masking */ _vp_compute_mask(look->psy_look+submap,pcm,floor,decay); @@ -305,7 +302,7 @@ static int forward(vorbis_block *vb,vorbis_look_mapping *l){ return(0); } -static int inverse(vorbis_block *vb,vorbis_look_mapping *l){ +static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; @@ -314,8 +311,8 @@ static int inverse(vorbis_block *vb,vorbis_look_mapping *l){ int i,j; long n=vb->pcmend=vi->blocksizes[vb->W]; - double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype]; - double **pcmbundle=alloca(sizeof(double *)*vi->channels); + float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype]; + float **pcmbundle=alloca(sizeof(float *)*vi->channels); int *nonzero=alloca(sizeof(int)*vi->channels); /* time domain information decode (note that applying the @@ -325,7 +322,7 @@ static int inverse(vorbis_block *vb,vorbis_look_mapping *l){ /* recover the spectral envelope; store it in the PCM vector for now */ for(i=0;ichannels;i++){ - double *pcm=vb->pcm[i]; + float *pcm=vb->pcm[i]; int submap=info->chmuxlist[i]; nonzero[i]=look->floor_func[submap]-> inverse(vb,look->floor_look[submap],pcm); @@ -347,7 +344,7 @@ static int inverse(vorbis_block *vb,vorbis_look_mapping *l){ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ /* only MDCT right now.... */ for(i=0;ichannels;i++){ - double *pcm=vb->pcm[i]; + float *pcm=vb->pcm[i]; _analysis_output("out",seq+i,pcm,n/2,0,1); mdct_backward(vd->transform[vb->W][0],pcm,pcm); } @@ -357,7 +354,7 @@ static int inverse(vorbis_block *vb,vorbis_look_mapping *l){ /* window the data */ for(i=0;ichannels;i++){ - double *pcm=vb->pcm[i]; + float *pcm=vb->pcm[i]; if(nonzero[i]) for(j=0;jlog2n=rint(log(n)/log(2)); @@ -96,21 +96,21 @@ void mdct_clear(mdct_lookup *l){ } } -static double *_mdct_kernel(double *x, double *w, +static float *_mdct_kernel(float *x, float *w, int n, int n2, int n4, int n8, mdct_lookup *init){ int i; /* step 2 */ { - double *xA=x+n4; - double *xB=x; - double *w2=w+n4; - double *A=init->trig+n2; + float *xA=x+n4; + float *xB=x; + float *w2=w+n4; + float *A=init->trig+n2; for(i=0;i>(i+2); int k1=1<<(i+3); int wbase=n2-2; - double *A=init->trig; - double *temp; + float *A=init->trig; + float *temp; for(r=0;r<(k0>>2);r++){ int w1=wbase; int w2=w1-(k0>>1); - double AEv= A[0],wA; - double AOv= A[1],wB; + float AEv= A[0],wA; + float AOv= A[1],wB; wbase-=2; k0++; @@ -170,23 +170,23 @@ static double *_mdct_kernel(double *x, double *w, /* step 4, 5, 6, 7 */ { - double *C=init->trig+n; + float *C=init->trig+n; int *bit=init->bitrev; - double *x1=x; - double *x2=x+n2-1; + float *x1=x; + float *x2=x+n2-1; for(i=0;in; - double *x=alloca(sizeof(double)*(n/2)); - double *w=alloca(sizeof(double)*(n/2)); - double *xx; + float *x=alloca(sizeof(float)*(n/2)); + float *w=alloca(sizeof(float)*(n/2)); + float *xx; int n2=n>>1; int n4=n>>2; int n8=n>>3; @@ -209,10 +209,10 @@ void mdct_forward(mdct_lookup *init, double *in, double *out){ /* window + rotate + step 1 */ { - double tempA,tempB; + float tempA,tempB; int in1=n2+n4-4; int in2=in1+5; - double *A=init->trig+n2; + float *A=init->trig+n2; i=0; @@ -253,9 +253,9 @@ void mdct_forward(mdct_lookup *init, double *in, double *out){ /* step 8 */ { - double *B=init->trig+n2; - double *out2=out+n2; - double scale=4./n; + float *B=init->trig+n2; + float *out2=out+n2; + float scale=4./n; for(i=0;in; - double *x=alloca(sizeof(double)*(n/2)); - double *w=alloca(sizeof(double)*(n/2)); - double *xx; + float *x=alloca(sizeof(float)*(n/2)); + float *w=alloca(sizeof(float)*(n/2)); + float *xx; int n2=n>>1; int n4=n>>2; int n8=n>>3; @@ -278,9 +278,9 @@ void mdct_backward(mdct_lookup *init, double *in, double *out){ /* rotate + step 1 */ { - double *inO=in+1; - double *xO= x; - double *A=init->trig+n2; + float *inO=in+1; + float *xO= x; + float *A=init->trig+n2; for(i=0;itrig+n2; + float *B=init->trig+n2; int o1=n4,o2=o1-1; int o3=n4+n2,o4=o3-1; for(i=0;i #endif @@ -57,9 +57,4 @@ # define max(x,y) ((x)<(y)?(y):(x)) #endif -#include "../include/vorbis/os_types.h" - #endif /* _OS_H */ - - - diff --git a/lib/psy.c b/lib/psy.c index ed3718b..3312f81 100644 --- a/lib/psy.c +++ b/lib/psy.c @@ -12,7 +12,7 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.28 2000/09/07 13:23:44 msmith Exp $ + last mod: $Id: psy.c,v 1.29 2000/10/12 03:12:53 xiphmont Exp $ ********************************************************************/ @@ -44,14 +44,14 @@ void _vi_psy_free(vorbis_info_psy *i){ /* Set up decibel threshhold slopes on a Bark frequency scale */ /* ATH is the only bit left on a Bark scale. No reason to change it right now */ -static void set_curve(double *ref,double *c,int n, double crate){ +static void set_curve(float *ref,float *c,int n, float crate){ int i,j=0; for(i=0;ic[i])c[i]=c2[i]; } -static void attenuate_curve(double *c,double att){ +static void attenuate_curve(float *c,float att){ int i; for(i=0;iath=malloc(n*sizeof(double)); + p->ath=malloc(n*sizeof(float)); p->octave=malloc(n*sizeof(int)); - p->bark=malloc(n*sizeof(double)); + p->bark=malloc(n*sizeof(float)); p->vi=vi; p->n=n; @@ -193,70 +193,70 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate){ p->octave[i]=oc; } - p->tonecurves=malloc(P_BANDS*sizeof(double **)); - p->noiseatt=malloc(P_BANDS*sizeof(double **)); - p->peakatt=malloc(P_BANDS*sizeof(double *)); + p->tonecurves=malloc(P_BANDS*sizeof(float **)); + p->noiseatt=malloc(P_BANDS*sizeof(float **)); + p->peakatt=malloc(P_BANDS*sizeof(float *)); for(i=0;itonecurves[i]=malloc(P_LEVELS*sizeof(double *)); - p->noiseatt[i]=malloc(P_LEVELS*sizeof(double)); - p->peakatt[i]=malloc(P_LEVELS*sizeof(double)); + p->tonecurves[i]=malloc(P_LEVELS*sizeof(float *)); + p->noiseatt[i]=malloc(P_LEVELS*sizeof(float)); + p->peakatt[i]=malloc(P_LEVELS*sizeof(float)); } for(i=0;itonecurves[i][j]=malloc(EHMER_MAX*sizeof(double)); + p->tonecurves[i][j]=malloc(EHMER_MAX*sizeof(float)); } /* OK, yeah, this was a silly way to do it */ - memcpy(p->tonecurves[0][4],tone_125_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[0][6],tone_125_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[0][8],tone_125_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[0][10],tone_125_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[2][4],tone_125_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[2][6],tone_125_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[2][8],tone_125_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[2][10],tone_125_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[4][4],tone_250_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[4][6],tone_250_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[4][8],tone_250_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[4][10],tone_250_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[6][4],tone_500_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[6][6],tone_500_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[6][8],tone_500_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[6][10],tone_500_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[8][4],tone_1000_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[8][6],tone_1000_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[8][8],tone_1000_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[8][10],tone_1000_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[10][4],tone_2000_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[10][6],tone_2000_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[10][8],tone_2000_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[10][10],tone_2000_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[12][4],tone_4000_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[12][6],tone_4000_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[12][8],tone_4000_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[12][10],tone_4000_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[14][4],tone_8000_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[14][6],tone_8000_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[14][8],tone_8000_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[14][10],tone_8000_100dB_SL,sizeof(double)*EHMER_MAX); - - memcpy(p->tonecurves[16][4],tone_8000_40dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[16][6],tone_8000_60dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[16][8],tone_8000_80dB_SL,sizeof(double)*EHMER_MAX); - memcpy(p->tonecurves[16][10],tone_8000_100dB_SL,sizeof(double)*EHMER_MAX); + memcpy(p->tonecurves[0][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[0][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[0][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[0][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[2][4],tone_125_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[2][6],tone_125_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[2][8],tone_125_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[2][10],tone_125_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[4][4],tone_250_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[4][6],tone_250_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[4][8],tone_250_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[4][10],tone_250_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[6][4],tone_500_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[6][6],tone_500_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[6][8],tone_500_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[6][10],tone_500_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[8][4],tone_1000_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[8][6],tone_1000_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[8][8],tone_1000_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[8][10],tone_1000_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[10][4],tone_2000_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[10][6],tone_2000_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[10][8],tone_2000_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[10][10],tone_2000_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[12][4],tone_4000_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[12][6],tone_4000_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[12][8],tone_4000_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[12][10],tone_4000_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[14][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[14][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[14][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[14][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX); + + memcpy(p->tonecurves[16][4],tone_8000_40dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[16][6],tone_8000_60dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[16][8],tone_8000_80dB_SL,sizeof(float)*EHMER_MAX); + memcpy(p->tonecurves[16][10],tone_8000_100dB_SL,sizeof(float)*EHMER_MAX); /* interpolate curves between */ for(i=1;itonecurves[i][j],p->tonecurves[i-1][j],EHMER_MAX*sizeof(double)); + memcpy(p->tonecurves[i][j],p->tonecurves[i-1][j],EHMER_MAX*sizeof(float)); /*interp_curve(p->tonecurves[i][j], p->tonecurves[i-1][j], p->tonecurves[i+1][j],.5);*/ @@ -303,17 +303,17 @@ void _vp_psy_clear(vorbis_look_psy *p){ } } -static void compute_decay_fixed(vorbis_look_psy *p,double *f, double *decay, int n){ +static void compute_decay_fixed(vorbis_look_psy *p,float *f, float *decay, int n){ /* handle decay */ int i; - double decscale=fromdB(p->vi->decay_coeff*n); - double attscale=1./fromdB(p->vi->attack_coeff); + float decscale=fromdB(p->vi->decay_coeff*n); + float attscale=1./fromdB(p->vi->attack_coeff); for(i=10;iattscale) decay[i]=fabs(f[i]/attscale); @@ -343,13 +343,13 @@ static long _eights[EHMER_MAX+1]={ 88752,96785,105545,115097, 125515}; -static int seed_curve(double *flr, - double **curves, - double amp,double specmax, - int x,int n,double specatt, +static int seed_curve(float *flr, + float **curves, + float amp,float specmax, + int x,int n,float specatt, int maxEH){ int i; - double *curve; + float *curve; /* make this attenuation adjustable */ int choice=(int)((todB(amp)-specmax+specatt)/10.+.5); @@ -365,9 +365,9 @@ static int seed_curve(double *flr, if(curve[i]>0.)break; for(;i>=0;i--){ - double lin=curve[i]; + float lin=curve[i]; if(lin>0.){ - double *fp=flr+((x*_eights[i])>>12); + float *fp=flr+((x*_eights[i])>>12); lin*=amp; if(*fp>12; /* make this attenuation adjustable */ @@ -387,7 +387,7 @@ static void seed_peak(double *flr, if(choice>=P_LEVELS)choice=P_LEVELS-1; if(prevxvi; long n=p->n,i; int maxEH=EHMER_MAX-1; @@ -414,10 +414,10 @@ static void seed_generic(vorbis_look_psy *p, } static void seed_att(vorbis_look_psy *p, - double **att, - double *f, - double *flr, - double specmax){ + float **att, + float *f, + float *flr, + float specmax){ vorbis_info_psy *vi=p->vi; long n=p->n,i; @@ -428,17 +428,17 @@ static void seed_att(vorbis_look_psy *p, } static void seed_point(vorbis_look_psy *p, - double **att, - double *f, - double *flr, - double specmax){ + float **att, + float *f, + float *flr, + float specmax){ vorbis_info_psy *vi=p->vi; long n=p->n,i; for(i=0;imax_curve_dB)/10.+.5); - double lin; + float lin; if(choice<0)choice=0; if(choice>=P_LEVELS)choice=P_LEVELS-1; lin=att[p->octave[i]][choice]*f[i]; @@ -447,10 +447,10 @@ static void seed_point(vorbis_look_psy *p, } /* bleaugh, this is more complicated than it needs to be */ -static void max_seeds(vorbis_look_psy *p,double *seeds,double *flr){ +static void max_seeds(vorbis_look_psy *p,float *seeds,float *flr){ long n=p->n,i,j; long *posstack=alloca(n*sizeof(long)); - double *ampstack=alloca(n*sizeof(double)); + float *ampstack=alloca(n*sizeof(float)); long stack=0; for(i=0;in); +void _vp_compute_mask(vorbis_look_psy *p,float *f, + float *flr, + float *decay){ + float *smooth=alloca(sizeof(float)*p->n); int i,n=p->n; - double specmax=0.; + float specmax=0.; - double *seed=alloca(sizeof(double)*p->n); - double *seed2=alloca(sizeof(double)*p->n); + float *seed=alloca(sizeof(float)*p->n); + float *seed2=alloca(sizeof(float)*p->n); - memset(flr,0,n*sizeof(double)); + memset(flr,0,n*sizeof(float)); /* noise masking */ if(p->vi->noisemaskp){ - memset(seed,0,n*sizeof(double)); + memset(seed,0,n*sizeof(float)); bark_noise(n,p->bark,f,seed); seed_point(p,p->noiseatt,seed,flr,specmax); @@ -611,19 +611,19 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f, /* compute power^.5 of three neighboring bins to smooth for peaks that get split twixt bins/peaks that nail the bin. This evens out treatment as we're not doing additive masking any longer. */ - double acc=smooth[0]*smooth[0]+smooth[1]*smooth[1]; - double prev=smooth[0]; + float acc=smooth[0]*smooth[0]+smooth[1]*smooth[1]; + float prev=smooth[0]; smooth[0]=sqrt(acc); for(i=1;ivi->athp){ - double att=specmax+p->vi->ath_adjatt; + float att=specmax+p->vi->ath_adjatt; if(attvi->ath_maxatt)att=p->vi->ath_maxatt; att=fromdB(att); for(i=0;iath[i]*att; + float av=p->ath[i]*att; if(av>flr[i])flr[i]=av; } } /* peak attenuation ******/ if(p->vi->peakattp){ - memset(seed,0,n*sizeof(double)); + memset(seed,0,n*sizeof(float)); seed_att(p,p->peakatt,smooth,seed,specmax); max_seeds(p,seed,flr); } /* tone masking */ if(p->vi->tonemaskp){ - memset(seed,0,n*sizeof(double)); - memset(seed2,0,n*sizeof(double)); + memset(seed,0,n*sizeof(float)); + memset(seed2,0,n*sizeof(float)); seed_generic(p,p->tonecurves,smooth,flr,seed2,specmax); max_seeds(p,seed2,seed2); @@ -677,7 +677,7 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f, it than to just tack it on */ for(i=0;iflr[i] || -2.*f[i]>flr[i])break; - if(i==n)memset(flr,0,sizeof(double)*n); + if(i==n)memset(flr,0,sizeof(float)*n); } @@ -685,8 +685,8 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f, /* this applies the floor and (optionally) tries to preserve noise energy in low resolution portions of the spectrum */ /* f and flr are *linear* scale, not dB */ -void _vp_apply_floor(vorbis_look_psy *p,double *f, double *flr){ - double *work=alloca(p->n*sizeof(double)); +void _vp_apply_floor(vorbis_look_psy *p,float *f, float *flr){ + float *work=alloca(p->n*sizeof(float)); int j; /* subtract the floor */ @@ -697,7 +697,7 @@ void _vp_apply_floor(vorbis_look_psy *p,double *f, double *flr){ work[j]=f[j]/flr[j]; } - memcpy(f,work,p->n*sizeof(double)); + memcpy(f,work,p->n*sizeof(float)); } diff --git a/lib/psy.h b/lib/psy.h index c59beae..ba2596d 100644 --- a/lib/psy.h +++ b/lib/psy.h @@ -12,7 +12,7 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.14 2000/08/15 09:09:43 xiphmont Exp $ + last mod: $Id: psy.h,v 1.15 2000/10/12 03:12:53 xiphmont Exp $ ********************************************************************/ @@ -28,13 +28,13 @@ typedef struct { int n; struct vorbis_info_psy *vi; - double ***tonecurves; - double **peakatt; - double **noiseatt; + float ***tonecurves; + float **peakatt; + float **noiseatt; - double *ath; + float *ath; int *octave; - double *bark; + float *bark; } vorbis_look_psy; @@ -42,10 +42,10 @@ extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rat extern void _vp_psy_clear(vorbis_look_psy *p); extern void *_vi_psy_dup(void *source); extern void _vi_psy_free(vorbis_info_psy *i); -extern void _vp_compute_mask(vorbis_look_psy *p,double *f, - double *floor, - double *decay); -extern void _vp_apply_floor(vorbis_look_psy *p,double *f,double *flr); +extern void _vp_compute_mask(vorbis_look_psy *p,float *f, + float *floor, + float *decay); +extern void _vp_apply_floor(vorbis_look_psy *p,float *f,float *flr); #endif diff --git a/lib/psytune.c b/lib/psytune.c index a3c0337..9a467f2 100644 --- a/lib/psytune.c +++ b/lib/psytune.c @@ -13,7 +13,7 @@ function: simple utility that runs audio through the psychoacoustics without encoding - last mod: $Id: psytune.c,v 1.6 2000/08/19 11:46:28 xiphmont Exp $ + last mod: $Id: psytune.c,v 1.7 2000/10/12 03:12:53 xiphmont Exp $ ********************************************************************/ @@ -29,6 +29,7 @@ #include "window.h" #include "scales.h" #include "lpc.h" +#include "lsp.h" static vorbis_info_psy _psy_set0={ 1,/*athp*/ @@ -111,7 +112,7 @@ static vorbis_info_psy _psy_set0={ }; static int noisy=0; -void analysis(char *base,int i,double *v,int n,int bark,int dB){ +void analysis(char *base,int i,float *v,int n,int bark,int dB){ if(noisy){ int j; FILE *of; @@ -126,7 +127,7 @@ void analysis(char *base,int i,double *v,int n,int bark,int dB){ if(bark) fprintf(of,"%g ",toBARK(22050.*j/n)); else - fprintf(of,"%g ",(double)j); + fprintf(of,"%g ",(float)j); if(dB){ fprintf(of,"%g\n",todB(fabs(v[j]))); @@ -149,17 +150,12 @@ typedef struct { lpc_lookup lpclook; } vorbis_look_floor0; -extern double _curve_to_lpc(double *curve,double *lpc,vorbis_look_floor0 *l, - long frameno); -extern void _lsp_to_curve(double *curve,double *lpc,double amp, - vorbis_look_floor0 *l,char *name,long frameno); - -long frameno=0; +long granulepos=0; /* hacked from floor0.c */ static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){ int j; - double scale; + float scale; look->m=m; look->n=n; look->ln=ln; @@ -177,15 +173,15 @@ static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){ int main(int argc,char *argv[]){ int eos=0; - double nonz=0.; - double acc=0.; - double tot=0.; + float nonz=0.; + float acc=0.; + float tot=0.; int framesize=2048; int order=32; int map=256; - double *pcm[2],*out[2],*window,*decay[2],*lpc,*floor; + float *pcm[2],*out[2],*window,*decay[2],*lpc,*floor; signed char *buffer,*buffer2; mdct_lookup m_look; vorbis_look_psy p_look; @@ -234,14 +230,14 @@ int main(int argc,char *argv[]){ argv++; } - pcm[0]=malloc(framesize*sizeof(double)); - pcm[1]=malloc(framesize*sizeof(double)); - out[0]=calloc(framesize/2,sizeof(double)); - out[1]=calloc(framesize/2,sizeof(double)); - decay[0]=calloc(framesize/2,sizeof(double)); - decay[1]=calloc(framesize/2,sizeof(double)); - floor=malloc(framesize*sizeof(double)); - lpc=malloc(order*sizeof(double)); + 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); @@ -280,9 +276,9 @@ int main(int argc,char *argv[]){ } for(i=0;i<2;i++){ - double amp; + float amp; - analysis("pre",frameno,pcm[i],framesize,0,0); + analysis("pre",granulepos,pcm[i],framesize,0,0); /* do the psychacoustics */ for(j=0;j #include #include +#include #include "vorbis/codec.h" -#include "bitwise.h" #include "registry.h" #include "bookinternal.h" #include "sharedbook.h" @@ -45,14 +45,14 @@ typedef struct { int **decodemap; } vorbis_look_residue0; -void free_info(vorbis_info_residue *i){ +void res0_free_info(vorbis_info_residue *i){ if(i){ memset(i,0,sizeof(vorbis_info_residue0)); free(i); } } -void free_look(vorbis_look_residue *i){ +void res0_free_look(vorbis_look_residue *i){ int j; if(i){ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; @@ -67,44 +67,44 @@ void free_look(vorbis_look_residue *i){ } } -void pack(vorbis_info_residue *vr,oggpack_buffer *opb){ +void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; int j,acc=0; - _oggpack_write(opb,info->begin,24); - _oggpack_write(opb,info->end,24); + oggpack_write(opb,info->begin,24); + oggpack_write(opb,info->end,24); - _oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and + oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and code with a partitioned book */ - _oggpack_write(opb,info->partitions-1,6); /* possible partition choices */ - _oggpack_write(opb,info->groupbook,8); /* group huffman book */ + oggpack_write(opb,info->partitions-1,6); /* possible partition choices */ + oggpack_write(opb,info->groupbook,8); /* group huffman book */ for(j=0;jpartitions;j++){ - _oggpack_write(opb,info->secondstages[j],4); /* zero *is* a valid choice */ + oggpack_write(opb,info->secondstages[j],4); /* zero *is* a valid choice */ acc+=info->secondstages[j]; } for(j=0;jbooklist[j],8); + oggpack_write(opb,info->booklist[j],8); } /* vorbis_info is for range checking */ -vorbis_info_residue *unpack(vorbis_info *vi,oggpack_buffer *opb){ +vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ int j,acc=0; vorbis_info_residue0 *info=calloc(1,sizeof(vorbis_info_residue0)); - info->begin=_oggpack_read(opb,24); - info->end=_oggpack_read(opb,24); - info->grouping=_oggpack_read(opb,24)+1; - info->partitions=_oggpack_read(opb,6)+1; - info->groupbook=_oggpack_read(opb,8); + info->begin=oggpack_read(opb,24); + info->end=oggpack_read(opb,24); + info->grouping=oggpack_read(opb,24)+1; + info->partitions=oggpack_read(opb,6)+1; + info->groupbook=oggpack_read(opb,8); for(j=0;jpartitions;j++){ - int cascade=info->secondstages[j]=_oggpack_read(opb,4); + int cascade=info->secondstages[j]=oggpack_read(opb,4); if(cascade>1)goto errout; /* temporary! when cascading gets reworked and actually used, we don't want old code to DTWT */ acc+=cascade; } for(j=0;jbooklist[j]=_oggpack_read(opb,8); + info->booklist[j]=oggpack_read(opb,8); if(info->groupbook>=vi->books)goto errout; for(j=0;jinfo; int i,j=0; - double max,localmax=0.; - double temp[128]; - double entropy[8]; + float max,localmax=0.; + float temp[128]; + float entropy[8]; /* setup */ for(i=0;idim; + memset(work,0,sizeof(float)*n); + for(i=0;idim; int step=n/dim; - for(i=0;iinfo; @@ -290,7 +289,7 @@ int forward(vorbis_block *vb,vorbis_look_residue *vl, /* we code the partition words for each channel, then the residual words for a partition per channel until we've written all the residual words for that partition word. Then write the next - parition channel words... */ + partition channel words... */ for(i=info->begin,l=0;iend;){ /* first we encode a partition codeword for each channel */ @@ -324,7 +323,7 @@ int forward(vorbis_block *vb,vorbis_look_residue *vl, } /* a truncated packet here just means 'stop working'; it's not an error */ -int inverse(vorbis_block *vb,vorbis_look_residue *vl,double **in,int ch){ +int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,float **in,int ch){ long i,j,k,l,transend=vb->pcmend/2; vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; vorbis_info_residue0 *info=look->info; @@ -337,12 +336,12 @@ int inverse(vorbis_block *vb,vorbis_look_residue *vl,double **in,int ch){ int partvals=n/samples_per_partition; int partwords=(partvals+partitions_per_word-1)/partitions_per_word; int **partword=alloca(ch*sizeof(long *)); - double *work=alloca(sizeof(double)*samples_per_partition); + float *work=alloca(sizeof(float)*samples_per_partition); partvals=partwords*partitions_per_word; /* make sure we're zeroed up to the start */ for(j=0;jbegin); + memset(in[j],0,sizeof(float)*info->begin); for(i=info->begin,l=0;iend;){ /* fetch the partition word for each channel */ @@ -366,23 +365,23 @@ int inverse(vorbis_block *vb,vorbis_look_residue *vl,double **in,int ch){ eopbreak: if(i dB, Bark and Mel scales - last mod: $Id: scales.h,v 1.5 2000/06/14 01:38:32 xiphmont Exp $ + last mod: $Id: scales.h,v 1.6 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -23,7 +23,8 @@ /* 20log10(x) */ #define DYNAMIC_RANGE_dB 200. -#define todB(x) ((x)==0?-9.e40:log(fabs(x))*8.6858896) +#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)) diff --git a/lib/sharedbook.c b/lib/sharedbook.c index 1e3670d..4dc8d4e 100644 --- a/lib/sharedbook.c +++ b/lib/sharedbook.c @@ -12,17 +12,17 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.c,v 1.8 2000/08/31 08:01:34 xiphmont Exp $ + last mod: $Id: sharedbook.c,v 1.9 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ #include #include #include +#include #include "os.h" #include "vorbis/codec.h" #include "vorbis/codebook.h" -#include "bitwise.h" #include "scales.h" #include "sharedbook.h" @@ -45,7 +45,7 @@ int _ilog(unsigned int v){ #define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */ /* doesn't currently guard under/overflow */ -long _float32_pack(double val){ +long _float32_pack(float val){ int sign=0; long exp; long mant; @@ -60,10 +60,10 @@ long _float32_pack(double val){ return(sign|exp|mant); } -double _float32_unpack(long val){ - double mant=val&0x1fffff; - double sign=val&0x80000000; - double exp =(val&0x7fe00000)>>VQ_FMAN; +float _float32_unpack(long val){ + float mant=val&0x1fffff; + float sign=val&0x80000000; + float exp =(val&0x7fe00000)>>VQ_FMAN; if(sign)mant= -mant; return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS)); } @@ -142,7 +142,7 @@ long *_make_words(long *l,long n){ /* build the decode helper tree from the codewords */ decode_aux *_make_decode_tree(codebook *c){ const static_codebook *s=c->c; - long top=0,i,j; + long top=0,i,j,n; decode_aux *t=malloc(sizeof(decode_aux)); long *ptr0=t->ptr0=calloc(c->entries*2,sizeof(long)); long *ptr1=t->ptr1=calloc(c->entries*2,sizeof(long)); @@ -173,6 +173,25 @@ decode_aux *_make_decode_tree(codebook *c){ } } free(codelist); + + t->tabn = _ilog(c->entries)-4; /* this is magic */ + if(t->tabn<5)t->tabn=5; + n = 1<tabn; + t->tab = malloc(n*sizeof(long)); + t->tabl = malloc(n*sizeof(int)); + for (i = 0; i < n; i++) { + long p = 0; + for (j = 0; j < t->tabn && (p > 0 || j == 0); j++) { + if (i & (1 << j)) + p = ptr1[p]; + else + p = ptr0[p]; + } + /* now j == length, and p == -code */ + t->tab[i] = p; + t->tabl[i] = j; + } + return(t); } @@ -212,13 +231,13 @@ long _book_maptype1_quantvals(const static_codebook *b){ generated algorithmically (each column of the vector counts through the values in the quant vector). in map type 2, all the values came in in an explicit list. Both value lists must be unpacked */ -double *_book_unquantize(const static_codebook *b){ +float *_book_unquantize(const static_codebook *b){ long j,k; if(b->maptype==1 || b->maptype==2){ int quantvals; - double mindel=_float32_unpack(b->q_min); - double delta=_float32_unpack(b->q_delta); - double *r=calloc(b->entries*b->dim,sizeof(double)); + float mindel=_float32_unpack(b->q_min); + float delta=_float32_unpack(b->q_delta); + float *r=calloc(b->entries*b->dim,sizeof(float)); /* maptype 1 and 2 both use a quantized value vector, but different sizes */ @@ -233,11 +252,11 @@ double *_book_unquantize(const static_codebook *b){ that */ quantvals=_book_maptype1_quantvals(b); for(j=0;jentries;j++){ - double last=0.; + float last=0.; int indexdiv=1; for(k=0;kdim;k++){ int index= (j/indexdiv)%quantvals; - double val=b->quantlist[index]; + float val=b->quantlist[index]; val=fabs(val)*delta+mindel+last; if(b->q_sequencep)last=val; r[j*b->dim+k]=val; @@ -247,9 +266,9 @@ double *_book_unquantize(const static_codebook *b){ break; case 2: for(j=0;jentries;j++){ - double last=0.; + float last=0.; for(k=0;kdim;k++){ - double val=b->quantlist[j*b->dim+k]; + float val=b->quantlist[j*b->dim+k]; val=fabs(val)*delta+mindel+last; if(b->q_sequencep)last=val; r[j*b->dim+k]=val; @@ -319,25 +338,25 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ return(-1); } -static double _dist(int el,double *ref, double *b,int step){ +static float _dist(int el,float *ref, float *b,int step){ int i; - double acc=0.; + float acc=0.; for(i=0;i -int _best(codebook *book, double *a, int step){ +int _best(codebook *book, float *a, int step){ encode_aux_nearestmatch *nt=book->c->nearest_tree; encode_aux_threshmatch *tt=book->c->thresh_tree; encode_aux_pigeonhole *pt=book->c->pigeon_tree; int dim=book->dim; int ptr=0,k,o; /*int savebest=-1; - double saverr;*/ + float saverr;*/ /* do we have a threshhold encode hint? */ if(tt){ @@ -364,14 +383,14 @@ int _best(codebook *book, double *a, int step){ if(pt){ const static_codebook *c=book->c; int i,besti=-1; - double best; + float best; int entry=0; /* dealing with sequentialness is a pain in the ass */ if(c->q_sequencep){ int pv; long mul=1; - double qlast=0; + float qlast=0; for(k=0,o=0;kmin)/pt->del); if(pv<0 || pv>=pt->mapentries)break; @@ -393,7 +412,7 @@ int _best(codebook *book, double *a, int step){ /* search the abbreviated list */ long *list=pt->fitlist+pt->fitmap[entry]; for(i=0;ifitlength[entry];i++){ - double this=_dist(dim,book->valuelist+list[i]*dim,a,step); + float this=_dist(dim,book->valuelist+list[i]*dim,a,step); if(besti==-1 || thisvaluelist+nt->p[ptr]; - double *q=book->valuelist+nt->q[ptr]; + float c=0.; + float *p=book->valuelist+nt->p[ptr]; + float *q=book->valuelist+nt->q[ptr]; for(k=0,o=0;kc; int i,besti=-1; - double best; - double *e=book->valuelist; + float best; + float *e=book->valuelist; for(i=0;ientries;i++){ if(c->lengthlist[i]>0){ - double this=_dist(dim,e,a,step); + float this=_dist(dim,e,a,step); if(besti==-1 || thisdim,i,o; int best=_best(book,a,step); switch(addmul){ @@ -469,7 +488,7 @@ int vorbis_book_besterror(codebook *book,double *a,int step,int addmul){ break; case 1: for(i=0,o=0;ivaluelist+best*dim)[i]; + float val=(book->valuelist+best*dim)[i]; if(val==0){ a[o]=0; }else{ @@ -519,7 +538,7 @@ static_codebook test1={ NULL, NULL,NULL }; -static double *test1_result=NULL; +static float *test1_result=NULL; /* linear, full mapping, nonsequential */ static_codebook test2={ @@ -530,7 +549,7 @@ static_codebook test2={ full_quantlist1, NULL,NULL }; -static double test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2}; +static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2}; /* linear, full mapping, sequential */ static_codebook test3={ @@ -541,7 +560,7 @@ static_codebook test3={ full_quantlist1, NULL,NULL }; -static double test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6}; +static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6}; /* linear, algorithmic mapping, nonsequential */ static_codebook test4={ @@ -552,7 +571,7 @@ static_codebook test4={ partial_quantlist1, NULL,NULL }; -static double test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3, +static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3, -3, 4,-3, 4, 4,-3, -1, 4,-3, -3,-1,-3, 4,-1,-3, -1,-1,-3, -3,-3, 4, 4,-3, 4, -1,-3, 4, @@ -571,7 +590,7 @@ static_codebook test5={ partial_quantlist1, NULL,NULL }; -static double test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7, +static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7, -3, 1,-2, 4, 8, 5, -1, 3, 0, -3,-4,-7, 4, 3, 0, -1,-2,-5, -3,-6,-2, 4, 1, 5, -1,-4, 0, @@ -581,8 +600,8 @@ static double test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7, -3, 1, 0, 4, 8, 7, -1, 3, 2, -3,-4,-5, 4, 3, 2, -1,-2,-3}; -void run_test(static_codebook *b,double *comp){ - double *out=_book_unquantize(b); +void run_test(static_codebook *b,float *comp){ + float *out=_book_unquantize(b); int i; if(comp){ diff --git a/lib/sharedbook.h b/lib/sharedbook.h index df2c1fc..aeb8256 100644 --- a/lib/sharedbook.h +++ b/lib/sharedbook.h @@ -12,7 +12,7 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.h,v 1.2 2000/05/08 20:49:50 xiphmont Exp $ + last mod: $Id: sharedbook.h,v 1.3 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -26,15 +26,15 @@ extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source) extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); extern void vorbis_book_clear(codebook *b); -extern double *_book_unquantize(const static_codebook *b); -extern double *_book_logdist(const static_codebook *b,double *vals); -extern double _float32_unpack(long val); -extern long _float32_pack(double val); -extern int _best(codebook *book, double *a, int step); +extern float *_book_unquantize(const static_codebook *b); +extern float *_book_logdist(const static_codebook *b,float *vals); +extern float _float32_unpack(long val); +extern long _float32_pack(float val); +extern int _best(codebook *book, float *a, int step); extern int _ilog(unsigned int v); extern long _book_maptype1_quantvals(const static_codebook *b); -extern int vorbis_book_besterror(codebook *book,double *a,int step,int addmul); +extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul); extern long vorbis_book_codeword(codebook *book,int entry); extern long vorbis_book_codelen(codebook *book,int entry); diff --git a/lib/smallft.c b/lib/smallft.c index c75e451..492ac37 100644 --- a/lib/smallft.c +++ b/lib/smallft.c @@ -12,7 +12,7 @@ ******************************************************************** function: *unnormalized* fft transform - last mod: $Id: smallft.c,v 1.8 2000/03/10 13:21:18 xiphmont Exp $ + last mod: $Id: smallft.c,v 1.9 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -35,10 +35,10 @@ #include "smallft.h" #include "misc.h" -static void drfti1(int n, double *wa, int *ifac){ +static void drfti1(int n, float *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; - static double tpi = 6.28318530717958647692528676655900577; - double arg,argh,argld,fi; + 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; @@ -91,7 +91,7 @@ static void drfti1(int n, double *wa, int *ifac){ for (j=0;j>1; @@ -570,7 +570,7 @@ L119: } } -static void drftf1(int n,double *c,double *ch,double *wa,int *ifac){ +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; @@ -631,9 +631,9 @@ static void drftf1(int n,double *c,double *ch,double *wa,int *ifac){ for(i=0;i>1; @@ -1151,7 +1151,7 @@ L132: } } -static void drftb1(int n, double *c, double *ch, double *wa, int *ifac){ +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; @@ -1229,19 +1229,19 @@ static void drftb1(int n, double *c, double *ch, double *wa, int *ifac){ for(i=0;in==1)return; drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } -void drft_backward(drft_lookup *l,double *data){ +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(double)); + l->trigcache=calloc(3*n,sizeof(float)); l->splitcache=calloc(32,sizeof(int)); fdrffti(n, l->trigcache, l->splitcache); } diff --git a/lib/smallft.h b/lib/smallft.h index 69e9b58..5132772 100644 --- a/lib/smallft.h +++ b/lib/smallft.h @@ -12,7 +12,7 @@ ******************************************************************** function: fft transform - last mod: $Id: smallft.h,v 1.6 2000/01/22 13:28:32 xiphmont Exp $ + last mod: $Id: smallft.h,v 1.7 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -23,12 +23,12 @@ typedef struct { int n; - double *trigcache; + float *trigcache; int *splitcache; } drft_lookup; -extern void drft_forward(drft_lookup *l,double *data); -extern void drft_backward(drft_lookup *l,double *data); +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); diff --git a/lib/spectrum.h b/lib/spectrum.h deleted file mode 100644 index bafc25c..0000000 --- a/lib/spectrum.h +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * - * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * - * PLEASE READ THESE TERMS DISTRIBUTING. * - * * - * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 * - * by Monty and The XIPHOPHORUS Company * - * http://www.xiph.org/ * - * * - ******************************************************************** - - function: spectrum envelope and residue code/decode - last mod: $Id: spectrum.h,v 1.4 2000/01/04 09:05:04 xiphmont Exp $ - - ********************************************************************/ - -#ifndef _V_SPECT_H_ -#define _V_SPECT_H_ - -extern int _vs_spectrum_encode(vorbis_block *vb,double amp,double *lsp); -extern int _vs_spectrum_decode(vorbis_block *vb,double *amp,double *lsp); -extern void _vs_residue_quantize(double *data,double *curve, - vorbis_info *vi,int n); -extern int _vs_residue_encode(vorbis_block *vb,double *data); -extern int _vs_residue_decode(vorbis_block *vb,double *data); - -extern void _vs_residue_train(vorbis_block *vb,double *data,double *curve, - int n); - -#endif diff --git a/lib/synthesis.c b/lib/synthesis.c index 00c9008..e8aae23 100644 --- a/lib/synthesis.c +++ b/lib/synthesis.c @@ -12,14 +12,14 @@ ******************************************************************** function: single-block PCM synthesis - last mod: $Id: synthesis.c,v 1.17 2000/07/07 00:53:10 xiphmont Exp $ + last mod: $Id: synthesis.c,v 1.18 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ #include +#include #include "vorbis/codec.h" #include "registry.h" -#include "bitwise.h" #include "misc.h" #include "os.h" @@ -31,23 +31,23 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ /* first things first. Make sure decode is ready */ _vorbis_block_ripcord(vb); - _oggpack_readinit(opb,op->packet,op->bytes); + oggpack_readinit(opb,op->packet,op->bytes); /* Check the packet type */ - if(_oggpack_read(opb,1)!=0){ + if(oggpack_read(opb,1)!=0){ /* Oops. This is not an audio data packet */ return(-1); } /* read our mode and pre/post windowsize */ - mode=_oggpack_read(opb,vd->modebits); + mode=oggpack_read(opb,vd->modebits); if(mode==-1)return(-1); vb->mode=mode; vb->W=vi->mode_param[mode]->blockflag; if(vb->W){ - vb->lW=_oggpack_read(opb,1); - vb->nW=_oggpack_read(opb,1); + vb->lW=oggpack_read(opb,1); + vb->nW=oggpack_read(opb,1); if(vb->nW==-1) return(-1); }else{ vb->lW=0; @@ -55,15 +55,15 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ } /* more setup */ - vb->frameno=op->frameno; + vb->granulepos=op->granulepos; vb->sequence=op->packetno-3; /* first block is third packet */ vb->eofflag=op->e_o_s; /* alloc pcm passback storage */ vb->pcmend=vi->blocksizes[vb->W]; - vb->pcm=_vorbis_block_alloc(vb,sizeof(double *)*vi->channels); + vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels); for(i=0;ichannels;i++) - vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(double)); + vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float)); /* unpack_header enforces range checking */ type=vi->map_type[vi->mode_param[mode]->mapping]; diff --git a/lib/time0.c b/lib/time0.c index 6344a48..8f48670 100644 --- a/lib/time0.c +++ b/lib/time0.c @@ -12,7 +12,7 @@ ******************************************************************** function: time backend 0 (dummy) - last mod: $Id: time0.c,v 1.5 2000/03/10 13:21:18 xiphmont Exp $ + last mod: $Id: time0.c,v 1.6 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -22,30 +22,31 @@ #include "registry.h" #include "misc.h" -static void pack (vorbis_info_time *i,oggpack_buffer *opb){ +static void time0_pack (vorbis_info_time *i,oggpack_buffer *opb){ } -static vorbis_info_time *unpack (vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_time *time0_unpack (vorbis_info *vi,oggpack_buffer *opb){ return ""; } -static vorbis_look_time *look (vorbis_dsp_state *vd,vorbis_info_mode *mi, +static vorbis_look_time *time0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi, vorbis_info_time *i){ return ""; } -static void free_info(vorbis_info_time *i){ +static void time0_free_info(vorbis_info_time *i){ } -static void free_look(vorbis_look_time *i){ +static void time0_free_look(vorbis_look_time *i){ } -static int forward(vorbis_block *vb,vorbis_look_time *i, - double *in,double *out){ +static int time0_forward(vorbis_block *vb,vorbis_look_time *i, + float *in,float *out){ return(0); } -static int inverse(vorbis_block *vb,vorbis_look_time *i, - double *in,double *out){ +static int time0_inverse(vorbis_block *vb,vorbis_look_time *i, + float *in,float *out){ return(0); } /* export hooks */ vorbis_func_time time0_exportbundle={ - &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse + &time0_pack,&time0_unpack,&time0_look,&time0_free_info, + &time0_free_look,&time0_forward,&time0_inverse }; diff --git a/lib/tone.c b/lib/tone.c new file mode 100644 index 0000000..3cc32b3 --- /dev/null +++ b/lib/tone.c @@ -0,0 +1,32 @@ +#include +#include +#include + +void usage(){ + fprintf(stderr,"tone []\n"); + exit(1); +} + +int main (int argc,char *argv[]){ + int i; + double f; + double amp=32767.; + + if(argc<2)usage(); + f=atof(argv[1]); + if(argc>=3)amp=atof(argv[2])*32767.; + + for(i=0;i<44100*10;i++){ + long val=rint(amp*sin(i/44100.*f*2*M_PI)); + if(val>32767.)val=32767.; + if(val<-32768.)val=-32768.; + + fprintf(stdout,"%c%c%c%c", + (char)(val&0xff), + (char)((val>>8)&0xff), + (char)(val&0xff), + (char)((val>>8)&0xff)); + } + return(0); +} + diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index 091ea2a..a1f8119 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -12,7 +12,7 @@ ******************************************************************** function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.c,v 1.28 2000/08/30 06:09:21 xiphmont Exp $ + last mod: $Id: vorbisfile.c,v 1.29 2000/10/12 03:12:54 xiphmont Exp $ ********************************************************************/ @@ -202,19 +202,22 @@ static void _bisect_forward_serialno(OggVorbis_File *vf, /* uses the local ogg_stream storage in vf; this is important for non-streaming input sources */ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc, - long *serialno){ + long *serialno,ogg_page *og_ptr){ ogg_page og; ogg_packet op; int i,ret; - - ret=_get_next_page(vf,&og,CHUNKSIZE); - if(ret==-1){ - fprintf(stderr,"Did not find initial header for bitstream.\n"); - return -1; - } - if(serialno)*serialno=ogg_page_serialno(&og); - ogg_stream_init(&vf->os,ogg_page_serialno(&og)); + if(!og_ptr){ + ret=_get_next_page(vf,&og,CHUNKSIZE); + if(ret==-1){ + fprintf(stderr,"Did not find initial header for bitstream.\n"); + return -1; + } + og_ptr=&og; + } + + if(serialno)*serialno=ogg_page_serialno(og_ptr); + ogg_stream_init(&vf->os,ogg_page_serialno(og_ptr)); /* extract the initial header from the first page and verify that the Ogg bitstream is in fact Vorbis data */ @@ -224,7 +227,7 @@ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc, i=0; while(i<3){ - ogg_stream_pagein(&vf->os,&og); + ogg_stream_pagein(&vf->os,og_ptr); while(i<3){ int result=ogg_stream_packetout(&vf->os,&op); if(result==0)break; @@ -239,7 +242,7 @@ static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc, i++; } if(i<3) - if(_get_next_page(vf,&og,1)<0){ + if(_get_next_page(vf,og_ptr,1)<0){ fprintf(stderr,"Missing header in logical bitstream.\n"); goto bail_header; } @@ -281,7 +284,7 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i, /* seek to the location of the initial header */ _seek_helper(vf,vf->offsets[i]); - if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL)==-1){ + if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)==-1){ fprintf(stderr,"Error opening logical bitstream #%d.\n\n",i+1); vf->dataoffsets[i]=-1; }else{ @@ -306,9 +309,9 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i, vorbis_comment_clear(vf->vc+i); break; } - if(ogg_page_frameno(&og)!=-1){ + if(ogg_page_granulepos(&og)!=-1){ vf->serialnos[i]=ogg_page_serialno(&og); - vf->pcmlengths[i]=ogg_page_frameno(&og); + vf->pcmlengths[i]=ogg_page_granulepos(&og); break; } } @@ -318,7 +321,11 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i, static int _make_decode_ready(OggVorbis_File *vf){ if(vf->decode_ready)exit(1); - vorbis_synthesis_init(&vf->vd,vf->vi); + if(vf->seekable){ + vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link); + }else{ + vorbis_synthesis_init(&vf->vd,vf->vi); + } vorbis_block_init(&vf->vd,&vf->vb); vf->decode_ready=1; return(0); @@ -333,7 +340,7 @@ static int _open_seekable(OggVorbis_File *vf){ ogg_page og; /* is this even vorbis...? */ - ret=_fetch_headers(vf,&initial_i,&initial_c,&serialno); + ret=_fetch_headers(vf,&initial_i,&initial_c,&serialno,NULL); dataoffset=vf->offset; ogg_stream_clear(&vf->os); if(ret==-1)return(-1); @@ -373,7 +380,7 @@ static int _open_nonseekable(OggVorbis_File *vf){ vf->vc=calloc(vf->links,sizeof(vorbis_info)); /* Try to fetch the headers, maintaining all the storage */ - if(_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno)==-1)return(-1); + if(_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL)==-1)return(-1); _make_decode_ready(vf); return 0; @@ -413,14 +420,14 @@ static int _process_packet(OggVorbis_File *vf,int readp){ if(vf->decode_ready){ ogg_packet op; int result=ogg_stream_packetout(&vf->os,&op); - ogg_int64_t frameno; + ogg_int64_t granulepos; /* if(result==-1)return(-1); hole in the data. For now, swallow and go. We'll need to add a real error code in a bit. */ if(result>0){ /* got a packet. process it */ - frameno=op.frameno; + granulepos=op.granulepos; if(!vorbis_synthesis(&vf->vb,&op)){ /* lazy check for lazy header handling. The header packets aren't @@ -438,7 +445,7 @@ static int _process_packet(OggVorbis_File *vf,int readp){ } /* update the pcm offset. */ - if(frameno!=-1 && !op.e_o_s){ + if(granulepos!=-1 && !op.e_o_s){ int link=(vf->seekable?vf->current_link:0); int i,samples; @@ -449,18 +456,18 @@ static int _process_packet(OggVorbis_File *vf,int readp){ As an aside, this trick is inaccurate if we begin reading anew right at the last page; the end-of-stream - frameno declares the last frame in the stream, and the + granulepos declares the last frame in the stream, and the last packet of the last page may be a partial frame. - So, we need a previous frameno from an in-sequence page + So, we need a previous granulepos from an in-sequence page to have a reference point. Thus the !op.e_o_s clause above */ samples=vorbis_synthesis_pcmout(&vf->vd,NULL); - frameno-=samples; + granulepos-=samples; for(i=0;ipcmlengths[i]; - vf->pcm_offset=frameno; + granulepos+=vf->pcmlengths[i]; + vf->pcm_offset=granulepos; } return(1); } @@ -515,7 +522,7 @@ static int _process_packet(OggVorbis_File *vf,int readp){ /* we're streaming */ /* fetch the three header packets, build the info struct */ - _fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno); + _fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og); vf->current_link++; link=0; } @@ -766,7 +773,7 @@ int ov_raw_seek(OggVorbis_File *vf,long pos){ /* we need to make sure the pcm_offset is set. We use the _fetch_packet helper to process one packet with readp set, then call it until it returns '0' with readp not set (the last packet - from a page has the 'frameno' field set, and that's how the + from a page has the 'granulepos' field set, and that's how the helper updates the offset */ switch(_process_packet(vf,1)){ @@ -851,9 +858,9 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){ if(ret==-1){ end=bisect; }else{ - ogg_int64_t frameno=ogg_page_frameno(&og); - if(framenooffset; /* raw offset of next packet */ }else{ end=bisect; @@ -873,7 +880,7 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){ /* discard samples until we reach the desired position. Crossing a logical bitstream boundary with abandon is OK. */ while(vf->pcm_offsetpcm_offset; long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm); @@ -1056,7 +1063,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length, while(1){ if(vf->decode_ready){ - double **pcm; + float **pcm; long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm); if(samples){ /* yay! proceed to pack data into the byte buffer */ @@ -1083,7 +1090,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int length, if(host_endian==bigendianp){ if(sgned){ for(i=0;ic; @@ -146,7 +146,7 @@ int get_vector(codebook *b,FILE *in,int start, int n,double *a){ break; if(i==c->dim){ - double temp=a[c->dim-1]; + float temp=a[c->dim-1]; for(i=0;idim;i++)a[i]-=sequence_base; if(c->q_sequencep)sequence_base=temp; v_sofar++; @@ -284,9 +284,9 @@ codebook *codebook_load(char *filename){ exit(1); } /* load quantthresh */ - find_seek_to(in,"static double _vq_quantthresh_"); + find_seek_to(in,"static float _vq_quantthresh_"); reset_next_value(); - t->quantthresh=malloc(sizeof(double)*t->threshvals); + t->quantthresh=malloc(sizeof(float)*t->threshvals); for(i=0;ithreshvals-1;i++) if(get_next_value(in,t->quantthresh+i)){ fprintf(stderr,"out of data 1 while reading codebook %s\n",filename); @@ -581,7 +581,7 @@ void write_codebook(FILE *out,char *name,const static_codebook *c){ if(t){ /* quantthresh */ - fprintf(out,"static double _vq_quantthresh_%s[] = {\n",name); + fprintf(out,"static float _vq_quantthresh_%s[] = {\n",name); for(j=0;jthreshvals-1;){ fprintf(out,"\t"); for(k=0;k<8 && jthreshvals-1;k++,j++) diff --git a/vq/bookutil.h b/vq/bookutil.h index e225a85..297aa8c 100644 --- a/vq/bookutil.h +++ b/vq/bookutil.h @@ -12,7 +12,7 @@ ******************************************************************** function: utility functions for loading .vqh and .vqd files - last mod: $Id: bookutil.h,v 1.6 2000/07/12 09:36:18 xiphmont Exp $ + last mod: $Id: bookutil.h,v 1.7 2000/10/12 03:13:01 xiphmont Exp $ ********************************************************************/ @@ -26,11 +26,11 @@ extern char *get_line(FILE *in); extern char *setup_line(FILE *in); -extern int get_line_value(FILE *in,double *value); -extern int get_next_value(FILE *in,double *value); +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,double *a); +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); diff --git a/vq/build.c b/vq/build.c index 295677a..2465c19 100644 --- a/vq/build.c +++ b/vq/build.c @@ -12,7 +12,7 @@ ******************************************************************** function: utility main for building codebooks from training sets - last mod: $Id: build.c,v 1.14 2000/06/14 01:38:32 xiphmont Exp $ + last mod: $Id: build.c,v 1.15 2000/10/12 03:13:01 xiphmont Exp $ ********************************************************************/ @@ -149,7 +149,7 @@ int main(int argc,char *argv[]){ i=0; quantlist=malloc(sizeof(long)*v.elements*v.entries); for(j=0;jc->q_sequencep){ - double temp; + float temp; for(j=0;jdim; diff --git a/vq/genericdata.c b/vq/genericdata.c index 2a6ffb9..eb9de75 100644 --- a/vq/genericdata.c +++ b/vq/genericdata.c @@ -12,7 +12,7 @@ ******************************************************************** function: generic euclidian distance metric for VQ codebooks - last mod: $Id: genericdata.c,v 1.5 2000/05/08 20:49:50 xiphmont Exp $ + last mod: $Id: genericdata.c,v 1.6 2000/10/12 03:13:01 xiphmont Exp $ ********************************************************************/ @@ -31,23 +31,23 @@ void vqext_quantize(vqgen *v,quant_meta *q){ vqgen_quantize(v,q); } -double *vqext_weight(vqgen *v,double *p){ +float *vqext_weight(vqgen *v,float *p){ /*noop*/ return(p); } /* candidate,actual */ -double vqext_metric(vqgen *v,double *e, double *p){ +float vqext_metric(vqgen *v,float *e, float *p){ int i; - double acc=0.; + float acc=0.; for(i=0;ielements;i++){ - double val=p[i]-e[i]; + float val=p[i]-e[i]; acc+=val*val; } return sqrt(acc/v->elements); } -void vqext_addpoint_adj(vqgen *v,double *b,int start,int dim,int cols,int num){ +void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ vqgen_addpoint(v,b+start,NULL); } diff --git a/vq/huffbuild.c b/vq/huffbuild.c index dc728f2..03604e1 100644 --- a/vq/huffbuild.c +++ b/vq/huffbuild.c @@ -12,7 +12,7 @@ ******************************************************************** function: hufftree builder - last mod: $Id: huffbuild.c,v 1.4 2000/07/12 09:36:17 xiphmont Exp $ + last mod: $Id: huffbuild.c,v 1.5 2000/10/12 03:13:01 xiphmont Exp $ ********************************************************************/ diff --git a/vq/latticebuild.c b/vq/latticebuild.c index aa92bdf..6de7ff6 100644 --- a/vq/latticebuild.c +++ b/vq/latticebuild.c @@ -12,7 +12,7 @@ ******************************************************************** function: utility main for building codebooks from lattice descriptions - last mod: $Id: latticebuild.c,v 1.5 2000/08/15 09:09:44 xiphmont Exp $ + last mod: $Id: latticebuild.c,v 1.6 2000/10/12 03:13:01 xiphmont Exp $ ********************************************************************/ @@ -59,7 +59,7 @@ static int ilog(unsigned int v){ int main(int argc,char *argv[]){ codebook b; static_codebook c; - double *quantlist; + float *quantlist; long *hits; int entries=-1,dim=-1,quantvals=-1,addmul=-1,sequencep=0; @@ -128,8 +128,8 @@ int main(int argc,char *argv[]){ /* gen a real quant list from the more easily human-grokked input */ { - double min=quantlist[0]; - double mindel=-1; + float min=quantlist[0]; + float mindel=-1; int fac=1; for(j=1;j.000001) break; } if(jdel+p->min+last; tempmax[i]=tempmin[i]+p->del; @@ -84,12 +84,12 @@ static void setvals(int dim,encode_aux_pigeonhole *p, quantize outside the pigeonmap are dropped and brute-forced. So we can ignore the <0 and >=n boundary cases in min/max error */ -static double minerror(int dim,double *a,encode_aux_pigeonhole *p, - long *temptrack,double *tempmin,double *tempmax){ +static float minerror(int dim,float *a,encode_aux_pigeonhole *p, + long *temptrack,float *tempmin,float *tempmax){ int i; - double err=0.; + float err=0.; for(i=0;itempmax[i]){ @@ -100,17 +100,17 @@ static double minerror(int dim,double *a,encode_aux_pigeonhole *p, return(err); } -static double maxerror(int dim,double *a,encode_aux_pigeonhole *p, - long *temptrack,double *tempmin,double *tempmax){ +static float maxerror(int dim,float *a,encode_aux_pigeonhole *p, + long *temptrack,float *tempmin,float *tempmax){ int i; - double err=0.,eval; + float err=0.,eval; for(i=0;itempmax[i]){ eval=a[i]-tempmin[i]; }else{ - double t1=a[i]-tempmin[i]; + float t1=a[i]-tempmin[i]; eval=tempmax[i]-a[i]; if(t1>eval)eval=t1; } @@ -123,7 +123,7 @@ int main(int argc,char *argv[]){ codebook *b; static_codebook *c; int entries=-1,dim=-1; - double min,del; + float min,del; char *name; long i,j; long dB=0; @@ -172,7 +172,7 @@ int main(int argc,char *argv[]){ fprintf(stderr,"Adding threshold hint to %s...\n",name); /* simplest possible threshold hint only */ - t->quantthresh=calloc(quantvals-1,sizeof(double)); + t->quantthresh=calloc(quantvals-1,sizeof(float)); t->quantmap=calloc(quantvals,sizeof(int)); t->threshvals=quantvals; t->quantvals=quantvals; @@ -184,8 +184,8 @@ int main(int argc,char *argv[]){ /* ok, gen the map and thresholds */ for(i=0;iquantmap[i]=quantsort[i]-c->quantlist; for(i=0;imapentries;i++){ - double thisval=del*i+min; /* middle of the quant zone */ + float thisval=del*i+min; /* middle of the quant zone */ int quant=0; - double err=fabs(c->quantlist[0]*del+min-thisval); + float err=fabs(c->quantlist[0]*del+min-thisval); for(j=1;jquantlist[j]*del+min-thisval); + float thiserr=fabs(c->quantlist[j]*del+min-thisval); if(thiserrmapentries; for(i=0;iquantvals; temptrack=calloc(dim,sizeof(long)); - tempmin=calloc(dim,sizeof(double)); - tempmax=calloc(dim,sizeof(double)); + tempmin=calloc(dim,sizeof(float)); + tempmax=calloc(dim,sizeof(float)); tempstack=calloc(pigeons,sizeof(long *)); tempcount=calloc(pigeons,sizeof(long)); while(1){ - double errorpost=-1; + float errorpost=-1; char buffer[80]; /* map our current pigeonhole to a 'big pigeonhole' so we know @@ -296,7 +296,7 @@ int main(int argc,char *argv[]){ maximum error. Record that error */ for(i=0;ilengthlist[i]>0){ - double this=maxerror(dim,b->valuelist+i*dim,p, + float this=maxerror(dim,b->valuelist+i*dim,p, temptrack,tempmin,tempmax); if(errorpost==-1 || thislengthlist; we assume that pigeonholing is in sync with the codeword cells, which it is */ /*for(i=0;ilengthlist[i]); + float probability= 1./(1<lengthlist[i]); if(c->lengthlist[i]==0 || probability*entriesdim,i,j; int step=n/dim; for(i=0;ic->thresh_tree; int dim=b->dim; int i,k,o; @@ -100,12 +100,12 @@ static int bestm(codebook *b,double *vec){ return(best); } -static int closest(codebook *b,double *vec,int current){ +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; - double bestmetric=0; + float bestmetric=0; int bestentry=-1; int best=bestm(b,vec); @@ -113,7 +113,7 @@ static int closest(codebook *b,double *vec,int current){ for(i=0;ientries;i++){ if(b->c->lengthlist[i]>0 && i!=best && i!=current){ - double thismetric=_dist(dim, vec, b->valuelist+i*dim); + float thismetric=_dist(dim, vec, b->valuelist+i*dim); if(bestentry==-1 || thismetricvaluelist+secondbest*b->dim; +static float _heuristic(codebook *b,float *ppt,int secondbest){ + float *secondcell=b->valuelist+secondbest*b->dim; int best=bestm(b,ppt); - double *firstcell=b->valuelist+best*b->dim; - double error=_dist(b->dim,firstcell,secondcell); - double *zero=alloca(b->dim*sizeof(double)); - double fromzero; + 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(double)); + memset(zero,0,b->dim*sizeof(float)); fromzero=sqrt(_dist(b->dim,firstcell,zero)); return(error/fromzero); @@ -217,7 +217,7 @@ int main(int argc,char *argv[]){ int cols; long lines=0; char *line; - double *vec; + float *vec; FILE *in=fopen(name,"r"); if(!in){ fprintf(stderr,"Could not open input file %s\n",name); @@ -235,7 +235,7 @@ int main(int argc,char *argv[]){ while(*temp==' ')temp++; } } - vec=alloca(cols*sizeof(double)); + vec=alloca(cols*sizeof(float)); /* count, then load, to avoid fragmenting the hell out of memory */ while(line){ @@ -248,7 +248,7 @@ int main(int argc,char *argv[]){ if((lines&0xff)==0)spinnit("counting samples...",lines*cols); line=setup_line(in); } - pointlist=malloc((cols*lines+entries*dim)*sizeof(double)); + pointlist=malloc((cols*lines+entries*dim)*sizeof(float)); rewind(in); line=setup_line(in); @@ -319,8 +319,8 @@ int main(int argc,char *argv[]){ long *cellcount=calloc(entries,sizeof(long)); long *cellcount2=calloc(entries,sizeof(long)); - double *cellerror=calloc(entries,sizeof(double)); - double *cellerrormax=calloc(entries,sizeof(double)); + float *cellerror=calloc(entries,sizeof(float)); + float *cellerrormax=calloc(entries,sizeof(float)); long cellsleft=entries; for(i=0;ivaluelist+dim*firstentry,ppt); - double secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + 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); @@ -382,8 +382,8 @@ int main(int argc,char *argv[]){ /* do the automatic cull request */ while(cellsleft>target){ int bestcell=-1; - double besterror=0; - double besterror2=0; + float besterror=0; + float besterror2=0; long head=-1; char spinbuf[80]; sprintf(spinbuf,"cells left to eliminate: %ld : ",cellsleft-target); @@ -413,11 +413,11 @@ int main(int argc,char *argv[]){ firsthead[bestcell]=-1; while(head!=-1){ /* head is a point number */ - double *ppt=pointlist+head*dim; + float *ppt=pointlist+head*dim; int firstentry=closest(b,ppt,-1); int secondentry=closest(b,ppt,firstentry); - double firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt); - double secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + float firstmetric=_dist(dim,b->valuelist+dim*firstentry,ppt); + float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); long next=membership[head]; if(headvaluelist+dim*bestcell,ppt); + float oldsecondmetric=_dist(dim,b->valuelist+dim*bestcell,ppt); /* new second closest error */ - double secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); + float secondmetric=_dist(dim,b->valuelist+dim*secondentry,ppt); long next=secondary[head]; if(head32)temp++; while(*temp==' ')temp++; } - vec=alloca(sizeof(double)*cols); + vec=alloca(sizeof(float)*cols); step=cols/dim; } diff --git a/vq/lspdata.c b/vq/lspdata.c index 1181ac4..e2a6119 100644 --- a/vq/lspdata.c +++ b/vq/lspdata.c @@ -12,7 +12,7 @@ ******************************************************************** function: metrics and quantization code for LSP VQ codebooks - last mod: $Id: lspdata.c,v 1.12 2000/05/08 20:49:50 xiphmont Exp $ + last mod: $Id: lspdata.c,v 1.13 2000/10/12 03:13:02 xiphmont Exp $ ********************************************************************/ @@ -27,12 +27,12 @@ char *vqext_booktype="LSPdata"; quant_meta q={0,0,0,1}; /* set sequence data */ int vqext_aux=1; -double global_maxdel=M_PI; -double global_mindel=M_PI; +float global_maxdel=M_PI; +float global_mindel=M_PI; #if 0 void vqext_quantize(vqgen *v,quant_meta *q){ - double delta,mindel; - double maxquant=((1<quant)-1); + float delta,mindel; + float maxquant=((1<quant)-1); int j,k; /* first find the basic delta amount from the maximum span to be @@ -48,10 +48,10 @@ void vqext_quantize(vqgen *v,quant_meta *q){ delta=_float32_unpack(q->delta); for(j=0;jentries;j++){ - double last=0; + float last=0; for(k=0;kelements;k++){ - double val=_now(v,j)[k]; - double now=rint((val-last-mindel)/delta); + float val=_now(v,j)[k]; + float now=rint((val-last-mindel)/delta); _now(v,j)[k]=now; if(now<0){ @@ -76,7 +76,7 @@ void vqext_quantize(vqgen *v,quant_meta *q){ } #endif -double *weight=NULL; +float *weight=NULL; #if 0 /* LSP training metric. We weight error proportional to distance *between* LSP vector values. The idea of this metric is not to set @@ -86,13 +86,13 @@ double *weight=NULL; #define FUDGE (global_maxdel-weight[i]) -double *vqext_weight(vqgen *v,double *p){ +float *vqext_weight(vqgen *v,float *p){ int i; int el=v->elements; - double lastp=0.; + float lastp=0.; for(i=0;ielements; - double acc=0.; + float acc=0.; for(i=0;ielements); @@ -124,9 +124,9 @@ double vqext_metric(vqgen *v,double *e, double *p){ trailing space */ /* assume vqext_aux==1 */ -void vqext_addpoint_adj(vqgen *v,double *b,int start,int dim,int cols,int num){ - double *a=alloca(sizeof(double)*(dim+1)); /* +aux */ - double base=0; +void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ + float *a=alloca(sizeof(float)*(dim+1)); /* +aux */ + float base=0; int i; if(start>0)base=b[start-1]; @@ -146,15 +146,15 @@ void vqext_preprocess(vqgen *v){ global_maxdel=0.; global_mindel=M_PI; for(j=0;jpoints;j++){ - double last=0.; + float last=0.; for(k=0;kelements+v->aux;k++){ - double p=_point(v,j)[k]; + float p=_point(v,j)[k]; if(p-last>global_maxdel)global_maxdel=p-last; if(p-lastelements); + weight=malloc(sizeof(float)*v->elements); } diff --git a/vq/metrics.c b/vq/metrics.c index 20d7990..9624b52 100644 --- a/vq/metrics.c +++ b/vq/metrics.c @@ -12,7 +12,7 @@ ******************************************************************** function: function calls to collect codebook metrics - last mod: $Id: metrics.c,v 1.8 2000/06/14 01:38:32 xiphmont Exp $ + last mod: $Id: metrics.c,v 1.9 2000/10/12 03:13:02 xiphmont Exp $ ********************************************************************/ @@ -39,20 +39,20 @@ /* set up metrics */ -double meanamplitude_acc=0.; -double meanamplitudesq_acc=0.; -double meanerror_acc=0.; -double meanerrorsq_acc=0.; +float meanamplitude_acc=0.; +float meanamplitudesq_acc=0.; +float meanerror_acc=0.; +float meanerrorsq_acc=0.; -double **histogram=NULL; -double **histogram_error=NULL; -double **histogram_errorsq=NULL; -double **histogram_hi=NULL; -double **histogram_lo=NULL; -double bits=0.; -double count=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 double *_now(codebook *c, int i){ +static float *_now(codebook *c, int i){ return c->valuelist+i*c->c->dim; } @@ -63,11 +63,11 @@ void process_preprocess(codebook **bs,char *basename){ while(bs[books])books++; if(books){ - histogram=calloc(books,sizeof(double *)); - histogram_error=calloc(books,sizeof(double *)); - histogram_errorsq=calloc(books,sizeof(double *)); - histogram_hi=calloc(books,sizeof(double *)); - histogram_lo=calloc(books,sizeof(double *)); + 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); @@ -75,19 +75,19 @@ void process_preprocess(codebook **bs,char *basename){ for(i=0;ientries,sizeof(double)); - histogram_error[i]=calloc(b->entries*b->dim,sizeof(double)); - histogram_errorsq[i]=calloc(b->entries*b->dim,sizeof(double)); - histogram_hi[i]=calloc(b->entries*b->dim,sizeof(double)); - histogram_lo[i]=calloc(b->entries*b->dim,sizeof(double)); + 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 double _dist(int el,double *a, double *b){ +static float _dist(int el,float *a, float *b){ int i; - double acc=0.; + float acc=0.; for(i=0;ic->entries;j++){ if(c->c->lengthlist[j]>0){ - double localmin=-1.; + float localmin=-1.; for(k=0;kc->entries;k++){ if(c->c->lengthlist[k]>0){ - double this=_dist(c->c->dim,_now(c,j),_now(c,k)); + float this=_dist(c->c->dim,_now(c,j),_now(c,k)); if(j!=k && (localmin==-1 || thisc->q_sequencep?last:0); meanamplitude_acc+=fabs(amplitude); @@ -226,7 +226,7 @@ double process_one(codebook *b,int book,double *a,int dim,int step,int addmul, } if(b->c->q_sequencep){ - double temp; + float temp; for(j=0;jdim; - double base=0.; + float base=0.; if(inter){ for(i=0;ielements; long n=v->entries; - double max=-1; - double *test=alloca(sizeof(double)*dim); + 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;jmax)max=norm; test[k]=norm; } @@ -62,15 +62,15 @@ void vqext_quantize(vqgen *v,quant_meta *q){ /* allow move only if unoccupied */ if(quant_save){ for(k=0;kquant=_ilog(max); if(quant_save){ - memcpy(_now(v,0),quant_save,sizeof(double)*dim*n); + memcpy(_now(v,0),quant_save,sizeof(float)*dim*n); fprintf(stderr,"cells shifted this iteration: %d\n",moved); } } /* candidate,actual */ -double vqext_metric(vqgen *v,double *e, double *p){ +float vqext_metric(vqgen *v,float *e, float *p){ int i; - double acc=0.; + float acc=0.; for(i=0;ielements;i++){ - double val=p[i]-e[i]; + float val=p[i]-e[i]; acc+=val*val; } return sqrt(acc); @@ -101,7 +101,7 @@ double vqext_metric(vqgen *v,double *e, double *p){ /* 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,double *b,int start,int dim,int cols,int num){ +void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ vqgen_addpoint(v,b+start,NULL); } @@ -109,7 +109,7 @@ void vqext_addpoint_adj(vqgen *v,double *b,int start,int dim,int cols,int num){ residuals (which causes lots & lots of dupes) */ void vqext_preprocess(vqgen *v){ long i,j,k,l; - double *test=alloca(sizeof(double)*v->elements); + float *test=alloca(sizeof(float)*v->elements); scalequant=q.quant; vqext_quantize(v,&q); @@ -118,7 +118,7 @@ void vqext_preprocess(vqgen *v){ /* if there are any dupes, reseed */ for(k=0;kentries;k++){ for(l=0;lelements)==0) + if(memcmp(_now(v,k),_now(v,l),sizeof(float)*v->elements)==0) break; } if(lpoints && jentries;i++){ for(k=0;kelements;k++){ - double val=_point(v,i)[k]; + float val=_point(v,i)[k]; test[k]=rint(val/scalequant)*scalequant; } @@ -143,7 +143,7 @@ void vqext_preprocess(vqgen *v){ if(k==v->elements)break; } if(l==j){ - memcpy(_now(v,j),test,v->elements*sizeof(double)); + memcpy(_now(v,j),test,v->elements*sizeof(float)); j++; } } @@ -154,8 +154,8 @@ void vqext_preprocess(vqgen *v){ } } vqext_quantize(v,&q); - quant_save=malloc(sizeof(double)*v->elements*v->entries); - memcpy(quant_save,_now(v,0),sizeof(double)*v->elements*v->entries); + 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 index 57fe2f8..66bae59 100644 --- a/vq/residuesplit.c +++ b/vq/residuesplit.c @@ -12,7 +12,7 @@ ******************************************************************** function: residue backend 0 partitioner/classifier - last mod: $Id: residuesplit.c,v 1.4 2000/08/15 09:09:32 xiphmont Exp $ + last mod: $Id: residuesplit.c,v 1.5 2000/10/12 03:13:02 xiphmont Exp $ ********************************************************************/ @@ -25,10 +25,10 @@ /* does not guard against invalid settings; eg, a subn of 16 and a subgroup request of 32. Max subn of 128 */ -static void _testhack(double *vec,int n,double *entropy){ +static void _testhack(float *vec,int n,float *entropy){ int i,j=0; - double max=0.; - double temp[128]; + float max=0.; + float temp[128]; /* setup */ for(i=0;icols){ fprintf(stderr,"ran out of columns reading %s\n",file); exit(1); @@ -306,7 +306,7 @@ int main(int argc,char *argv[]){ signal(SIGINT,setexit); for(i=0;ielements*i) /* default metric; squared 'distance' from desired value. */ -double _dist(vqgen *v,double *a, double *b){ +float _dist(vqgen *v,float *a, float *b){ int i; int el=v->elements; - double acc=0.; + float acc=0.; for(i=0;ientries;i++) - memcpy(_now(v,i),_point(v,i),sizeof(double)*v->elements); + memcpy(_now(v,i),_point(v,i),sizeof(float)*v->elements); v->seeded=1; } int directdsort(const void *a, const void *b){ - double av=*((double *)a); - double bv=*((double *)b); + float av=*((float *)a); + float bv=*((float *)b); if(av>bv)return(-1); return(1); } void vqgen_cellmetric(vqgen *v){ int j,k; - double min=-1.,max=-1.,mean=0.,acc=0.; + float min=-1.,max=-1.,mean=0.,acc=0.; long dup=0,unused=0; #ifdef NOISY int i; char buff[80]; - double spacings[v->entries]; + float spacings[v->entries]; int count=0; FILE *cells; sprintf(buff,"cellspace%d.m",v->it); @@ -105,11 +105,11 @@ void vqgen_cellmetric(vqgen *v){ /* minimum, maximum, cell spacing */ for(j=0;jentries;j++){ - double localmin=-1.; + float localmin=-1.; for(k=0;kentries;k++){ if(j!=k){ - double this=_dist(v,_now(v,j),_now(v,k)); + float this=_dist(v,_now(v,j),_now(v,k)); if(this>0){ if(v->assigned[k] && (localmin==-1 || thisquant)-1); + float delta; + float maxquant=((1<quant)-1); int j,k; mindel=maxdel=_now(v,0)[0]; for(j=0;jentries;j++){ - double last=0.; + float last=0.; for(k=0;kelements;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; @@ -200,10 +200,10 @@ void vqgen_quantize(vqgen *v,quant_meta *q){ delta=_float32_unpack(q->delta); for(j=0;jentries;j++){ - double last=0; + float last=0; for(k=0;kelements;k++){ - double val=_now(v,j)[k]; - double now=rint((val-last-mindel)/delta); + float val=_now(v,j)[k]; + float now=rint((val-last-mindel)/delta); _now(v,j)[k]=now; if(now<0){ @@ -226,13 +226,13 @@ void vqgen_quantize(vqgen *v,quant_meta *q){ scales; we just make sure they're properly offset. */ void vqgen_unquantize(vqgen *v,quant_meta *q){ long j,k; - double mindel=_float32_unpack(q->min); - double delta=_float32_unpack(q->delta); + float mindel=_float32_unpack(q->min); + float delta=_float32_unpack(q->delta); for(j=0;jentries;j++){ - double last=0.; + float last=0.; for(k=0;kelements;k++){ - double now=_now(v,j)[k]; + float now=_now(v,j)[k]; now=fabs(now)*delta+last+mindel; if(q->sequencep)last=now; _now(v,j)[k]=now; @@ -240,9 +240,9 @@ void vqgen_unquantize(vqgen *v,quant_meta *q){ } } -void vqgen_init(vqgen *v,int elements,int aux,int entries,double mindist, - double (*metric)(vqgen *,double *, double *), - double *(*weight)(vqgen *,double *),int centroid){ +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; @@ -250,13 +250,13 @@ void vqgen_init(vqgen *v,int elements,int aux,int entries,double mindist, v->aux=aux; v->mindist=mindist; v->allocated=32768; - v->pointlist=malloc(v->allocated*(v->elements+v->aux)*sizeof(double)); + v->pointlist=malloc(v->allocated*(v->elements+v->aux)*sizeof(float)); v->entries=entries; - v->entrylist=malloc(v->entries*v->elements*sizeof(double)); + v->entrylist=malloc(v->entries*v->elements*sizeof(float)); v->assigned=malloc(v->entries*sizeof(long)); - v->bias=calloc(v->entries,sizeof(double)); - v->max=calloc(v->entries,sizeof(double)); + v->bias=calloc(v->entries,sizeof(float)); + v->max=calloc(v->entries,sizeof(float)); if(metric) v->metric_func=metric; else @@ -270,7 +270,7 @@ void vqgen_init(vqgen *v,int elements,int aux,int entries,double mindist, } -void vqgen_addpoint(vqgen *v, double *p,double *a){ +void vqgen_addpoint(vqgen *v, float *p,float *a){ int k; for(k=0;kelements;k++) fprintf(v->asciipoints,"%.12g\n",p[k]); @@ -280,11 +280,11 @@ void vqgen_addpoint(vqgen *v, double *p,double *a){ if(v->points>=v->allocated){ v->allocated*=2; v->pointlist=realloc(v->pointlist,v->allocated*(v->elements+v->aux)* - sizeof(double)); + sizeof(float)); } - memcpy(_point(v,v->points),p,sizeof(double)*v->elements); - if(v->aux)memcpy(_point(v,v->points)+v->elements,a,sizeof(double)*v->aux); + 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.){ @@ -311,7 +311,7 @@ void vqgen_sortmesh(vqgen *v){ long i,march=1; /* sort to make uniqueness detection trivial */ - sortsize=(v->elements+v->aux)*sizeof(double); + sortsize=(v->elements+v->aux)*sizeof(float); qsort(v->pointlist,v->points,sortsize,meshcomp); /* now march through and eliminate dupes */ @@ -333,19 +333,19 @@ void vqgen_sortmesh(vqgen *v){ v->sorted=1; } -double vqgen_iterate(vqgen *v,int biasp){ +float vqgen_iterate(vqgen *v,int biasp){ long i,j,k; - double fdesired; + float fdesired; long desired; long desired2; - double asserror=0.; - double meterror=0.; - double *new; - double *new2; + float asserror=0.; + float meterror=0.; + float *new; + float *new2; long *nearcount; - double *nearbias; + float *nearbias; #ifdef NOISY char buff[80]; FILE *assig; @@ -368,30 +368,30 @@ double vqgen_iterate(vqgen *v,int biasp){ if(!v->sorted)vqgen_sortmesh(v); if(!v->seeded)_vqgen_seed(v); - fdesired=(double)v->points/v->entries; + fdesired=(float)v->points/v->entries; desired=fdesired; desired2=desired*2; - new=malloc(sizeof(double)*v->entries*v->elements); - new2=malloc(sizeof(double)*v->entries*v->elements); + 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(double)); + nearbias=malloc(v->entries*desired2*sizeof(float)); /* fill in nearest points for entry biasing */ - /*memset(v->bias,0,sizeof(double)*v->entries);*/ + /*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;ipoints;i++){ - double *ppt=v->weight_func(v,_point(v,i)); - double firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0]; - double secondmetric=v->metric_func(v,_now(v,1),ppt)+v->bias[1]; + 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){ - double temp=firstmetric; + float temp=firstmetric; firstmetric=secondmetric; secondmetric=temp; firstentry=1; @@ -399,7 +399,7 @@ double vqgen_iterate(vqgen *v,int biasp){ } for(j=2;jentries;j++){ - double thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; + float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; if(thismetricentries;j++){ - double thismetric,localmetric; - double *nearbiasptr=nearbias+desired2*j; + float thismetric,localmetric; + float *nearbiasptr=nearbias+desired2*j; long k=nearcount[j]; localmetric=v->metric_func(v,_now(v,j),ppt); @@ -441,7 +441,7 @@ double vqgen_iterate(vqgen *v,int biasp){ k++; if(k==desired){ spinnit("biasing... ",v->points+v->points+v->entries-i); - qsort(nearbiasptr,desired,sizeof(double),directdsort); + qsort(nearbiasptr,desired,sizeof(float),directdsort); } }else if(thismetric>nearbiasptr[desired-1]){ @@ -449,7 +449,7 @@ double vqgen_iterate(vqgen *v,int biasp){ k++; if(k==desired2){ spinnit("biasing... ",v->points+v->points+v->entries-i); - qsort(nearbiasptr,desired2,sizeof(double),directdsort); + qsort(nearbiasptr,desired2,sizeof(float),directdsort); k=desired; } } @@ -460,31 +460,31 @@ double vqgen_iterate(vqgen *v,int biasp){ /* inflate/deflate */ for(i=0;ientries;i++){ - double *nearbiasptr=nearbias+desired2*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(double),directdsort); + qsort(nearbiasptr,nearcount[i],sizeof(float),directdsort); v->bias[i]=nearbiasptr[desired-1]; } }else{ - memset(v->bias,0,v->entries*sizeof(double)); + memset(v->bias,0,v->entries*sizeof(float)); } /* Now assign with new bias and find new midpoints */ for(i=0;ipoints;i++){ - double *ppt=v->weight_func(v,_point(v,i)); - double firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0]; + 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;jentries;j++){ - double thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; + float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j]; if(thismetricpointlist+((v->elements+v->aux)*ptr); } -static inline double *_aux(vqgen *v,long ptr){ +static inline float *_aux(vqgen *v,long ptr){ return _point(v,ptr)+v->aux; } -static inline double *_now(vqgen *v,long ptr){ +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,double mindist, - double (*metric)(vqgen *,double *, double *), - double *(*weight)(vqgen *,double *),int centroid); -extern void vqgen_addpoint(vqgen *v, double *p,double *aux); + 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 double vqgen_iterate(vqgen *v,int biasp); +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); diff --git a/vq/vqsplit.c b/vq/vqsplit.c index c54751b..aebfcc7 100644 --- a/vq/vqsplit.c +++ b/vq/vqsplit.c @@ -12,7 +12,7 @@ ******************************************************************** function: build a VQ codebook and the encoding decision 'tree' - last mod: $Id: vqsplit.c,v 1.19 2000/05/08 20:49:51 xiphmont Exp $ + last mod: $Id: vqsplit.c,v 1.20 2000/10/12 03:13:02 xiphmont Exp $ ********************************************************************/ @@ -68,11 +68,11 @@ int iascsort(const void *a,const void *b){ return(av-bv); } -static double _Ndist(int el,double *a, double *b){ +static float _Ndist(int el,float *a, float *b){ int i; - double acc=0.; + float acc=0.; for(i=0;idim; - double *entrylist=b->valuelist; + float *entrylist=b->valuelist; long ret; long *entryA=calloc(entries,sizeof(long)); long *entryB=calloc(entries,sizeof(long)); @@ -198,10 +198,10 @@ int lp_split(double *pointlist,long totalpoints, /* more than one way to do this part. For small sets, we can brute force it. */ - if(entries<8 || (double)points*entries*entries<16.*1024*1024){ + if(entries<8 || (float)points*entries*entries<16.*1024*1024){ /* try every pair possibility */ - double best=0; - double this; + float best=0; + float this; for(i=0;ielements,_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(double)*v->elements); + 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; @@ -402,14 +402,14 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){ { v->assigned=calloc(v->entries,sizeof(long)); for(i=0;ipoints;i++){ - double *ppt=_point(v,i); - double firstmetric=_Ndist(v->elements,_now(v,0),ppt); + 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;jentries;j++){ - double thismetric=_Ndist(v->elements,_now(v,j),ppt); + float thismetric=_Ndist(v->elements,_now(v,j),ppt); if(thismetricassigned[j]==0){ fprintf(stderr,"found an unused entry! removing...\n"); v->entries--; - memcpy(_now(v,j),_now(v,v->entries),sizeof(double)*v->elements); + 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); @@ -460,15 +460,15 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){ for(i=0;ipoints;i++)membership[i]=-1; for(i=0;ipoints;i++){ - double *ppt=_point(v,i); + float *ppt=_point(v,i); long firstentry=0; - double firstmetric=_Ndist(v->elements,_now(v,0),ppt); + float firstmetric=_Ndist(v->elements,_now(v,0),ppt); if(!(i&0xff))spinnit("assigning... ",v->points-i); for(j=1;jentries;j++){ if(v->assigned[j]!=-1){ - double thismetric=_Ndist(v->elements,_now(v,j),ppt); + float thismetric=_Ndist(v->elements,_now(v,j),ppt); if(thismetric<=firstmetric){ firstmetric=thismetric; firstentry=j; @@ -595,7 +595,7 @@ void vqsp_book(vqgen *v, codebook *b, long *quantlist){ /* map lengthlist and vallist with index */ c->lengthlist=calloc(c->entries,sizeof(long)); - b->valuelist=malloc(sizeof(double)*c->entries*c->dim); + b->valuelist=malloc(sizeof(float)*c->entries*c->dim); c->quantlist=malloc(sizeof(long)*c->entries*c->dim); for(i=0;ientries;i++){ long e=index[i]; diff --git a/vq/vqsplit.h b/vq/vqsplit.h index d09265b..bfb105f 100644 --- a/vq/vqsplit.h +++ b/vq/vqsplit.h @@ -12,7 +12,7 @@ ******************************************************************** function: build a VQ codebook decision tree - last mod: $Id: vqsplit.h,v 1.2 2000/05/08 20:49:51 xiphmont Exp $ + last mod: $Id: vqsplit.h,v 1.3 2000/10/12 03:13:02 xiphmont Exp $ ********************************************************************/ @@ -22,8 +22,8 @@ #include "vorbis/codebook.h" extern void vqsp_book(vqgen *v,codebook *b,long *quantlist); -extern int vqenc_entry(codebook *b,double *val); -extern int lp_split(double *pointlist,long totalpoints, +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, -- 2.7.4