Initial revision
authorJosh Coalson <jcoalson@users.sourceforce.net>
Sun, 10 Dec 2000 04:09:52 +0000 (04:09 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Sun, 10 Dec 2000 04:09:52 +0000 (04:09 +0000)
63 files changed:
COPYING.GPL [new file with mode: 0644]
COPYING.LGPL [new file with mode: 0644]
Makefile [new file with mode: 0644]
README [new file with mode: 0644]
build/exe.mk [new file with mode: 0644]
build/lib.mk [new file with mode: 0644]
doc/comparison.html [new file with mode: 0644]
doc/developers.html [new file with mode: 0644]
doc/documentation.html [new file with mode: 0644]
doc/download.html [new file with mode: 0644]
doc/features.html [new file with mode: 0644]
doc/format.html [new file with mode: 0644]
doc/goals.html [new file with mode: 0644]
doc/images/1x1.gif [new file with mode: 0644]
doc/images/logo.jpg [new file with mode: 0644]
doc/index.html [new file with mode: 0644]
doc/news.html [new file with mode: 0644]
include/FLAC/all.h [new file with mode: 0644]
include/FLAC/encoder.h [new file with mode: 0644]
include/FLAC/file_decoder.h [new file with mode: 0644]
include/FLAC/format.h [new file with mode: 0644]
include/FLAC/ordinals.h [new file with mode: 0644]
include/FLAC/stream_decoder.h [new file with mode: 0644]
src/flac/Makefile [new file with mode: 0644]
src/flac/Makefile.vc [new file with mode: 0644]
src/flac/decode.c [new file with mode: 0644]
src/flac/decode.h [new file with mode: 0644]
src/flac/encode.c [new file with mode: 0644]
src/flac/encode.h [new file with mode: 0644]
src/flac/main.c [new file with mode: 0644]
src/libFLAC/Makefile [new file with mode: 0644]
src/libFLAC/Makefile.vc [new file with mode: 0644]
src/libFLAC/bitbuffer.c [new file with mode: 0644]
src/libFLAC/crc.c [new file with mode: 0644]
src/libFLAC/encoder.c [new file with mode: 0644]
src/libFLAC/encoder_framing.c [new file with mode: 0644]
src/libFLAC/file_decoder.c [new file with mode: 0644]
src/libFLAC/fixed.c [new file with mode: 0644]
src/libFLAC/format.c [new file with mode: 0644]
src/libFLAC/include/private/all.h [new file with mode: 0644]
src/libFLAC/include/private/bitbuffer.h [new file with mode: 0644]
src/libFLAC/include/private/crc.h [new file with mode: 0644]
src/libFLAC/include/private/encoder_framing.h [new file with mode: 0644]
src/libFLAC/include/private/fixed.h [new file with mode: 0644]
src/libFLAC/include/private/lpc.h [new file with mode: 0644]
src/libFLAC/include/protected/stream_decoder.h [new file with mode: 0644]
src/libFLAC/lpc.c [new file with mode: 0644]
src/libFLAC/stream_decoder.c [new file with mode: 0644]
src/plugin_winamp2/Makefile.vc [new file with mode: 0644]
src/plugin_winamp2/in2.h [new file with mode: 0644]
src/plugin_winamp2/in_flac.c [new file with mode: 0644]
src/plugin_winamp2/out.h [new file with mode: 0644]
src/plugin_xmms/Makefile [new file with mode: 0644]
src/plugin_xmms/plugin.c [new file with mode: 0644]
src/test_streams/Makefile [new file with mode: 0644]
src/test_streams/main.c [new file with mode: 0644]
src/test_unit/Makefile [new file with mode: 0644]
src/test_unit/bitbuffer.c [new file with mode: 0644]
src/test_unit/bitbuffer.h [new file with mode: 0644]
src/test_unit/main.c [new file with mode: 0644]
test/Makefile [new file with mode: 0644]
test/test_streams.sh [new file with mode: 0755]
test/test_unit.sh [new file with mode: 0755]

diff --git a/COPYING.GPL b/COPYING.GPL
new file mode 100644 (file)
index 0000000..c3c7a9e
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 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.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, 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 or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+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 give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) 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; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, 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 executable.  However, as a
+special exception, the source code 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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+  5. 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 Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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 to
+this License.
+
+  7. 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 Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the 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 Program
+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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/COPYING.LGPL b/COPYING.LGPL
new file mode 100644 (file)
index 0000000..5c879e4
--- /dev/null
@@ -0,0 +1,481 @@
+                 GNU LIBRARY GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1991 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 library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+                           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 Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, 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 or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the 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 a program 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.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+\f
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  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, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+\f
+                 GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+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.
+\f
+  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.
+\f
+  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.
+\f
+  6. As an exception to the Sections above, you may also compile 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) 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.
+
+    c) 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.
+
+    d) 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 source code 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.
+\f
+  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 to
+this License.
+\f
+  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 Library 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.
+\f
+  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
+\f
+           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.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    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.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..09f27ee
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,46 @@
+#
+# GNU Makefile
+#
+# Useful targets
+#
+# all     : build all libraries and programs in the default configuration (currently 'release')
+# debug   : build all libraries and programs in debug mode
+# release : build all libraries and programs in release mode
+# test    : run the unit and stream tests
+# clean   : remove all non-distro files
+#
+
+all: libFLAC flac test_streams test_unit
+
+DEFAULT_CONFIG = release
+
+CONFIG = $(DEFAULT_CONFIG)
+
+debug   : CONFIG = debug
+release : CONFIG = release
+
+debug   : all
+release : all
+
+libFLAC:
+       (cd src/$@ ; make $(CONFIG))
+
+flac: libFLAC
+       (cd src/$@ ; make $(CONFIG))
+
+test_streams: libFLAC
+       (cd src/$@ ; make $(CONFIG))
+
+test_unit: libFLAC
+       (cd src/$@ ; make $(CONFIG))
+
+test: debug
+       (cd test ; make)
+
+clean:
+       -(cd src/libFLAC ; make clean)
+       -(cd src/flac ; make clean)
+       -(cd src/plugin_xmms ; make clean)
+       -(cd src/test_streams ; make clean)
+       -(cd src/test_unit ; make clean)
+       -(cd test ; make clean)
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..b8c4a87
--- /dev/null
+++ b/README
@@ -0,0 +1,44 @@
+==========
+FLAC - 0.2
+==========
+
+This is the source release for the FLAC project.  The
+reference encoder/decoder library 'libFLAC' is released
+under the LGPL (see COPYING.LGPL).  This means the code
+in include/FLAC/ and src/libFLAC/.  All other code is
+covered by the GPL (see COPYING.GPL).  See
+
+       doc/index.html
+
+for full documentation.
+
+A brief description of the directory tree:
+
+       build/     makefile templates for building
+       doc/       the HTML documentation
+       include/   public include files for libFLAC
+       obj/       the compiled libraries and executables will
+                  end up here
+       src/       the source code and private headers
+       test/      the test scripts
+
+
+=============================
+Building in a GNU environment
+=============================
+
+All files called 'Makefile' are GNUmake files.  To build all
+libraries and programs, just 'make all' from the top-level
+directory.  To run the tests, just 'make test'.
+
+Everything can be built in either debug or release mode.
+See the Makefiles for details.
+
+
+==================
+Building with MSVC
+==================
+
+There is no overall make system for MSVC but the individual
+source directories with a 'Makefile.vc' file in them allow
+building with MSVC.  Just 'nmake /f Makefile.vc'.
diff --git a/build/exe.mk b/build/exe.mk
new file mode 100644 (file)
index 0000000..b4bd1a3
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# GNU makefile fragment for building an executable
+#
+
+CC           = gcc
+# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static
+LINKAGE      = -static
+LINK         = gcc $(LINKAGE)
+BINPATH      = ../../obj/bin
+LIBPATH      = ../../obj/lib
+PROGRAM      = $(BINPATH)/$(PROGRAM_NAME)
+
+all : release
+
+debug   : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(INCLUDES)
+release : CFLAGS = -O3 -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(INCLUDES)
+
+LFLAGS  = -L$(LIBPATH)
+
+debug   : $(PROGRAM)
+release : $(PROGRAM)
+
+$(PROGRAM) : $(OBJS)
+       $(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
+
+%.o : %.c
+       $(CC) $(CFLAGS) -c $< -o $@
+%.i : %.c
+       $(CC) $(CFLAGS) -E $< -o $@
+
+.PHONY : clean
+clean :
+       -rm -f $(OBJS) $(PROGRAM)
+
+.PHONY : depend
+depend:
+       makedepend -- $(CFLAGS) $(INCLUDES) -- *.c
diff --git a/build/lib.mk b/build/lib.mk
new file mode 100644 (file)
index 0000000..62c4c73
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# GNU makefile fragment for building a library
+#
+
+CC          = gcc
+LINK        = ar cru
+LINKD       = ld -G
+LIBPATH     = ../../obj/lib
+STATIC_LIB  = $(LIBPATH)/$(LIB_NAME).a
+DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
+
+all : release
+
+debug   : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(INCLUDES)
+release : CFLAGS = -O3 -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(INCLUDES)
+
+LFLAGS  = -L$(LIBPATH)
+
+debug   : $(STATIC_LIB) $(DYNAMIC_LIB)
+release : $(STATIC_LIB) $(DYNAMIC_LIB)
+
+$(STATIC_LIB) : $(OBJS)
+       $(LINK) $@ $(OBJS)
+
+$(DYNAMIC_LIB) : $(OBJS)
+       $(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
+
+%.o : %.c
+       $(CC) $(CFLAGS) -c $< -o $@
+%.i : %.c
+       $(CC) $(CFLAGS) -E $< -o $@
+
+.PHONY : clean
+clean :
+       -rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB)
+
+.PHONY : depend
+depend:
+       makedepend -- $(CFLAGS) $(INCLUDES) -- *.c
diff --git a/doc/comparison.html b/doc/comparison.html
new file mode 100644 (file)
index 0000000..4107413
--- /dev/null
@@ -0,0 +1,654 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - comparison</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;comparison&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">comparison</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               The purpose of the comparison page is not only to show how compression ratios and encoding times using the flac reference encoder compare to other lossless encoders, but also to compare features (for example, some coders archive only and files must be uncompressed completely before playback can start).  Keep a few things in mind:
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       As far as I know, only two of the lossless encoders out there (flac and Shorten) are truly free.  Most others give out free binaries, but without access to the source, you are leaving your data to the whim of the maintainer for eternity; you have no way to port the program to another OS or fix it if it breaks.  This can be a serious drawback unless the format has world-class clout (like MP3).
+               </LI>
+               <LI>
+                       The compression ratios and times are representative only of the reference encoder.  They are not indicative of the limits of all FLAC encoders or the FLAC format itself since the format is open and extensible, and anyone is free to write a better FLAC encoder.  And it is almost certain that the reference encoder itself will improve.
+               </LI>
+               <LI>
+                       Since FLAC supports streaming, it is at a slight disadvantage to the formats that don't because they don't have the extra overhead of all those frame headers.
+               </LI>
+       </UL>
+       </P>
+       <P>
+               I make an effort to keep this information as accurate as possible, but if any of the data is wrong, <A HREF="mailto:jcoalson@users.sourceforge.net">let me know</A> and I'll correct it.
+       </P>
+       <P>
+               Reviewed encoders:
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       <A HREF="index.html">flac</A> of course.
+               </LI>
+               <LI>
+                       <A HREF="http://www-ft.ee.tu-berlin.de/~liebchen/lpac.html">LPAC</A> - A closed source codec.  At least it's available for more than just Windows, but there's only a Winamp plugin.
+               </LI>
+               <LI>
+                       <A HREF="http://www.monkeysaudio.com/">Monkey's Audio</A> - A closed source, Windows-only codec, with a Winamp plugin.
+               </LI>
+               <LI>
+                       <A HREF="http://www.jpg.com/products/sound.html">Pegasus-SPS</A> - A closed source, Windows-only codec.
+               </LI>
+               <LI>
+                       <A HREF="http://rksoft.virtualave.net/">RKAU</A> - A closed source, Windows-only codec.
+               </LI>
+               <LI>
+                       <A HREF="http://www.softsound.com/Shorten.html">Shorten</A> - A.J. Robinson's well-known codec; source is available <A HREF="http://rpmfind.net/linux/rpm2html/search.php?query=shorten">here</A>.
+               </LI>
+               <LI>
+                       <A HREF="http://www.gadgetlabs.com/wavezip.htm">WaveZIP</A> - A closed source, Windows-only archiver.  Uses the <A HREF="http://members.aol.com/_ht_a/sndspace/index.html">MUSICompress</A>[tm] engine which supposedly has a patent.
+               </LI>
+               <LI>
+                       <A HREF="http://www.wavpack.com/">WavPack</A> - A closed source, Windows-only archiver.
+               </LI>
+       </UL>
+       </P>
+       <P>
+               Encoders I couldn't get a copy of:
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       AudioPak
+               </LI>
+               <LI>
+                       WavARC
+               </LI>
+       </UL>
+       </P>
+       <P>
+               If you take maximum compression ratio and speed out of the picture (as you will see later, most coders exhibit similar performance), here is a subjective sort based on overall "usefulness".  As far as features go, having source code gives you the most freedom since you can add anything you need that is missing; besides, open source projects tend to get better faster than closed source ones.  A close second (depending on the user) would be OS support or plugin support.
+       </P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD ALIGN="RIGHT">
+                               <FONT SIZE="+1"><B>Codec</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Source Available?</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Plugins Available?</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Streamable?</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Seekable?</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Cost</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>OS support</B></FONT>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               flac v0.2
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               YES (Winamp, XMMS)
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD>
+                               ANY (source)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               Shorten v2.3a
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               YES (Winamp plugin somewhere)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD>
+                               ANY (source)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               LPAC v1.20 (codec 2.0)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               YES (Winamp only)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no?
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD>
+                               Windows/Linux/Solaris
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               Monkey's Audio v3.71
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               YES (Winamp only)
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               Windows only
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               RKAU v1.06
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               YES (Winamp only)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               YES
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               Windows only
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               WavPack v3.6
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               FREE
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               Windows only
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               WaveZIP v2
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD>
+                               FREE (24-bit costs $)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               Windows only
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" BGCOLOR="#F4F4CC">
+                               Pegasus-SPS
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               no
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               $39 (free trial)
+                       </TD>
+                       <TD BGCOLOR="#D3D4C5">
+                               Windows only
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       <P>
+               The machine I used for encoding the test files is a PII-333 with 256 megs of RAM, running Windows NT 4.0 SP5.  Unfortunately, Windows is the lowest-common-denominator platform for all the encoders.
+       </P>
+       <P>
+               The input corpus currently consists entirely of CD music tracks.  In the future it may include more kinds of input (like speech, other sample rates, etc).  There are ??? tracks whose genres range from death metal to pop to western classical to Indian classical.
+       </P>
+       <P>
+               In all tables, the results are sorter by compression ratio, which is compressed size / uncompressed size.  The first table is a summary of results on all input tracks.  The remaining table shows the results of the encoders on each track.
+       </P>
+       <P>
+               Some interesting things to note: LPAC quality settings are not too stable with -r (which allows seeking during playback) turned on.  In most cases the 'normal' mode makes the smallest file, and much faster.  RKAU also has a tendency to get bigger in the 'high' mode.  Shorten's method for quantizing and transmitting the LPC coefficients is not very good which is the main reason why the fixed predictors runs are both smaller and faster.
+       </P>
+       <P>
+               Another ironic fact is that the encoders that are patented or cost money turn out to be the worst by most measures.  SPS is so archane and crippled that I gave up trying to put together results for it after one track.
+       </P>
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Encoder</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Encode time</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Compressed size</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Compression ratio</B></FONT>
+                       </TD>
+               </TR>
+               <TR><TD>Monkey's Audio 3.80 (extra high)</TD><TD>20:24.18</TD><TD>381.85 MB</TD><TD>0.5073</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>RKAU 1.06 (normal)</TD><TD>52:53.46</TD><TD>383.36 MB</TD><TD>0.5093</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>133:25.36</TD><TD>383.75 MB</TD><TD>0.5098</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>Monkey's Audio 3.80 (high)</TD><TD>7:45.75</TD><TD>387.97 MB</TD><TD>0.5154</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>20:49.34</TD><TD>393.16 MB</TD><TD>0.5223</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>LPAC 1.20 (-r, high)</TD><TD>88:20.18</TD><TD>393.12 MB</TD><TD>0.5223</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, extra high)</TD><TD>109:27.86</TD><TD>393.93 MB</TD><TD>0.5234</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>flac 0.2 (-6)</TD><TD>41:11.46</TD><TD>399.30 MB</TD><TD>0.5305</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>10:05.48</TD><TD>403.70 MB</TD><TD>0.5363</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>6:41.17</TD><TD>417.24 MB</TD><TD>0.5543</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>9:16.47</TD><TD>422.59 MB</TD><TD>0.5614</TD></TR>
+               <TR BGCOLOR="#D3D4C5"><TD>WaveZip</TD><TD>8:24.17</TD><TD>435.06 MB</TD><TD>0.5780</TD></TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       <P>
+               Here are the results for each individual track.
+       </P>
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD ALIGN="RIGHT">
+                               <FONT SIZE="+1"><B>Track</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Encoder</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Encode time</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Compressed size</B></FONT>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1"><B>Compression ratio</B></FONT>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="14" BGCOLOR="#F4F4CC">
+                               Dream Theater<BR><I>6:00</I><BR>58.47 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:39.08</TD><TD>43.70 MB</TD><TD>0.7475</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:41.98</TD><TD>43.85 MB</TD><TD>0.7500</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>8:12.44</TD><TD>43.87 MB</TD><TD>0.7503</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>2:59.56</TD><TD>43.88 MB</TD><TD>0.7504</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>flac 0.2 (-6)</TD><TD>3:13.55</TD><TD>44.38 MB</TD><TD>0.7591</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>6:51.24</TD><TD>44.42 MB</TD><TD>0.7598</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>1:45.72</TD><TD>44.44 MB</TD><TD>0.7601</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, extra high)</TD><TD>7:50.80</TD><TD>44.44 MB</TD><TD>0.7601</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:47.79</TD><TD>44.74 MB</TD><TD>0.7653</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>0:49.21</TD><TD>45.37 MB</TD><TD>0.7760</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Pegasus-SPS</TD><TD>4:45.00</TD><TD>45.40 MB</TD><TD>0.7765</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:34.50</TD><TD>46.68 MB</TD><TD>0.7984</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WaveZip</TD><TD>0:38.99</TD><TD>47.22 MB</TD><TD>0.8077</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Tool<BR><I>Forty-six & 2</I><BR>64.25 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:48.94</TD><TD>39.30 MB</TD><TD>0.6116</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:33.43</TD><TD>39.51 MB</TD><TD>0.6149</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (normal)</TD><TD>3:34.75</TD><TD>39.93 MB</TD><TD>0.6214</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>8:37.42</TD><TD>39.97 MB</TD><TD>0.6220</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>1:52.22</TD><TD>40.57 MB</TD><TD>0.6314</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>7:36.55</TD><TD>40.61 MB</TD><TD>0.6320</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>9:49.64</TD><TD>40.71 MB</TD><TD>0.6336</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>3:35.02</TD><TD>41.01 MB</TD><TD>0.6383</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:52.37</TD><TD>41.72 MB</TD><TD>0.6492</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:50.22</TD><TD>43.05 MB</TD><TD>0.6701</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:35.93</TD><TD>43.19 MB</TD><TD>0.6722</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:42.84</TD><TD>44.52 MB</TD><TD>0.6930</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Cannibal Corpse<BR><I>Mummified In Barbed Wire</I><BR>33.37 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>0:49.20</TD><TD>23.47 MB</TD><TD>0.7033</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:23.25</TD><TD>23.66 MB</TD><TD>0.7087</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>1:01.16</TD><TD>23.75 MB</TD><TD>0.7116</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>5:13.57</TD><TD>23.92 MB</TD><TD>0.7168</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>6:04.27</TD><TD>23.95 MB</TD><TD>0.7175</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>1:32.20</TD><TD>24.04 MB</TD><TD>0.7202</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>3:21.70</TD><TD>24.04 MB</TD><TD>0.7202</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>1:50.43</TD><TD>24.31 MB</TD><TD>0.7285</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:27.03</TD><TD>25.12 MB</TD><TD>0.7525</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>0:28.07</TD><TD>25.44 MB</TD><TD>0.7621</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:19.85</TD><TD>26.59 MB</TD><TD>0.7966</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:22.25</TD><TD>26.89 MB</TD><TD>0.8058</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Alanis Morisette<BR><I>Hand In My Pocket</I><BR>39.09 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:03.98</TD><TD>22.85 MB</TD><TD>0.5845</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:25.70</TD><TD>23.04 MB</TD><TD>0.5893</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>5:54.68</TD><TD>23.16 MB</TD><TD>0.5925</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>2:23.63</TD><TD>23.19 MB</TD><TD>0.5933</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>1:07.58</TD><TD>23.45 MB</TD><TD>0.6000</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>4:47.03</TD><TD>23.49 MB</TD><TD>0.6008</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>5:50.53</TD><TD>23.52 MB</TD><TD>0.6016</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>2:10.43</TD><TD>23.55 MB</TD><TD>0.6023</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:31.44</TD><TD>24.30 MB</TD><TD>0.6217</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:30.45</TD><TD>24.72 MB</TD><TD>0.6324</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:21.93</TD><TD>25.33 MB</TD><TD>0.6478</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:28.05</TD><TD>25.95 MB</TD><TD>0.6638</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Gloria Estefan<BR><I>Conga</I><BR>45.15 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:15.79</TD><TD>30.12 MB</TD><TD>0.6670</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:29.68</TD><TD>30.32 MB</TD><TD>0.6716</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>flac 0.2 (-6)</TD><TD>2:35.05</TD><TD>30.82 MB</TD><TD>0.6825</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>6:52.69</TD><TD>30.83 MB</TD><TD>0.6828</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (normal)</TD><TD>2:41.42</TD><TD>30.87 MB</TD><TD>0.6837</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>1:20.29</TD><TD>31.03 MB</TD><TD>0.6871</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:37.15</TD><TD>31.04 MB</TD><TD>0.6875</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>5:33.21</TD><TD>31.06 MB</TD><TD>0.6879</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>6:39.28</TD><TD>31.11 MB</TD><TD>0.6889</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:35.51</TD><TD>31.76 MB</TD><TD>0.7033</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:24.65</TD><TD>32.62 MB</TD><TD>0.7223</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:29.42</TD><TD>33.02 MB</TD><TD>0.7313</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Cream<BR><I>White Room</I><BR>53.01 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>8:15.46</TD><TD>34.30 MB</TD><TD>0.6469</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>3:12.99</TD><TD>34.35 MB</TD><TD>0.6479</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:28.45</TD><TD>34.65 MB</TD><TD>0.6535</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:24.17</TD><TD>34.91 MB</TD><TD>0.6586</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>1:34.16</TD><TD>35.10 MB</TD><TD>0.6621</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>3:00.29</TD><TD>35.14 MB</TD><TD>0.6629</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, high)</TD><TD>6:39.29</TD><TD>35.17 MB</TD><TD>0.6633</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, extra high)</TD><TD>7:39.28</TD><TD>35.19 MB</TD><TD>0.6638</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:40.44</TD><TD>35.39 MB</TD><TD>0.6676</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>0:44.18</TD><TD>35.82 MB</TD><TD>0.6758</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:29.49</TD><TD>36.39 MB</TD><TD>0.6864</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:35.77</TD><TD>37.13 MB</TD><TD>0.7004</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Maurice Ravel<BR><I>Fanfare from "L'eventail de Jeanne"</I><BR>20.82 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (normal)</TD><TD>1:46.51</TD><TD>6.86 MB</TD><TD>0.3297</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>3:53.54</TD><TD>6.90 MB</TD><TD>0.3316</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>0:30.30</TD><TD>7.09 MB</TD><TD>0.3407</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>0:30.93</TD><TD>7.47 MB</TD><TD>0.3586</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>3:06.27</TD><TD>7.48 MB</TD><TD>0.3591</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>2:21.16</TD><TD>7.48 MB</TD><TD>0.3593</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (high)</TD><TD>0:12.58</TD><TD>7.56 MB</TD><TD>0.3634</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>1:02.16</TD><TD>7.82 MB</TD><TD>0.3755</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:16.11</TD><TD>7.99 MB</TD><TD>0.3838</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:07.92</TD><TD>8.16 MB</TD><TD>0.3921</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:13.88</TD><TD>8.28 MB</TD><TD>0.3977</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:13.11</TD><TD>8.72 MB</TD><TD>0.4193</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Maurice Ravel<BR><I>String Quartet (4th movement)</I><BR>56.18 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>1:29.26</TD><TD>20.87 MB</TD><TD>0.3715</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>3:51.42</TD><TD>21.46 MB</TD><TD>0.3820</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (high)</TD><TD>0:34.29</TD><TD>21.55 MB</TD><TD>0.3836</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>10:39.05</TD><TD>21.56 MB</TD><TD>0.3838</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, high)</TD><TD>6:28.14</TD><TD>22.30 MB</TD><TD>0.3969</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>1:28.02</TD><TD>22.32 MB</TD><TD>0.3972</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>8:13.86</TD><TD>22.38 MB</TD><TD>0.3983</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>0:43.84</TD><TD>22.53 MB</TD><TD>0.4010</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>flac 0.2 (-6)</TD><TD>3:00.34</TD><TD>22.85 MB</TD><TD>0.4067</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:29.33</TD><TD>23.63 MB</TD><TD>0.4205</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:38.05</TD><TD>25.58 MB</TD><TD>0.4552</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:36.60</TD><TD>25.84 MB</TD><TD>0.4600</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Sergei Prokofiev<BR><I>Piano Concerto No.3 (3rd movement)</I><BR>100.68 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>2:37.54</TD><TD>34.55 MB</TD><TD>0.3431</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>6:34.97</TD><TD>35.31 MB</TD><TD>0.3507</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (high)</TD><TD>1:00.47</TD><TD>35.46 MB</TD><TD>0.3521</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>10:12.47</TD><TD>35.74 MB</TD><TD>0.3549</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>18:34.20</TD><TD>35.80 MB</TD><TD>0.3555</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, extra high)</TD><TD>12:18.79</TD><TD>35.83 MB</TD><TD>0.3558</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>2:33.43</TD><TD>36.05 MB</TD><TD>0.3580</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>1:17.06</TD><TD>37.88 MB</TD><TD>0.3762</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>flac 0.2 (-6)</TD><TD>5:15.13</TD><TD>38.56 MB</TD><TD>0.3830</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:50.03</TD><TD>39.34 MB</TD><TD>0.3907</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WaveZip</TD><TD>1:05.60</TD><TD>43.67 MB</TD><TD>0.4337</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>1:09.86</TD><TD>45.36 MB</TD><TD>0.4505</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Frederic Chopin<BR><I>Prelude No.24 in d minor</I><BR>27.46 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>0:42.69</TD><TD>10.53 MB</TD><TD>0.3834</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:19.69</TD><TD>10.77 MB</TD><TD>0.3921</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, high)</TD><TD>3:21.61</TD><TD>10.91 MB</TD><TD>0.3973</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>0:41.79</TD><TD>10.92 MB</TD><TD>0.3976</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>3:56.36</TD><TD>10.93 MB</TD><TD>0.3979</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>1:58.42</TD><TD>10.97 MB</TD><TD>0.3994</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>5:20.71</TD><TD>11.21 MB</TD><TD>0.4083</TD></TR>
+               <TR><TD>WavPack 3.6 (high)</TD><TD>0:22.32</TD><TD>11.52 MB</TD><TD>0.4193</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>flac 0.2 (-6)</TD><TD>1:26.66</TD><TD>11.77 MB</TD><TD>0.4285</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:13.56</TD><TD>12.01 MB</TD><TD>0.4374</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WaveZip</TD><TD>0:18.75</TD><TD>13.08 MB</TD><TD>0.4765</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:20.61</TD><TD>14.39 MB</TD><TD>0.5239</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               Domenico Scarlatti<BR><I>Sonata K.42 (arr.Yepes for guitar)</I><BR>16.39 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>0:25.79</TD><TD>6.96 MB</TD><TD>0.4245</TD></TR>
+               <TR><TD>RKAU 1.06 (high)</TD><TD>3:09.40</TD><TD>6.96 MB</TD><TD>0.4246</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (normal)</TD><TD>1:14.43</TD><TD>6.97 MB</TD><TD>0.4252</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:10.28</TD><TD>7.14 MB</TD><TD>0.4356</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>0:25.98</TD><TD>7.27 MB</TD><TD>0.4436</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>2:21.30</TD><TD>7.34 MB</TD><TD>0.4480</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>3:00.91</TD><TD>7.38 MB</TD><TD>0.4500</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>0:53.18</TD><TD>7.41 MB</TD><TD>0.4519</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:13.17</TD><TD>7.41 MB</TD><TD>0.4520</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:07.99</TD><TD>7.47 MB</TD><TD>0.4558</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WaveZip</TD><TD>0:10.56</TD><TD>7.83 MB</TD><TD>0.4781</TD></TR>
+               <TR><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:10.91</TD><TD>8.20 MB</TD><TD>0.5001</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               The Benedictine Monks of<BR>Santo Domingo de Silos<BR><I>Laetatus sum</I><BR>24.26 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>3:15.29</TD><TD>12.21 MB</TD><TD>0.5031</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>1:25.48</TD><TD>12.21 MB</TD><TD>0.5034</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>0:41.19</TD><TD>12.47 MB</TD><TD>0.5138</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>0:15.69</TD><TD>12.68 MB</TD><TD>0.5228</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, normal)</TD><TD>0:41.22</TD><TD>12.75 MB</TD><TD>0.5253</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, high)</TD><TD>3:40.65</TD><TD>12.88 MB</TD><TD>0.5309</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>4:53.81</TD><TD>12.92 MB</TD><TD>0.5323</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>1:22.09</TD><TD>12.92 MB</TD><TD>0.5324</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>0:20.21</TD><TD>13.15 MB</TD><TD>0.5420</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>0:12.71</TD><TD>13.28 MB</TD><TD>0.5475</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>0:17.35</TD><TD>13.41 MB</TD><TD>0.5527</TD></TR>
+               <TR><TD>WaveZip</TD><TD>0:16.37</TD><TD>13.72 MB</TD><TD>0.5655</TD></TR>
+               <TR>
+                       <TD ALIGN="RIGHT" ROWSPAN="13" BGCOLOR="#F4F4CC">
+                               L. Subramaniam<BR><I>Raga Sivapriya</I><BR>213.56 MB
+                       </TD>
+                       <TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
+               </TR>
+               <TR BGCOLOR="D3D4C5"><TD>RKAU 1.06 (high)</TD><TD>47:18.78</TD><TD>92.94 MB</TD><TD>0.4351</TD></TR>
+               <TR><TD>RKAU 1.06 (normal)</TD><TD>19:37.68</TD><TD>93.31 MB</TD><TD>0.4369</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Monkey's Audio (extra high)</TD><TD>5:51.97</TD><TD>95.30 MB</TD><TD>0.4462</TD></TR>
+               <TR><TD>Monkey's Audio (high)</TD><TD>2:14.54</TD><TD>97.52 MB</TD><TD>0.4566</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, high)</TD><TD>23:13.96</TD><TD>97.80 MB</TD><TD>0.4579</TD></TR>
+               <TR><TD>LPAC 1.20 (-r, normal)</TD><TD>5:46.84</TD><TD>98.04 MB</TD><TD>0.4590</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>LPAC 1.20 (-r, extra high)</TD><TD>30:04.06</TD><TD>98.10 MB</TD><TD>0.4593</TD></TR>
+               <TR><TD>flac 0.2 (-6)</TD><TD>11:47.13</TD><TD>98.76 MB</TD><TD>0.4624</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>WavPack 3.6 (high)</TD><TD>2:50.35</TD><TD>99.53 MB</TD><TD>0.4660</TD></TR>
+               <TR><TD>Shorten 2.3a (-p0 -b1024)</TD><TD>1:53.28</TD><TD>102.54 MB</TD><TD>0.4801</TD></TR>
+               <TR BGCOLOR="D3D4C5"><TD>Shorten 2.3a (-p8 -b2048)</TD><TD>2:34.37</TD><TD>102.59 MB</TD><TD>0.4803</TD></TR>
+               <TR><TD>WaveZip</TD><TD>2:25.86</TD><TD>107.47 MB</TD><TD>0.5032</TD></TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/developers.html b/doc/developers.html
new file mode 100644 (file)
index 0000000..e0cbef3
--- /dev/null
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - developers</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;developers&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">developers</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               FLAC is an open source project and we are happy to enlist the help of anyone who wants to contribute.  You can do this to a limited extent through the <A HREF="http://sourceforge.net/mail/?group_id=13478">mailing list</A> but if you have major changes to make to the code it's best to <A HREF="http://sourceforge.net/project/memberlist.php?group_id=13478">sign up as a developer</A>.  In either case, make sure to check out the <A HREF="goals.html">FLAC goals</A> first; there are some thing the we <B>don't</B> want added to FLAC, like copy protection and lossy compression.
+       </P>
+       <P>
+               There are several areas that are especially important:
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       Converging on the <A HREF="format.html">bitstream format</A>.  This is probably the single most important issue.
+               </LI>
+               <LI>
+                       Testing.  This is a close second, since if you are a lossless encoder you have to be absolutely lossless for all input.  The test suite has patterns that are designed to strain the encoder to the limit but more test cases would definitely help.
+               </LI>
+               <LI>
+                       Makefile fixups and code changes to work on more platforms.  Both libFLAC and flac are ANSI C and use only the standard C library and math library, meaning ports should not be that difficult.  Currently there is a GNU make system and makefiles for MSVC.
+               </LI>
+               <LI>
+                       More input plugins.  Currently there are plugins for XMMS and Winamp.  More is better!
+               </LI>
+               <LI>
+                       Speeding up the encoding.  Encoding speed at average compression is a little slower than I would like.  Improvements to the reference encoder that don't drastically obfuscate the code would be welcome.
+               </LI>
+       </UL>
+       </P>
+       <P>
+               Some other "nice-to-haves":
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       Improving the compression methods.  Some suggestions: on the entropy coding side, try context-modeling the Rice paramter, using general Golomb coding and Huffman coding.  On the prediction side, try some other methods for determining the LP coefficients (covariance method, Marple, Burg), or explore other kinds of modeling.
+               </LI>
+               <LI>
+                       A faster seek algorithm in the file decoder.
+               </LI>
+               <LI>
+                       A stream analyser that gives useful statistics for tuning or testing new algorithms.
+               </LI>
+               <LI>
+                       Fix the MSVC makefiles to make libFLAC.dll (instead of just the .lib).
+               </LI>
+               <LI>
+                       Clean up the Winamp2 plugin and/or write a Winamp3 one.
+               </LI>
+               <LI>
+                       Configurable ID3V1 support and ID3V2 support in the plugins.
+               </LI>
+               <LI>
+                       Better encoding decoding statistics for flac.
+               </LI>
+               <LI>
+                       Support more input types than just WAVE and raw in flac.
+               </LI>
+               <LI>
+                       Expand the test suite.
+               </LI>
+               <LI>
+                       A better logo!  Gimp jedi I'm not...
+               </LI>
+       </UL>
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/documentation.html b/doc/documentation.html
new file mode 100644 (file)
index 0000000..4b387c9
--- /dev/null
@@ -0,0 +1,454 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - documentation</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;documentation&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">documentation</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               This page describes the user-level view of the FLAC format (for a more detailed explanation see the <A HREF="format.html">format page</A>).  It also contains the user documentation for <B><TT>flac</TT></B>, which is the command-line file encoder/decoder, and the <A HREF="#plugins">input plugins</A>.
+       </P>
+       <P>
+               Keep in mind that the online version of this document will always apply to the latest release.  For older releases, check the documentation included with the release package.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">format</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               See the <A HREF="format.html#scope">Scope</A>, <A HREF="format.html#architecture">Architecture</A>, <A HREF="format.html#definitions">Definitions</A>, and <A HREF="format.html#overview">Overview</A> sections of the <A HREF="format.html">format page</A> for a good introduction.  This section will be expanded in the future.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">flac</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               <B><TT>flac</TT></B> is the command-line file encoder/decoder.  The input to the encoder and the output to the decoder must either be RIFF WAVE format, or raw interleaved sample data.  <B><TT>flac</TT></B> only supports linear PCM samples (in other words, no A-LAW, uLAW, etc.).  Another restriction (hopefully short-term) is that the input must be 8 or 16 bits per sample.  This is not a limitation of the FLAC format, just the reference encoder.
+       </P>
+       <P>
+               <B><TT>flac</TT></B> assumes that RIFF WAVE files will have the extension ".wav"; this may be overridden with a command-line option.  Other than this, <B><TT>flac</TT></B> makes no assumptions about file extensions, though the convention is that FLAC files have the extension ".flac" (or ".fla" on ancient file systems like FAT-16).
+       </P>
+       <P>
+               Before going into the full command-line description, two other things help to sort it out: 1) <B><TT>flac</TT></B> encodes by default, so you must use <B>-d</B> to decode; 2) the options <B><TT>-0</TT></B> .. <B><TT>-9</TT></B> that control the compression level actually are just synonyms for different groups of specific coding options (described later).  You can get the same effect by using the same options.
+       </P>
+       <P>
+               <B><TT>flac</TT></B> will be invoked one of two ways, depending on whether you are encoding or decoding:
+               <UL>
+               <LI>
+                       Encoding: flac [-v] [--skip #] [&lt;format-options&gt;] [&lt;encoding options&gt;] inputfile outputfile
+               </LI>
+               <LI>
+                       Decoding: flac -d [-v] [--skip #] [&lt;format-options&gt;] inputfile outputfile
+               </LI>
+               </UL>
+       </P>
+       <P>
+               In either case, inputfile may be "-" for stdin, and "-" for stdout.  The encoding options affect the compression ratio and encoding speed.  The format options are used to tell <B><TT>flac</TT></B> the arrangement of samples if the input file (or output file when decoding) is a raw file.  If it is a RIFF WAVE file the format options are not needed since they are read from the WAVE header.
+       </P>
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <FONT SIZE="+1"><B>General Options</B></FONT>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -d
+                       </TD>
+                       <TD>
+                               Decode (<B><TT>flac</TT></B> encodes by default).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -s
+                       </TD>
+                       <TD>
+                               Silent: do not show encoding/decoding statistics.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               --skip #
+                       </TD>
+                       <TD>
+                               Skip over the first # of samples of the input.  This works for both encoding and decoding.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <FONT SIZE="+1"><B>Encoding Options</B></FONT>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               --lax
+                       </TD>
+                       <TD>
+                               Allow encoder to generate non-Subset files.  The resulting FLAC file may not be streamable, so you should only use this option in combination with custom encoding options meant for archival.  File decoders will still be able play (and seek in) such files.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -b #
+                       </TD>
+                       <TD>
+                               Set the blocksize.  The default is 1152 for -l 0, otherwise 4608.  Subset streams must use one of 192/576/1152/2304/4608.  The current encoder uses the same blocksize for the entire stream.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -m
+                       </TD>
+                       <TD>
+                               Enable mid-side coding (only for stereo streams).  Tends to increase compression by a few percent on average.  For each block both the stereo pair and mid-side versions of the block will be encoded, and smallest resulting frame will be stored.  Currently mid-side encoding is only available when bits-per-sample <= 16.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -0 .. -9
+                       </TD>
+                       <TD>
+                               Fastest compression .. highest compression.  The default is <TT>-6</TT>.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -0
+                       </TD>
+                       <TD>
+                               Synonymous with -l 0
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -1
+                       </TD>
+                       <TD>
+                               Synonymous with -l 0 -m
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -2
+                       </TD>
+                       <TD>
+                               Synonymous with -l 0 -m -r # (where # is set based on the blocksize)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -3
+                       </TD>
+                       <TD>
+                               Reserved
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -4
+                       </TD>
+                       <TD>
+                               Synonymous with -l 8
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -5
+                       </TD>
+                       <TD>
+                               Synonymous with -l 8 -m
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -6
+                       </TD>
+                       <TD>
+                               Synonymous with -l 8 -m -r # (where # is set based on the blocksize)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -7
+                       </TD>
+                       <TD>
+                               Reserved
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -8
+                       </TD>
+                       <TD>
+                               Synonymous with -l 32 -m -r # (where # is set based on the blocksize)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -9
+                       </TD>
+                       <TD>
+                               Synonymous with -l 32 -m -e -r 99 -p.  This is painfully slow but gives you the maximum compression <B><TT>flac</TT></B> can do for a given blocksize.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -e
+                       </TD>
+                       <TD>
+                               Exhaustive model search (expensive!).  Normally the encoder estimates the best model to use and encodes once based on the estimate.  With an exhaustive model search, the encoder will generate subframes for every order and use the smallest.  If the max LPC order is high this can significantly increase the encode time but can shave off another 0.5%.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -l #
+                       </TD>
+                       <TD>
+                               Specifies the maximum LPC order.  This number must be <= 32.  If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors.  Using fixed predictors is faster but usually results in files being 5-10% larger.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -q #
+                       </TD>
+                       <TD>
+                               Specifies the precision of the quantized LP coefficients, in bits.  The default is <B><TT>-q 0</TT></B>, which means let the encoder decide based on the signal.  Unless you really know your input file it's best to leave this up to the encoder.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -p
+                       </TD>
+                       <TD>
+                               Do exhaustive LP coefficient quantization optimization.  This option overrides any <B><TT>-q</TT></B> option.  It is expensive and typically will only improve the compression a tiny fraction of a percent.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -r #
+                       </TD>
+                       <TD>
+                               Do Rice parameter optimization.  By default the encoder uses a single Rice parameter for the subframe's entire residual.  With this option, the residual is partitioned into 2^n pieces, each with its own Rice parameter.  Higher values of n yield diminishing returns.  The most bang for the buck is usually with <B><TT>-r 2</TT></B> (more for higher blocksizes).  This usually shaves off another 1.5%.  The technique tends to peak out about when blocksize/(2^n)=128.  Use <B><TT>-r 99</TT></B> to force the highest degree of optimization.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                       </TD>
+                       <TD>
+                               -m-, -e-, -p-, --lax- can all be used to turn off a particular option.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <FONT SIZE="+1"><B>Format Options</B></FONT>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fb | -fl
+                       </TD>
+                       <TD>
+                               Specify big-endian | little-endian byte order in the raw file.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fc #
+                       </TD>
+                       <TD>
+                               Specify the number of channels in the raw file.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fp #
+                       </TD>
+                       <TD>
+                               Specify the number of bits per sample in the raw file.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fs #
+                       </TD>
+                       <TD>
+                               Specify the sample rate of the raw file.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fu
+                       </TD>
+                       <TD>
+                               Specify that the samples in the raw file are unsigned (the default is signed).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fr
+                       </TD>
+                       <TD>
+                               Treat the input file (or output file if decoding) as a raw file, regardless of the extension.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               -fw
+                       </TD>
+                       <TD>
+                               Treat the input file (or output file if decoding) as a RIFF WAVE file, regardless of the extension.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <A NAME="plugins"><B><FONT SIZE="+2">xmms plugin</FONT></B></A>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               All that is necessary is to copy <B><TT>libxmms-flac.so</TT></B> to the directory where XMMS looks for input plugins (usually <B><TT>/usr/lib/xmms/Input</TT></B>).  There is nothing else to configure.  Make sure to restart XMMS before trying to play any .flac files.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">winamp plugin</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               All that is necessary is to copy <B><TT>in_flac.dll</TT></B> to the <B><TT>Plugins/</TT></B> directory of your Winamp installation.  There is nothing else to configure.  Make sure to restart Winamp before trying to play any .flac files.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/download.html b/doc/download.html
new file mode 100644 (file)
index 0000000..165ba1b
--- /dev/null
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - download</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;download&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">download</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               This page will be updated once the CVS repository is set up and the first release is made.  Check back soon or <A HREF="http://sourceforge.net/mail/?group_id=13478">join the mailing list</A>.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/features.html b/doc/features.html
new file mode 100644 (file)
index 0000000..127b77a
--- /dev/null
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - features</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;features&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">features</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+       FLAC stands for Free Lossless Audio Coder.  The FLAC project consists of:
+       </P>
+       <P>
+       <UL>
+               <LI>the stream format</LI>
+               <LI>libFLAC, which implements a reference encoder, stream decoder, and file decoder</LI>
+               <LI>flac, which is a command-line wrapper around libFLAC to encode and decode .flac files</LI>
+               <LI>input plugins for various music players (Winamp, XMMS, and more in the works)</LI>
+       </UL>
+       </P>
+       <P>
+               "Free" means that the specification of the stream format is in the public domain (the FLAC project reserves the right to set the FLAC specification and certify compliance), and that neither the FLAC format nor any of the implemented encoding/decoding methods are covered by any patent.  It also means that the source for libFLAC is available under the <A HREF="http://www.opensource.org/licenses/lgpl-license.html">LGPL</A> and the sources for flac and the plugins are available under the <A HREF="http://www.opensource.org/licenses/gpl-license.html">GPL</A>.
+       </P>
+       <P>
+               What FLAC is:
+       </P>
+       <UL>
+               <P><LI>
+                       FLAC is patent free.  The FLAC format or encoding/decoding methods are not covered by any patents.
+               </LI></P>
+               <P><LI>
+                       FLAC is lossless.  The encoding of PCM data incurs no loss of information, and the decoded audio is bit-for-bit identical to what went into the encoder.
+               </LI></P>
+               <P><LI>
+                       FLAC is designed to compress audio data.  Technically, flac can "compress" other kinds of data losslessly (if you pass it in as a mono 8-bit raw file), but the output files tend to be bigger.
+               </LI></P>
+               <P><LI>
+                       The compression capabilities of FLAC are extendable, meaning that new methods can be added to future versions of the format without breaking older streams or decoders.
+               </LI></P>
+               <P><LI>
+                       The currently implemented compression methods in the reference encoder yield streams on par or smaller than shorten.  The encoding time is variable, but is generally between that of <A HREF="http://www.softsound.com/Shorten.html">shorten</A>, and that of, say, <A HREF="http://www.mp3dev.org/mp3/">LAME</A>.  The most aggressive compression however can be quite slow.  For more info see the <A HREF="comparison.html">comparison page</A>.
+               </LI></P>
+               <P><LI>
+                       FLAC is asymmetric in favor of decode speed.  Decoding requires only integer arithmetic, and is much less compute-intensive than for most perceptual codecs.  Real-time decode performance is easily achievable on even modest hardare.
+               </LI></P>
+               <P><LI>
+                       FLAC is suitable for archiving, since there is no information loss.  You are not locked into the format since there is no generation loss if you decide to convert your data to another format in the future.
+               </LI></P>
+               <P><LI>
+                       FLAC is suitable for streaming.  Each FLAC frame contains enough data to decode that frame.  FLAC does not even rely on previous or following frames.  FLAC uses sync codes and CRCs (similar to MPEG and other formats), which, along with framing, allow decoders to pick up in the middle of a stream with a minimum of delay.
+               </LI></P>
+               <P><LI>
+                       FLAC supports fast sample-accurate seeking.  Not only is this useful for playback, it makes FLAC files suitable for use in editing applications.
+               </LI></P>
+               <P><LI>
+                       FLAC has an extendable meta-data system.  New meta-data blocks can be defined and implemented in future versions of FLAC without breaking older streams or decoders.  ID3 and ID3V2 tags may be attached to .flac files without disrupting the decoder.
+               </LI></P>
+       </UL>
+       <P>
+               Some things that follow from the features:
+       </P>
+       <UL>
+               <P><LI>
+                       FLAC streams can be played back consecutively with no audible gaps in between, unlike say, MP3s (this is one of the minor <A HREF="goals.html">goals</A>).  For example, you can encode a live album as individual tracks and still play them back seamlessly.
+               </LI></P>
+               <P><LI>
+                       The sample-accurate seeking allows versatile playback: a sophisticated player could do index points, complex looping, or other structured playback.  This could be useful in for say DJs, or practice sessions where you want to play along through specific passages.
+               </LI></P>
+               <P><LI>
+                       Basically, you get the versatility of a WAV file in a compressed streamable format.
+               </LI></P>
+       </UL>
+       <P>
+               What FLAC is <B>not</B>:
+       </P>
+       <UL>
+               <P><LI>
+                       Lossy.  FLAC is intended for lossless compression only, as there are many good lossy formats already, such as <A HREF="http://www.mp3-tech.org/">MP3</A> (see <A HREF="http://www.mp3dev.org/mp3/">LAME</A> for an excellent open-source implementation), and <A HREF="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</A>.
+               </LI></P>
+               <P><LI>
+                       SDMI compliant, et cetera.  There is no intention to support any methods of copy protection, which are, for all practical purposes, a complete waste of bits.  (Another way to look at it is that since copy protection is futile, it really carries no information, so you might say FLAC already losslessly compresses all possible copy protection information down to zero bits!)  Of course, we can't stop what some misguided person does with proprietary meta-data blocks, but then again, non-proprietary decoders will skip them anyway.
+               </LI></P>
+       </UL>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/format.html b/doc/format.html
new file mode 100644 (file)
index 0000000..6b73b60
--- /dev/null
@@ -0,0 +1,1092 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - format</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;format&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">format</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               This is a detailed description of the FLAC format.  The format is still in an alpha stage, which means it can change (even breaking old streams) until the first beta, so if you are a developer, <A HREF="http://sourceforge.net/mail/?group_id=13478">join the mailing list</A> or check back regularly.
+       </P>
+       <P>
+               First, as the original developer I have to say that I am not a compression expert and I feel obligated to give credit where it is due.  FLAC owes a lot to the many people who have advanced the audio compression field so freely.  For instance:
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/">A. J. Robinson</A> for his work on <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">Shorten</A>; his code and paper are a good starting point on some of the basic methods used by FLAC.  FLAC expands on the fixed predictors used in shorten.
+               </LI>
+               <LI>
+                       <A HREF="http://commsci.usc.edu/faculty/golomb.html">S. W. Golomb</A> and Robert F. Rice; their universal codes are used by FLAC's entropy coder.
+               </LI>
+               <LI>
+                       N. Levinson and J. Durbin; the reference encoder uses an algorithm developed and refined by them for determining the LPC coefficients from the autocorrelation coefficients.
+               </LI>
+               <LI>
+                       And of course, the main guy, <A HREF="http://www.digitalcentury.com/encyclo/update/shannon.html">Claude Shannon</A>
+               </LI>
+       </UL>
+       </P>
+       <P>
+               <A NAME="scope"><FONT SIZE="+1"><B><U>Scope</U></B></FONT></A>
+       </P>
+       <P>
+               It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain.  FLAC's domain is audio data.  Though it can losslessly code any input, only certain kinds of input will get smaller.  FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.
+       </P>
+       <P>
+               Within the audio domain, there are many possible subdomains.  For example: low bitrate speech, high-bitrate multi-channel music, etc.  FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample).  The effect of the encoding parameters on different kinds of audio data will be examined later.
+       </P>
+       <P>
+               <A NAME="architecture"><FONT SIZE="+1"><B><U>Architecture</U></B></FONT></A>
+       </P>
+       <P>
+               Similar to many audio coders, a FLAC encoder has the following stages:
+       </P>
+       <UL>
+               <P><LI>
+                       <A HREF="#blocking">Blocking</A>.  The input is broken up into many contiguous blocks.  With FLAC, the blocks may vary in size.  The optimal size of the block is usually affected by many factors, including the sample rate, spectral characteristics over time, etc.  Though FLAC allows the block size to vary within a stream, the reference encoder uses a fixed block size.
+               </LI></P>
+               <P><LI>
+                       <A HREF="#interchannel">Interchannel Decorrelation</A>.  In the case of stereo streams, the encoder will create mid and side signals based on the average and difference (respectively) of the left and right channels.  The encoder will then pass the best form of the signal to the next stage.
+               </LI></P>
+               <P><LI>
+                       <A HREF="#prediction">Prediction</A>.  The block is passed through a prediction stage where the encoder tries to find a mathematical description (usually an approximate one) of the signal.  This description is typically much smaller than the raw signal itself.  Since the methods of prediction are known to both the encoder and decoder, only the parameters of the predictor need be included in the compressed stream.  FLAC currently uses four different classes of predictors (described in the <A HREF="#prediction">prediction</A> section), but the format has reserved space for additional methods.  FLAC allows the class of predictor to change from block to block, or even within the channels of a block.
+               </LI></P>
+               <LI><P>
+                       <A HREF="#residualcoding">Residual coding</A>.  If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal (called the error or residual signal) must be coded losslessy.  If the predictor is effective, the residual signal will require fewer bits per sample than the original signal.  FLAC currently uses only one method for encoding the residual (see the <A HREF="#residualcoding">Residual coding</A> section), but the format has reserved space for additional methods.  FLAC allows the residual coding method to change from block to block, or even within the channels of a block.
+               </LI></P>
+       </UL>
+       <P>
+               In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.
+       </P>
+       <P>
+               <A NAME="definitions"><FONT SIZE="+1"><B><U>Definitions</U></B></FONT></A>
+       </P>
+       <P>
+               Many terms like "block" and "frame" are used to mean different things in differenct encoding schemes.  For example, a frame in MP3 corresponds to many samples across several channels, whereas an S/PDIF frame represents just one sample for each channel.  The definitions we use for FLAC follow.  Note that when we talk about blocks and subblocks we are refering to the raw unencoded audio data that is the input to the encoder, and when we talk about frames and subframes, we are refering to the FLAC-encoded data.
+       </P>
+       <UL>
+               <P><LI>
+                       <B>Block</B>: One or more audio samples that span several channels.
+               </LI></P>
+               <P><LI>
+                       <B>Subblock</B>: One or more audio samples within a channel.  So a block contains one subblock for each channel, and all subblocks contain the same number of samples.
+               </LI></P>
+               <P><LI>
+                       <B>Blocksize</B>: The number of samples in any of a block's subblocks.  For example, a one second block sampled at 44.1KHz has a blocksize of 44100, regardless of the number of channels.
+               </LI></P>
+               <P><LI>
+                       <B>Frame</B>: A frame header plus one or more subframes.
+               </LI></P>
+               <P><LI>
+                       <B>Subframe</B>: A subframe header plus one or more encoded samples from a given channel.  All subframes within a frame will contain the same number of samples.
+               </LI></P>
+       </UL>
+       <P>
+               <A NAME="blocking"><FONT SIZE="+1"><B><U>Blocking</U></B></FONT></A>
+       </P>
+       <P>
+               The size used for blocking the audio data has a direct effect on the compression ratio.  If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers.  If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor.  In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples.  This range covers the optimal size for all of the audio data FLAC supports.
+       </P>
+       <P>
+               Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input.  Future version may vary the block size depending on the characteristics of the signal.
+       </P>
+       <P>
+               Blocked data is passed to the predictor stage one subblock (channel) at a time.  Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame.  Because each channel is coded independently, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.  The FLAC format has reserved space for supporting mid-side coding of stereo data, but it is currently not defined or implemented in the reference codec.
+       </P>
+       <P>
+               <A NAME="interchannel"><FONT SIZE="+1"><B><U>Interchannel Decorrelation</U></B></FONT></A>
+       </P>
+       <P>
+               In stereo streams, in many cases there is an exploitable amount of correlation between the left and right channels.  FLAC allows the frames of stereo streams to have different channel assignments, and an encoder may choose to use the best representation on a frame-by-frame basis.
+       </P>
+       <UL>
+               <P><LI>
+                       <B>Independent</B>.  The left and right channels are coded independently.
+               </LI></P>
+               <P><LI>
+                       <B>Mid-side</B>.  The left and right channels are transformed into mid and side channels.  The mid channel is the midpoint (average) of the left and right signals, and the side is the difference signal (left minus right).
+               </LI></P>
+               <P><LI>
+                       <B>Left-side</B>.  The left channel and side channel are coded.
+               </LI></P>
+               <P><LI>
+                       <B>Right-side</B>.  The right channel and side channel are coded
+               </LI></P>
+       </UL>
+       <P>
+               Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.
+       </P>
+       <P>
+               <A NAME="prediction"><FONT SIZE="+1"><B><U>Prediction</U></B></FONT></A>
+       </P>
+       <P>
+               FLAC uses four methods for modeling the input signal:
+       </P>
+       <UL>
+               <P><LI>
+                       <B>Verbatim</B>.  This is essentially a zero-order predictor of the signal.  The predictor of the signal is the signal itself, so the compression is zero.  This is the baseline against which the other predictors are measured.  If you feed random data to the encoder, the verbatim predictor will probably be used for every subblock.  Since the raw signal is not actually passed through the residual coding stage (it is added to the stream 'verbatim'), the encoding results will not be the same as a zero-order linear predictor.
+               </LI></P>
+               <P><LI>
+                       <B>Constant</B>.  This predictor is used whenever the subblock contains digital silence, i.e. a constant value throughout.  The signal is run-length encoded and added to the stream.
+               </LI></P>
+               <P><LI>
+                       <B>Fixed linear predictor</B>.  FLAC uses a class of computationally-efficient fixed linear predictors (for a good description, see <A HREF="http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf">audiopak</A> and <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">shorten</A>).  FLAC adds a fourth-order predictor to the zero-to-third-order predictors used by shorten.  Since the predictors are fixed, the predictor order is the only parameter that needs to be stored in the compressed stream.  The error signal is then passed to the residual coder.
+               </LI></P>
+               <P><LI>
+                       <B>FIR Linear prediction</B>.  For more accurate modeling (at a cost of slower encoding), FLAC supports up to 32nd order FIR linear prediction (again, for info on linear prediction, see <A HREF="http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf">audiopak</A> and <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">shorten</A>).  The reference encoder uses the Levinson-Durbin method for calculating the LPC coefficients from the autocorrelation coefficients, and the coefficients are quantized before computing the residual.  Whereas encoders such as shorten used a fixed quantization for the entire input, FLAC allows the quantized coefficient precision to vary from subframe to subframe.  The FLAC reference encoder estimates the optimal precision to use based on the block size and dynamic range of the original signal.
+               </LI></P>
+       </UL>
+       <P>
+               <A NAME="residualcoding"><FONT SIZE="+1"><B><U>Residual Coding</U></B></FONT></A>
+       </P>
+       <P>
+               FLAC currently defines two similar methods for the coding of the error signal from the prediction stage.  The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single rice parameter based on the variance of the residual, and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean.  (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)
+       </P>
+       <P>
+               The FLAC format has reserved space for other coding methods.  Some possiblities for volunteers would be to explore better context-modeling of the Rice parameter, generic Golomb coding (Rice codes are a subset of Golomb codes where the Rice parameter k is the Golomb parameter m = 2^k), and Huffman coding.  See <A HREF="http://www.hpl.hp.com/techreports/98/HPL-98-193.html">LOCO-I</A> and <A HREF="http://www.cs.tut.fi/~albert/Dev/pucrunch/packing.html">pucrunch</A> for descriptions of several universal codes.
+       </P>
+       <P>
+               <FONT SIZE="+1"><B><U>Format</U></B></FONT>
+       </P>
+       <P>
+               This section specifies the FLAC bitstream format.  FLAC has no format version information, but it does contain reserved space in several places.  Future versions of the format may use this reserved space safely without breaking the format of older streams.  Older decoders may choose to abort decoding or skip data encoded with newer methods.  Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format.  These invalid patterns are usually used to make the synchronization mechanism more robust.
+       </P>
+       <P>
+               All numbers used in a FLAC bitstream are integers; there are no floating-point representations.  All numbers are big-endian coded.  All numbers are unsigned unless otherwise specified.
+       </P>
+       <P>
+               <A NAME="overview">A FLAC bitstream may be appended with ID3V1 data or prepended with ID3V2 data.  FLAC has no knowledge of such data, but the reference decoder knows how to skip an ID3 tag.  The input plugins support ID3V1 tags</A>
+       </P>
+       <P>
+               Before the formal description of the stream, an overview might be helpful.
+       </P>
+       <UL>
+               <P><LI>
+                       A FLAC bitstream consists of the "fLaC" marker at the beginning of the stream, followed by a mandatory metadata block (called the 'Encoding' block), any number of other metadata blocks, then the audio frames.
+               </LI></P>
+               <P><LI>
+                       FLAC supports up to 128 kinds of metadata blocks, but currently only one is defined.  This is the 'Encoding' block, which has info about the whole stream like sample rate, number of channels, total number of samples, etc.  This block must be present as the first metadata block in the stream.  Other metadata blocks may follow, and ones that the decoder doesn't understand, it will skip.
+               </LI></P>
+               <P><LI>
+                       The audio data is composed of one or more audio frames.  Each frame consists of a frame header, which contains a sync code, info about the frame like the block size, sample rate, number of channels, et cetera, and an 8-bit CRC.  The frame header also contains either the sample number of the first sample in the frame (for variable-blocksize streams), or the frame number (for fixed-blocksize streams).  This allows for fast, sample-accurate seeking to be performed.  Following the frame header are encoded subframes, one for each channel, and finally, the frame is zero-padded to a byte boundary.  Each subframe has its own header that specifies how the subframe is encoded.
+               </LI></P>
+               <P><LI>
+                       Since a decoder may start decoding in the middle of a stream, there must be a method to determine the start of a frame.  A 9-bit sync code begins every frame.  The sync code will not appear anywhere else in the frame header.  However, since it may appear in the subframes, the decoder has two other ways of ensuring a correct sync.  The first is to check that the rest of the frame header contains no invalid data.  Even this is not foolproof since valid header patterns can still occur within the subframes.  The decoder's final check is to generate an 8-bit CRC of the frame header and compare this to the CRC stored at the end of the frame header.
+               </LI></P>
+               <P><LI>
+                       Again, since a decoder may start decoding at an arbitrary frame in the stream, each frame header must contain some basic information about the stream because the decoder may not have access to the ENCODING metadata block at the start of the stream.  This information includes sample rate, bits per sample, number of channels, etc.  Since the frame header is pure overhead, it has a direct effect on the compression ratio.  To keep the frame header as small as possible, FLAC uses lookup tables for the most commonly used values for frame parameters.  For instance, the sample rate part of the frame header is specified using 4 bits.  Eight of the bit patterns correspond to the commonly used sample rates of 8/16/22.05/24/32/44.1/48/96 kHz.  However, odd sample rates can be specified by using one of the 'hint' bit patterns, directing the decoder to find the exact sample rate at the end of the frame header.  The same method is used for specifying the block size and bits per sample.  In this way, the frame header size stays small for all of the most common forms of audio data.
+               </LI></P>
+               <P><LI>
+                       Individual subframes (one for each channel) are coded separately within a frame, and appear serially in the stream.  In other words, the encoded audio data is NOT channel-interleaved.  This reduces decoder complexity at the cost of requiring larger decode buffers.  Each subframe has its own header specifying the attributes of the subframe, like prediction method and order, residual coding parameters, etc.  The header is followed by the encoded audio data for that channel.
+               </LI></P>
+               <P><LI>
+                       FLAC specifies a subset of itself as the Subset format.  The purpose of this is to ensure that any streams encoded according to the Subset are truly "streamable", meaning that a decoder that cannot seek within the stream can still pick up in the middle of the stream and start decoding.  It also makes hardware decoder implementations more practical by limiting the blocking such that decoder buffer sizes can be easily determined.  "flac" generates Subset streams by default unless the "--lax" command-line option is used.  The Subset makes the following limitations on what may be used in the stream:
+                       <UL>
+                       <LI>
+                               The blocksize bits in the <A HREF="#frame_header">frame header</A> must be 001-101, specifying a fixed-blocksize stream (the exception being the last block as described in the table).  This also means that the Encoding metadata block must specify equal mininum and maximum blocksizes.
+                       </LI>
+                       <LI>
+                               The bits-per-sample bits in the <A HREF="#frame_header">frame header</A> must be 001-110.
+                       </LI>
+                       <LI>
+                               The sample rate bits in the <A HREF="#frame_header">frame header</A> must be 0001-1011.
+                       </LI>
+                       </UL>
+               </LI></P>
+       </UL>
+
+       <P>
+               The following tables constitute a formal description of the FLAC format.  Numbers in angle brackets indicate how many bits are used for a given field.
+       </P>
+
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="stream"><FONT SIZE="+1"><B>STREAM</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;32&gt;
+                       </TD>
+                       <TD>
+                               "fLaC", the FLAC stream marker in ASCII, meaning byte 0 of the stream is 0x66, followed by 0x4C 0x61 0x43
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_encoding_block"><I>METADATA_ENCODING_BLOCK</I></A>
+                       </TD>
+                       <TD>
+                               This is the mandatory metadata block that has the basic properties of the stream
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block"><I>METADATA_BLOCK</I></A>*
+                       </TD>
+                       <TD>
+                               Zero or more metadata blocks
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#frame"><I>FRAME</I></A>+
+                       </TD>
+                       <TD>
+                               One or more audio frames
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="metadata_block"><FONT SIZE="+1"><B>METADATA_BLOCK</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block_header"><I>METADATA_BLOCK_HEADER</I></A>
+                       </TD>
+                       <TD>
+                               A block header that specifies the type and size of the metadata block data.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block_data"><I>METADATA_BLOCK_DATA</I></A>
+                       </TD>
+                       <TD>
+                               &nbsp;
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="metadata_encoding_block"><FONT SIZE="+1"><B>METADATA_ENCODING_BLOCK</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block_header"><I>METADATA_BLOCK_HEADER</I></A>
+                       </TD>
+                       <TD>
+                               A block header that specifies the ENCODING BLOCK
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block_encoding"><I>METADATA_BLOCK_ENCODING</I></A>
+                       </TD>
+                       <TD>
+                               &nbsp;
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="metadata_block_header"><FONT SIZE="+1"><B>METADATA_BLOCK_HEADER</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;1&gt;
+                       </TD>
+                       <TD>
+                               Last-metadata-block flag: '1' if this block is the last metadata block before the audio blocks, '0' otherwise.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;7&gt;
+                       </TD>
+                       <TD>
+                               BLOCK_TYPE<BR>
+                               <UL>
+                               <LI>
+                                       <TT>0</TT> : ENCODING
+                               </LI>
+                               <LI>
+                                       <TT>1-127</TT> : reserved
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;24&gt;
+                       </TD>
+                       <TD>
+                               Length (in bytes) of metadata to follow (does not include the size of the METADATA_BLOCK_HEADER)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1">NOTES</FONT><BR>
+                               <UL>
+                               <LI>
+                                       Currently, FLAC specifies only one metadata block, the ENCODING block.  Its presence as the first metadata block in the stream is mandatory.
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="metadata_block_data"><FONT SIZE="+1"><B>METADATA_BLOCK_DATA</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#metadata_block_encoding"><I>METADATA_BLOCK_ENCODING</I></A>
+                       </TD>
+                       <TD>
+                               Currently, FLAC specifies only one metadata block, the ENCODING block.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="metadata_block_encoding"><FONT SIZE="+1"><B>METADATA_BLOCK_ENCODING</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;16&gt;
+                       </TD>
+                       <TD>
+                               The minimum block size (in samples) used in the stream.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;16&gt;
+                       </TD>
+                       <TD>
+                               The maximum block size (in samples) used in the stream.  (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;16&gt;
+                       </TD>
+                       <TD>
+                               The minimum frame size (in bytes) used in the stream.  May be 0 to imply the value is not known.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;16&gt;
+                       </TD>
+                       <TD>
+                               The maximum frame size (in bytes) used in the stream.  May be 0 to imply the value is not known.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;20&gt;
+                       </TD>
+                       <TD>
+                               Sample rate in Hz.  Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz.  Also, a value of 0 is invalid.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;3&gt;
+                       </TD>
+                       <TD>
+                               (number of channels)-1.  FLAC supports from 1 to 8 channels
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;5&gt;
+                       </TD>
+                       <TD>
+                               (bits per sample)-1.  FLAC supports from 1 to 32 bits per sample.  Currently the reference encoder and decoders only support up to 24 bits per sample.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;36&gt;
+                       </TD>
+                       <TD>
+                               Total samples in stream.  'Samples' means channel-wide sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels.  A value of zero here means the number of total samples is unknown.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1">NOTES</FONT><BR>
+                               <UL>
+                               <LI>
+                                       FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid.
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="frame"><FONT SIZE="+1"><B>FRAME</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#frame_header"><I>FRAME_HEADER</I></A>
+                       </TD>
+                       <TD>
+                               nbsp;
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#subframe"><I>SUBFRAME</I></A>+
+                       </TD>
+                       <TD>
+                               One SUBFRAME per channel.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;?&gt;
+                       </TD>
+                       <TD>
+                               Zero-padding to byte alignment.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="frame_header"><FONT SIZE="+1"><B>FRAME_HEADER</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;9&gt;
+                       </TD>
+                       <TD>
+                               sync code '<TT>111111110</TT>'
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;3&gt;
+                       </TD>
+                       <TD>
+                               block size in channel-wide samples:<BR>
+                               <UL>
+                               <LI>
+                                       <TT>000</TT> : get from ENCODING metadata block
+                               </LI>
+                               <LI>
+                                       <TT>001</TT> : 192 samples
+                               </LI>
+                               <LI>
+                                       <TT>010-101</TT> : 576 * (2^(2-n)) samples, i.e. 576/1152/2304/4608
+                               </LI>
+                               <LI>
+                                       <TT>110</TT> : get 8 bit (blocksize-1) from end of header
+                               </LI>
+                               <LI>
+                                       <TT>111</TT> : get 16 bit (blocksize-1) from end of header
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;4&gt;
+                       </TD>
+                       <TD>
+                               sample rate:<BR>
+                               <UL>
+                               <LI>
+                                       <TT>0000</TT> : get from ENCODING metadata block
+                               </LI>
+                               <LI>
+                                       <TT>0001-0011</TT> : reserved
+                               </LI>
+                               <LI>
+                                       <TT>0100</TT> : 8kHz
+                               </LI>
+                               <LI>
+                                       <TT>0101</TT> : 16kHz
+                               </LI>
+                               <LI>
+                                       <TT>0110</TT> : 22.05kHz
+                               </LI>
+                               <LI>
+                                       <TT>0111</TT> : 24kHz
+                               </LI>
+                               <LI>
+                                       <TT>1000</TT> : 32kHz
+                               </LI>
+                               <LI>
+                                       <TT>1001</TT> : 44.1kHz
+                               </LI>
+                               <LI>
+                                       <TT>1010</TT> : 48kHz
+                               </LI>
+                               <LI>
+                                       <TT>1011</TT> : 96kHz
+                               </LI>
+                               <LI>
+                                       <TT>1100</TT> : get 8 bit sample rate (in kHz) from end of header
+                               </LI>
+                               <LI>
+                                       <TT>1101</TT> : get 16 bit sample rate (in Hz) from end of header
+                               </LI>
+                               <LI>
+                                       <TT>1110</TT> : get 16 bit sample rate (in tens of Hz) from end of header
+                               </LI>
+                               <LI>
+                                       <TT>1111</TT> : invalid, to prevent sync-fooling string of 1s
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;4&gt;
+                       </TD>
+                       <TD>
+                               channel assignment
+                               <UL>
+                               <LI>
+                                       <TT>0000-0111</TT> : (number of independent channels)-1.  when == 0001, channel 0 is the left channel and channel 1 is the right
+                               </LI>
+                               <LI>
+                                       <TT>1000</TT> : left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel
+                               </LI>
+                               <LI>
+                                       <TT>1001</TT> : right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right channel
+                               </LI>
+                               <LI>
+                                       <TT>1010</TT> : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel
+                               </LI>
+                               <LI>
+                                       <TT>1011-1111</TT> : reserved
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;3&gt;
+                       </TD>
+                       <TD>
+                               sample size in bits:<BR>
+                               <UL>
+                               <LI>
+                                       <TT>000</TT> : get from ENCODING metadata block
+                               </LI>
+                               <LI>
+                                       <TT>001</TT> : 8 bits per sample
+                               </LI>
+                               <LI>
+                                       <TT>010</TT> : 12 bits per sample
+                               </LI>
+                               <LI>
+                                       <TT>011</TT> : reserved
+                               </LI>
+                               <LI>
+                                       <TT>100</TT> : 16 bits per sample
+                               </LI>
+                               <LI>
+                                       <TT>101</TT> : 20 bits per sample
+                               </LI>
+                               <LI>
+                                       <TT>110</TT> : 24 bits per sample
+                               </LI>
+                               <LI>
+                                       <TT>111</TT> : reserved
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;1&gt;
+                       </TD>
+                       <TD>
+                               zero bit padding, to prevent sync-fooling string of 1s
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;?&gt;
+                       </TD>
+                       <TD>
+                               if(variable blocksize)<BR>
+                               &nbsp;&nbsp;&nbsp;&lt;8-56&gt;:"UTF-8" coded sample number (decoded number is 36 bits)<BR>
+                               else<BR>
+                               &nbsp;&nbsp;&nbsp;&lt;8-48&gt;:"UTF-8" coded frame number (decoded number is 31 bits)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;?&gt;
+                       </TD>
+                       <TD>
+                               if(blocksize bits == 11x)<BR>
+                               &nbsp;&nbsp;&nbsp;8/16 bit (blocksize-1)
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;?&gt;
+                       </TD>
+                       <TD>
+                               if(sample rate bits == 11xx)<BR>
+                               &nbsp;&nbsp;&nbsp;8/16 bit sample rate
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;8&gt;
+                       </TD>
+                       <TD>
+                               CRC-8 (polynomial = x^8 + x^2 + x + 1) of everything before the crc, including the sync code
+                       </TD>
+               </TR>
+               <TR>
+                       <TD>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1">NOTES</FONT><BR>
+                               <UL>
+                               <LI>
+                                       The blocksize bits 000-101 may only be used if the blocksize is fixed throughout the entire stream.  Blocksize bits 110-111 may be used in any case but the decoder will have to pessimistically guess that it is a variable-blocksize stream.  There is only one special case: the encoder may use blocksize bits 110-111 on the last frame of a fixed-blocksize stream, as long as the blocksize is not greater than the stream blocksize.
+                               </LI>
+                               <LI>
+                                       The "UTF-8" coding used for the sample/frame number is the same variable length code used to store compressed UCS-2, extended to handle larger input.
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe"><FONT SIZE="+1"><B>SUBFRAME</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#subframe_header"><I>SUBFRAME_HEADER</I></A>
+                       </TD>
+                       <TD>
+                               &nbsp;
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#subframe_constant"><I>SUBFRAME_CONSTANT</I></A><BR>|| <A HREF="#subframe_fixed"><I>SUBFRAME_FIXED</I></A><BR>|| <A HREF="#subframe_lpc"><I>SUBFRAME_LPC</I></A><BR>|| <A HREF="#subframe_verbatim"><I>SUBFRAME_VERBATIM</I></A>
+                       </TD>
+                       <TD VALIGN="TOP">
+                               The SUBFRAME_HEADER specifies which one.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe_header"><FONT SIZE="+1"><B>SUBFRAME_HEADER</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;8&gt;
+                       </TD>
+                       <TD>
+                               Subframe type:
+                               <UL>
+                               <LI>
+                                       <TT>xxxxxxx1</TT> : invalid, to prevent sync-fooling string of 1s
+                               </LI>
+                               <LI>
+                                       <TT>00000000</TT> : <A HREF="#subframe_constant">SUBFRAME_CONSTANT</A>
+                               </LI>
+                               <LI>
+                                       <TT>00000010</TT> : <A HREF="#subframe_verbatim">SUBFRAME_VERBATIM</A>
+                               </LI>
+                               <LI>
+                                       <TT>000001x0</TT> : reserved
+                               </LI>
+                               <LI>
+                                       <TT>00001xx0</TT> : reserved
+                               </LI>
+                               <LI>
+                                       <TT>0001xxx0</TT> : if(xxx <= 4) <A HREF="#subframe_fixed">SUBFRAME_FIXED</A>, xxx=order ; else reserved
+                               </LI>
+                               <LI>
+                                       <TT>001xxxx0</TT> : reserved
+                               </LI>
+                               <LI>
+                                       <TT>01xxxxx0</TT> : <A HREF="#subframe_lpc">SUBFRAME_LPC</A>, xxxxx=order-1
+                               </LI>
+                               <LI>
+                                       <TT>1xxxxxxx</TT> : invalid, to prevent sync-fooling string of 1s
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe_constant"><FONT SIZE="+1"><B>SUBFRAME_CONSTANT</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;n&gt;
+                       </TD>
+                       <TD>
+                               Unencoded constant value of the subblock, n = frame's bits-per-sample.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe_fixed"><FONT SIZE="+1"><B>SUBFRAME_FIXED</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;n&gt;
+                       </TD>
+                       <TD>
+                               Unencoded warm-up samples (n = frame's bits-per-sample * predictor order).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#residual"><I>RESIDUAL</I></A>
+                       </TD>
+                       <TD>
+                               Encoded residual
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe_lpc"><FONT SIZE="+1"><B>SUBFRAME_LPC</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;n&gt;
+                       </TD>
+                       <TD>
+                               Unencoded warm-up samples (n = frame's bits-per-sample * lpc order).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;4&gt;
+                       </TD>
+                       <TD>
+                               (quantized linear predictor coefficients' precision in bits)-1 (1111 = invalid).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;5&gt;
+                       </TD>
+                       <TD>
+                               Quantized linear predictor coefficient shift needed in bits (NOTE: this number is signed).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;n&gt;
+                       </TD>
+                       <TD>
+                               Unencoded predictor coefficients (n = qlp coeff precision * lpc order).
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#residual"><I>RESIDUAL</I></A>
+                       </TD>
+                       <TD>
+                               Encoded residual
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="subframe_verbatim"><FONT SIZE="+1"><B>SUBFRAME_VERBATIM</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;n*i&gt;
+                       </TD>
+                       <TD>
+                               Unencoded subblock; n = frame's bits-per-sample, i = frame's blocksize.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="residual"><FONT SIZE="+1"><B>RESIDUAL</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;2&gt;
+                       </TD>
+                       <TD>
+                               Residual coding method:<BR>
+                               <UL>
+                               <LI>
+                                       <TT>00</TT> : partitioned rice coding
+                               </LI>
+                               <LI>
+                                       <TT>01-11</TT> : reserved
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#partitioned_rice"><I>RESIDUAL_CODING_METHOD_PARTITIONED_RICE</I></A>
+                       </TD>
+                       <TD>
+                               &nbsp;
+                       </TD>
+               </TR>
+               <TR>
+                       <TD>
+                       </TD>
+                       <TD BGCOLOR="#F4F4CC">
+                               <FONT SIZE="+1">NOTES</FONT><BR>
+                               <UL>
+                               <LI>
+                                       Currently, FLAC specifies only one entropy coding method.
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="partitioned_rice"><FONT SIZE="+1"><B>RESIDUAL_CODING_METHOD_PARTITIONED_RICE</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;4&gt;
+                       </TD>
+                       <TD>
+                               Partition order.
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               <A HREF="#rice_partition"><I>RICE_PARTITION</I></A>+
+                       </TD>
+                       <TD>
+                               There will be 2^order partitions.
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+       <P>
+       <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
+       <TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
+               <TR>
+                       <TD COLSPAN="2" BGCOLOR="#D3D4C5">
+                               <A NAME="rice_partition"><FONT SIZE="+1"><B>RICE_PARTITION</B></FONT></A>
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;4&gt;
+                       </TD>
+                       <TD>
+                               Rice parameter
+                       </TD>
+               </TR>
+               <TR>
+                       <TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
+                               &lt;?&gt;
+                       </TD>
+                       <TD>
+                               Encoded residual.  The number of samples (n) in the partition is determined as follows:<BR>
+                               <UL>
+                               <LI>
+                                       if the partition order is zero, n = frame's blocksize
+                               </LI>
+                               <LI>
+                                       else if this is not the first partition of the subframe, n = (frame's blocksize / (2^partition order))
+                               </LI>
+                               <LI>
+                                       else n = (frame's blocksize / (2^partition order)) - predictor order
+                               </LI>
+                               </UL>
+                       </TD>
+               </TR>
+       </TABLE>
+       </TD></TR></TABLE>
+       </P>
+
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/goals.html b/doc/goals.html
new file mode 100644 (file)
index 0000000..3aa165b
--- /dev/null
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - goals</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;goals&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">goals</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               Since FLAC is an open-source project, it's important to have a set of goals that everyone works to.  They may change slightly from time to time but they're a good guideline.  Changes should be in line with the goals and should not attempt to embrace any of the anti-goals!
+       </P>
+       <P>
+               <B>Goals</B>
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       FLAC should be and stay an open format.  The source code is all either LGPL'd or GPL'd.
+               </LI>
+               <LI>
+                       FLAC should be lossless.  This seems obvious but lossy compression seems to creep into every audio coder.  This goal also means that flac should stay archival quality and be truly lossless for all input.  Testing of releases should be thorough.
+               </LI>
+               <LI>
+                       FLAC should yield respectable compression, on par or better than other lossless coders.
+               </LI>
+               <LI>
+                       FLAC should allow at least realtime decoding on even modest hardware.
+               </LI>
+               <LI>
+                       FLAC should support fast sample-accurate seeking.
+               </LI>
+               <LI>
+                       FLAC should allow gapless playback of consecutive streams.  This follows from the lossless goal.
+               </LI>
+               <LI>
+                       The FLAC project owes a lot to the many people who have advanced the audio compression field so freely, and aims also to contribute through the open-source development of new ideas.
+               </LI>
+       </UL>
+       </P>
+       <P>
+               <B>Anti-goals</B>
+       </P>
+       <P>
+       <UL>
+               <LI>
+                       Lossy compression.  There are already many suitable lossy format (<A HREF="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</A>, <A HREF="http://www.mp3-tech.org/">MP3</A>, etc.).
+               </LI>
+               <LI>
+                       Copy protection of any kind.  Don't get me started, just see the <A HREF="features.html">features page</A> for the short answer.
+               </LI>
+       </UL>
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/images/1x1.gif b/doc/images/1x1.gif
new file mode 100644 (file)
index 0000000..f14ea13
Binary files /dev/null and b/doc/images/1x1.gif differ
diff --git a/doc/images/logo.jpg b/doc/images/logo.jpg
new file mode 100644 (file)
index 0000000..9a995bd
Binary files /dev/null and b/doc/images/logo.jpg differ
diff --git a/doc/index.html b/doc/index.html
new file mode 100644 (file)
index 0000000..4a1043f
--- /dev/null
@@ -0,0 +1,232 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - Free Lossless Audio Coder</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;home&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+<TABLE cellspacing="0" cellpadding="3" border="0" width="100%" bgcolor="#99CC99">
+       <TR>
+               <TD align="center" valign="top">
+
+<TABLE WIDTH="100%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">status</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>FLAC is currently in the alpha stage.  The current version is 0.2.  The format is well defined but may change enough before becoming beta to break older streams.  It also has not gone through enough testing yet to be considered archival quality.  You should keep those two things in mind when using any alpha or beta versions of FLAC.</P>
+       <P>That said, we intend to settle on the format quickly, then start releasing beta versions.  If you use FLAC and have suggestions or bugs, please <A HREF="http://sourceforge.net/mail/?group_id=13478">join the mailing list</A> or <A HREF="http://sourceforge.net/project/memberlist.php?group_id=13478">developers group</A> and help us move to an official 1.0 version.</P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+<TABLE WIDTH="100%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">what is FLAC?</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+       FLAC stands for Free Lossless Audio Coder.  The FLAC project consists of:
+       </P>
+       <P>
+       <UL>
+               <LI>the stream format</LI>
+               <LI>libFLAC, which implements a reference encoder, stream decoder, and file decoder</LI>
+               <LI>flac, which is a command-line wrapper around libFLAC to encode and decode .flac files</LI>
+               <LI>input plugins for various music players (Winamp, XMMS, and more in the works)</LI>
+       </UL>
+       </P>
+       <P>
+               "Free" means that the specification of the stream format is in the public domain (the FLAC project reserves the right to set the FLAC specification and certify compliance), and that neither the FLAC format nor any of the implemented encoding/decoding methods are covered by any patent.  It also means that the source for libFLAC is available under the <A HREF="http://www.opensource.org/licenses/lgpl-license.html">LGPL</A> and the sources for flac and the plugins are available under the <A HREF="http://www.opensource.org/licenses/gpl-license.html">GPL</A>.
+       </P>
+       <P>
+               See the <A HREF="features.html">features page</A>, <A HREF="documentation.html">documentation page</A>, or <A HREF="format.html">FLAC format page</A> for more info, the <A HREF="comparison.html">comparison page</A> to see how the reference encoder measures up, or the <A HREF="goals.html">goals page</A> for what the FLAC project hopes to achieve.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+
+<TABLE WIDTH="100%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">download</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               Visit the <A HREF="download.html">download page</A> for links to the source code or pre-built binaries, or go directly to the <A HREF="http://www.sourceforge.net/projects/flac/">source</A> on SourceForge.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+
+<TABLE WIDTH="100%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">documentation</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               The documentation is available online as well as in the distributions.  The general installation and usage documentation for flac and the plugins is <A HREF="documentation.html">here</A>.  For a detailed description of the FLAC format and reference encoder see the <A HREF="format.html">FLAC format page</A>.
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+
+<TABLE WIDTH="100%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">message from the maintainer</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               I came up with FLAC because no audio compression format I could find did everything I needed.  Since I couldn't mash them all together (most are closed-source), I solidified all my requirements (now the FLAC <A HREF="goals.html">goals</A>) and wrote the first implementation.  I intended to open-source it from the beginning for two reasons: 1) so that people who knew more about audio compression than me could help improve it; and 2) I wanted to give something back to the OS community, whose huge body of work I rely on so much.
+       </P>
+       <P>
+               So I started the FLAC project on SourceForge as soon as I had a relatively complete first implementation.  Now I'm the maintainer of the FLAC project.  You can get in touch with me about it through the <A HREF="http://sourceforge.net/mail/?group_id=13478">mailing list</A> or <A HREF="mailto:jcoalson@users.sourceforge.net">directly</A>
+       </P>
+       <P>
+               --Josh Coalson
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+
+</TD>
+
+
+<TD width="26%" valign="top" align="center">
+
+
+<TABLE WIDTH="95%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD ALIGN="center"><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B>news</B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+               <TR><TD BGCOLOR="#EEEED4"><SMALL><FONT FACE="Lucida,Verdana,Helvetica,Arial"><A HREF="news.html#20001101">10-Dec-2000</A> :<BR>&nbsp;&nbsp;FLAC <A HREF="http://www.sourceforge.net/projects/flac/">debuts</A> on SourceForge<BR></FONT></SMALL></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE><BR><P>
+
+
+<TABLE WIDTH="95%">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD ALIGN="center"><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B>links</B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+               <TR><TD BGCOLOR="#EEEED4"><SMALL><FONT FACE="Lucida,Verdana,Helvetica,Arial"><A HREF="http://www.sourceforge.net/projects/flac/">SourceForge</A><BR></FONT></SMALL></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE><BR><P>
+
+
+<A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?group_id=13478&amp;type=1" width="88" height="31" border="0" alt="SourceForge Logo"></A><BR>
+
+
+<BR></FONT>
+</TD></TR></TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/doc/news.html b/doc/news.html
new file mode 100644 (file)
index 0000000..d2c0ba3
--- /dev/null
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+       <TITLE>FLAC - news</TITLE>
+</HEAD>
+
+<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">
+
+<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
+       <TR>
+               <TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
+                       <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
+                               <TR>
+                                       <TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;news&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="format.html">format</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
+                                       <TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
+                               </TR>
+                       </TABLE>
+               </TD>
+       </TR>
+</TABLE>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>
+
+<CENTER>
+
+<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>
+
+
+<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
+<TR><TD>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
+               <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+               <B><FONT SIZE="+2">news</FONT></B>
+               </FONT></TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+       <TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
+       <TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
+       <P>
+               <A NAME="20001101">10-Dec-2000:</A>
+       </P>
+       <P>
+       <UL>
+               <LI><B>FLAC debuts on SourceForge.</B>  The FLAC project is now being hosted on SourceForge.  Visit the <A HREF="http://www.sourceforge.net/projects/projects/flac/">FLAC project page</A> to join the mailing list or sign up as a developer.</LI>
+       </UL>
+       </P>
+       </FONT>
+       </TD></TR>
+       </TABLE>
+       <TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
+</TD></TR>
+</TABLE>
+
+
+</CENTER>
+
+</BODY>
+</HTML>
diff --git a/include/FLAC/all.h b/include/FLAC/all.h
new file mode 100644 (file)
index 0000000..9464dcc
--- /dev/null
@@ -0,0 +1,28 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__ALL_H
+#define FLAC__ALL_H
+
+#include "encoder.h"
+#include "file_decoder.h"
+#include "ordinals.h"
+#include "stream_decoder.h"
+
+#endif
diff --git a/include/FLAC/encoder.h b/include/FLAC/encoder.h
new file mode 100644 (file)
index 0000000..e1171b4
--- /dev/null
@@ -0,0 +1,77 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__ENCODER_H
+#define FLAC__ENCODER_H
+
+#include "format.h"
+
+typedef enum {
+       FLAC__ENCODER_WRITE_OK = 0,
+       FLAC__ENCODER_WRITE_FATAL_ERROR = 1
+} FLAC__EncoderWriteStatus;
+
+typedef enum {
+       FLAC__ENCODER_OK,
+       FLAC__ENCODER_UNINITIALIZED,
+       FLAC__ENCODER_INVALID_NUMBER_OF_CHANNELS,
+       FLAC__ENCODER_INVALID_BITS_PER_SAMPLE,
+       FLAC__ENCODER_INVALID_SAMPLE_RATE,
+       FLAC__ENCODER_INVALID_BLOCK_SIZE,
+       FLAC__ENCODER_INVALID_QLP_COEFF_PRECISION,
+       FLAC__ENCODER_MID_SIDE_CHANNELS_MISMATCH,
+       FLAC__ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH,
+       FLAC__ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
+       FLAC__ENCODER_NOT_STREAMABLE,
+       FLAC__ENCODER_FRAMING_ERROR,
+       FLAC__ENCODER_FATAL_ERROR_WHILE_ENCODING,
+       FLAC__ENCODER_FATAL_ERROR_WHILE_WRITING, /* that is, the write_callback returned an error */
+       FLAC__ENCODER_MEMORY_ALLOCATION_ERROR
+} FLAC__EncoderState;
+
+struct FLAC__EncoderPrivate;
+typedef struct {
+       /*
+        * none of these fields may change once FLAC__encoder_init() is called
+        */
+       struct FLAC__EncoderPrivate *guts;    /* must be 0 when passed to FLAC__encoder_init() */
+       FLAC__EncoderState state;             /* must be FLAC__ENCODER_UNINITIALIZED when passed to FLAC__encoder_init() */
+       bool     streamable_subset;
+       bool     do_mid_side_stereo;          /* 0 or 1; 1 only if channels==2 */
+       unsigned channels;                    /* must be <= FLAC__MAX_CHANNELS */
+       unsigned bits_per_sample;             /* do not give the encoder wider data than what you specify here or bad things will happen! */
+       unsigned sample_rate;
+       unsigned blocksize;
+       unsigned max_lpc_order;               /* 0 => encoder will not try general LPC, only fixed predictors; must be <= FLAC__MAX_LPC_ORDER */
+       unsigned qlp_coeff_precision;         /* >= FLAC__MIN_QLP_COEFF_PRECISION, or 0 to let encoder select based on blocksize; */
+                                             /* qlp_coeff_precision+bits_per_sample must be < 32 */
+       bool     do_qlp_coeff_prec_search;    /* 0 => use qlp_coeff_precision, 1 => search around qlp_coeff_precision, take best */
+       bool     do_exhaustive_model_search;  /* 0 => use estimated bits per residual for scoring, 1 => generate all, take shortest */
+       unsigned rice_optimization_level;     /* 0 => estimate Rice parameter based on residual variance, 1-8 => partition residual, use parameter for each */
+} FLAC__Encoder;
+
+
+FLAC__Encoder *FLAC__encoder_get_new_instance();
+void FLAC__encoder_free_instance(FLAC__Encoder *encoder);
+FLAC__EncoderState FLAC__encoder_init(FLAC__Encoder *encoder, FLAC__EncoderWriteStatus (*write_callback)(const FLAC__Encoder *encoder, const byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data), void (*metadata_callback)(const FLAC__Encoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data), void *client_data);
+void FLAC__encoder_finish(FLAC__Encoder *encoder);
+bool FLAC__encoder_process(FLAC__Encoder *encoder, const int32 *buf[], unsigned samples);
+bool FLAC__encoder_process_interleaved(FLAC__Encoder *encoder, const int32 buf[], unsigned samples);
+
+#endif
diff --git a/include/FLAC/file_decoder.h b/include/FLAC/file_decoder.h
new file mode 100644 (file)
index 0000000..54aa1ec
--- /dev/null
@@ -0,0 +1,59 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__FILE_DECODER_H
+#define FLAC__FILE_DECODER_H
+
+#include "stream_decoder.h"
+
+typedef enum {
+    FLAC__FILE_DECODER_OK,
+       FLAC__FILE_DECODER_SEEKING,
+       FLAC__FILE_DECODER_END_OF_FILE,
+    FLAC__FILE_DECODER_ERROR_OPENING_FILE,
+    FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR,
+       FLAC__FILE_DECODER_SEEK_ERROR,
+       FLAC__FILE_DECODER_STREAM_ERROR,
+    FLAC__FILE_DECODER_UNINITIALIZED
+} FLAC__FileDecoderState;
+
+struct FLAC__FileDecoderPrivate;
+typedef struct {
+       FLAC__FileDecoderState state; /* must be FLAC__FILE_DECODER_UNINITIALIZED when passed to FLAC__file_decoder_init() */
+       struct FLAC__FileDecoderPrivate *guts; /* must be 0 when passed to FLAC__file_decoder_init() */
+} FLAC__FileDecoder;
+
+FLAC__FileDecoder *FLAC__file_decoder_get_new_instance();
+void FLAC__file_decoder_free_instance(FLAC__FileDecoder *decoder);
+FLAC__FileDecoderState FLAC__file_decoder_init(
+       FLAC__FileDecoder *decoder,
+       const char *filename,
+       FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__FileDecoder *decoder, const FLAC__FrameHeader *header, const int32 *buffer[], void *client_data),
+       void (*metadata_callback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
+       void (*error_callback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
+       void *client_data
+);
+void FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
+bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
+bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
+bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder);
+bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder);
+bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, uint64 sample);
+
+#endif
diff --git a/include/FLAC/format.h b/include/FLAC/format.h
new file mode 100644 (file)
index 0000000..2de59a5
--- /dev/null
@@ -0,0 +1,315 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__FORMAT_H
+#define FLAC__FORMAT_H
+
+#include "ordinals.h"
+
+/* changing the following values to be higher will break the framing and hence the stream format, so DON'T! */
+#define FLAC__MIN_BLOCK_SIZE (16u)
+#define FLAC__MAX_BLOCK_SIZE (65535u)
+#define FLAC__MAX_CHANNELS (8u)
+/*NOTE: only up to 24 because of the current predictor coefficient quantization and the fact we use int32s for all work */
+#define FLAC__MAX_BITS_PER_SAMPLE (24u)
+/* the following is ((2 ** 20) - 1) div 10 */
+#define FLAC__MAX_SAMPLE_RATE (1048570u)
+#define FLAC__MAX_LPC_ORDER (32u)
+#define FLAC__MIN_QLP_COEFF_PRECISION (5u)
+/* changing this also means changing all of fixed.c and more, so DON'T! */
+#define FLAC__MAX_FIXED_ORDER (4u)
+#define FLAC__MAX_RICE_PARTITION_ORDER (15u)
+
+#define FLAC__VERSION_STRING "0.2"
+extern const unsigned FLAC__MAJOR_VERSION;
+extern const unsigned FLAC__MINOR_VERSION;
+
+extern const byte     FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */;
+extern const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */;
+extern const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */;
+
+
+/*****************************************************************************
+ *
+ * NOTE: Within the bitstream, all fixed-width numbers are big-endian coded.
+ *       All numbers are unsigned unless otherwise noted.
+ *
+ *****************************************************************************/
+
+typedef enum {
+       FLAC__METADATA_TYPE_ENCODING = 0
+} FLAC__MetaDataType;
+
+/*****************************************************************************
+ *
+ * 16: minimum blocksize (in samples) of all blocks in the stream
+ * 16: maximum blocksize (in samples) of all blocks in the stream
+ * 24: minimum framesize (in bytes) of all frames in the stream; 0 => unknown
+ * 24: maximum framesize (in bytes) of all frames in the stream; 0 => unknown
+ * 20: sample rate in Hz, 0 is invalid
+ *  3: (number of channels)-1
+ *  5: (bits per sample)-1
+ * 36: total samples, 0 => unknown
+ *---- -----------------
+ * 18  bytes total
+ */
+typedef struct {
+       unsigned min_blocksize, max_blocksize;
+       unsigned min_framesize, max_framesize;
+       unsigned sample_rate;
+       unsigned channels;
+       unsigned bits_per_sample;
+       uint64 total_samples;
+} FLAC__StreamMetaData_Encoding;
+
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_MIN_BLOCK_SIZE_LEN; /* = 16 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_MAX_BLOCK_SIZE_LEN; /* = 16 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_MIN_FRAME_SIZE_LEN; /* = 24 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_MAX_FRAME_SIZE_LEN; /* = 24 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_SAMPLE_RATE_LEN; /* = 20 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_CHANNELS_LEN; /* = 3 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_BITS_PER_SAMPLE_LEN; /* = 5 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_TOTAL_SAMPLES_LEN; /* = 36 bits */
+extern const unsigned FLAC__STREAM_METADATA_ENCODING_LENGTH; /* = 18 bytes */
+
+/*****************************************************************************
+ *
+ *  1: =1 if this is the last meta-data block, else =0
+ *  7: meta-data type (c.f. FLAC__MetaDataType)
+ * 24: length (in bytes) of the block-specific data to follow
+ *---- -----------------
+ *  4  bytes total
+ */
+typedef struct {
+       FLAC__MetaDataType type;
+       bool is_last;
+       unsigned length; /* in bytes */
+       union {
+               FLAC__StreamMetaData_Encoding encoding;
+       } data;
+} FLAC__StreamMetaData;
+
+extern const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /* = 1 bits */
+extern const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /* = 7 bits */
+extern const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /* = 24 bits */
+
+/*****************************************************************************/
+
+typedef enum {
+       FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0
+} FLAC__EntropyCodingMethodType;
+
+/*****************************************************************************
+ *
+ *  4: partition order => (2 ** order) subdivisions
+ */
+typedef struct {
+       unsigned order;
+       unsigned parameters[1 << FLAC__MAX_RICE_PARTITION_ORDER];
+} FLAC__EntropyCodingMethod_PartitionedRice;
+
+extern const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /* = 4 bits */
+extern const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /* = 4 bits */
+
+/*****************************************************************************
+ *
+ *  2: entropy coding method:
+ *     00: partitioned rice coding
+ *     01-11: reserved
+ *  ?: entropy coding method data
+ */
+typedef struct {
+       FLAC__EntropyCodingMethodType type;
+       union {
+               FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
+       } data;
+} FLAC__EntropyCodingMethod;
+
+extern const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /* = 2 bits */
+
+/*****************************************************************************/
+
+typedef enum {
+       FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0,
+       FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1,
+       FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2,
+       FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3
+} FLAC__ChannelAssignment;
+
+/*****************************************************************************
+ *
+ *  9: sync code '111111110'
+ *  3: blocksize in samples
+ *        000: get from stream header => implies constant blocksize throughout stream
+ *        001: 192 samples (AES/EBU) => implies constant blocksize throughout stream
+ *        010-101: 576 * (2^(2-n)) samples, i.e. 576/1152/2304/4608 => implies constant blocksize throughout stream
+ *        110: get 8 bit (blocksize-1) from end of header => variable blocksize throughout stream unless it's the last frame
+ *        111: get 16 bit (blocksize-1) from end of header => variable blocksize throughout stream unless it's the last frame
+ *  4: sample rate:
+ *        0000: get from stream header
+ *        0001-0011: reserved
+ *        0100: 8kHz
+ *        0101: 16kHz
+ *        0110: 22.05kHz
+ *        0111: 24kHz
+ *        1000: 32kHz
+ *        1001: 44.1kHz
+ *        1010: 48kHz
+ *        1011: 96kHz
+ *        1100: get 8 bit sample rate (in kHz) from end of header
+ *        1101: get 16 bit sample rate (in Hz) from end of header
+ *        1110: get 16 bit sample rate (in tens of Hz) from end of header
+ *        1111: invalid, to prevent sync-fooling string of 1s (use to check for erroneous sync)
+ *  4: channel assignment
+ *     0000-0111: (number of independent channels)-1.  when == 0001, channel 0 is the left channel and channel 1 is the right
+ *     1000: left/side stereo : channel 0 is the left             channel, channel 1 is the side(difference) channel
+ *     1001: right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right            channel
+ *     1010: mid/side stereo  : channel 0 is the mid(average)     channel, channel 1 is the side(difference) channel
+ *     1011-1111: reserved
+ *  3: sample size in bits
+ *        000: get from stream header
+ *        001: 8 bits per sample
+ *        010: 12 bits per sample
+ *        011: reserved
+ *        100: 16 bits per sample
+ *        101: 20 bits per sample
+ *        110: 24 bits per sample
+ *        111: reserved
+ *  1: zero pad, to prevent sync-fooling string of 1s (use to check for erroneous sync)
+ *  ?: if(variable blocksize)
+ *        8-56: 'UTF-8' coded sample number (decoded number is 0-36 bits) (use to check for erroneous sync)
+ *     else
+ *        8-48: 'UTF-8' coded frame number (decoded number is 0-31 bits) (use to check for erroneous sync)
+ *  ?: if(blocksize bits == 11x)
+ *        8/16 bit (blocksize-1)
+ *  ?: if(sample rate bits == 11xx)
+ *        8/16 bit sample rate
+ *  8: CRC-8 (polynomial = x^8 + x^2 + x + 1) of everything before the crc, including the sync code
+ */
+typedef struct {
+       unsigned blocksize; /* in samples */
+       unsigned sample_rate; /* in Hz */
+       unsigned channels;
+       FLAC__ChannelAssignment channel_assignment;
+       unsigned bits_per_sample;
+       union {
+               uint32 frame_number;
+               uint64 sample_number;
+       } number;
+} FLAC__FrameHeader;
+
+extern const unsigned FLAC__FRAME_HEADER_SYNC; /* = 0x1fe */
+extern const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /* = 9 bits */
+extern const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /* = 3 bits */
+extern const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /* = 4 bits */
+extern const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /* = 4 bits */
+extern const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /* = 3 bits */
+extern const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /* = 1 bit */
+extern const unsigned FLAC__FRAME_HEADER_CRC8_LEN; /* = 8 bits */
+
+/*****************************************************************************/
+
+typedef enum {
+       FLAC__SUBFRAME_TYPE_CONSTANT = 0,
+       FLAC__SUBFRAME_TYPE_VERBATIM = 1,
+       FLAC__SUBFRAME_TYPE_FIXED = 2,
+       FLAC__SUBFRAME_TYPE_LPC = 3
+} FLAC__SubframeType;
+
+/*****************************************************************************
+ *
+ * n: constant value for signal; n = frame's bits-per-sample
+ */
+typedef struct {
+       int32 value;
+} FLAC__SubframeHeader_Constant;
+
+/*****************************************************************************
+ *
+ * n*i: unencoded signal; n = frame's bits-per-sample, i = frame's blocksize
+ */
+/* There is no (trivial) for structure FLAC__SubframeHeader_Verbatim */
+
+/*****************************************************************************
+ *
+ *  n: unencoded warm-up samples (n = fixed-predictor order * bits per sample)
+ *  ?: entropy coding method info
+ *  ?: encoded residual ((blocksize minus fixed-predictor order) samples)
+ *  The order is stored in the main subframe header
+ */
+typedef struct {
+       FLAC__EntropyCodingMethod entropy_coding_method;
+       unsigned order;
+       int32 warmup[FLAC__MAX_FIXED_ORDER];
+} FLAC__SubframeHeader_Fixed;
+
+/*****************************************************************************
+ *
+ *  n: unencoded warm-up samples (n = lpc order * bits per sample)
+ *  4: (qlp coeff precision in bits)-1 (1111 = invalid, use to check for erroneous sync)
+ *  5: qlp shift needed in bits (signed)
+ *  n: unencoded predictor coefficients (n = lpc order * qlp coeff precision)
+ *  ?: entropy coding method info
+ *  ?: encoded residual ((blocksize minus lpc order) samples)
+ *  The order is stored in the main subframe header
+ */
+typedef struct {
+       FLAC__EntropyCodingMethod entropy_coding_method;
+       unsigned order;
+       unsigned qlp_coeff_precision;
+       int quantization_level;
+       int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
+       int32 warmup[FLAC__MAX_LPC_ORDER];
+} FLAC__SubframeHeader_LPC;
+
+extern const unsigned FLAC__SUBFRAME_HEADER_LPC_QLP_COEFF_PRECISION_LEN; /* = 4 bits */
+extern const unsigned FLAC__SUBFRAME_HEADER_LPC_QLP_SHIFT_LEN; /* = 5 bits */
+
+/*****************************************************************************
+ *
+ *  8: subframe type
+ *       xxxxxxx1: invalid, to prevent sync-fooling string of 1s (use to check for erroneous sync)
+ *       00000000: constant value
+ *       00000010: verbatim
+ *       000001x0: reserved
+ *       00001xx0: reserved
+ *       0001xxx0: fixed predictor, xxx=order <= 4, else reserved
+ *       001xxxx0: reserved
+ *       01xxxxx0: lpc, xxxxx=order-1
+ *       1xxxxxxx: invalid, to prevent sync-fooling string of 1s (use to check for erroneous sync)
+ *  ?: subframe-specific header (c.f. FLAC__SubframeHeader_*)
+ */
+typedef struct {
+       FLAC__SubframeType type;
+       union {
+               FLAC__SubframeHeader_Constant constant;
+               FLAC__SubframeHeader_Fixed fixed;
+               FLAC__SubframeHeader_LPC lpc;
+       } data; /* data will be undefined for FLAC__SUBFRAME_TYPE_VERBATIM */
+} FLAC__SubframeHeader;
+
+extern const unsigned FLAC__SUBFRAME_HEADER_TYPE_CONSTANT; /* = 0x00 */
+extern const unsigned FLAC__SUBFRAME_HEADER_TYPE_VERBATIM; /* = 0x02 */
+extern const unsigned FLAC__SUBFRAME_HEADER_TYPE_FIXED; /* = 0x10 */
+extern const unsigned FLAC__SUBFRAME_HEADER_TYPE_LPC; /* = 0x40 */
+extern const unsigned FLAC__SUBFRAME_HEADER_TYPE_LEN; /* = 8 bits */
+
+/*****************************************************************************/
+
+#endif
diff --git a/include/FLAC/ordinals.h b/include/FLAC/ordinals.h
new file mode 100644 (file)
index 0000000..d9f024a
--- /dev/null
@@ -0,0 +1,75 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__ORDINALS_H
+#define FLAC__ORDINALS_H
+
+#ifdef bool
+#undef bool
+#endif
+#ifdef true
+#undef true
+#endif
+#ifdef false
+#undef false
+#endif
+#ifdef byte
+#undef byte
+#endif
+#ifdef int16
+#undef int16
+#endif
+#ifdef uint16
+#undef uint16
+#endif
+#ifdef int32
+#undef int32
+#endif
+#ifdef uint32
+#undef uint32
+#endif
+#ifdef int64
+#undef int64
+#endif
+#ifdef uint64
+#undef uint64
+#endif
+#ifdef real
+#undef real
+#endif
+
+#define true 1
+#define false 0
+
+typedef int bool;
+typedef unsigned char byte;
+typedef short int16;
+typedef unsigned short uint16;
+typedef int int32;
+typedef unsigned int uint32;
+#if defined _WIN32 && !defined __CYGWIN__
+typedef __int64 int64;
+typedef unsigned __int64 uint64;
+#else
+typedef long long int int64;
+typedef unsigned long long uint64;
+#endif
+typedef double real;
+
+#endif
diff --git a/include/FLAC/stream_decoder.h b/include/FLAC/stream_decoder.h
new file mode 100644 (file)
index 0000000..8ac0609
--- /dev/null
@@ -0,0 +1,83 @@
+/* libFLAC - Free Lossless Audio Coder library
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef FLAC__STREAM_DECODER_H
+#define FLAC__STREAM_DECODER_H
+
+#include "format.h"
+
+typedef enum {
+       FLAC__STREAM_DECODER_SEARCH_FOR_METADATA,
+       FLAC__STREAM_DECODER_READ_METADATA,
+       FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
+       FLAC__STREAM_DECODER_READ_FRAME,
+       FLAC__STREAM_DECODER_RESYNC_IN_HEADER,
+       FLAC__STREAM_DECODER_END_OF_STREAM,
+       FLAC__STREAM_DECODER_ABORTED,
+       FLAC__STREAM_DECODER_UNPARSEABLE_STREAM,
+       FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
+       FLAC__STREAM_DECODER_UNINITIALIZED
+} FLAC__StreamDecoderState;
+
+typedef enum {
+       FLAC__STREAM_DECODER_READ_CONTINUE,
+       FLAC__STREAM_DECODER_READ_END_OF_STREAM,
+       FLAC__STREAM_DECODER_READ_ABORT
+} FLAC__StreamDecoderReadStatus;
+
+typedef enum {
+       FLAC__STREAM_DECODER_WRITE_CONTINUE,
+       FLAC__STREAM_DECODER_WRITE_ABORT
+} FLAC__StreamDecoderWriteStatus;
+
+typedef enum {
+       FLAC__STREAM_DECODER_ERROR_LOST_SYNC
+} FLAC__StreamDecoderErrorStatus;
+
+struct FLAC__StreamDecoderPrivate;
+typedef struct {
+       /* these fields are read-only and valid as of the last write_callback() */
+       unsigned channels;
+       FLAC__ChannelAssignment channel_assignment;
+       unsigned bits_per_sample;
+       unsigned sample_rate; /* in Hz */
+       unsigned blocksize; /* in samples (per channel) */
+       FLAC__StreamDecoderState state; /* must be FLAC__STREAM_DECODER_UNINITIALIZED when passed to FLAC__stream_decoder_init() */
+       struct FLAC__StreamDecoderPrivate *guts; /* must be 0 when passed to FLAC__stream_decoder_init() */
+} FLAC__StreamDecoder;
+
+FLAC__StreamDecoder *FLAC__stream_decoder_get_new_instance();
+void FLAC__stream_decoder_free_instance(FLAC__StreamDecoder *decoder);
+FLAC__StreamDecoderState FLAC__stream_decoder_init(
+       FLAC__StreamDecoder *decoder,
+       FLAC__StreamDecoderReadStatus (*read_callback)(const FLAC__StreamDecoder *decoder, byte buffer[], unsigned *bytes, void *client_data),
+       FLAC__StreamDecoderWriteStatus (*write_callback)(const FLAC__StreamDecoder *decoder, const FLAC__FrameHeader *header, const int32 *buffer[], void *client_data),
+       void (*metadata_callback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data),
+       void (*error_callback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data),
+       void *client_data
+);
+void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder);
+bool FLAC__stream_decoder_process_remaining_frames(FLAC__StreamDecoder *decoder);
+
+#endif
diff --git a/src/flac/Makefile b/src/flac/Makefile
new file mode 100644 (file)
index 0000000..ea58b13
--- /dev/null
@@ -0,0 +1,16 @@
+#
+# GNU makefile
+#
+
+PROGRAM_NAME = flac
+INCLUDES     = -I./include -I../../include
+LIBS         = -lFLAC -lm
+
+OBJS = \
+       decode.o \
+       encode.o \
+       main.o
+
+include ../../build/exe.mk
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/src/flac/Makefile.vc b/src/flac/Makefile.vc
new file mode 100644 (file)
index 0000000..e0d7cdf
--- /dev/null
@@ -0,0 +1,25 @@
+!include <win32.mak>
+
+!IFDEF DEBUG
+.c.obj:
+       $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -YX /Od /D "_DEBUG" $<
+!else
+.c.obj:
+       $(cc) $(cdebug) $(cflags) /I "..\..\include" /I ".\include" -DSTRICT -YX /O2 -DNODEBUG $<
+!endif
+
+C_FILES= \
+       decode.c \
+       encode.c \
+       main.c
+
+OBJS= $(C_FILES:.c=.obj)
+
+all: flac.exe
+
+flac.exe: $(OBJS)
+       link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libFLAC.lib
+
+clean:
+       -del *.obj *.pch
+       -del ..\..\obj\bin\flac.exe
diff --git a/src/flac/decode.c b/src/flac/decode.c
new file mode 100644 (file)
index 0000000..b8dfca0
--- /dev/null
@@ -0,0 +1,377 @@
+/* flac - Command-line FLAC encoder/decoder
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This program 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.
+ */
+
+#if defined _WIN32 && !defined __CYGWIN__
+/* where MSVC puts unlink() */
+# include <io.h>
+#else
+# include <unistd.h>
+#endif
+#include <stdio.h> /* for FILE */
+#include <string.h> /* for strcmp() */
+#include "FLAC/all.h"
+#include "decode.h"
+
+typedef struct {
+       FILE *fout;
+       bool abort_flag;
+       bool is_wave_out;
+       bool is_big_endian;
+       bool is_unsigned_samples;
+       uint64 total_samples;
+       unsigned bps;
+       unsigned channels;
+       unsigned sample_rate;
+       bool verbose;
+       uint64 skip;
+       uint64 samples_processed;
+       unsigned frame_counter;
+} stream_info_struct;
+
+static FLAC__FileDecoder *decoder;
+static bool is_big_endian_host;
+
+/* local routines */
+static bool init(const char *infile, stream_info_struct *stream_info);
+static bool write_little_endian_uint16(FILE *f, uint16 val);
+static bool write_little_endian_uint32(FILE *f, uint32 val);
+static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__FileDecoder *decoder, const FLAC__FrameHeader *header, const int32 *buffer[], void *client_data);
+static void metadata_callback(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data);
+static void error_callback(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
+static void print_stats(const stream_info_struct *stream_info);
+
+int decode_wav(const char *infile, const char *outfile, bool verbose, uint64 skip)
+{
+       stream_info_struct stream_info;
+
+       decoder = 0;
+       stream_info.abort_flag = false;
+       stream_info.is_wave_out = true;
+       stream_info.verbose = verbose;
+       stream_info.skip = skip;
+       stream_info.samples_processed = 0;
+       stream_info.frame_counter = 0;
+
+       if(0 == strcmp(outfile, "-")) {
+               stream_info.fout = stdout;
+       }
+       else {
+               if(0 == (stream_info.fout = fopen(outfile, "wb"))) {
+                       fprintf(stderr, "ERROR: can't open output file %s\n", outfile);
+                       return false;
+               }
+       }
+
+       if(!init(infile, &stream_info))
+               goto wav_abort_;
+
+       if(skip > 0) {
+               if(!FLAC__file_decoder_process_metadata(decoder)) {
+                       fprintf(stderr, "ERROR during decoding\n");
+                       goto wav_abort_;
+               }
+               if(!FLAC__file_decoder_seek_absolute(decoder, skip)) {
+                       fprintf(stderr, "ERROR seeking while skipping bytes in input file %s\n", infile);
+                       goto wav_abort_;
+               }
+               if(!FLAC__file_decoder_process_remaining_frames(decoder)) {
+                       fprintf(stderr, "ERROR during decodingg\n");
+                       goto wav_abort_;
+               }
+               if(decoder->state != FLAC__FILE_DECODER_OK && decoder->state != FLAC__FILE_DECODER_END_OF_FILE) {
+                       fprintf(stderr, "ERROR during decodinggg\n");
+                       goto wav_abort_;
+               }
+       }
+       else {
+               if(!FLAC__file_decoder_process_whole_file(decoder)) {
+                       fprintf(stderr, "ERROR during decoding\n");
+                       goto wav_abort_;
+               }
+               if(decoder->state != FLAC__FILE_DECODER_OK && decoder->state != FLAC__FILE_DECODER_END_OF_FILE) {
+                       fprintf(stderr, "ERROR during decodingg, state=%u\n", decoder->state);
+                       goto wav_abort_;
+               }
+       }
+
+       if(decoder) {
+               if(decoder->state != FLAC__FILE_DECODER_UNINITIALIZED)
+                       FLAC__file_decoder_finish(decoder);
+               print_stats(&stream_info);
+               FLAC__file_decoder_free_instance(decoder);
+       }
+       fclose(stream_info.fout);
+       if(verbose)
+               printf("\n");
+       return 0;
+wav_abort_:
+       if(decoder) {
+               if(decoder->state != FLAC__FILE_DECODER_UNINITIALIZED)
+                       FLAC__file_decoder_finish(decoder);
+               FLAC__file_decoder_free_instance(decoder);
+       }
+       fclose(stream_info.fout);
+       unlink(outfile);
+       return 1;
+}
+
+int decode_raw(const char *infile, const char *outfile, bool verbose, uint64 skip, bool is_big_endian, bool is_unsigned_samples)
+{
+       stream_info_struct stream_info;
+
+       decoder = 0;
+       stream_info.abort_flag = false;
+       stream_info.is_wave_out = false;
+       stream_info.is_big_endian = is_big_endian;
+       stream_info.is_unsigned_samples = is_unsigned_samples;
+       stream_info.verbose = verbose;
+       stream_info.skip = skip;
+       stream_info.samples_processed = 0;
+       stream_info.frame_counter = 0;
+
+       if(0 == strcmp(outfile, "-")) {
+               stream_info.fout = stdout;
+       }
+       else {
+               if(0 == (stream_info.fout = fopen(outfile, "wb"))) {
+                       fprintf(stderr, "ERROR: can't open output file %s\n", outfile);
+                       return false;
+               }
+       }
+
+       if(!init(infile, &stream_info))
+               goto raw_abort_;
+
+       if(skip > 0) {
+               if(!FLAC__file_decoder_process_metadata(decoder)) {
+                       fprintf(stderr, "ERROR during decoding\n");
+                       goto raw_abort_;
+               }
+               if(!FLAC__file_decoder_seek_absolute(decoder, skip)) {
+                       fprintf(stderr, "ERROR seeking while skipping bytes in input file %s\n", infile);
+                       goto raw_abort_;
+               }
+               if(!FLAC__file_decoder_process_remaining_frames(decoder)) {
+                       fprintf(stderr, "ERROR during decodingg\n");
+                       goto raw_abort_;
+               }
+               if(decoder->state != FLAC__FILE_DECODER_OK && decoder->state != FLAC__FILE_DECODER_END_OF_FILE) {
+                       fprintf(stderr, "ERROR during decodinggg\n");
+                       goto raw_abort_;
+               }
+       }
+       else {
+               if(!FLAC__file_decoder_process_whole_file(decoder)) {
+                       fprintf(stderr, "ERROR during decoding\n");
+                       goto raw_abort_;
+               }
+               if(decoder->state != FLAC__FILE_DECODER_OK && decoder->state != FLAC__FILE_DECODER_END_OF_FILE) {
+                       fprintf(stderr, "ERROR during decodingg\n");
+                       goto raw_abort_;
+               }
+       }
+
+       if(decoder) {
+               if(decoder->state != FLAC__FILE_DECODER_UNINITIALIZED)
+                       FLAC__file_decoder_finish(decoder);
+               print_stats(&stream_info);
+               FLAC__file_decoder_free_instance(decoder);
+       }
+       fclose(stream_info.fout);
+       if(verbose)
+               printf("\n");
+       return 0;
+raw_abort_:
+       if(decoder) {
+               if(decoder->state != FLAC__FILE_DECODER_UNINITIALIZED)
+                       FLAC__file_decoder_finish(decoder);
+               FLAC__file_decoder_free_instance(decoder);
+       }
+       fclose(stream_info.fout);
+       unlink(outfile);
+       return 1;
+}
+
+bool init(const char *infile, stream_info_struct *stream_info)
+{
+       uint32 test = 1;
+
+       is_big_endian_host = (*((byte*)(&test)))? false : true;
+
+       decoder = FLAC__file_decoder_get_new_instance();
+       if(0 == decoder) {
+               fprintf(stderr, "ERROR creating the decoder instance\n");
+               return false;
+       }
+
+       if(FLAC__file_decoder_init(decoder, infile, write_callback, metadata_callback, error_callback, stream_info) != FLAC__FILE_DECODER_OK) {
+               fprintf(stderr, "ERROR initializing decoder, state = %d\n", decoder->state);
+               return false;
+       }
+
+       return true;
+}
+
+bool write_little_endian_uint16(FILE *f, uint16 val)
+{
+       byte *b = (byte*)(&val);
+       if(is_big_endian_host) {
+               byte tmp;
+               tmp = b[1]; b[1] = b[0]; b[0] = tmp;
+       }
+       return fwrite(b, 1, 2, f) == 2;
+}
+
+bool write_little_endian_uint32(FILE *f, uint32 val)
+{
+       byte *b = (byte*)(&val);
+       if(is_big_endian_host) {
+               byte tmp;
+               tmp = b[3]; b[3] = b[0]; b[0] = tmp;
+               tmp = b[2]; b[2] = b[1]; b[1] = tmp;
+       }
+       return fwrite(b, 1, 4, f) == 4;
+}
+
+FLAC__StreamDecoderWriteStatus write_callback(const FLAC__FileDecoder *decoder, const FLAC__FrameHeader *header, const int32 *buffer[], void *client_data)
+{
+       stream_info_struct *stream_info = (stream_info_struct *)client_data;
+       FILE *fout = stream_info->fout;
+       unsigned bps = stream_info->bps, channels = stream_info->channels;
+       bool is_big_endian = (stream_info->is_wave_out? false : stream_info->is_big_endian);
+       bool is_unsigned_samples = (stream_info->is_wave_out? bps==8 : stream_info->is_unsigned_samples);
+       unsigned wide_samples = header->blocksize, wide_sample, sample, channel, byte;
+       static signed char scbuffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * ((FLAC__MAX_BITS_PER_SAMPLE+7)>>3)]; /* WATCHOUT: can be up to 2 megs */
+       unsigned char *ucbuffer = (unsigned char *)scbuffer;
+       signed short *ssbuffer = (signed short *)scbuffer;
+       unsigned short *usbuffer = (unsigned short *)scbuffer;
+
+       (void)decoder;
+
+       if(stream_info->abort_flag)
+               return FLAC__STREAM_DECODER_WRITE_ABORT;
+
+       stream_info->samples_processed += wide_samples;
+       stream_info->frame_counter++;
+
+       if(stream_info->verbose && !(stream_info->frame_counter & 0x1f))
+               print_stats(stream_info);
+
+       if(bps == 8) {
+               if(is_unsigned_samples) {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       ucbuffer[sample] = buffer[channel][wide_sample] + 128;
+               }
+               else {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       scbuffer[sample] = buffer[channel][wide_sample];
+               }
+               if(fwrite(ucbuffer, 1, sample, fout) != sample)
+                       return FLAC__STREAM_DECODER_WRITE_ABORT;
+       }
+       else { /* bps == 16 */
+               if(is_unsigned_samples) {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       usbuffer[sample] = buffer[channel][wide_sample] + 32768;
+               }
+               else {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       ssbuffer[sample] = buffer[channel][wide_sample];
+               }
+               if(is_big_endian != is_big_endian_host) {
+                       unsigned char tmp;
+                       for(byte = 0; byte < sample<<1; byte += 2) {
+                               tmp = ucbuffer[byte];
+                               ucbuffer[byte] = ucbuffer[byte+1];
+                               ucbuffer[byte+1] = tmp;
+                       }
+               }
+               if(fwrite(usbuffer, 2, sample, fout) != sample)
+                       return FLAC__STREAM_DECODER_WRITE_ABORT;
+       }
+       return FLAC__STREAM_DECODER_WRITE_CONTINUE;
+}
+
+void metadata_callback(const FLAC__FileDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)
+{
+       stream_info_struct *stream_info = (stream_info_struct *)client_data;
+       (void)decoder;
+       if(metadata->type == FLAC__METADATA_TYPE_ENCODING) {
+               stream_info->total_samples = metadata->data.encoding.total_samples - stream_info->skip;
+               stream_info->bps = metadata->data.encoding.bits_per_sample;
+               stream_info->channels = metadata->data.encoding.channels;
+               stream_info->sample_rate = metadata->data.encoding.sample_rate;
+
+               if(stream_info->bps != 8 && stream_info->bps != 16) {
+                       fprintf(stderr, "ERROR: bits per sample is not 8 or 16\n");
+                       stream_info->abort_flag = true;
+                       return;
+               }
+
+               /* write the WAVE headers if necessary */
+               if(stream_info->is_wave_out) {
+                       uint64 data_size = stream_info->total_samples * stream_info->channels * ((stream_info->bps+7)/8);
+                       if(data_size >= 0xFFFFFFDC) {
+                               fprintf(stderr, "ERROR: stream is too big for a wave file\n");
+                               stream_info->abort_flag = true;
+                               return;
+                       }
+                       if(fwrite("RIFF", 1, 4, stream_info->fout) != 4) stream_info->abort_flag = true;
+                       if(!write_little_endian_uint32(stream_info->fout, (uint32)(data_size+36))) stream_info->abort_flag = true; /* filesize-8 */
+                       if(fwrite("WAVEfmt ", 1, 8, stream_info->fout) != 8) stream_info->abort_flag = true;
+                       if(fwrite("\020\000\000\000", 1, 4, stream_info->fout) != 4) stream_info->abort_flag = true; /* chunk size = 16 */
+                       if(fwrite("\001\000", 1, 2, stream_info->fout) != 2) stream_info->abort_flag = true; /* compression code == 1 */
+                       if(!write_little_endian_uint16(stream_info->fout, (uint16)(stream_info->channels))) stream_info->abort_flag = true;
+                       if(!write_little_endian_uint32(stream_info->fout, stream_info->sample_rate)) stream_info->abort_flag = true;
+                       if(!write_little_endian_uint32(stream_info->fout, stream_info->sample_rate * stream_info->channels * ((stream_info->bps+7) / 8))) stream_info->abort_flag = true; /* @@@ or is it (sample_rate*channels*bps) / 8 ??? */
+                       if(!write_little_endian_uint16(stream_info->fout, (uint16)(stream_info->channels * ((stream_info->bps+7) / 8)))) stream_info->abort_flag = true; /* block align */
+                       if(!write_little_endian_uint16(stream_info->fout, (uint16)(stream_info->bps))) stream_info->abort_flag = true; /* bits per sample */
+                       if(fwrite("data", 1, 4, stream_info->fout) != 4) stream_info->abort_flag = true;
+                       if(!write_little_endian_uint32(stream_info->fout, (uint32)data_size)) stream_info->abort_flag = true; /* data size */
+               }
+       }
+}
+
+void error_callback(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
+{
+       stream_info_struct *stream_info = (stream_info_struct *)client_data;
+       (void)decoder;
+       fprintf(stderr, "*** Got error code %d\n", status);
+       stream_info->abort_flag = true;
+}
+
+void print_stats(const stream_info_struct *stream_info)
+{
+       if(stream_info->verbose) {
+               printf("\rwrote %u of %u samples, %6.2f%% complete",
+                       (unsigned)stream_info->samples_processed,
+                       (unsigned)stream_info->total_samples,
+#ifdef _MSC_VER
+                       /* with VC++ you have to spoon feed it the casting */
+                       (double)(int64)stream_info->samples_processed / (double)(int64)stream_info->total_samples * 100.0
+#else
+                       (double)stream_info->samples_processed / (double)stream_info->total_samples * 100.0
+#endif
+               );
+               fflush(stdout);
+       }
+}
diff --git a/src/flac/decode.h b/src/flac/decode.h
new file mode 100644 (file)
index 0000000..8c23485
--- /dev/null
@@ -0,0 +1,25 @@
+/* flac - Command-line FLAC encoder/decoder
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This program 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.
+ */
+
+#ifndef flac__decode_h
+#define flac__decode_h
+
+int decode_wav(const char *infile, const char *outfile, bool verbose, uint64 skip);
+int decode_raw(const char *infile, const char *outfile, bool verbose, uint64 skip, bool is_big_endian, bool is_unsigned_samples);
+
+#endif
diff --git a/src/flac/encode.c b/src/flac/encode.c
new file mode 100644 (file)
index 0000000..151dbde
--- /dev/null
@@ -0,0 +1,587 @@
+/* flac - Command-line FLAC encoder/decoder
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This program 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.
+ */
+
+#include <assert.h>
+#if defined _WIN32 && !defined __CYGWIN__
+/* where MSVC puts unlink() */
+# include <io.h>
+#else
+# include <unistd.h>
+#endif
+#include <stdio.h> /* for FILE */
+#include <string.h> /* for strcmp() */
+#include "FLAC/all.h"
+#include "encode.h"
+
+#define CHUNK_OF_SAMPLES 2048
+
+typedef struct {
+       FILE *fout;
+       const char *outfile;
+       FLAC__Encoder *encoder;
+       bool verbose;
+       uint64 unencoded_size;
+       uint64 total_samples_to_encode;
+       uint64 bytes_written;
+       uint64 samples_written;
+       unsigned current_frame;
+} encoder_wrapper_struct;
+
+static bool is_big_endian_host;
+
+static unsigned char ucbuffer[CHUNK_OF_SAMPLES*FLAC__MAX_CHANNELS*(FLAC__MAX_BITS_PER_SAMPLE>>3)];
+static signed char *scbuffer = (signed char *)ucbuffer;
+static uint16 *usbuffer = (uint16 *)ucbuffer;
+static int16 *ssbuffer = (int16 *)ucbuffer;
+
+static int32 in[FLAC__MAX_CHANNELS][CHUNK_OF_SAMPLES];
+static int32 *input[FLAC__MAX_CHANNELS];
+
+/* local routines */
+static bool init(encoder_wrapper_struct *encoder_wrapper);
+static bool init_encoder(bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision, unsigned channels, unsigned bps, unsigned sample_rate, encoder_wrapper_struct *encoder_wrapper);
+static void format_input(unsigned wide_samples, bool is_big_endian, bool is_unsigned_samples, unsigned channels, unsigned bps);
+static FLAC__EncoderWriteStatus write_callback(const FLAC__Encoder *encoder, const byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
+static void metadata_callback(const FLAC__Encoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data);
+static void print_stats(const encoder_wrapper_struct *encoder_wrapper);
+static bool read_little_endian_uint16(FILE *f, uint16 *val, bool eof_ok);
+static bool read_little_endian_uint32(FILE *f, uint32 *val, bool eof_ok);
+
+int encode_wav(const char *infile, const char *outfile, bool verbose, uint64 skip, bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision)
+{
+       encoder_wrapper_struct encoder_wrapper;
+       FILE *fin;
+       bool is_unsigned_samples;
+       unsigned channels, bps, sample_rate, data_bytes;
+       size_t bytes_per_wide_sample, bytes_read;
+       uint16 x;
+       uint32 xx;
+
+       encoder_wrapper.encoder = 0;
+       encoder_wrapper.verbose = verbose;
+       encoder_wrapper.bytes_written = 0;
+       encoder_wrapper.samples_written = 0;
+       encoder_wrapper.outfile = outfile;
+
+       if(0 == strcmp(infile, "-")) {
+               fin = stdin;
+       }
+       else {
+               if(0 == (fin = fopen(infile, "rb"))) {
+                       fprintf(stderr, "ERROR: can't open input file %s\n", infile);
+                       return false;
+               }
+       }
+       if(0 == strcmp(outfile, "-")) {
+               encoder_wrapper.fout = stdout;
+       }
+       else {
+               if(0 == (encoder_wrapper.fout = fopen(outfile, "wb"))) {
+                       fprintf(stderr, "ERROR: can't open output file %s\n", outfile);
+                       fclose(fin);
+                       return false;
+               }
+       }
+
+       if(!init(&encoder_wrapper))
+               goto wav_abort_;
+
+       /*
+        * check the RIFF chunk
+        */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       if(xx != 0x46464952) { /* "RIFF" */
+               fprintf(stderr, "ERROR: no RIFF header\n");
+               goto wav_abort_;
+       }
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+
+       /*
+        * now process the WAVE chunk
+        */
+       if(!read_little_endian_uint32(fin, &xx, true))
+               goto wav_end_;
+       if(xx != 0x45564157) { /* "WAVE" */
+               fprintf(stderr, "ERROR: no WAVE header\n");
+               goto wav_abort_;
+       }
+
+       /* do the format sub-chunk */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       if(xx != 0x20746d66) { /* "fmt " */
+               fprintf(stderr, "ERROR: no format sub-chunk\n");
+               goto wav_abort_;
+       }
+       /* fmt chunk size */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       if(xx != 16) {
+               fprintf(stderr, "ERROR: unsupported chunk\n");
+               goto wav_abort_;
+       }
+       /* compression code */
+       if(!read_little_endian_uint16(fin, &x, false))
+               goto wav_abort_;
+       if(x != 1) {
+               fprintf(stderr, "ERROR: unsupported compression type %u\n", (unsigned)x);
+               goto wav_abort_;
+       }
+       /* number of channels */
+       if(!read_little_endian_uint16(fin, &x, false))
+               goto wav_abort_;
+       if(x == 0 || x > FLAC__MAX_CHANNELS) {
+               fprintf(stderr, "ERROR: unsupported number channels %u\n", (unsigned)x);
+               goto wav_abort_;
+       }
+       channels = x;
+       /* sample rate */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       if(xx == 0 || xx > FLAC__MAX_SAMPLE_RATE) {
+               fprintf(stderr, "ERROR: unsupported sample rate %u\n", (unsigned)xx);
+               goto wav_abort_;
+       }
+       sample_rate = xx;
+       /* avg bytes per second (ignored) */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       /* block align (ignored) */
+       if(!read_little_endian_uint16(fin, &x, false))
+               goto wav_abort_;
+       /* bits per sample */
+       if(!read_little_endian_uint16(fin, &x, false))
+               goto wav_abort_;
+       if(x != 8 && x != 16) {
+               fprintf(stderr, "ERROR: unsupported bits per sample %u\n", (unsigned)x);
+               goto wav_abort_;
+       }
+       bps = x;
+       is_unsigned_samples = (x == 8);
+
+       /* do the data sub-chunk */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       if(xx != 0x61746164) { /* "data" */
+               fprintf(stderr, "ERROR: no data sub-chunk\n");
+               goto wav_abort_;
+       }
+       /* data size */
+       if(!read_little_endian_uint32(fin, &xx, false))
+               goto wav_abort_;
+       data_bytes = xx;
+
+       if(!init_encoder(lax, do_mid_side, do_exhaustive_model_search, do_qlp_coeff_prec_search, rice_optimization_level, max_lpc_order, blocksize, qlp_coeff_precision, channels, bps, sample_rate, &encoder_wrapper))
+               goto wav_abort_;
+
+       bytes_per_wide_sample = channels * (bps >> 3);
+
+       if(-1 == fseek(fin, bytes_per_wide_sample * (unsigned)skip, SEEK_CUR)) {
+               fprintf(stderr, "ERROR seeking while skipping samples in input file %s\n", infile);
+               goto wav_abort_;
+       }
+
+       encoder_wrapper.total_samples_to_encode = data_bytes / bytes_per_wide_sample - skip;
+       encoder_wrapper.unencoded_size = encoder_wrapper.total_samples_to_encode * bytes_per_wide_sample + 44; /* 44 for the size of the WAV headers */
+
+       while(data_bytes > 0) {
+               bytes_read = fread(ucbuffer, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample, fin);
+               if(bytes_read == 0) {
+                       if(ferror(fin)) {
+                               fprintf(stderr, "ERROR reading from %s\n", infile);
+                               goto wav_abort_;
+                       }
+                       else if(feof(fin))
+                               break;
+               }
+               else if(bytes_read % bytes_per_wide_sample != 0) {
+                       fprintf(stderr, "ERROR, got partial sample from input file %s\n", infile);
+                       goto wav_abort_;
+               }
+               else {
+                       unsigned wide_samples = bytes_read / bytes_per_wide_sample;
+                       format_input(wide_samples, false, is_unsigned_samples, channels, bps);
+                       if(!FLAC__encoder_process(encoder_wrapper.encoder, input, wide_samples)) {
+                               fprintf(stderr, "ERROR during encoding, state = %d\n", encoder_wrapper.encoder->state);
+                               goto wav_abort_;
+                       }
+                       data_bytes -= bytes_read;
+               }
+       }
+
+wav_end_:
+       if(encoder_wrapper.encoder) {
+               if(encoder_wrapper.encoder->state != FLAC__ENCODER_UNINITIALIZED)
+                       FLAC__encoder_finish(encoder_wrapper.encoder);
+               FLAC__encoder_free_instance(encoder_wrapper.encoder);
+       }
+       if(encoder_wrapper.verbose && encoder_wrapper.total_samples_to_encode > 0) {
+               print_stats(&encoder_wrapper);
+               printf("\n");
+       }
+       fclose(fin);
+       return 0;
+wav_abort_:
+       if(encoder_wrapper.verbose && encoder_wrapper.total_samples_to_encode > 0)
+               printf("\n");
+       if(encoder_wrapper.encoder) {
+               if(encoder_wrapper.encoder->state != FLAC__ENCODER_UNINITIALIZED)
+                       FLAC__encoder_finish(encoder_wrapper.encoder);
+               FLAC__encoder_free_instance(encoder_wrapper.encoder);
+       }
+       fclose(fin);
+       unlink(outfile);
+       return 1;
+}
+
+int encode_raw(const char *infile, const char *outfile, bool verbose, uint64 skip, bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision, bool is_big_endian, bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned sample_rate)
+{
+       encoder_wrapper_struct encoder_wrapper;
+       FILE *fin;
+       size_t bytes_read;
+       const size_t bytes_per_wide_sample = channels * (bps >> 3);
+
+       encoder_wrapper.encoder = 0;
+       encoder_wrapper.verbose = verbose;
+       encoder_wrapper.bytes_written = 0;
+       encoder_wrapper.samples_written = 0;
+       encoder_wrapper.outfile = outfile;
+
+       if(0 == strcmp(infile, "-")) {
+               fin = stdin;
+       }
+       else {
+               if(0 == (fin = fopen(infile, "rb"))) {
+                       fprintf(stderr, "ERROR: can't open input file %s\n", infile);
+                       return false;
+               }
+       }
+       if(0 == strcmp(outfile, "-")) {
+               encoder_wrapper.fout = stdout;
+       }
+       else {
+               if(0 == (encoder_wrapper.fout = fopen(outfile, "wb"))) {
+                       fprintf(stderr, "ERROR: can't open output file %s\n", outfile);
+                       fclose(fin);
+                       return false;
+               }
+       }
+
+       if(!init(&encoder_wrapper))
+               goto raw_abort_;
+
+       if(!init_encoder(lax, do_mid_side, do_exhaustive_model_search, do_qlp_coeff_prec_search, rice_optimization_level, max_lpc_order, blocksize, qlp_coeff_precision, channels, bps, sample_rate, &encoder_wrapper))
+               goto raw_abort_;
+
+       /* get the file length */
+       if(0 != fseek(fin, 0, SEEK_END)) {
+               encoder_wrapper.total_samples_to_encode = encoder_wrapper.unencoded_size = 0;
+       }
+       else {
+               long filesize;
+               fflush(fin);
+               if(-1 == (filesize = ftell(fin))) {
+                       encoder_wrapper.total_samples_to_encode = encoder_wrapper.unencoded_size = 0;
+               }
+               else {
+                       encoder_wrapper.unencoded_size = filesize - skip * bytes_per_wide_sample;
+                       encoder_wrapper.total_samples_to_encode = filesize / bytes_per_wide_sample - skip;
+               }
+       }
+
+       if(-1 == fseek(fin, bytes_per_wide_sample * (unsigned)skip, SEEK_SET)) {
+               fprintf(stderr, "ERROR seeking while skipping samples in input file %s\n", infile);
+               goto raw_abort_;
+       }
+
+       while(!feof(fin)) {
+               bytes_read = fread(ucbuffer, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample, fin);
+               if(bytes_read == 0) {
+                       if(ferror(fin)) {
+                               fprintf(stderr, "ERROR reading from %s\n", infile);
+                               goto raw_abort_;
+                       }
+               }
+               else if(bytes_read % bytes_per_wide_sample != 0) {
+                       fprintf(stderr, "ERROR, got partial sample from input file %s\n", infile);
+                       goto raw_abort_;
+               }
+               else {
+                       unsigned wide_samples = bytes_read / bytes_per_wide_sample;
+                       format_input(wide_samples, is_big_endian, is_unsigned_samples, channels, bps);
+                       if(!FLAC__encoder_process(encoder_wrapper.encoder, input, wide_samples)) {
+                               fprintf(stderr, "ERROR during encoding, state = %d\n", encoder_wrapper.encoder->state);
+                               goto raw_abort_;
+                       }
+               }
+       }
+
+       if(encoder_wrapper.encoder) {
+               if(encoder_wrapper.encoder->state != FLAC__ENCODER_UNINITIALIZED)
+                       FLAC__encoder_finish(encoder_wrapper.encoder);
+               FLAC__encoder_free_instance(encoder_wrapper.encoder);
+       }
+       if(encoder_wrapper.verbose && encoder_wrapper.total_samples_to_encode > 0) {
+               print_stats(&encoder_wrapper);
+               printf("\n");
+       }
+       fclose(fin);
+       return 0;
+raw_abort_:
+       if(encoder_wrapper.verbose && encoder_wrapper.total_samples_to_encode > 0)
+               printf("\n");
+       if(encoder_wrapper.encoder) {
+               if(encoder_wrapper.encoder->state != FLAC__ENCODER_UNINITIALIZED)
+                       FLAC__encoder_finish(encoder_wrapper.encoder);
+               FLAC__encoder_free_instance(encoder_wrapper.encoder);
+       }
+       fclose(fin);
+       unlink(outfile);
+       return 1;
+}
+
+bool init(encoder_wrapper_struct *encoder_wrapper)
+{
+       unsigned i;
+       uint32 test = 1;
+
+       is_big_endian_host = (*((byte*)(&test)))? false : true;
+
+       for(i = 0; i < FLAC__MAX_CHANNELS; i++)
+               input[i] = &(in[i][0]);
+
+       encoder_wrapper->encoder = FLAC__encoder_get_new_instance();
+       if(0 == encoder_wrapper->encoder) {
+               fprintf(stderr, "ERROR creating the encoder instance\n");
+               return false;
+       }
+
+       return true;
+}
+
+bool init_encoder(bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision, unsigned channels, unsigned bps, unsigned sample_rate, encoder_wrapper_struct *encoder_wrapper)
+{
+       if(channels != 2 || bps > 16)
+               do_mid_side = false;
+
+       encoder_wrapper->encoder->streamable_subset = !lax;
+       encoder_wrapper->encoder->channels = channels;
+       encoder_wrapper->encoder->bits_per_sample = bps;
+       encoder_wrapper->encoder->sample_rate = sample_rate;
+       encoder_wrapper->encoder->blocksize = blocksize;
+       encoder_wrapper->encoder->qlp_coeff_precision = qlp_coeff_precision;
+       encoder_wrapper->encoder->max_lpc_order = max_lpc_order;
+       encoder_wrapper->encoder->do_mid_side_stereo = do_mid_side;
+       encoder_wrapper->encoder->do_exhaustive_model_search = do_exhaustive_model_search;
+       encoder_wrapper->encoder->do_qlp_coeff_prec_search = do_qlp_coeff_prec_search;
+       encoder_wrapper->encoder->rice_optimization_level = rice_optimization_level;
+
+       if(FLAC__encoder_init(encoder_wrapper->encoder, write_callback, metadata_callback, encoder_wrapper) != FLAC__ENCODER_OK) {
+               fprintf(stderr, "ERROR initializing encoder, state = %d\n", encoder_wrapper->encoder->state);
+               return false;
+       }
+
+       return true;
+}
+
+void format_input(unsigned wide_samples, bool is_big_endian, bool is_unsigned_samples, unsigned channels, unsigned bps)
+{
+       unsigned wide_sample, sample, channel, byte;
+
+       if(bps == 8) {
+               if(is_unsigned_samples) {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       input[channel][wide_sample] = (int32)ucbuffer[sample] - 128;
+               }
+               else {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       input[channel][wide_sample] = (int32)scbuffer[sample];
+               }
+       }
+       else {
+               if(is_big_endian != is_big_endian_host) {
+                       unsigned char tmp;
+                       const unsigned bytes = wide_samples * channels * (bps >> 3);
+                       for(byte = 0; byte < bytes; byte += 2) {
+                               tmp = ucbuffer[byte];
+                               ucbuffer[byte] = ucbuffer[byte+1];
+                               ucbuffer[byte+1] = tmp;
+                       }
+               }
+               if(is_unsigned_samples) {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       input[channel][wide_sample] = (int32)usbuffer[sample] - 32768;
+               }
+               else {
+                       for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
+                               for(channel = 0; channel < channels; channel++, sample++)
+                                       input[channel][wide_sample] = (int32)ssbuffer[sample];
+               }
+       }
+}
+
+FLAC__EncoderWriteStatus write_callback(const FLAC__Encoder *encoder, const byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)
+{
+       encoder_wrapper_struct *encoder_wrapper = (encoder_wrapper_struct *)client_data;
+       unsigned mask = (encoder->do_exhaustive_model_search || encoder->do_qlp_coeff_prec_search)? 0x07 : 0x1f;
+
+       encoder_wrapper->bytes_written += bytes;
+       encoder_wrapper->samples_written += samples;
+       encoder_wrapper->current_frame = current_frame;
+
+       if(samples && encoder_wrapper->verbose && encoder_wrapper->total_samples_to_encode > 0 && !(current_frame & mask))
+               print_stats(encoder_wrapper);
+
+       if(fwrite(buffer, sizeof(byte), bytes, encoder_wrapper->fout) == bytes)
+               return FLAC__ENCODER_WRITE_OK;
+       else
+               return FLAC__ENCODER_WRITE_FATAL_ERROR;
+}
+
+void metadata_callback(const FLAC__Encoder *encoder, const FLAC__StreamMetaData *metadata, void *client_data)
+{
+       encoder_wrapper_struct *encoder_wrapper = (encoder_wrapper_struct *)client_data;
+       byte b;
+       FILE *f;
+       const uint64 samples = metadata->data.encoding.total_samples;
+       const unsigned min_framesize = metadata->data.encoding.min_framesize;
+       const unsigned max_framesize = metadata->data.encoding.max_framesize;
+
+       (void)encoder; /* silence compiler warning about unused parameter */
+
+       if(encoder_wrapper->fout == stdout)
+               return;
+
+       fclose(encoder_wrapper->fout);
+       if(0 == (f = fopen(encoder_wrapper->outfile, "r+b")))
+               return;
+
+       /* all this is based on intimate knowledge of the stream header
+        * layout, but a change to the header format that would break this
+        * would also break all streams encoded in the previous format.
+        */
+
+       if(-1 == fseek(f, 21, SEEK_SET)) goto framesize_;
+       if(fread(&b, 1, 1, f) != 1) goto framesize_;
+       if(-1 == fseek(f, 21, SEEK_SET)) goto framesize_;
+       b = (b & 0xf0) | (byte)((samples >> 32) & 0x0F);
+       if(fwrite(&b, 1, 1, f) != 1) goto framesize_;
+       b = (byte)((samples >> 24) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto framesize_;
+       b = (byte)((samples >> 16) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto framesize_;
+       b = (byte)((samples >> 8) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto framesize_;
+       b = (byte)(samples & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto framesize_;
+
+framesize_:
+       if(-1 == fseek(f, 12, SEEK_SET)) goto end_;
+       b = (byte)((min_framesize >> 16) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+       b = (byte)((min_framesize >> 8) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+       b = (byte)(min_framesize & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+       b = (byte)((max_framesize >> 16) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+       b = (byte)((max_framesize >> 8) & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+       b = (byte)(max_framesize & 0xFF);
+       if(fwrite(&b, 1, 1, f) != 1) goto end_;
+end_:
+       fclose(encoder_wrapper->fout);
+       return;
+}
+
+void print_stats(const encoder_wrapper_struct *encoder_wrapper)
+{
+#ifdef _MSC_VER
+       /* with VC++ you have to spoon feed it the casting */
+       double progress = (double)(int64)encoder_wrapper->samples_written / (double)(int64)encoder_wrapper->total_samples_to_encode;
+#else
+       double progress = (double)encoder_wrapper->samples_written / (double)encoder_wrapper->total_samples_to_encode;
+#endif
+       printf("\r%0.2f%% complete: frame %u, wrote %u bytes, %u of %u samples, ratio = %5.3f",
+               progress * 100.0, encoder_wrapper->current_frame,
+               (unsigned)encoder_wrapper->bytes_written, (unsigned)encoder_wrapper->samples_written, (unsigned)encoder_wrapper->total_samples_to_encode,
+#ifdef _MSC_VER
+               /* with VC++ you have to spoon feed it the casting */
+               (double)(int64)encoder_wrapper->bytes_written / ((double)(int64)encoder_wrapper->unencoded_size * progress)
+#else
+               (double)encoder_wrapper->bytes_written / ((double)encoder_wrapper->unencoded_size * progress)
+#endif
+       );
+       fflush(stdout);
+}
+
+bool read_little_endian_uint16(FILE *f, uint16 *val, bool eof_ok)
+{
+       size_t bytes_read = fread(val, 1, 2, f);
+
+       if(bytes_read == 0) {
+               if(!eof_ok) {
+                       fprintf(stderr, "ERROR: unexpected EOF\n");
+                       return false;
+               }
+               else
+                       return true;
+       }
+       else if(bytes_read < 2) {
+               fprintf(stderr, "ERROR: unexpected EOF\n");
+               return false;
+       }
+       else {
+               if(is_big_endian_host) {
+                       byte tmp, *b = (byte*)val;
+                       tmp = b[1]; b[1] = b[0]; b[0] = tmp;
+               }
+               return true;
+       }
+}
+
+bool read_little_endian_uint32(FILE *f, uint32 *val, bool eof_ok)
+{
+       size_t bytes_read = fread(val, 1, 4, f);
+
+       if(bytes_read == 0) {
+               if(!eof_ok) {
+                       fprintf(stderr, "ERROR: unexpected EOF\n");
+                       return false;
+               }
+               else
+                       return true;
+       }
+       else if(bytes_read < 4) {
+               fprintf(stderr, "ERROR: unexpected EOF\n");
+               return false;
+       }
+       else {
+               if(is_big_endian_host) {
+                       byte tmp, *b = (byte*)val;
+                       tmp = b[3]; b[3] = b[0]; b[0] = tmp;
+                       tmp = b[2]; b[2] = b[1]; b[1] = tmp;
+               }
+               return true;
+       }
+}
diff --git a/src/flac/encode.h b/src/flac/encode.h
new file mode 100644 (file)
index 0000000..74a1f1e
--- /dev/null
@@ -0,0 +1,27 @@
+/* flac - Command-line FLAC encoder/decoder
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This program 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.
+ */
+
+#ifndef flac__encode_h
+#define flac__encode_h
+
+#include "FLAC/ordinals.h"
+
+int encode_wav(const char *infile, const char *outfile, bool verbose, uint64 skip, bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision);
+int encode_raw(const char *infile, const char *outfile, bool verbose, uint64 skip, bool lax, bool do_mid_side, bool do_exhaustive_model_search, bool do_qlp_coeff_prec_search, unsigned rice_optimization_level, unsigned max_lpc_order, unsigned blocksize, unsigned qlp_coeff_precision, bool is_big_endian, bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned sample_rate);
+
+#endif
diff --git a/src/flac/main.c b/src/flac/main.c
new file mode 100644 (file)
index 0000000..b7cba20
--- /dev/null
@@ -0,0 +1,338 @@
+/* flac - Command-line FLAC encoder/decoder
+ * Copyright (C) 2000  Josh Coalson
+ *
+ * This program 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.
+ */
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "FLAC/all.h"
+#include "decode.h"
+#include "encode.h"
+
+static int usage(const char *message, ...);
+
+int main(int argc, char *argv[])
+{
+       int i;
+       bool verbose = true, lax = false, mode_decode = false, do_mid_side = true, do_exhaustive_model_search = false, do_qlp_coeff_prec_search = false;
+       unsigned max_lpc_order = 8;
+       unsigned qlp_coeff_precision = 0;
+       uint64 skip = 0;
+       int format_is_wave = -1, format_is_big_endian = -1, format_is_unsigned_samples = false;
+       int format_channels = -1, format_bps = -1, format_sample_rate = -1;
+       int blocksize = -1, rice_optimization_level = -1;
+
+       if(argc <= 1)
+               return usage(0);
+
+       /* get the options */
+       for(i = 1; i < argc; i++) {
+               if(argv[i][0] != '-' || argv[i][1] == 0)
+                       break;
+               if(0 == strcmp(argv[i], "-d"))
+                       mode_decode = true;
+               else if(0 == strcmp(argv[i], "-s"))
+                       verbose = false;
+               else if(0 == strcmp(argv[i], "-s-"))
+                       verbose = true;
+               else if(0 == strcmp(argv[i], "--skip"))
+                       skip = (uint64)atoi(argv[++i]); /* takes a pretty damn big file to overflow atoi() here, but it could happen */
+               else if(0 == strcmp(argv[i], "--lax"))
+                       lax = true;
+               else if(0 == strcmp(argv[i], "--lax-"))
+                       lax = false;
+               else if(0 == strcmp(argv[i], "-b"))
+                       blocksize = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-e"))
+                       do_exhaustive_model_search = true;
+               else if(0 == strcmp(argv[i], "-e-"))
+                       do_exhaustive_model_search = false;
+               else if(0 == strcmp(argv[i], "-l"))
+                       max_lpc_order = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-m"))
+                       do_mid_side = true;
+               else if(0 == strcmp(argv[i], "-m-"))
+                       do_mid_side = false;
+               else if(0 == strcmp(argv[i], "-p"))
+                       do_qlp_coeff_prec_search = true;
+               else if(0 == strcmp(argv[i], "-p-"))
+                       do_qlp_coeff_prec_search = false;
+               else if(0 == strcmp(argv[i], "-q"))
+                       qlp_coeff_precision = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-r"))
+                       rice_optimization_level = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-fb"))
+                       format_is_big_endian = true;
+               else if(0 == strcmp(argv[i], "-fl"))
+                       format_is_big_endian = false;
+               else if(0 == strcmp(argv[i], "-fc"))
+                       format_channels = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-fp"))
+                       format_bps = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-fs"))
+                       format_sample_rate = atoi(argv[++i]);
+               else if(0 == strcmp(argv[i], "-fu"))
+                       format_is_unsigned_samples = true;
+               else if(0 == strcmp(argv[i], "-fr"))
+                       format_is_wave = false;
+               else if(0 == strcmp(argv[i], "-fw"))
+                       format_is_wave = true;
+               else if(0 == strcmp(argv[i], "-0")) {
+                       do_exhaustive_model_search = false;
+                       do_mid_side = false;
+                       qlp_coeff_precision = 0;
+                       rice_optimization_level = 0;
+                       max_lpc_order = 0;
+               }
+               else if(0 == strcmp(argv[i], "-1")) {
+                       do_exhaustive_model_search = false;
+                       do_mid_side = true;
+                       qlp_coeff_precision = 0;
+                       rice_optimization_level = 0;
+                       max_lpc_order = 0;
+               }
+               else if(0 == strcmp(argv[i], "-2")) {
+                       do_exhaustive_model_search = false;
+                       do_mid_side = true;
+                       qlp_coeff_precision = 0;
+                       max_lpc_order = 0;
+               }
+               else if(0 == strcmp(argv[i], "-4")) {
+                       do_exhaustive_model_search = false;
+                       do_mid_side = false;
+                       qlp_coeff_precision = 0;
+                       rice_optimization_level = 0;
+                       max_lpc_order = 8;
+          &n