Index: penc/trunk/.new.downmix.c
===================================================================
--- /mppenc/trunk/.new.downmix.c	(revision 96)
+++ 	(revision )
@@ -1,327 +1,0 @@
-
-//Pre-scaled downmix coefficients
-static float cmixlev_lut[4] = { 0.2928, 0.2468, 0.2071, 0.2468 };
-static float smixlev_lut[4] = { 0.2928, 0.2071, 0.0   , 0.2071 };
-
-downmix_3f_2r_to_2ch
-{
-        left      = samples[0];
-        centre    = samples[1];
-        right     = samples[2];
-        left_sur  = samples[3];
-        right_sur = samples[4];
-
-        clev = cmixlev_lut[bsi->cmixlev];
-        slev = smixlev_lut[bsi->surmixlev];
-
-        for (j = 0; j < 256; j++) {
-                left_tmp = 0.4142f * *left++  + clev * *centre   + slev * *left_sur++;
-                right_tmp= 0.4142f * *right++ + clev * *centre++ + slev * *right_sur++;
-
-                s16_samples[j * 2 ]    = (left_tmp );
-                s16_samples[j * 2 + 1] = (right_tmp);
-        }
-}
-
-downmix_2f_2r_to_2ch
-{
-        left      = samples[0];
-        right     = samples[1];
-        left_sur  = samples[2];
-        right_sur = samples[3];
-
-        slev = smixlev_lut[bsi->surmixlev];
-
-        for (j = 0; j < 256; j++) {
-                left_tmp = 0.4142f * *left++  + slev * *left_sur++;
-                right_tmp= 0.4142f * *right++ + slev * *right_sur++;
-
-                s16_samples[j * 2 ]    = (left_tmp );
-                s16_samples[j * 2 + 1] = (right_tmp);
-        }
-}
-
-downmix_3f_1r_to_2ch
-{
-        left      = samples[0];
-        centre    = samples[1];
-        right     = samples[2];
-        //Mono surround
-        sur = samples[3];
-
-        clev = cmixlev_lut[bsi->cmixlev];
-        slev = smixlev_lut[bsi->surmixlev];
-
-        for (j = 0; j < 256; j++) {
-                left_tmp = 0.4142f * *left++  + clev * *centre++ + slev * *sur;
-                right_tmp= 0.4142f * *right++ + clev * *centre   + slev * *sur++;
-
-                s16_samples[j * 2 ]    = (left_tmp );
-                s16_samples[j * 2 + 1] = (right_tmp);
-        }
-}
-
-
-downmix_2f_1r_to_2ch
-{
-        left      = samples[0];
-        right     = samples[1];
-        //Mono surround
-        sur = samples[2];
-
-        slev = smixlev_lut[bsi->surmixlev];
-
-        for (j = 0; j < 256; j++) {
-                left_tmp = 0.4142f * *left++  + slev * *sur;
-                right_tmp= 0.4142f * *right++ + slev * *sur++;
-
-                s16_samples[j * 2 ]    = (left_tmp );
-                s16_samples[j * 2 + 1] = (right_tmp);
-        }
-}
-
-downmix_3f_0r_to_2ch
-{
-        left      = samples[0];
-        centre    = samples[1];
-        right     = samples[2];
-
-        clev = cmixlev_lut[bsi->cmixlev];
-
-        for (j = 0; j < 256; j++) {
-                left_tmp = 0.4142f * *left++  + clev * *centre;
-                right_tmp= 0.4142f * *right++ + clev * *centre++;
-
-                s16_samples[j * 2 ]    = (left_tmp );
-                s16_samples[j * 2 + 1] = (right_tmp);
-        }
-}
-
-downmix_2f_0r_to_2ch
-{
-        left      = samples[0];
-        right     = samples[1];
-
-        for (j = 0; j < 256; j++) {
-                s16_samples[j * 2 ]    = (*left++ );
-                s16_samples[j * 2 + 1] = (*right++);
-        }
-}
-
-downmix_1f_0r_to_2ch
-{
-        for (j = 0; j < 256; j++) {
-                tmp = 0.7071f * *centre++;
-
-                s16_samples[j * 2 ] = s16_samples[j * 2 + 1] = tmp;
-        }
-}
-
-//
-// Downmix into 2 or 4 channels  (4 ch isn't in quite yet)
-//
-// The downmix function names have the following format
-//
-// downmix_Xf_Yr_to_[2|4]ch[_dolby]
-//
-// where X        = number of front channels
-//       Y        = number of rear channels
-//       [2|4]    = number of output channels
-//       [_dolby] = with or without dolby surround mix
-//
-
-downmix
-{
-        if(bsi->acmod > 7)
-                dprintf("(downmix) invalid acmod number\n");
-
-        //
-        //There are two main cases, with or without Dolby Surround
-        //
-        if(ac3_config.flags & AC3_DOLBY_SURR_ENABLE)
-        {
-                fprintf(stderr,"Dolby Surround Mixes not currently enabled\n");
-                exit(1);
-        }
-
-        //Non-Dolby surround downmixes
-        switch(bsi->acmod)
-        {
-                // 3/2
-                case 7:
-                        downmix_3f_2r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                // 2/2
-                case 6:
-                        downmix_2f_2r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                // 3/1
-                case 5:
-                        downmix_3f_1r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                // 2/1
-                case 4:
-                        downmix_2f_1r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                // 3/0
-                case 3:
-                        downmix_3f_0r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                case 2:
-                        downmix_2f_0r_to_2ch(bsi,samples,s16_samples);
-                break;
-
-                // 1/0
-                case 1:
-                        downmix_1f_0r_to_2ch(samples[0],s16_samples);
-                break;
-
-                // 1+1
-                case 0:
-                        downmix_1f_0r_to_2ch(samples[ac3_config.dual_mono_ch_sel],s16_samples);
-                break;
-        }
-}
-
-
-
-
-
-
-
-        //the dolby mixes lay here for the time being
-        switch(bsi->acmod)
-        {
-                // 3/2
-                case 7:
-                        left      = samples[0];
-                        centre    = samples[1];
-                        right     = samples[2];
-                        left_sur  = samples[3];
-                        right_sur = samples[4];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
-                                left_tmp  = -1 * right_tmp;
-                                right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
-                                left_tmp  += 0.3204f * *left++  + 0.2265f * *centre++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = left_tmp;
-                        }
-
-                break;
-
-                // 2/2
-                case 6:
-                        left      = samples[0];
-                        right     = samples[1];
-                        left_sur  = samples[2];
-                        right_sur = samples[3];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
-                                left_tmp  = -1 * right_tmp;
-                                right_tmp += 0.3204f * *right++;
-                                left_tmp  += 0.3204f * *left++ ;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = left_tmp;
-                        }
-                break;
-
-                // 3/1
-                case 5:
-                        left      = samples[0];
-                        centre    = samples[1];
-                        right     = samples[2];
-                        //Mono surround
-                        right_sur = samples[3];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp =  0.2265f * *right_sur++;
-                                left_tmp  = -1 * right_tmp;
-                                right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
-                                left_tmp  += 0.3204f * *left++  + 0.2265f * *centre++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = left_tmp;
-                        }
-                break;
-
-                // 2/1
-                case 4:
-                        left      = samples[0];
-                        right     = samples[1];
-                        //Mono surround
-                        right_sur = samples[2];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp =  0.2265f * *right_sur++;
-                                left_tmp  = -1 * right_tmp;
-                                right_tmp += 0.3204f * *right++;
-                                left_tmp  += 0.3204f * *left++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = left_tmp;
-                        }
-                break;
-
-                // 3/0
-                case 3:
-                        left      = samples[0];
-                        centre    = samples[1];
-                        right     = samples[2];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp = 0.3204f * *right++ + 0.2265f * *centre;
-                                left_tmp  = 0.3204f * *left++  + 0.2265f * *centre++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = left_tmp;
-                        }
-                break;
-
-                // 2/0
-                case 2:
-                //Do nothing!
-                break;
-
-                // 1/0
-                case 1:
-                        //Mono program!
-                        right = samples[0];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp = 0.7071f * *right++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = right_tmp;
-                        }
-
-                break;
-
-                // 1+1
-                case 0:
-                        //Dual mono, output selected by user
-                        right = samples[ac3_config.dual_mono_ch_sel];
-
-                        for (j = 0; j < 256; j++)
-                        {
-                                right_tmp = 0.7071f * *right++;
-
-                                samples[1][j] = right_tmp;
-                                samples[0][j] = right_tmp;
-                        }
-                break;
Index: /mppenc/trunk/CMakeLists.txt
===================================================================
--- /mppenc/trunk/CMakeLists.txt	(revision 97)
+++ /mppenc/trunk/CMakeLists.txt	(revision 97)
@@ -0,0 +1,5 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+project(mppenc C)
+set(CMAKE_VERBOSE_MAKEFILE false)
+set(CMAKE_C_FLAGS "-fno-strict-aliasing -Os -fomit-frame-pointer -pipe") 
+add_subdirectory(src)
Index: penc/trunk/COPYING.GPL
===================================================================
--- /mppenc/trunk/COPYING.GPL	(revision 96)
+++ 	(revision )
@@ -1,345 +1,0 @@
-                    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.
-
-
-                    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.)
-
-
-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.
-
-
-  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.
-
-
-  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
-
-
-            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) 20yy  <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) 20yy 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.
Index: penc/trunk/COPYING.LGPL
===================================================================
--- /mppenc/trunk/COPYING.LGPL	(revision 96)
+++ 	(revision )
@@ -1,511 +1,0 @@
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                            Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-
-                  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-
-  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.
-
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-
-  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
-
-
-           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 Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
Index: penc/trunk/Huffman.dsp
===================================================================
--- /mppenc/trunk/Huffman.dsp	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# Microsoft Developer Studio Project File - Name="huffman" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=huffman - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "huffman.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "huffman.mak" CFG="huffman - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "huffman - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "huffman - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "huffman - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "huffman - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "huffman - Win32 Release"
-# Name "huffman - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\huffman.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: /mppenc/trunk/INSTALL
===================================================================
--- /mppenc/trunk/INSTALL	(revision 97)
+++ /mppenc/trunk/INSTALL	(revision 97)
@@ -0,0 +1,14 @@
+Known prerequisites:
+- cmake >= 2.2
+
+Steps:
+'cmake .'
+	- Generate the build system
+'make'
+	- Compile mppenc binary
+'make install'
+	- Install freshly compiled binary on your system
+
+Notes:
+- If you need to install mppenc in another directory than the default one, call cmake with this command instead 'cmake -DCMAKE_INSTALL_PREFIX:=/myPath'
+- Current mppenc isn't robust enough to handle any cflag combinations so don't modify it needlessly. You can add "-march=yourcpu" to enhance speed a bit further. You MUST NOT remove "-fno-strict-aliasing" unless you enjoy segmentation faults and broken bitrates.
Index: penc/trunk/Import.sh
===================================================================
--- /mppenc/trunk/Import.sh	(revision 96)
+++ 	(revision )
@@ -1,15 +1,0 @@
-#! /bin/bash
-
-dir=0
-
-sync
-
-#mount -t vfat /dev/hdg4 /mnt/zip &> /dev/null; mkdir 0; cp -R /mnt/zip/sv7/* 0
-
-./Remove.tab 0/{.,*,*/*,*/*/*,*/*/*/*}/*.{c,h,cpp} &> /dev/null
-( for i in * */* */*/* */*/*/* */*/*/*/*; do /usr/local/bin/unify ./"$i" ./0/* ./0/*/* ./0/*/*/* ./0/*/*/*/* ./0/*/*/*/*/*; done ) &> /dev/null
-rm -f 0/{.,*,*/*,*/*/*,*/*/*/*,*/*/*/*/*}/*.{obj,plg,pch,pdb,ilk,idb,ncb,*~,aps,sbr} &> /dev/null
-rmdir 0/{*/*/*/*,*/*/*,*/*,*} &> /dev/null &> /dev/null 
-chown -R pfk .
-
-#umount /mnt/zip
Index: penc/trunk/Make.sh
===================================================================
--- /mppenc/trunk/Make.sh	(revision 96)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#! /bin/bash
-
-mv -i makefile      Makefile
-mv -i makefile.nol  Makefile.nol
-mv -i m             M
-mv -i mm            MM
-mv -i mmm.bat       MMM.bat
-mv -i make.sh       Make.sh
-mv -i remove.tab    Remove.tab
-mv -i summary       Summary
-mv -i howtocom.txt  HowToCom.txt
-mv -i howtorea.txt  HowToRea.txt
-for i in msc.bat tcc.bat ztc.bat ztc.res ztc.ret; do mv -i make$i Make$i; done
-
-chmod 755 Remove.tab wavcmp Make.sh M MM Remove.comment
-
-./Remove.tab
-
-make
-make test3
-sync
-make speed
Index: penc/trunk/Makefile
===================================================================
--- /mppenc/trunk/Makefile	(revision 96)
+++ 	(revision )
@@ -1,739 +1,0 @@
-#
-#  Makefile for mppdec/mppenc for gcc
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-include version
-
-
-# Name of this Makefile
-
-MAKEFILE = Makefile
-
-# DEBIAN DESTDIR
-
-DESTDIR = `pwd`/debian/musepack-encoder/
-
-# Build static binaries
-
-#BLD_STATIC = 1
-
-# Define, if building with MinGW
-
-#MINGW    = 1
-
-# Select the compiler. Normally gcc is used.
-
-ifndef CC
-CC       = gcc
-endif
-CC3      = gcc -pipe -L/lib
-CC_MAJ   = $(shell $(CC) -dumpversion | cut -b 1)
-CC_MIN   = $(shell $(CC) -dumpversion | cut -b 3)
-TUNE    = $(shell [ $(CC_MAJ)$(CC_MIN) -ge 34 ] && echo tune || echo cpu)
-
-
-# Select architecture and CPU type with the variable $(ARCH).
-# If unset Intel 386 with optimization for Pentium is selected.
-
-ifndef ARCH
-ARCH     = -march=i586 -m$(TUNE)=i686
-endif
-
-ifdef MINGW
-EXEEXT   = .exe
-endif
-
-# Paths of several test files for testing
-# You don't need them for simple compiling
-
-TEST1    = /Archive/Audio/technik/mpc/SV4test.mpc
-TEST2    = /Archive/Audio/technik/mpc/SV5test.mpc
-TEST3    = /Archive/Audio/technik/mpc/SV6test.mpc
-TEST4    = /Archive/Audio/technik/mpc/SV7test.mpc
-TEST5    = '/Archive/Audio/Fury in the Slaughterhouse/Mono -- [02] Generation got its own disease.pac'
-TEST6    = /tmp/1.wav
-TEST7    = G1.mpc
-TEST8    = G2.mpc
-TEST9    = /Archive/1.mpc
-TEST10   = /Archive/CD.mpc
-TEST11   = /tmp/1.wav
-TEST12   = /tmp/2.wav
-
-DATE     = `date '+%Y-%m-%d_%H-%M-%S'`
-TMPFILE  = /tmp/tmpfile-mpp-$(DATE)-`hostname -f``tty|sed 's,/,-,g'`
-
-
-# Prioriry used for testing. This should reduce effects of other programs
-# while running the benchmark tests. Set to -20 if you are root, 0 otherwise
-
-NICE     = nice -n -20
-
-
-# Names of several tools
-
-RM_F     = rm -f --
-RM_RF    = rm -rf --
-CP_F     = cp -f --
-MV_F     = mv -f --
-STRIP    = strip
-CHOWN    = chown
-CHMOD    = chmod
-MKDIR    = mkdir
-CLS      = clear
-CAT      = cat
-LPAC     = lpac
-ZIP      = zip -9
-BZIP2    = bzip2 -9
-PGP      = pgp
-TAR      = tar
-LESS     = more
-ENCODE   = uuencode
-MAIL     = mail
-DEVNULL  = /dev/null
-LOGFILE  = /dev/tty
-#LOGFILE = logfile
-
-
-# Name of libraries you need for linking
-
-ifndef MINGW
-LDADD    = -lm
-#LDADD   += -lesd
-else
-LDADD    = -lwinmm -lws2_32
-endif
-#LDADD  += -lossaudio
-#LDADD  += -lrt
-#LDADD  += -lsocket -lnsl
-
-
-# Directory for object files
-
-OBJDIR = ./o
-
-
-# Path of additional includes and libs
-
-ifndef MINGW
-XINCLDIR = /usr/include
-XLIBDIR  = /usr/lib
-endif
-
-
-# Warning options, unset if the compiler makes trouble because of unknown
-# options
-
-WARN  = #\
-	-Wall                   \
-	-pedantic               \
-	-W                      \
-	-Wshadow                \
-	-Wbad-function-cast     \
-	-Wcast-align            \
-	-Wwrite-strings         \
-	-Wconversion            \
-	-Wsign-compare          \
-	-Wstrict-prototypes     \
-	-Wmissing-prototypes    \
-	-Wmissing-declarations  \
-	-Wnested-externs        \
-	-Wno-long-long          \
-
-
-# Feature select for different optimization versions
-
-# Defined in mppenc.h for win32
-ifndef MINGW
-FEATURE += -DCVD_FASTLOG
-FEATURE += -DFAST_MATH
-endif
-#FEATURE += -DEXTRA_DECONV
-#FEATURE += -DFASTER
-
-
-# Options for $(STRIP)
-
-STRIPOPT = --remove-section .comment --remove-section .note.ABI-tag --remove-section .note --remove-section .gnu.warning.llseek --remove-section .gnu.version
-
-
-# Die Zielvariante zum Ausliefern sollte nur 'OPTIM=-O3' und 'WARN=' enthalten,
-# damit das Programm überall (alle CPUs, OS und Compiler) übersetzbar ist.
-
-FLAGS = \
-	-fomit-frame-pointer -funroll-loops \
-	-mno-ieee-fp -ffast-math -pipe
-
-ifneq ($(CC_MAJ),4)
-FLAGS += -fmove-all-movables
-endif
-ifeq ($(CC_MAJ),2)
-FLAGS += -malign-jumps=5 -malign-loops=0 -malign-functions=5
-else
-FLAGS += -falign-jumps=5 -falign-loops=0 -falign-functions=5
-# unset optimizations that tend to break mppenc encodings
-UNBREAK = \
-	-fno-strict-aliasing -fno-gcse \
-	-fno-finite-math-only -fno-unsafe-math-optimizations
-endif
-
-OPTIM_SPEED = -O2 $(FLAGS) $(UNBREAK)
-
-OPTIM_SIZE = -Os $(FLAGS) $(UNBREAK)
-
-# Options to generate Assembly code for inspecting
-
-ASSEM = -S -fverbose-asm
-
-
-# Some remaining possible options (time measurement and debugging)
-
-#PROFILE = -DPROFILE
-#DEBUG   = -DNDEBUG
-
-
-#
-# Overwrite problematic options which can't be understand by all compilers
-#
-
-ifdef USE_GCC272
-ARCH        =
-FEATURE     =
-WARN        =
-PROFILE     =
-DEBUG       =
-XINCLDIR    =
-XLIBDIR     =
-ASSEM       =
-OPTIM_SPEED =
-OPTIM_SIZE  =
-endif
-
-
-# Merge all options together for CFLAGS and CFLAG_SIZE
-
-CFLAGS        += $(ARCH) $(FEATURE) $(WARN) $(PROFILE) $(DEBUG) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\" -DMPPENC_VERSION=\"$(MPPENC_VERSION)\"
-ifndef MINGW
-CFLAGS       += -I$(XINCLDIR) -L$(XLIBDIR)
-endif
-#CFLAGS      += $(ASSEM)
-CFLAGS_SIZE   = $(CFLAGS) $(OPTIM_SIZE)
-CFLAGS       += $(OPTIM_SPEED)
-
-
-# Name and Options for NASM, the Netwide Assembler
-
-NASM          = nasm
-ifndef MINGW
-NASMFLAGS     = -f elf
-else
-NASMFLAGS     = -f win32
-endif
-
-
-# Another optimization for the Pentium Classic (60...200 MHz) and Pentium MMX (166...233 MHz)
-
-ifdef PENTIUM
-NASMFLAGS    += -DUSE_FXCH
-endif
-
-
-# Targets and general dependencies
-
-MPPDEC_TARGET    = mppdec
-MPPENC_TARGET    = mppenc$(EXEEXT)
-STREAM_TARGET    = streamserver
-REPLAY_TARGET    = replaygain$(EXEEXT)
-CLIPSTAT_TARGET  = clipstat
-TAGGER_TARGET    = tagger
-ALL_TARGETS      = $(MPPENC_TARGET) $(REPLAY_TARGET)
-
-OTHER_DEPEND_ASM = $(MAKEFILE) tools.inc version
-OTHER_DEPEND_DEC = $(MAKEFILE) mppdec.h mpp.h config.h profile.h version
-OTHER_DEPEND_ENC = $(OTHER_DEPEND_DEC) mppenc.h minimax.h
-
-
-# Lists of object and C files
-
-MPPDEC_OBJ = cpu_feat.o decode.o http.o huffsv7.o huffsv46.o id3tag.o mppdec.o profile.o requant.o synth.o synthasm.o synthtab.o toolsd.o wave_out.o stderr.o _setargv.o
-MPPDEC_SRC =            decode.c http.c huffsv7.c huffsv46.c id3tag.c mppdec.c profile.c requant.c synth.c            synthtab.c tools.c  wave_out.c stderr.c _setargv.c
-MPPDEC_ASO = cpu_feat.o                                                                                     synthasm.o
-
-
-MPPENC_OBJ = analy_filter.o ans.o bitstream.o cvd.o fft4g.o fft4gasm.o fft_routines.o mppenc.o profile.o psy.o psy_tab.o quant.o huffsv7e.o encode_sv7.o wave_in.o tags.o toolse.o fastmath.o pipeopen.o stderr.o regress.o keyboard.o
-ifdef MINGW
-MPPENC_OBJ += winmsg.o
-endif
-MPPENC_SRC = analy_filter.c ans.c bitstream.c cvd.c fft4g.c            fft_routines.c mppenc.c profile.c psy.c psy_tab.c quant.c huffsv7.c  encode_sv7.c wave_in.c tags.c tools.c  fastmath.c pipeopen.c stderr.c regress.c keyboard.c
-ifdef MINGW
-MPPENC_SRC += winmsg.c
-endif
-MPPENC_ASO =                                                fft4gasm.o
-
-
-REPLAY_OBJ = replaygain.o gain_analysis.o pipeopen.o stderr.o _setargv.o
-REPLAY_SRC = replaygain.c gain_analysis.c pipeopen.c stderr.c _setargv.c
-REPLAY_ASO =
-
-
-CLIPSTAT_OBJ = clipstat.o pipeopen.o stderr.o
-CLIPSTAT_SRC = clipstat.c pipeopen.c stderr.c
-CLIPSTAT_ASO =
-
-
-# Files for source packages
-
-MPPDEC_PACKAGE = $(MPPDEC_SRC) AUTHORS CHANGES COPYING.LGPL ChangeLog INSTALL NEWS README SV7.txt MANUAL.TXT SHOWDIFFS version *.mak streamserver.c HowToRea.txt $(MAKEFILE) Makefile.nol Makefile.bsd Makefile.sun Makefile.BeOS Makefile.Darwin Makemsc.bat Maketcc.bat Makeztc.bat Makeztc.res Makeztc.ret Makeintel.bat config.c config.dsp streamserver.dsp udp_server_client.c msr.h cpu_feat.nas dump.c mppdec.dsp mpp.dsw mpp.h mpp.prj mppdec.h profile.h synthasm.nas tools.inc replaygain.c replaygain.dsp gain_analysis.[ch] pipeopen.[ch] _setargv.c name.c name.dsp
-MPPENC_PACKAGE = $(MPPENC_SRC) TODO minimax.h mppenc.dsp mppenc.h fastmath.h winmsg.c A-*.txt fft4gasm.nas predict.h
-WINAMP_PACKAGE = winamp/COPYING.LGPL winamp/INFO.txt winamp/README_mpc-plugin_english.txt winamp/README_mpc-plugin_finnish.txt winamp/README_mpc-plugin_german.txt winamp/README_mpc-plugin_korean.txt winamp/README_mpc-plugin_spanish.txt winamp/TODO winamp/bitstream.cpp winamp/bitstream.h winamp/colorbar-klemm.bmp winamp/colorbar-korean.bmp winamp/colorbar-old.bmp winamp/colorbar.bmp winamp/config.cpp winamp/http.cpp winamp/huffsv46.cpp winamp/huffsv46.h winamp/huffsv7.cpp winamp/huffsv7.h winamp/idtag.cpp winamp/idtag.h winamp/in2.h winamp/in_mpc.cpp winamp/in_mpc.dsp winamp/in_mpc.dsw winamp/in_mpc.h winamp/jnetlib/Makefile winamp/jnetlib/asyncdns.cpp winamp/jnetlib/asyncdns.h winamp/jnetlib/connection.cpp winamp/jnetlib/connection.h winamp/jnetlib/httpget.cpp winamp/jnetlib/httpget.h winamp/jnetlib/httpserv.cpp winamp/jnetlib/httpserv.h winamp/jnetlib/jnetlib.h winamp/jnetlib/listen.cpp winamp/jnetlib/listen.h winamp/jnetlib/netinc.h winamp/jnetlib/sercon.cpp winamp/jnetlib/sercon.h winamp/jnetlib/test.cpp winamp/jnetlib/test.dsp winamp/jnetlib/test.dsw winamp/jnetlib/udpconnection.cpp winamp/jnetlib/udpconnection.h winamp/jnetlib/util.cpp winamp/jnetlib/util.h winamp/language.h winamp/logo.bmp winamp/minimax.h winamp/mpc_dec.cpp winamp/mpc_dec.h winamp/out.h winamp/requant.cpp winamp/requant.h winamp/resource.h winamp/resource.hm winamp/synth_filter.cpp winamp/synth_filter.h winamp/tag-korean.rc winamp/tag.rc winamp/tagz.cpp winamp/tagz.h winamp/unihack.cpp winamp/ws_exp.h winamp/ws_loader.c winamp/ws_loader.h
-XMMS_PACKAGE   = COPYING.LGPL xmms/ChangeLog xmms/in_mpc.c xmms/Makefile xmms/README_mpc-plugin_*.txt xmms/bitstream.[ch] xmms/huffsv{46,7}.[ch] xmms/minimax.h xmms/mpc_dec.[ch] xmms/mpplus_blue.xpm xmms/requant.[ch] xmms/synth_filter.[ch] xmms/xmms-musepack.spec xmms/xmms.dsp
-
-
-# may be megabytes of Trash
-
-TRASH       = ./*.o ./*.obj ./*.lst {$(MPPDEC_TARGET),$(MPPENC_TARGET)}{,-static,-diet} $(STREAM_TARGET) a.out ./*.da ./*.s $(REPLAY_TARGET)
-AUX_TRASH   = ./*~ ./*/*~ ./*.bak ./.*~ DEADJOE mpp.lib config.h config .logging website/{*~,*/*~} report-*.txt .{,/*}/{Release,Debug}/*.{obj,pch,pdb,sbr,ilk,idb,exp,res} ./*.{plg,ncb,opt}
-BACKUP_EXCL = *.mpc website/audio/* website/audio2/* website/audio3/* website/bin/* website/img/* i/* mpp{enc,dec}-[0-9].[0-9][0-9][a-z]/* rfc*.txt.bz2
-
-
-# Broadcast destinations
-
-BROADCAST_MPPDEC = busch piecha pfk zeiss case@mobiili.net steve.lhomme@free.fr Nicolaus.Berglmeir@t-online.de
-BROADCAST_MPPENC = Andree.Buschmann@web.de patrick.piecha@micronas.com pfk f.klemm@zeiss.de Nicolaus.Berglmeir@t-online.de
-
-
-########################################################################################
-#
-# Compile source packages
-
-all:    $(ALL_TARGETS)
-
-
-$(MPPDEC_TARGET): $(MPPDEC_OBJ)
-ifndef BLD_STATIC
-	$(CC)         $(CFLAGS) $(MPPDEC_OBJ) -o $(MPPDEC_TARGET)        $(LDADD)
-#	-$(STRIP)     $(STRIPOPT)                $(MPPDEC_TARGET)
-else
-	$(CC) -static $(CFLAGS) $(MPPDEC_OBJ) -o $(MPPDEC_TARGET)-static $(LDADD)
-#	-$(STRIP)     $(STRIPOPT)                $(MPPDEC_TARGET)-static
-endif
-
-
-$(MPPDEC_TARGET)16: $(MPPDEC_OBJ)
-	make clean
-	BITS=16 make mppdec
-	$(MV_F) mppdec mppdec16
-	$(MV_F) mppdec-static mppdec16-static
-
-
-$(MPPDEC_TARGET)24: $(MPPDEC_OBJ)
-	make clean
-	BITS=24 make mppdec
-	$(MV_F) mppdec mppdec24
-	$(MV_F) mppdec-static mppdec24-static
-
-
-$(MPPDEC_TARGET)32: $(MPPDEC_OBJ)
-	make clean
-	BITS=32 make mppdec
-	$(MV_F) mppdec mppdec32
-	$(MV_F) mppdec-static mppdec32-static
-
-
-$(MPPENC_TARGET): $(MPPENC_OBJ)
-ifndef BLD_STATIC
-	$(CC)         $(CFLAGS) $(MPPENC_OBJ) -o $(MPPENC_TARGET)        $(LDADD)
-#	-$(STRIP)     $(STRIPOPT)                $(MPPENC_TARGET)
-else
-	$(CC) -static $(CFLAGS) $(MPPENC_OBJ) -o $(MPPENC_TARGET)-static $(LDADD)
-#	-$(STRIP)     $(STRIPOPT)                $(MPPENC_TARGET)-static
-endif
-
-
-$(MPPDEC_TARGET)-profiling: $(MPPDEC_OBJ)
-	$(CC3) -c      $(CFLAGS) $(CSRC)                            -fprofile-arcs         $(LDADD)
-	$(CC3)         $(CFLAGS) $(OBJ)  -o $(MPPDEC_TARGET)        -fprofile-arcs         $(LDADD)
-	make
-	make speed2
-	$(CC3) -c      $(CFLAGS) $(CSRC)                            -fprofile-arcs         $(LDADD)
-	$(CC3)         $(CFLAGS) $(OBJ)  -o $(MPPDEC_TARGET)        -fbranch-probabilities $(LDADD)
-	$(CC3) -static $(CFLAGS) $(OBJ)  -o $(MPPDEC_TARGET)-static -fbranch-probabilities $(LDADD)
-
-
-$(MPPDEC_TARGET)-diet:   $(MPPDEC_ASO) config.h
-	diet $(CC) $(CFLAGS) -DUSE_DIET -DNDEBUG $(MPPDEC_SRC) $(MPPDEC_ASO) -o $(MPPDEC_TARGET)-diet
-	elftrunc $(MPPDEC_TARGET)-diet $(MPPDEC_TARGET)-diet
-
-
-$(MPPENC_TARGET)-diet:   $(MPPENC_ASO) config.h
-	diet $(CC) $(CFLAGS) -DUSE_DIET -DNDEBUG $(MPPENC_SRC) $(MPPENC_ASO) -o $(MPPENC_TARGET)-diet
-	elftrunc $(MPPENC_TARGET)-diet $(MPPENC_TARGET)-diet
-
-
-$(STREAM_TARGET):
-	$(CC) -DMPP_DECODER $(CFLAGS) -o $(STREAM_TARGET) $(STREAM_TARGET).c
-	-$(STRIP)     $(STRIPOPT)           $(STREAM_TARGET)
-
-
-$(REPLAY_TARGET): $(REPLAY_OBJ) mpp.h config.c
-	$(CC) $(CFLAGS) $(REPLAY_OBJ) -o $(REPLAY_TARGET)      $(LDADD)
-#	-$(STRIP)     $(STRIPOPT)           $(REPLAY_TARGET)
-
-
-$(TAGGER_TARGET):
-	$(CC) -DMPP_DECODER $(CFLAGS) -o $(TAGGER_TARGET) $(TAGGER_TARGET).c
-	-$(STRIP)     $(STRIPOPT)           $(TAGGER_TARGET)
-
-
-$(CLIPSTAT_TARGET):
-	$(CC)         $(CFLAGS) $(CLIPSTAT_OBJ) -o $(CLIPSTAT_TARGET)  $(LDADD)
-	-$(STRIP)     $(STRIPOPT)           $(CLIPSTAT_TARGET)
-
-
-###########################################################################################
-#
-# Compile mppdec source code files
-
-config.h: mpp.h config.c
-	$(CC) -DMPP_DECODER $(CFLAGS) -o config config.c   $(LDADD) &> $(LOGFILE)
-	@$(RM_F) config.h
-	@./config "$(CC) $(CFLAGS) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-
-decode.o:   $(OTHER_DEPEND_DEC) dump.c
-	$(CC) -c -DMPP_DECODER $(CFLAGS) decode.c
-
-http.o:     $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) http.c
-
-huffsv7.o: $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS_SIZE) huffsv7.c
-
-huffsv46.o: $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS_SIZE) huffsv46.c
-
-id3tag.o:   $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS_SIZE) id3tag.c
-
-mppdec.o:   $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) mppdec.c
-
-profile.o:  $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) profile.c
-
-requant.o:  $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS_SIZE) requant.c
-
-synth.o:    $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) -fno-omit-frame-pointer -O synth.c
-
-synthtab.o: $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) synthtab.c
-
-toolsd.o:    $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER -o toolsd.o $(CFLAGS) tools.c
-
-wave_out.o: $(OTHER_DEPEND_DEC)
-	$(CC) -c -DMPP_DECODER $(CFLAGS) wave_out.c
-
-synthasm.o: $(OTHER_DEPEND_ASM) synthasm.nas
-	$(RM_F) synthasm.lst
-	$(NASM) $(NASMFLAGS) synthasm.nas -o synthasm.o -l synthasm.lst
-
-cpu_feat.o: $(OTHER_DEPEND_ASM) cpu_feat.nas
-	$(RM_F) cpu_feat.lst
-	$(NASM) $(NASMFLAGS) cpu_feat.nas -o cpu_feat.o -l cpu_feat.lst
-
-
-################################################################################
-#
-# Compile mppenc source code files
-
-wave_in.o:      $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER wave_in.c
-
-psy.o:          $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER psy.c
-
-ans.o:          $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER ans.c
-
-cvd.o:          $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER cvd.c
-
-huffsv7e.o:    $(OTHER_DEPEND_ENC)
-	$(CC) -o huffsv7e.o -c $(CFLAGS_SIZE) -DMPP_ENCODER huffsv7.c
-
-encode_sv7.o:   $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER encode_sv7.c
-
-bitstream.o:    $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER bitstream.c
-
-analy_filter.o: $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER analy_filter.c
-
-quant.o:        $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER quant.c
-
-fft4g.o:        $(OTHER_DEPEND_ENC) fft4g.c
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER -fno-omit-frame-pointer -O fft4g.c
-
-fft4gasm.o:     $(OTHER_DEPEND_ASM) fft4gasm.nas
-	$(NASM) $(NASMFLAGS) fft4gasm.nas -o fft4gasm.o -l fft4gasm.lst
-
-fft_routines.o: $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER fft_routines.c
-
-psy_tab.o:      $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER psy_tab.c
-
-mppenc.o:       $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER mppenc.c
-
-toolse.o:    $(OTHER_DEPEND_ENC)
-	$(CC) -o toolse.o -c $(CFLAGS) -DMPP_ENCODER tools.c
-
-tags.o:    $(OTHER_DEPEND_ENC)
-	$(CC) -o tags.o -c $(CFLAGS) -DMPP_ENCODER tags.c
-
-keyboard.o:       $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER keyboard.c
-
-winmsg.o:       $(OTHER_DEPEND_ENC)
-	$(CC) -c $(CFLAGS) -DMPP_ENCODER winmsg.c
-
-################################################################################
-#
-# Compile replaygain source code files
-
-replaygain.o:
-	$(CC) -c $(CFLAGS) -DMPP_DECODER replaygain.c
-
-gain_analysis.o:
-	$(CC) -c $(CFLAGS) -DMPP_DECODER gain_analysis.c
-
-pipeopen.o:
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_DECODER pipeopen.c
-
-stderr.o:
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_DECODER stderr.c
-
-fastmath.o:
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_ENCODER fastmath.c
-
-clipstat.o:
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_DECODER clipstat.c
-
-_setargv.o:
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_DECODER _setargv.c
-
-####################################################################################
-
-list:	list.o pipeopen.o _setargv.o stderr.o
-	$(CC) $(CFLAGS_SIZE) -DMPP_ENCODER -o list list.o pipeopen.o _setargv.o stderr.o -lm
-
-list.o:	list.c
-	$(CC) -c $(CFLAGS_SIZE) -DMPP_ENCODER list.c
-
-
-###############################################################################################
-#
-# Cleaning and removing unnecessary files
-
-clean:
-	@$(RM_F) $(TRASH)
-
-
-mrproper:
-	@$(RM_F) $(TRASH) $(AUX_TRASH)
-
-
-###############################################################################################
-#
-# Speed tests and function tests
-
-speedd1:
-	@$(CAT)  "$(TEST9)" "$(MPPDEC_TARGET)" > $(DEVNULL)
-	@$(CAT)  "$(TEST9)" "$(MPPDEC_TARGET)" > $(DEVNULL)
-	@$(NICE) time ./mppdec       "$(TEST9)"  $(DEVNULL)
-	@$(NICE) ../decorig/mppdec   "$(TEST9)"  $(DEVNULL)
-
-
-speedd2:
-	@$(CAT)  "$(TEST10)" "$(MPPDEC_TARGET)"   > $(DEVNULL)
-	@$(CAT)  "$(TEST10)" "$(MPPDEC_TARGET)"   > $(DEVNULL)
-	@$(NICE) time ./mppdec          "$(TEST10)" $(DEVNULL)
-	@$(NICE) time ./mppdec          "$(TEST10)" $(DEVNULL)
-	@$(NICE) time ../decorig/mppdec "$(TEST10)" $(DEVNULL)
-
-
-testd1:
-	./mppdec           "$(TEST4)" $(TEST11)
-	../decorig/mppdec "$(TEST4)" $(TEST12)
-	./wavcmp $(TEST11) $(TEST12) | $(LESS)
-	$(RM_F) $(TEST11) $(TEST12)
-
-
-testd2:
-	@./mppdec          "$(TEST9)" $(TEST11)
-	@../decorig/mppdec "$(TEST9)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) | $(LESS)
-	@$(RM_F) $(TEST11) $(TEST12)
-
-
-testd3:
-	@./mppdec          "$(TEST4)" $(TEST11)
-	@../decorig/mppdec "$(TEST4)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) > $(TMPFILE)
-	@$(RM_F) $(TEST11) $(TEST12)
-	@./mppdec          "$(TEST3)" $(TEST11)
-	@../decorig/mppdec "$(TEST3)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) >> $(TMPFILE)
-	@$(RM_F) $(TEST11) $(TEST12)
-	@./mppdec          "$(TEST2)" $(TEST11)
-	@../decorig/mppdec "$(TEST2)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) >> $(TMPFILE)
-	@$(RM_F) $(TEST11) $(TEST12)
-	@./mppdec          "$(TEST1)" $(TEST11)
-	@../decorig/mppdec "$(TEST1)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) >> $(TMPFILE)
-	@$(RM_F) $(TEST11) $(TEST12)
-	@$(LESS) $(TMPFILE)
-	@$(RM_F) $(TMPFILE)
-
-
-testd4:
-	@./mppdec          "$(TEST1)" $(TEST11)
-	@../decorig/mppdec "$(TEST1)" $(TEST12)
-	@./wavcmp $(TEST11) $(TEST12) >> $(TMPFILE)
-	@$(RM_F) $(TEST11) $(TEST12)
-
-
-speede1:
-	@-$(RM_F) $(TEST7) $(TEST8)
-	@$(LPAC) -x $(TEST5) $(TEST6)
-	@$(CAT) $(TEST6) > $(DEVNULL)
-	@./$(MPPENC_TARGET) $(TEST6) $(TEST7)
-	@$(CAT) $(TEST6) > $(DEVNULL)
-	@../encorig/mppenc $(TEST6) $(TEST8)
-
-
-speede2:
-	@-$(RM_F) $(TEST7) $(TEST8)
-	@$(CAT) $(TEST6) ./$(MPPENC_TARGET) > $(DEVNULL)
-	@$(NICE) ./$(MPPENC_TARGET) $(TEST6) $(TEST7)
-	@$(CAT) $(TEST6) > $(DEVNULL)
-	@../encorig/mppenc $(TEST6) $(TEST8)
-
-
-#################################################################################################################
-#
-# Backup of important files
-
-backup:
-	@make clean
-	@$(ZIP) -r ../codec_$(DATE).zip ./* -x $(BACKUP_EXCL)
-
-
-#################################################################################################################
-#
-# Installing all binary files
-
-##install:
-##	@make
-##	@-mount -o remount,rw /usr &> $(DEVNULL)
-##	@-$(CP_F)                      {mppdec,mppdec16,mppdec24,mppdec32,mppenc}{,-static,-diet} /usr/local/bin
-##	@-$(CHOWN)  0.0 /usr/local/bin/{mppdec,mppdec16,mppdec24,mppdec32,mppenc}{,-static,-diet}
-##	@-$(CHMOD) 4755 /usr/local/bin/{mppdec,mppdec16,mppdec24,mppdec32,mppenc}{,-static,-diet}
-##	@-$(CP_F)                      replaygain                                                 /usr/local/bin
-
-install:
-	@make
-	install -m 0755 mppenc$(EXEEXT) $(DESTDIR)/usr/bin/
-
-
-installv:
-	@make clean
-	@make mppenc
-	@-mount -o remount,rw /usr &> $(DEVNULL)
-	@-$(CP_F)                      mppenc /usr/local/bin/mppenc-${MPPENC_VERSION}
-	@-mount -o remount,ro /usr &> $(DEVNULL)
-
-
-websrc:
-	@chmod 755 Remove.tab
-	@./Remove.tab -v {.,*,*/*,*/*/*,*/*/*/*}/*.{c,cpp,h,inc,nas,txt,htm,html}
-	@make mrproper
-	@$(RM_F) website/src/{mppdec,mppenc,winamp,xmms}-*.{tar.gz,tar.bz2,tar.Z,zip,pgp}
-	@-$(MKDIR) mppdec-${MPPDEC_VERSION} mppenc-${MPPENC_VERSION} winamp-${WINAMP_VERSION} xmms-${XMMS_VERSION}
-	@$(CP_F) $(MPPDEC_PACKAGE) mppdec-${MPPDEC_VERSION}
-	@$(CP_F) $(MPPENC_PACKAGE) mppenc-${MPPENC_VERSION}
-	@$(CP_F) $(WINAMP_PACKAGE) winamp-${WINAMP_VERSION}
-	@$(CP_F) $(XMMS_PACKAGE)   xmms-${XMMS_VERSION}
-	@-$(CHOWN) -R nobody.nogroup mppdec-${MPPDEC_VERSION} mppenc-${MPPENC_VERSION} winamp-${WINAMP_VERSION} xmms-${XMMS_VERSION}
-	@$(TAR) cf - mppdec-${MPPDEC_VERSION} | bzip2 -9 > website/src/mppdec-${MPPDEC_VERSION}.tar.bz2
-	@$(TAR) cf - mppenc-${MPPENC_VERSION} | bzip2 -9 > website/src/mppenc-${MPPENC_VERSION}.tar.bz2
-	@$(TAR) cf - winamp-${WINAMP_VERSION} | bzip2 -9 > website/src/winamp-${WINAMP_VERSION}.tar.bz2
-	@$(TAR) cf - xmms-${XMMS_VERSION}     | bzip2 -9 > website/src/xmms-${XMMS_VERSION}.tar.bz2
-	@$(RM_RF) mppdec-${MPPDEC_VERSION} mppenc-${MPPENC_VERSION} winamp-${WINAMP_VERSION} xmms-${XMMS_VERSION}
-	@$(PGP) -e website/src/mppenc-${MPPENC_VERSION}.tar.bz2 MPEGplus
-	@$(CHMOD) 644 website/src/*
-
-
-zip:
-	@make websrc
-	@/usr/local/bin/gz website/src/mpp*.tar.bz2
-	@-mdel z:mpp??c*.tar.gz
-	@-mcopy website/src/mpp??c*.tar.gz z:
-	@-mdel a:mpp??c*.tar.gz
-	@-mcopy website/src/mpp??c*.tar.gz a:
-
-
-send:
-	@make websrc
-	@make onlysendsource
-
-
-onlysendsource:
-	@echo Sending Sources ...
-	@$(ENCODE) website/src/mppdec-${MPPDEC_VERSION}.tar.bz2 website/src/mppdec-${MPPDEC_VERSION}-$(DATE).tar.bz2     | $(MAIL) -s "Source Decoder (${MPPDEC_VERSION}) ($(DATE))" $(BROADCAST_MPPDEC)
-	@$(ENCODE) website/src/mppenc-${MPPENC_VERSION}.tar.bz2 website/src/mppenc-${MPPENC_VERSION}-$(DATE).tar.bz2.pgp | $(MAIL) -s "Source Encoder (${MPPENC_VERSION}) ($(DATE))" $(BROADCAST_MPPENC)
-	@$(ENCODE) website/src/winamp-${WINAMP_VERSION}.tar.bz2 website/src/winamp-${WINAMP_VERSION}-$(DATE).tar.bz2     | $(MAIL) -s "Source WinAmp  (${WINAMP_VERSION}) ($(DATE))" $(BROADCAST_MPPDEC)
-	@$(ENCODE) website/src/xmms-${XMMS_VERSION}.tar.bz2     website/src/xmms-${XMMS_VERSION}-$(DATE).tar.bz2         | $(MAIL) -s "Source XMMS    (${XMMS_VERSION}) ($(DATE))" $(BROADCAST_MPPDEC)
-	@echo -e 'Bei Modifikationen bitte einsenden:\n\n\tQuelle (Zeitstempel der Mail: '$(DATE)')\n\tModifikationen bestimmt mit »diff -abBU5 alteDatei neueDatei«\n\nFrank Klemm (pfk@fuchs.offl.uni-jena.de)\n ' | $(MAIL) -s "Hinweis" $(BROADCAST)
-
-
-onlysendbinary:
-	@make
-	@$(BZIP2) < mppdec-static | $(ENCODE) mppdec-${MPPDEC_VERSION}-linux-IA32-libc6-static.bz2 | $(MAIL) -s "Programm D" $(BROADCAST)
-	@$(BZIP2) < mppenc-static | $(ENCODE) mppenc-${MPPENC_VERSION}-linux-IA32-libc6-static.bz2 | $(MAIL) -s "Programm E" $(BROADCAST)
-
-
-#################################################################################################################
-#
-#
-
-linux:
-	@USE_GCC272=yes make
-
-
-linstall: linux
-	@$(CP_F) $(MPPDEC_TARGET) ~/bin1/mppdec_pp
-	@$(CP_F) $(MPPENC_TARGET) ~/bin1/mppenc_pp
-	@$(CP_F) $(REPLAY_TARGET) ~/bin1/replaygain_pp
-
-
-solaris:
-	@USE_GCC272=yes _SUNOS=yes make
-
-
-sinstall: solaris
-	@$(CP_F) $(MPPDEC_TARGET) ~/bin/mppdec_pp
-	@$(CP_F) $(MPPENC_TARGET) ~/bin/mppenc_pp
-	@$(CP_F) $(REPLAY_TARGET) ~/bin/replaygain_pp
-
-
-######### end of Makefile ###################################################################################
-
-
Index: penc/trunk/Makefile.BeOS
===================================================================
--- /mppenc/trunk/Makefile.BeOS	(revision 96)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#
-#  Makefile for mppdec for BeOS R5 x86
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-CC       = cc
-RM_F     = rm -f
-#LDADD    = -lnet
-
-
-include version
-OPTIM    = -O3 -s
-
-WARN     =
-
-CFLAGS   = $(OPTIM) $(WARN) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\" -DMPP_DECODER
-
-TARGETS  = mppdec
-
-MAKEFILE = Makefile.nol
-
-#
-#  Dependencies am Ende noch mal abgleichen
-#
-
-OBJ = \
-	decode.o     \
-	http.o       \
-	huffsv46.o   \
-	huffsv7.o    \
-	id3tag.o     \
-	mppdec.o     \
-	profile.o    \
-	requant.o    \
-	synth.o      \
-	synthtab.o   \
-	tools.o      \
-	wave_out.o   \
-	stderr.o     \
-
-
-all:    $(TARGETS)
-
-mppdec: $(OBJ)
-	$(CC)         $(CFLAGS) $(OBJ) -o $(TARGETS)        $(LDADD)
-	$(CC) -static $(CFLAGS) $(OBJ) -o $(TARGETS)-static $(LDADD)
-
-config.h: mpp.h config.c
-	$(CC)    $(OPTIM)   -DMPP_DECODER    -o config config.c   $(LDADD)
-	@./config "$(CC) $(OPTIM) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-decode.o:   mpp.h config.h profile.h $(MAKEFILE) dump.c
-
-huffsv46.o: mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv7.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-id3tag.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-mppdec.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-requant.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-synth.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-synthtab.o: mpp.h config.h profile.h $(MAKEFILE)
-
-tools.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-wave_out.o: mpp.h config.h profile.h $(MAKEFILE)
-
-stderr.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-
-clean:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet config.h config
-
-mrproper:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet ./*~ ./*.bak ./*.obj a.out *.s DEADJOE mpp.lib config.h config
-
-install:
-	@strip mppdec
-	@cp mppdec /boot/home/config/bin
Index: penc/trunk/Makefile.Darwin
===================================================================
--- /mppenc/trunk/Makefile.Darwin	(revision 96)
+++ 	(revision )
@@ -1,106 +1,0 @@
-#
-#  Makefile for mppdec for Darwin/Mac OS X
-#
-#  Assumes ESD (Fink package esound)
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-CC       = gcc
-RM_F     = rm -f
-LDADD    = `esd-config --libs` -lesd
-
-include version
-
-# -m*=750 optimises for the G3
-OPTIM    = -O3 -mcpu=750 -mtune=750 -ffast-math -s
-
-WARN     = -Wno-long-double
-
-CFLAGS   = $(OPTIM) $(WARN) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\" -DMPP_DECODER `esd-config --cflags`
-
-TARGETS  = mppdec
-
-MAKEFILE = Makefile.darwin
-
-#
-#  Dependencies am Ende noch mal abgleichen
-#
-
-OBJ = \
-	decode.o        \
-	http.o          \
-	huffsv46.o      \
-	huffsv7.o       \
-	id3tag.o        \
-	mppdec.o        \
-	profile.o       \
-	requant.o       \
-	synth.o         \
-	synthtab.o      \
-	tools.o         \
-	wave_out.o      \
-	_setargv.o      \
-	dump.o          \
-	gain_analysis.o \
-	pipeopen.o      \
-	stderr.o
-
-
-all:    $(TARGETS)
-
-
-mppdec: $(OBJ)
-	$(CC)          $(CFLAGS) $(OBJ) -o $(TARGETS)        $(LDADD)
-
-
-config.h: mpp.h config.c
-	$(CC)         $(OPTIM)    -DMPP_DECODER     -o config config.c   $(LDADD)
-	@./config "$(CC) $(OPTIM) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-
-
-decode.o:       mpp.h config.h profile.h $(MAKEFILE) dump.c
-
-http.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv46.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv7.o:      mpp.h config.h profile.h $(MAKEFILE)
-
-id3tag.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-mppdec.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-requant.o:      mpp.h config.h profile.h $(MAKEFILE)
-
-synth.o:        mpp.h config.h profile.h $(MAKEFILE)
-
-synthtab.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-tools.o:        mpp.h config.h profile.h $(MAKEFILE)
-
-wave_out.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-_setargv.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-dump.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-gain_analysis.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-http.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-pipeopen.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-stderr.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-
-clean:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static config.h config
-
-mrproper:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static ./*~ ./*.bak ./*.obj a.out *.s DEADJOE mpp.lib config.h config
-
-install:
-	@strip mppdec
-	@cp mppdec /usr/local/bin
Index: penc/trunk/Makefile.bsd
===================================================================
--- /mppenc/trunk/Makefile.bsd	(revision 96)
+++ 	(revision )
@@ -1,94 +1,0 @@
-#
-#  Makefile for mppdec for BSD
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-CC       = cc
-RM_F     = rm -f
-LDADD    = -lm `esd-config --libs`
-#LDADD  += -lesd
-#LDADD  += -lossaudio
-
-include version
-OPTIM    = -O3 -march=pentiumpro -ffast-math -s
-
-WARN     =
-
-CFLAGS   = $(OPTIM) $(WARN) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\" -DMPP_DECODER `esd-config --cflags`
-
-TARGETS  = mppdec
-
-MAKEFILE = Makefile.nol
-
-#
-#  Dependencies am Ende noch mal abgleichen
-#
-
-OBJ = \
-	decode.o     \
-	http.o       \
-	huffsv46.o   \
-	huffsv7.o    \
-	id3tag.o     \
-	mppdec.o     \
-	profile.o    \
-	requant.o    \
-	synth.o      \
-	synthtab.o   \
-	tools.o      \
-	wave_out.o   \
-	stderr.o     \
-	cpu_feat.o   \
-	synthasm.o   \
-	_setargv.o   \
-
-
-all:    $(TARGETS)
-
-mppdec: $(OBJ)
-	$(CC)         $(CFLAGS) $(OBJ) -o $(TARGETS)        $(LDADD)
-	$(CC) -static $(CFLAGS) $(OBJ) -o $(TARGETS)-static $(LDADD)
-
-config.h: mpp.h config.c
-	$(CC) $(OPTIM) -DMPP_DECODER `esd-config --cflags` -o config config.c $(LDADD)
-	@./config "$(CC) $(OPTIM) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-decode.o:   mpp.h config.h profile.h $(MAKEFILE) dump.c
-
-huffsv46.o: mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv7.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-id3tag.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-mppdec.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-requant.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-synth.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-synthtab.o: mpp.h config.h profile.h $(MAKEFILE)
-
-tools.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-wave_out.o: mpp.h config.h profile.h $(MAKEFILE)
-
-stderr.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-cpu_feat.o: tools.inc
-	nasm -f elf cpu_feat.nas
-
-synthasm.o: tools.inc
-	nasm -f elf synthasm.nas
-
-
-clean:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet config.h config
-
-mrproper:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet ./*~ ./*.bak ./*.obj a.out *.s DEADJOE mpp.lib config.h config
-
-install:
-	@strip mppdec
-	@cp mppdec /usr/local/bin
Index: penc/trunk/Makefile.nol
===================================================================
--- /mppenc/trunk/Makefile.nol	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-#  Makefile for mppdec for generic ANSI-C compiler
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-CC       = cc
-RM_F     = rm -f
-LDADD    = -lm
-#LDADD  += -lesd
-#LDADD  += -lossaudio
-
-include version
-OPTIM    = -O3 -s
-
-WARN     =
-
-CFLAGS   = -DMPP_DECODER $(OPTIM) $(WARN) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\"
-
-TARGETS  = mppdec
-
-MAKEFILE = Makefile.nol
-
-#
-#  Dependencies am Ende noch mal abgleichen
-#
-
-OBJ = \
-	decode.o         \
-	http.o           \
-	huffsv46.o       \
-	huffsv7.o        \
-	id3tag.o         \
-	mppdec.o         \
-	profile.o        \
-	requant.o        \
-	synth.o          \
-	synthtab.o       \
-	tools.o          \
-	wave_out.o       \
-	_setargv.o       \
-	dump.o           \
-	gain_analysis.o  \
-	http.o           \
-	pipeopen.o       \
-	stderr.o         \
-
-
-all:    $(TARGETS)
-
-mppdec: $(OBJ)
-	$(CC)         $(CFLAGS) $(OBJ) -o $(TARGETS)        $(LDADD)
-	$(CC) -static $(CFLAGS) $(OBJ) -o $(TARGETS)-static $(LDADD)
-
-config.h: mpp.h config.c
-	$(CC)         $(OPTIM)    -DMPP_DECODER     -o config config.c   $(LDADD)
-	@./config "$(CC) $(OPTIM) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-decode.o:   mpp.h config.h profile.h $(MAKEFILE) dump.c
-
-huffsv46.o: mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv7.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-id3tag.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-mppdec.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-requant.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-synth.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-synthtab.o: mpp.h config.h profile.h $(MAKEFILE)
-
-tools.o:    mpp.h config.h profile.h $(MAKEFILE)
-
-wave_out.o: mpp.h config.h profile.h $(MAKEFILE)
-
-_setargv.o: mpp.h config.h profile.h $(MAKEFILE)
-
-dump.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-gain_analysis.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-http.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-pipeopen.o: mpp.h config.h profile.h $(MAKEFILE)
-
-stderr.o:   mpp.h config.h profile.h $(MAKEFILE)
-
-
-clean:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet config.h config
-
-mrproper:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static $(TARGETS)-diet ./*~ ./*.bak ./*.obj a.out *.s DEADJOE mpp.lib config.h config
-
-install:
-	@strip mppdec
-	@cp mppdec /usr/local/bin
Index: penc/trunk/Makefile.sun
===================================================================
--- /mppenc/trunk/Makefile.sun	(revision 96)
+++ 	(revision )
@@ -1,107 +1,0 @@
-#
-#  Makefile for mppdec for Sun C compiler
-#  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-
-CC       = cc -xCC
-RM_F     = rm -f
-LDADD    = -lm -lrt
-LDADD   += -lsocket -lnsl
-#LDADD  += -lesd
-#LDADD  += -lossaudio
-
-include version
-OPTIM    = -native -xO5 -fast -s
-
-WARN     =
-
-CFLAGS   = -DMPP_DECODER $(OPTIM) $(WARN) -DMPPDEC_VERSION=\"$(MPPDEC_VERSION)\"
-
-TARGETS  = mppdec
-
-MAKEFILE = Makefile.sun
-
-#
-#  Dependencies am Ende noch mal abgleichen
-#
-
-OBJ = \
-	decode.o        \
-	http.o          \
-	huffsv46.o      \
-	huffsv7.o       \
-	id3tag.o        \
-	mppdec.o        \
-	profile.o       \
-	requant.o       \
-	synth.o         \
-	synthtab.o      \
-	tools.o         \
-	wave_out.o      \
-	_setargv.o      \
-	dump.o          \
-	gain_analysis.o \
-	http.o          \
-	pipeopen.o      \
-	stderr.o
-
-
-all:    $(TARGETS)
-
-
-mppdec: $(OBJ)
-	$(CC)          $(CFLAGS) $(OBJ) -o $(TARGETS)        $(LDADD)
-	$(CC) -Bstatic $(CFLAGS) $(OBJ) -o $(TARGETS)-static $(LDADD)
-
-
-config.h: mpp.h config.c
-	$(CC)         $(OPTIM)    -DMPP_DECODER     -o config config.c   $(LDADD)
-	@./config "$(CC) $(OPTIM) -o <<EXE>> <<SRC>> $(LDADD)" "./<<EXE>>"
-	@$(RM_F) config
-
-
-
-decode.o:       mpp.h config.h profile.h $(MAKEFILE) dump.c
-
-http.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv46.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-huffsv7.o:      mpp.h config.h profile.h $(MAKEFILE)
-
-id3tag.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-mppdec.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-requant.o:      mpp.h config.h profile.h $(MAKEFILE)
-
-synth.o:        mpp.h config.h profile.h $(MAKEFILE)
-
-synthtab.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-tools.o:        mpp.h config.h profile.h $(MAKEFILE)
-
-wave_out.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-_setargv.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-dump.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-gain_analysis.o:  mpp.h config.h profile.h $(MAKEFILE)
-
-http.o:         mpp.h config.h profile.h $(MAKEFILE)
-
-pipeopen.o:     mpp.h config.h profile.h $(MAKEFILE)
-
-stderr.o:       mpp.h config.h profile.h $(MAKEFILE)
-
-
-clean:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static config.h config
-
-mrproper:
-	@$(RM_F) *.o *.lst $(TARGETS) $(TARGETS)-static ./*~ ./*.bak ./*.obj a.out *.s DEADJOE mpp.lib config.h config
-
-install:
-	@strip mppdec
-	@cp mppdec /usr/local/bin
Index: penc/trunk/Makeintel.bat
===================================================================
--- /mppenc/trunk/Makeintel.bat	(revision 96)
+++ 	(revision )
@@ -1,33 +1,0 @@
-@echo off
-
-cls
-
-SET NASM=nasmw.EXE
-SET CFLAGS=/Gr /nologo /O3 /QIfist /Qpc64 /Qrestrict /Qsox- /Qunroll12 /Qwp_ipo
-SET FILES=decode.c huffsv46.c huffsv7.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release\cpu_feat.obj Release\synthasm.obj setargv.obj user32.lib winmm.lib
- ws2_32.lib
-
-del compile*.log 
-del *.lst
-
-mkdir Release
-%NASM% -f win32 -o Release\cpu_feat.obj -l cpu_feat.lst cpu_feat.nas
-%NASM% -f win32 -o Release\synthasm.obj -l synthasm.lst synthasm.nas
-
-icl /GB /QaxW /Feconfig.exe      %CFLAGS% config.c
-.\config.exe
-
-icl /GB /QaxW /Femppdec.exe      %CFLAGS% %FILES% > compile.log
-icl /G5       /Femppdec_P1.exe   %CFLAGS% %FILES% > compile_P1.log
-icl /G5 /QxM  /Femppdec_PMMX.exe %CFLAGS% %FILES% > compile_PMMX.log
-icl /G6 /Qxi  /Femppdec_PPro.exe %CFLAGS% %FILES% > compile_PPro.log
-icl /G6 /QxiM /Femppdec_P2.exe   %CFLAGS% %FILES% > compile_P2.log
-icl /G6 /QxK  /Femppdec_P3.exe   %CFLAGS% %FILES% > compile_P3.log
-icl /G7 /QxW  /Femppdec_P4.exe   %CFLAGS% %FILES% > compile_P4.log
-
-echo.
-dir *.exe
-echo.
-
-.\mppdec_P2.exe /Archive/1.mpc /dev/null
-.\mppdec_P2.exe /Archive/1.mpc /dev/null
Index: penc/trunk/Makeintel.sh
===================================================================
--- /mppenc/trunk/Makeintel.sh	(revision 96)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#! /bin/bash
-
-clear
-
-icl /Ox /Ob2 /Og /Oi /Ot  /GB /QaxW  /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec      decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G5        /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_P1   decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G6 /Qxi   /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_PPro decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G5 /QxM   /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_PMMX decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G6 /QxiM  /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_P2   decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G6 /QxK   /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_P3   decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
-icl /Ox /Ob2 /Og /Oi /Ot  /G7 /QxW   /Gr /Gs /Qip /Qunroll12 /Qpc64 /QIfist /Femppdec_P4   decode.c huffsv7.c huffsv46.c id3tag.c mppdec.c requant.c synth.c synthtab.c tools.c wave_out.c Release/cpu_feat.o Release/synthasm.o
Index: penc/trunk/Makemsc.bat
===================================================================
--- /mppenc/trunk/Makemsc.bat	(revision 96)
+++ 	(revision )
@@ -1,22 +1,0 @@
-@echo off
-
-set include=D:\MSC\include
-set lib=D:\MSC\lib
-
-if exist *.obj	 del *.obj
-if exist mpp.lib del mpp.lib
-
-:::set opt=/W4 /G2 /Gr /Ot /Ol /Og /Oe /Oi /FPi87 /Gr /Gs
-set opt=/W4
-
-for %%i in (WAVE HUFF_NEW HUFF_OLD REQUANT SYNTH)	 do cl %opt% /c %%i.c
-for %%i in (DECODE MPPDEC TOOLS ID3TAG SYNTHTAB PROFILE) do cl %opt% /c %%i.c
-
-tlib mpp.lib /c +SYNTH.obj +HUFF_NEW.obj +HUFF_OLD.obj +REQUANT.obj +WAVE.obj +DECODE.obj
-tlib mpp.lib /c +MPPDEC.obj +TOOLS.obj +ID3TAG.obj +SYNTHTAB.obj +PROFILE.obj
-
-cl /Gr mppdec.obj mpp.lib
-diet mpp.exe > nul
-
-copy SV7test.mpp nul > nul
-mpp SV7test.mpp nul
Index: penc/trunk/Maketcc.bat
===================================================================
--- /mppenc/trunk/Maketcc.bat	(revision 96)
+++ 	(revision )
@@ -1,20 +1,0 @@
-@echo off
-
-tcc -ms -2 -f287 -DFILEIO=4 config.c
-.\config
-del config.exe
-
-if exist *.obj   del *.obj
-if exist mpp.lib del mpp.lib
-
-for %%i in (SYNTH HUFF_NEW HUFF_OLD REQUANT WAVE) do tcc -ms -DFILEIO=4 -2 -f287 -Z -G -O -c -k- %%i.c
-for %%i in (DECODE MPPDEC TOOLS ID3TAG SYNTHTAB PROFILE)  do tcc -ms -DFILEIO=4 -2 -f287 -Z -G -O -c -k- %%i.c
-
-tlib mpp.lib /c +SYNTH.obj +HUFF_NEW.obj +HUFF_OLD.obj +REQUANT.obj +WAVE.obj +DECODE.obj
-tlib mpp.lib /c +MPPDEC.obj +TOOLS.obj +ID3TAG.obj +SYNTHTAB.obj +PROFILE.obj
-
-tcc -2 -f287 -ms -empp.exe mpp.lib
-diet mpp.exe > nul
-
-copy SV7test.mpp nul > nul
-mpp SV7test.mpp nul
Index: penc/trunk/Makeztc.bat
===================================================================
--- /mppenc/trunk/Makeztc.bat	(revision 96)
+++ 	(revision )
@@ -1,12 +1,0 @@
-@echo off
-
-if exist mppz?.exe del mppz?.exe
-
-ztc -f -ms    -c          -v2 @makeztc.res
-ztc -f -ms    -omppz2.exe -v2 @makeztc.ret
-ztc -f -mx -3 -c	  -v2 @makeztc.res
-ztc -f -mx -3 -omppz3.exe -v2 @makeztc.ret
-
-copy  SV7test.mpp nul
-mppz2 SV7test.mpp nul
-mppz3 SV7test.mpp nul
Index: penc/trunk/Makeztc.res
===================================================================
--- /mppenc/trunk/Makeztc.res	(revision 96)
+++ 	(revision )
@@ -1,1 +1,0 @@
--o+dc -o+da -o+dv -o+reg -o+cse -o+vbe -o+time -o+li -o+liv -o+cp -o+cnp -o+w mppdec.c huffsv7.c huffsv46.c id3tag.c requant.c synthtab.c wave.c decode.c tools.c synth.c
Index: penc/trunk/Makeztc.ret
===================================================================
--- /mppenc/trunk/Makeztc.ret	(revision 96)
+++ 	(revision )
@@ -1,1 +1,0 @@
-mppdec.obj huffsv46.obj huffsv7.obj id3tag.obj requant.obj synthtab.obj wave.obj decode.obj tools.obj synth.obj
Index: penc/trunk/README
===================================================================
--- /mppenc/trunk/README	(revision 96)
+++ 	(revision )
@@ -1,45 +1,0 @@
-mppdec -- the MPEGplus compressed audio decoder
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This is a speed and portability optimized version of Andree Buschmann's
-MPEG-Plus decoder. Speed enhancement is about 1:4...1:5 relative to the
-original source. Some of these optimizations flood back to the original
-decoder, but especially on AMD K6-2/AMD K6-III/AMD Athlon/AMD Duron/Intel
-Pentium III/Intel Pentium 4 there's still some hand written assembler code
-so this decoder ist still much faster.
-
-
-Advantages of this Decoder:
-  * really fast!
-  * direct support of Audio devices under UNIX and Windows
-  * realtime support on Unix, Windows and POSIX 1.b systems
-  * support of AMDs 3DNow! and Intels SSE
-  * support of reading ID3 tags (version 1 and 1.1)
-  * multiple files support
-  * runs also on 16 and 64 bit CPUs, not only on 32 bit
-  * needs less memory
-  * 16...32 bit, dithering and noise shaping support
-  * Microsoft WAVE, Apple AIFF and Raw PCM support
-
-Features still missing:
-  * resync on errors
-  * audio support also for other Operating Systems,
-    Rewind/Review/Cue/Fast Forward support
-  * Divide decoder into lib and frontend
-
-Note: Recommentations and bug reports are welcome
-(use a realname and a valid e-Mail address!).
-
-
-The author of the file format and the original coder and decoder is
-Andree Buschmann. His MPEGplus web page and work you can find at:
-
-    http://www.stud.uni-hannover.de/user/73884/audiocoder.html
-
-The web page of mppdec you hold in your hands (you can also find
-precompiled binaries there) is:
-
-    http://www.uni-jena.de/~pfk/mpp/
-
---
-Frank Klemm <pfk@schnecke.offl.uni-jena.de>
Index: penc/trunk/Remove.comment
===================================================================
--- /mppenc/trunk/Remove.comment	(revision 96)
+++ 	(revision )
@@ -1,19 +1,0 @@
-#! /bin/bash
-
-if [ "$1" = "-c" ]; then
-    # Replace //-Comments (C99/C++) with /*-Comments-*/
-    shift
-    while [ ! "$1" = "" ]; do
-        sed 's|//.*$|/\*& \*/|' < $1 | sed 's|/\*//|/\*|' > $1_x_x
-        mv -f $1_x_x $1
-        shift
-    done
-else
-    # convert ANSI-C to K&R
-    while [ ! "$1" = "" ]; do
-        # replacement of whole words only !!!!
-        ansi2knr < $1 | sed 's/const //g' | sed 's/( void )/()/' | sed 's/(void)//' | sed 's/void\* /char* /g' | sed 's/void/int/g' | sed 's/ signed / /g' > $1_x_x
-        mv -f $1_x_x $1
-        shift
-    done
-fi
Index: penc/trunk/Remove.tab.c
===================================================================
--- /mppenc/trunk/Remove.tab.c	(revision 96)
+++ 	(revision )
@@ -1,269 +1,0 @@
-/*
- *  In-place file filter
- */
-
- /* To do: inplace old data write test */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#ifndef _WIN32
-# include <unistd.h>
-# include <sys/time.h>
-# include <sys/ioctl.h>
-#else
-typedef signed long ssize_t;
-# include <io.h>
-# include <time.h>
-#define ftruncate( fd, olen )   _chsize(fd, olen)
-#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-
-
-#ifndef O_BINARY
-# ifdef _O_BINARY
-#  define O_BINARY      _O_BINARY
-# else
-#  define O_BINARY      0
-# endif
-#endif
-
-
-int verbose  = 0;
-int Makefile = 0;
-
-/*
- *  Transform Tabulators to Spaces using 'tabsize'
- *  Remove Ctrl-M, Spaces and Tabulators at the end of lines
- *  Stop file interpreting at Ctrl-Z
- *  Remove multiple linefeeds at the end of a file
- */
-
-size_t
-convert ( char* dst, const char* src, ssize_t ilen, unsigned int tabsize )
-{
-    char*         d;
-    const char*   srce;
-    unsigned int  col;
-    unsigned int  n;
-
-
-    for ( srce = src + ilen, d = dst, col = 0; src < srce; src++ ) {
-        switch ( *src ) {
-        case '\x1A':
-            srce = src;
-        case '\n':
-            while ( d > dst  &&  d[-1] == '\r' ) d--;
-            while ( d > dst  &&  d[-1] == ' '  ) d--;
-            *d++ = '\n';
-            col  = 0;
-            if (Makefile) {
-                if ( src[1] == ' '  ||  src[1] == '\t' ) {
-                    while ( src[1] == ' '  ||  src[1] == '\t' )
-                        src++;
-                    *d++ = '\t';
-                }
-            }
-            break;
-        case '\t':
-            n = tabsize - col % tabsize;
-            memset ( d, ' ', n );
-            d   += n;
-            col += n;
-            break;
-        default:
-            *d++ = *src;
-            col++;
-            break;
-        }
-    }
-    *d++ = '\n';
-
-    while ( d > dst  &&  d[-1] == '\n'  &&  d[-2] == '\n' ) d--;
-    if ( d-1 == dst  &&  d[-1] == '\n' ) d--;
-
-    return d - dst;
-}
-
-/*
- *  Transform a file in-place. To avoid data loss, it uses atomic overwrite of data.
- *  new file < old file:
- *    - rewind
- *    - write all new data with one atomic write
- *    - cut size to new size
- *  new file == old file:
- *    - rewind
- *    - write all new data with one atomic write
- *  new file > old file:
- *    - seek to end
- *    - append data, if it fails, cut size down to old size and exit
- *    - rewind
- *    - write all new data with one atomic write
- */
-
-int
-process ( const char* filename, unsigned int tabsize )
-{
-    static char  input  [4 * 1024 * 1024];
-    static char  output [4 * 1024 * 1024];
-    ssize_t      ilen;
-    ssize_t      olen;
-    ssize_t      owrite;
-    int          fd;
-    int          ret = 0;
-    const char*  msg = NULL;
-
-    fd = open ( filename, O_RDWR | O_BINARY );
-
-    if ( fd < 0 ) {
-        msg = "File can't be opened in Read/Write mode";
-        goto end;
-    }
-
-    ilen = read ( fd, input, sizeof input );
-    olen = convert ( output, input, ilen, tabsize );
-
-    if ( ilen >= sizeof input  ||  olen >= sizeof output ) {
-        msg = "File is too large for this convert program";
-        goto end;
-    }
-
-    if      ( olen < ilen ) {                                   // smaller
-        if ( 0 != lseek ( fd, 0L, SEEK_SET ) ) {
-            msg = "Lseek failed. File not modified";
-            goto end;
-        }
-        owrite = write ( fd, output, olen );                    // atomic overwrite
-        if ( owrite <= 0 ) {
-            msg = "Writing new file failed";
-            goto end;
-        }
-        if ( owrite != olen ) {
-            msg = "Writing new file incomplete. *** DATA LOSS *** ";
-            goto end;
-        }
-        ftruncate ( fd, olen );
-        if ( verbose )
-            fprintf ( stderr, "Converted '%s'\n", filename );
-        ret = 1;
-    }
-    else if ( olen > ilen ) {                                   // larger
-        if ( ilen != lseek ( fd, ilen, SEEK_SET ) ) {
-            msg = "Lseek failed. File not modified";
-            goto end;
-        }
-        owrite = write ( fd, output + ilen, olen - ilen );      // append
-        if ( owrite <= 0 ) {
-            msg = "Writing new file failed";
-            goto end;
-        }
-        if ( owrite != olen - ilen ) {
-            ftruncate ( fd, ilen );
-            msg = "Writing new file incomplete";
-            goto end;
-        }
-        if ( 0 != lseek ( fd, 0L, SEEK_SET ) ) {
-            msg = "Rewind failed. File not modified";
-            goto end;
-        }
-        owrite = write ( fd, output, olen );
-        if ( owrite <= 0 ) {
-            msg = "Writing new file failed";
-            goto end;
-        }
-        if ( owrite != olen ) {
-            msg = "Writing new file incomplete. *** DATA LOSS *** ";
-            goto end;
-        }
-        if ( verbose )
-            fprintf ( stderr, "Converted '%s'\n", filename );
-        ret = 1;
-    }
-    else if ( 0 != memcmp (input, output, ilen) ) {
-        if ( 0 != lseek ( fd, 0L, SEEK_SET ) ) {
-            msg = "Lseek failed. File not modified";
-            goto end;
-        }
-        owrite = write ( fd, output, olen );
-        if ( owrite <= 0 ) {
-            msg = "Writing new file failed";
-            goto end;
-        }
-        if ( olen !=  owrite ) {
-            msg = "Writing new file incomplete. *** DATA LOSS *** ";
-            goto end;
-        }
-        if ( verbose )
-            fprintf ( stderr, "Converted '%s'\n", filename );
-        ret = 1;
-    }
-
-end:
-    if ( fd >= 0 )
-        close (fd);
-    if ( msg != NULL ) {
-        fprintf ( stderr, msg );
-        fprintf ( stderr, ": %s  (%s)\n", filename, strerror (errno) );
-    }
-    return ret;
-}
-
-
-/*
- *  determine tab size (default: 8)
- *  do converting file for file
- */
-
-void mysetargv ( int* argc, char*** argv, const char** extentions );
-
-int complete_read ( int fd, void* ptr, size_t len )
-{
-    return read ( fd, ptr, len );
-}
-
-int
-main ( int argc, char** argv )
-{
-    unsigned int  tabsize = 8;
-    unsigned int  changed = 0;
-    static const char*  extentions [] = { ".c", ".cpp", ".h", ".hpp", ".htm", ".html", ".nas", ".inc", ".s", NULL };
-
-    if ( argv[1] != NULL  &&  argv[1][0] == '-'  &&  argv[1][1] == 'v'  &&  argv[1][2] == '\0' ) {
-        verbose = 1;
-        ++argv;
-        argc--;
-    }
-
-    if ( argv[1] != NULL  &&  argv[1][0] == '-'  &&  (unsigned int)(argv[1][1]-'0') < 10u ) {
-        tabsize = atoi ( *++argv + 1 );
-        argc--;
-    } else if ( argv[1] != NULL  &&  argv[1][0] == '+'  &&  (unsigned int)(argv[1][1]-'0') < 10u ) {
-        Makefile = 1;
-        tabsize = atoi ( *++argv + 1 );
-        argc--;
-    }
-
-    if ( argv[1] == NULL ) {
-        fprintf ( stderr, "usage: Remove.tab [-v] [-tabsize] file [file...]\n" );
-        fprintf ( stderr, "       Remove.tab [-v] +tabsize file [file...] for Makefile\n" );
-        return 1;
-    }
-
-    mysetargv ( &argc, &argv, extentions );
-
-    if ( verbose )
-        fprintf ( stderr, "Tabsize is %u.\n", tabsize );
-
-    while ( *++argv )
-        changed += process ( *argv, tabsize );
-
-    if ( changed )
-        fprintf ( stderr, "%u files modified.\n", changed );
-
-    return 0;
-}
-
-/* end of Remove.tab.c */
Index: penc/trunk/Remove.tab.dsp
===================================================================
--- /mppenc/trunk/Remove.tab.dsp	(revision 96)
+++ 	(revision )
@@ -1,104 +1,0 @@
-# Microsoft Developer Studio Project File - Name="Remove.tab" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=Remove.tab - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "Remove.tab.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "Remove.tab.mak" CFG="Remove.tab - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "Remove.tab - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Remove.tab - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "Remove.tab - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "Remove.tab - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "Remove.tab - Win32 Release"
-# Name "Remove.tab - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\_setargv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\Remove.tab.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/Remove.tab.vcproj
===================================================================
--- /mppenc/trunk/Remove.tab.vcproj	(revision 96)
+++ 	(revision )
@@ -1,184 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="Remove.tab"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/Remove.tab.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/Remove.tab.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/Remove.tab.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/Remove.tab.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;MPP_DECODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/Remove.tab.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/Remove.tab.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/Remove.tab.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/Remove.tab.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="_setargv.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Remove.tab.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/SHOWDIFFS
===================================================================
--- /mppenc/trunk/SHOWDIFFS	(revision 96)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#! /bin/bash
-
-oldpath="$1"
-newpath="$2"
-
-
-if [ "${oldpath}" = "" -o "${newpath}" = "" ]; then
-    echo usage: $0  old_dir  new_dir
-    exit
-fi
-
-
-killall -9 mgdiff &> /dev/null
-echo
-diffcount=0
-
-
-for oldfile in "${oldpath}"/*; do
-
-    newfile="${newpath}/${oldfile##*/}"
-    
-    if [ "${oldfile##*.}" = "o" -o "${oldfile##*.}" = "lst" ]; then
-        echo "${oldfile} not compared, uninteresting"
-    elif [ ! -f "${oldfile}" -o ! -f ${newfile} ]; then
-        echo "${oldfile} or ${newfile} is not a regular file"
-    else
-        if ! diff -abB "${oldfile}" "${newfile}" &> /dev/null; then
-            echo "${oldfile}" and "${newfile}" are different
-            sleep $[diffcount*diffcount/2]
-            mgdiff "${oldfile}" "${newfile}" &
-            diffcount=$[diffcount+1]
-        fi
-    fi
-done
-
-
-echo
-if   [ "${diffcount}" = "0" ]; then
-    echo "no differences found"
-elif [ "${diffcount}" = "1" ]; then
-    echo "1 file is different"
-else
-    echo ${diffcount} "files are different"
-fi
-echo
Index: penc/trunk/Summary
===================================================================
--- /mppenc/trunk/Summary	(revision 96)
+++ 	(revision )
@@ -1,39 +1,0 @@
-                                Intel PII-300   AMD K6-2-315    AMD K6-2-315    AMD K6-2-315    AMD K6-2-315
-                                                (3DNow!)                        (3DNow!)        (3DNow!)
-                                gcc-2.95.2      gcc-2.95.2      gcc-2.95.2      gcc-2.95.2      gcc-2.95.2
-
-Synthese_Filter_16()            3,85 s          1,89 s 1)       7,52 s          1,80 s          1,70 s          1,96 s          1,67 s
-memmove()                       0,26 s          0,31 s          0,27 s          0,26 s          0,44 s          0,44 s          0,31 s
-Huffman_Decode()+_fast()        3,34 s          2,20 s          2,21 s          2,10 s          1,66 s          1,60 s          1,23 s
-Calculate_New_V()               1,51 s          3,62 s 2)       4,04 s          1,15 s          0,97 s          0,96 s          0,88 s
-Lese_Bitstrom_SV7()             2,22 s          1,41 s          1,44 s          1,45 s          1,59 s          1,47 s          1,50 s
-Requantisierung()               0,83 s          1,04 s          1,06 s          0,59 s          0,61 s          0,63 s          0,63 s
-Bitstream_read()                0,17 s          0,10 s          0,10 s          0,09 s          0,11 s          0,10 s          0,16 s
-
-TOTAL                           12,47 s         10,90 s         16,96 s         7,64 s          7,26 s          7,33 s          6,61 s
-
-1) Main functionality is branched out to a 3DNow!-Routine
-   this functionality has been sped up by the factor 8.
-2) Some floating-point-copying with the integer unit.
-
-
-
-
-------------------------------------------------------------------------------
-100.0%     2086.467117 ms   *** TOTAL ***                         [701.6 MHz]
- 27.92%     582.506630 ms   Lese_Bitstrom_SV7()                   decode.c:525
- 21.75%     453.756631 ms   Synthese_Filter_16_3DNow()             synth.c:378
- 20.63%     430.395686 ms   Huffman_Decode_fastest()              decode.c:229
- 15.77%     329.139172 ms   Synthese_Filter_16_3DNow()             synth.c:389
-  3.61%      75.252374 ms   Requantize_MidSideStereo()             tools.c:160
-  2.83%      59.118796 ms   Huffman_Decode()                      decode.c:146
-  2.05%      42.766131 ms   Bitstream_read1()                     decode.c:104
-  2.02%      42.195878 ms   Synthese_Filter_16_3DNow()             synth.c:383
-  1.46%      30.471017 ms   Read_LittleEndians()                   tools.c:101
-  0.75%      15.669079 ms   Bitstream_read()                      decode.c:74
-  0.55%      11.377206 ms   fwrite_with_test()                      wave.c:26
-  0.41%       8.509899 ms   Decode()                              mppdec.c:84
-  0.16%       3.266557 ms   DecodeFile()                          mppdec.c:277
-  0.05%       1.110525 ms   write_PCM_2x16bit()                     wave.c:169
-  0.04%       0.931536 ms   main()                                mppdec.c:455
-------------------------------------------------------------------------------
Index: penc/trunk/_setargv.c
===================================================================
--- /mppenc/trunk/_setargv.c	(revision 96)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppdec.h"
-
-#ifndef _WIN32
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <unistd.h>
-# include <dirent.h>
-# include <ctype.h>
-#else
-# include <stdlib.h>
-#endif
-
-/*
- *  Function type which is called by treewalk.
- *  The function gets the next filename and an auxiliary pointer.
- *  The function and the auxillary pointer are the last two parameters
- *  of treewalk. The function do the desired stuff and often you
- *  need a context for this function and for that this pointer can be used.
- */
-
-typedef int (*leaffn) ( const char* filename, void* aux );
-
-
-/*
- *  Array structure:
- *      length:  maximum number of elements you can store in the structure
- *      elems:   actual number of elements stored in the structure (elem <= length)
- *      array:   elements stored in the structure
- */
-
-typedef struct {
-    size_t    length;
-    size_t    elems;
-    char**    array;
-} argc_t;
-
-
-/*
- *  Check the 'filename' for the extention 'ext'.
- *  Returns 1 if filename has this extention, otherwise 0.
- *  Allowed wildcard in ext is currently the '?'.
- */
-
-static int
-extcompare ( const char* filename, const char* ext )
-{
-    if ( strlen (filename) < strlen (ext) )
-        return 0;
-
-    filename += strlen (filename) - strlen (ext);
-    for ( ; *ext; ext++, filename++ ) {
-        if ( *ext != '?' )
-            if ( *ext != *filename )
-                return 0;
-    }
-    return 1;
-}
-
-
-/*
- *  Walk trough a tree starting with 'start', searching for files with the extensions
- *  mask[0], mask[1], ... (NULL terminated list of extensions containing the ".").
- *  For each file 'f' is called with the filename and the parameter 'aux'.
- */
-
-#ifdef _WIN32
-
-long
-treewalk ( const char* start, const char** mask, leaffn f, void* aux )
-{
-    struct _finddata_t  fileinfo;
-    long                handle;
-    char                all [4096];
-    int                 i;
-    long                ret = 0;
-    const char*         name;
-    int                 path_len = strlen (start);
-
-    if ( path_len > 0  &&  start[path_len-1] == PATH_SEP )
-        path_len--;
-
-    sprintf ( all, "%.*s%c*", path_len, start, PATH_SEP );
-    if ( ( handle = _findfirst ( all, &fileinfo ) ) < 0 )
-        return 0;
-
-    do {
-        name = fileinfo.name;
-        sprintf ( all, "%.*s%c%s", path_len, start, PATH_SEP, name );
-        if ( ( fileinfo.attrib & _A_SUBDIR ) == 0 ) {   // file
-            for ( i = 0; mask[i]; i++ )
-                if ( extcompare (name, mask[i] ) ) {
-                    f (all, aux);
-                    ret++;
-                    break;
-                }
-        }
-        else {                                          // subdir
-            if ( 0 != strcmp (name, "." )  &&  0 != strcmp (name, "..") ) {
-                ret += treewalk ( all, mask, f, aux );
-            }
-        }
-
-    } while ( 0 == _findnext ( handle, &fileinfo) );
-
-    _findclose (handle);
-    return ret;
-}
-
-#else
-
-long
-treewalk ( const char* start, const char** mask, leaffn f, void* aux )
-{
-    DIR*                handle;
-    struct dirent*      de;
-    struct stat         b;
-    char                all [4096];
-    int                 i;
-    long                ret = 0;
-    const char*         name;
-    int                 path_len = strlen (start);
-
-    if ( path_len > 0  &&  start[path_len-1] == PATH_SEP )
-        path_len--;
-
-    if ( ( handle = opendir (start) ) == NULL )
-         return 0;
-
-    while ( NULL != ( de = readdir (handle) ) ) {
-        name = de -> d_name;
-        sprintf ( all, "%.*s%c%s", path_len, start, PATH_SEP, name );
-
-        if ( stat ( all, &b ) != 0 )
-            continue;
-
-        if     ( S_ISREG (b.st_mode) ) {                // file
-            for ( i = 0; mask[i]; i++ )
-                if ( extcompare (name, mask[i] ) ) {
-                    f (all, aux);
-                    ret++;
-                    break;
-                }
-        }
-        else if ( S_ISDIR (b.st_mode) ) {               // dir
-            if ( 0 != strcmp (name, "." )  &&  0 != strcmp (name, "..") ) {
-                ret += treewalk ( all, mask, f, aux );
-            }
-        }
-    }
-
-    closedir (handle);
-    return ret;
-}
-
-#endif
-
-/*
- *  A leaffn used by mysetargv(). aux is used as pointer to a argc_t structure,
- *  which is used for collecting all filenames in a list.
- */
-
-static int
-add_elem ( const char* filename, void* aux )
-{
-    argc_t*  p = (argc_t*) aux;
-
-    if ( p->elems >= p->length ) {
-        p->length += p->length / 2 + 512;
-        p->array = realloc ( p->array, sizeof(char*) * p->length );
-    }
-
-    p->array [p->elems++] = filename  ?  strdup (filename)  :  NULL;
-    // printf ("%s\n", filename );
-    return 0;
-}
-
-/*
- *  Used by mysetargv to sort files by the filename in ascending order.
- */
-
-static int Cdecl
-comparefilename ( const void* p1, const void* p2 )
-{
-    return strcmp ( *(const char**)p1, *(const char**)p2 );
-}
-
-
-/*
- * Other playlist formats I found:
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  *.txt
- *    |Location|Name|Artist|Album|Length|Genre|Year|Type|Size|Comment|Bitrate|Track #|Date|Custom 1|Custom 2|Custom 3|
- *    |D:\Audio\Video Streams\A Bug's Life.avi|A Bug's Life|||01:31:02|||avi|647.391MB||||7/3/2001 9:21:18 AM||||
- *
- * *.mpl:
- *    <Item Location="D:\Audio\Bohinta\[08] broken_one.mp3" Type="mp3">
- *
- * *.htm*:
- *    <TD ALIGN="left" ><FONT SIZE="2" COLOR="#000000" FACE="Arial">D:\Audio\Bohinta\[09] lament.mp3</FONT></TD>
- *
- */
-
-
-/*
- *  Read out all files in an M3U file.
- *  Relative file names are converted to absolute filenames
- *  using the path of the M3U file.
- *  'f' and 'aux' have the same meaning as in treewalk.
- *  'fp' is a descriptor to the source file, name is its name
- *  (used for converting relative to absolute file names).
- */
-
-static void
-readm3u ( FILE_T fp, const char* name, leaffn f, void* aux )
-{
-    unsigned char   ch;
-    unsigned char*  p;
-    unsigned char*  q = strrchr ( name, PATH_SEP );
-    unsigned char   buff [4096];
-
-    if (q == NULL) {
-        q = buff;
-    } else {
-        memcpy ( buff, name, (char*)q-(char*)name+1 );
-        q = buff + ((char*)q-(char*)name+1);
-    }
-
-    while ( 1 == READ1 (fp, &ch) ) {
-        if ( ch != '#'  &&  ch >= ' ' ) {
-            p = q;
-            do {
-                *p++ = ch;
-                if ( 1 != READ1 (fp, &ch)  ||  ch < ' ' )
-                    break;
-            } while (1);
-
-            *p = '\0';
-            if ( q[1] == DRIVE_SEP  ||  q[0] == PATH_SEP )              // This is a disgusting hack
-                f (q, aux );
-            else
-                f (buff, aux);
-        }
-
-        while ( ch != '\n' )
-            if ( 1 != READ1 (fp, &ch) )
-                return;
-    }
-}
-
-
-/*
- *  mysetargv() is the interface function for this module.
- *  You give the original _argv[_argc] list and a list of allowed file
- *  extensions for the directory search (this is a NULL terminated
- *  list of file extensions including the dot ".").
- *
- *  The function generates a new _argv[_argc] list and stores its
- *  parameters back to callers variables.
- *  Normal files are simply copied to the new list, files ending
- *  with the directory separator ("/" or "\") will be treated as
- *  directory trees and all files with allowed extensions are
- *  added to the list (instead of the directory). Files ending with
- *  ".m3u" will be read and the contents are added to the list.
- *
- *  What do not work?
- *     - m3u files inside an m3u file
- *     - playlist files in *.txt format
- *     - playlist files in *.mpl format
- *     - playlist files in *.htm/*.html format
- */
-
-void
-mysetargv ( int* _argc, char*** _argv, const char** extentions )
-{
-    const char*  m3u = ".m3u";
-    argc_t       arg;
-    char*        p;
-    int          i;
-    size_t       j;
-    FILE_T       fp;
-
-    arg.length = 0;
-    arg.elems  = 0;
-    arg.array  = NULL;
-
-    for ( i = 0; i < *_argc; i++ ) {
-        p = (*_argv) [i];
-        if ( strlen(p) >= strlen(m3u)  &&  0 == strcasecmp (p+strlen(p)-strlen(m3u), m3u) ) {
-            fp = OPEN (p);
-            readm3u ( fp, p, add_elem, &arg );
-            CLOSE (fp);
-        }
-        else if ( p[0] == '\0'  ||  p[strlen(p)-1] != PATH_SEP ) {
-            add_elem ( p, &arg );
-        }
-        else {
-            j = arg.elems;
-            treewalk ( p, extentions, add_elem, &arg );
-            qsort ( arg.array + j, arg.elems - j, sizeof(char*), comparefilename );
-        }
-    }
-
-    add_elem ( NULL, &arg );
-    arg.array = realloc ( arg.array, sizeof(char*) * arg.elems );
-
-    *_argc = arg.elems - 1;
-    *_argv = arg.array;
-    return;
-}
-
-/* end of _setargv.c */
Index: penc/trunk/aaa.c
===================================================================
--- /mppenc/trunk/aaa.c	(revision 96)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#include <stdio.h>
-#include <math.h>
-
-#define QUANT   256
-
-double  A  [18] [QUANT];
-long    B  [18] [QUANT];
-double  C  [18] [QUANT];
-double  AA [18];
-long    BB [18];
-
-/*
- 1[  0]:     0.841315 (   8)
- 1[  5]:     0.603536 (   1)
- 1[  6]:     0.697221 (   1)
- 1[  8]:     0.777310 (   1)
-
-*/
-
-int
-main ( void )
-{
-    int     i, j;
-    char    buff [256];
-    int     res, eff, events;
-    double  mult;
-    double  D;
-
-    while ( gets ( buff ) ) {
-        if ( 4 == sscanf ( buff, "%u[%u]: %lf (%u)", &res, &eff, &mult, &events )   &&  mult >= 0.01  &&  mult <= 100. ) {
-            A  [res] [eff] += events * mult;
-            B  [res] [eff] += events;
-            AA [res]       += events * mult;
-            BB [res]       += events;
-        }
-    }
-
-    for ( i = 1; i < 18; i++ )
-        for ( j = 0; j < QUANT; j++ )
-            if ( B [i] [j] )
-                printf ( "%2u[%3u]: %8.6f (%8lu)\n", i, j, A[i][j]/B[i][j], B[i][j] );
-
-    for ( i = 1; i < 18; i++ )
-        if ( BB [i] )
-            printf ( "%2u: %8.6f (%8lu)\n", i, AA[i]/BB[i], BB[i] );
-
-    for ( i = 0; i < 18; i++ ) {
-        D = B[i][24] ? A[i][24]/B[i][24] : 1.;
-        for ( j = 24; j < QUANT; j++ ) {
-            if ( B [i] [j] ) {
-                mult = sqrt( B[i][j]);        // 0 .... thousand
-                mult = (mult-1) / ( mult );
-                D = D * (1-mult) + A[i][j]/B[i][j] * mult;
-            }
-            C [i][j] = D;
-        }
-        D = B[i][24] ? A[i][24]/B[i][24] : 1.;
-        for ( j = 24; j >= 0; j-- ) {
-            if ( B [i] [j] ) {
-                mult = sqrt( B[i][j]);        // 0 .... thousand
-                mult = (mult-1) / ( mult );
-                D = D * (1-mult) + A[i][j]/B[i][j] * mult;
-            }
-            C [i][j] = D;
-        }
-    }
-
-    for ( i = 0; i < 18; i++ ) {
-        printf ( "    { ");
-        for ( j = 0; j < QUANT; j++ )
-            printf ( "%8.6f, ", C[i][j] );
-        printf ( "},\n" );
-    }
-
-    for ( i = 0; i < 18; i++ )
-        printf ( "    %8.6f,\n", BB[i] ? AA[i]/BB[i] : 1. );
-
-    return 0;
-}
Index: penc/trunk/analy_filter-old.c
===================================================================
--- /mppenc/trunk/analy_filter-old.c	(revision 96)
+++ 	(revision )
@@ -1,272 +1,0 @@
-#include "mppenc.h"
-
-
-/* C O N S T A N T S */
-/*
-for (i=0; i<32; ++i)
-{
-    for (k=0; k<32; ++k) {
-        Mi[i][k] = (float)(cos( (2*i+1)*k*M_PI/64 ));
-    }
-}
-*/
-// Mi[32][32] = Mi[i][k] being mapped onto M[1024] = M[i*32+k]
-static const float M[1024] = {
-    1.0000000000000000f, 0.9987954497337341f, 0.9951847195625305f, 0.9891765099647810f, 0.9807852506637573f, 0.9700312614440918f, 0.9569403529167175f, 0.9415440651830208f, 0.9238795042037964f, 0.9039893150329590f, 0.8819212913513184f, 0.8577286100002721f, 0.8314695954322815f, 0.8032075166702271f, 0.7730104327201843f, 0.7409511253549591f, 0.7071067690849304f, 0.6715589761734009f, 0.6343932747840881f, 0.5956993044924335f, 0.5555702447891235f, 0.5141027569770813f, 0.4713967442512512f, 0.4275550934302822f, 0.3826834261417389f, 0.3368898630142212f, 0.2902846634387970f, 0.2429801799032640f, 0.1950903236865997f, 0.1467304676771164f, 0.0980171412229538f, 0.0490676743274181f,
-    1.0000000000000000f, 0.9891765117645264f, 0.9569403529167175f, 0.9039892931234433f, 0.8314695954322815f, 0.7409511208534241f, 0.6343932747840881f, 0.5141027441932217f, 0.3826834261417389f, 0.2429801821708679f, 0.0980171412229538f,-0.0490676743274180f,-0.1950903236865997f,-0.3368898630142212f,-0.4713967442512512f,-0.5956993044924334f,-0.7071067690849304f,-0.8032075166702271f,-0.8819212913513184f,-0.9415440651830207f,-0.9807852506637573f,-0.9987954497337341f,-0.9951847195625305f,-0.9700312531945440f,-0.9238795042037964f,-0.8577286005020142f,-0.7730104327201843f,-0.6715589548470187f,-0.5555702447891235f,-0.4275550842285156f,-0.2902846634387970f,-0.1467304744553623f,
-    1.0000000000000000f, 0.9700312614440918f, 0.8819212913513184f, 0.7409511253549591f, 0.5555702447891235f, 0.3368898630142212f, 0.0980171412229538f,-0.1467304744553616f,-0.3826834261417389f,-0.5956993103027344f,-0.7730104327201843f,-0.9039892931234433f,-0.9807852506637573f,-0.9987954497337341f,-0.9569403529167175f,-0.8577286100002721f,-0.7071067690849304f,-0.5141027569770813f,-0.2902846634387970f,-0.0490676743274180f, 0.1950903236865997f, 0.4275550842285156f, 0.6343932747840881f, 0.8032075314806451f, 0.9238795042037964f, 0.9891765117645264f, 0.9951847195625305f, 0.9415440651830209f, 0.8314695954322815f, 0.6715589761734009f, 0.4713967442512512f, 0.2429801799032642f,
-    1.0000000000000000f, 0.9415440559387207f, 0.7730104327201843f, 0.5141027441932217f, 0.1950903236865997f,-0.1467304676771164f,-0.4713967442512512f,-0.7409511253549589f,-0.9238795042037964f,-0.9987954497337341f,-0.9569403529167175f,-0.8032075314806449f,-0.5555702447891235f,-0.2429801821708679f, 0.0980171412229538f, 0.4275550934302821f, 0.7071067690849304f, 0.9039893150329590f, 0.9951847195625305f, 0.9700312531945441f, 0.8314695954322815f, 0.5956993103027344f, 0.2902846634387970f,-0.0490676743274175f,-0.3826834261417389f,-0.6715589761734009f,-0.8819212913513184f,-0.9891765099647810f,-0.9807852506637573f,-0.8577286005020142f,-0.6343932747840881f,-0.3368898533922210f,
-    1.0000000000000000f, 0.9039893150329590f, 0.6343932747840881f, 0.2429801799032640f,-0.1950903236865997f,-0.5956993103027344f,-0.8819212913513184f,-0.9987954562051724f,-0.9238795042037964f,-0.6715589761734009f,-0.2902846634387970f, 0.1467304744553619f, 0.5555702447891235f, 0.8577286005020142f, 0.9951847195625305f, 0.9415440651830209f, 0.7071067690849304f, 0.3368898630142212f,-0.0980171412229538f,-0.5141027441932214f,-0.8314695954322815f,-0.9891765117645264f,-0.9569403529167175f,-0.7409511253549599f,-0.3826834261417389f, 0.0490676760673523f, 0.4713967442512512f, 0.8032075314806448f, 0.9807852506637573f, 0.9700312614440918f, 0.7730104327201843f, 0.4275550934302828f,
-    1.0000000000000000f, 0.8577286005020142f, 0.4713967442512512f,-0.0490676743274180f,-0.5555702447891235f,-0.9039893150329590f,-0.9951847195625305f,-0.8032075314806449f,-0.3826834261417389f, 0.1467304676771164f, 0.6343932747840881f, 0.9415440651830208f, 0.9807852506637573f, 0.7409511208534241f, 0.2902846634387970f,-0.2429801799032628f,-0.7071067690849304f,-0.9700312614440918f,-0.9569403529167175f,-0.6715589548470181f,-0.1950903236865997f, 0.3368898630142212f, 0.7730104327201843f, 0.9891765099647810f, 0.9238795042037964f, 0.5956993103027344f, 0.0980171412229538f,-0.4275550934302818f,-0.8314695954322815f,-0.9987954497337341f,-0.8819212913513184f,-0.5141027441932238f,
-    1.0000000000000000f, 0.8032075166702271f, 0.2902846634387970f,-0.3368898533922199f,-0.8314695954322815f,-0.9987954497337341f,-0.7730104327201843f,-0.2429801799032641f, 0.3826834261417389f, 0.8577286005020142f, 0.9951847195625305f, 0.7409511253549592f, 0.1950903236865997f,-0.4275550842285156f,-0.8819212913513184f,-0.9891765099647811f,-0.7071067690849304f,-0.1467304676771164f, 0.4713967442512512f, 0.9039892931234430f, 0.9807852506637573f, 0.6715589761734009f, 0.0980171412229538f,-0.5141027441932212f,-0.9238795042037964f,-0.9700312614440918f,-0.6343932747840881f,-0.0490676743274185f, 0.5555702447891235f, 0.9415440559387207f, 0.9569403529167175f, 0.5956993044924350f,
-    1.0000000000000000f, 0.7409511208534241f, 0.0980171412229538f,-0.5956993044924334f,-0.9807852506637573f,-0.8577286005020142f,-0.2902846634387970f, 0.4275550934302821f, 0.9238795042037964f, 0.9415440559387207f, 0.4713967442512512f,-0.2429801799032628f,-0.8314695954322815f,-0.9891765117645264f,-0.6343932747840881f, 0.0490676743274174f, 0.7071067690849304f, 0.9987954497337341f, 0.7730104327201843f, 0.1467304744553618f,-0.5555702447891235f,-0.9700312614440918f,-0.8819212913513184f,-0.3368898533922196f, 0.3826834261417389f, 0.9039893150329590f, 0.9569403529167175f, 0.5141027441932239f,-0.1950903236865997f,-0.8032075166702271f,-0.9951847195625305f,-0.6715589548470199f,
-    1.0000000000000000f, 0.6715589761734009f,-0.0980171412229538f,-0.8032075314806448f,-0.9807852506637573f,-0.5141027569770813f, 0.2902846634387970f, 0.9039892931234431f, 0.9238795042037964f, 0.3368898630142212f,-0.4713967442512512f,-0.9700312531945441f,-0.8314695954322815f,-0.1467304676771164f, 0.6343932747840881f, 0.9987954562051724f, 0.7071067690849304f,-0.0490676760673523f,-0.7730104327201843f,-0.9891765099647811f,-0.5555702447891235f, 0.2429801821708679f, 0.8819212913513184f, 0.9415440651830208f, 0.3826834261417389f,-0.4275550842285156f,-0.9569403529167175f,-0.8577286100002726f,-0.1950903236865997f, 0.5956993103027344f, 0.9951847195625305f, 0.7409511253549602f,
-    1.0000000000000000f, 0.5956993103027344f,-0.2902846634387970f,-0.9415440651830207f,-0.8314695954322815f,-0.0490676760673523f, 0.7730104327201843f, 0.9700312531945441f, 0.3826834261417389f,-0.5141027569770813f,-0.9951847195625305f,-0.6715589548470181f, 0.1950903236865997f, 0.9039893150329590f, 0.8819212913513184f, 0.1467304744553618f,-0.7071067690849304f,-0.9891765117645264f,-0.4713967442512512f, 0.4275550934302801f, 0.9807852506637573f, 0.7409511208534241f,-0.0980171412229538f,-0.8577286100002717f,-0.9238795042037964f,-0.2429801821708679f, 0.6343932747840881f, 0.9987954562051724f, 0.5555702447891235f,-0.3368898630142212f,-0.9569403529167175f,-0.8032075314806458f,
-    1.0000000000000000f, 0.5141027569770813f,-0.4713967442512512f,-0.9987954562051724f,-0.5555702447891235f, 0.4275550842285156f, 0.9951847195625305f, 0.5956993044924333f,-0.3826834261417389f,-0.9891765117645264f,-0.6343932747840881f, 0.3368898533922202f, 0.9807852506637573f, 0.6715589761734009f,-0.2902846634387970f,-0.9700312531945441f,-0.7071067690849304f, 0.2429801821708679f, 0.9569403529167175f, 0.7409511253549601f,-0.1950903236865997f,-0.9415440559387207f,-0.7730104327201843f, 0.1467304744553603f, 0.9238795042037964f, 0.8032075166702271f,-0.0980171412229538f,-0.9039892931234428f,-0.8314695954322815f, 0.0490676760673523f, 0.8819212913513184f, 0.8577286100002728f,
-    1.0000000000000000f, 0.4275550842285156f,-0.6343932747840881f,-0.9700312531945440f,-0.1950903236865997f, 0.8032075166702271f, 0.8819212913513184f,-0.0490676743274175f,-0.9238795042037964f,-0.7409511208534241f, 0.2902846634387970f, 0.9891765099647810f, 0.5555702447891235f,-0.5141027569770813f,-0.9951847195625305f,-0.3368898533922196f, 0.7071067690849304f, 0.9415440559387207f, 0.0980171412229538f,-0.8577286100002717f,-0.8314695954322815f, 0.1467304676771164f, 0.9569403529167175f, 0.6715589548470199f,-0.3826834261417389f,-0.9987954497337341f,-0.4713967442512512f, 0.5956993044924335f, 0.9807852506637573f, 0.2429801821708679f,-0.7730104327201843f,-0.9039892931234438f,
-    1.0000000000000000f, 0.3368898630142212f,-0.7730104327201843f,-0.8577286100002721f, 0.1950903236865997f, 0.9891765117645264f, 0.4713967442512512f,-0.6715589548470177f,-0.9238795042037964f, 0.0490676760673523f, 0.9569403529167175f, 0.5956993044924335f,-0.5555702447891235f,-0.9700312614440918f,-0.0980171412229538f, 0.9039892931234429f, 0.7071067690849304f,-0.4275550842285156f,-0.9951847195625305f,-0.2429801799032640f, 0.8314695954322815f, 0.8032075166702271f,-0.2902846634387970f,-0.9987954562051723f,-0.3826834261417389f, 0.7409511208534241f, 0.8819212913513184f,-0.1467304744553635f,-0.9807852506637573f,-0.5141027569770813f, 0.6343932747840881f, 0.9415440651830210f,
-    1.0000000000000000f, 0.2429801821708679f,-0.8819212913513184f,-0.6715589548470187f, 0.5555702447891235f, 0.9415440559387207f,-0.0980171412229538f,-0.9891765099647810f,-0.3826834261417389f, 0.8032075166702271f, 0.7730104327201843f,-0.4275550934302818f,-0.9807852506637573f,-0.0490676760673523f, 0.9569403529167175f, 0.5141027441932239f,-0.7071067690849304f,-0.8577286005020142f, 0.2902846634387970f, 0.9987954562051724f, 0.1950903236865997f,-0.9039893150329590f,-0.6343932747840881f, 0.5956993044924335f, 0.9238795042037964f,-0.1467304676771164f,-0.9951847195625305f,-0.3368898533922236f, 0.8314695954322815f, 0.7409511208534241f,-0.4713967442512512f,-0.9700312531945442f,
-    1.0000000000000000f, 0.1467304676771164f,-0.9569403529167175f,-0.4275550934302825f, 0.8314695954322815f, 0.6715589761734009f,-0.6343932747840881f,-0.8577286100002723f, 0.3826834261417389f, 0.9700312614440918f,-0.0980171412229538f,-0.9987954562051724f,-0.1950903236865997f, 0.9415440559387207f, 0.4713967442512512f,-0.8032075314806446f,-0.7071067690849304f, 0.5956993103027344f, 0.8819212913513184f,-0.3368898533922179f,-0.9807852506637573f, 0.0490676760673523f, 0.9951847195625305f, 0.2429801799032678f,-0.9238795042037964f,-0.5141027569770813f, 0.7730104327201843f, 0.7409511253549606f,-0.5555702447891235f,-0.9039893150329590f, 0.2902846634387970f, 0.9891765099647810f,
-    1.0000000000000000f, 0.0490676760673523f,-0.9951847195625305f,-0.1467304744553623f, 0.9807852506637573f, 0.2429801821708679f,-0.9569403529167175f,-0.3368898533922210f, 0.9238795042037964f, 0.4275550842285156f,-0.8819212913513184f,-0.5141027441932238f, 0.8314695954322815f, 0.5956993103027344f,-0.7730104327201843f,-0.6715589548470199f, 0.7071067690849304f, 0.7409511208534241f,-0.6343932747840881f,-0.8032075314806458f, 0.5555702447891235f, 0.8577286005020142f,-0.4713967442512512f,-0.9039892931234438f, 0.3826834261417389f, 0.9415440559387207f,-0.2902846634387970f,-0.9700312531945442f, 0.1950903236865997f, 0.9891765117645264f,-0.0980171412229538f,-0.9987954562051724f,
-    1.0000000000000000f,-0.0490676760673523f,-0.9951847195625305f, 0.1467304744553619f, 0.9807852506637573f,-0.2429801821708679f,-0.9569403529167175f, 0.3368898533922202f, 0.9238795042037964f,-0.4275550842285156f,-0.8819212913513184f, 0.5141027441932227f, 0.8314695954322815f,-0.5956993103027344f,-0.7730104327201843f, 0.6715589548470184f, 0.7071067690849304f,-0.7409511208534241f,-0.6343932747840881f, 0.8032075314806444f, 0.5555702447891235f,-0.8577286005020142f,-0.4713967442512512f, 0.9039892931234441f, 0.3826834261417389f,-0.9415440559387207f,-0.2902846634387970f, 0.9700312531945442f, 0.1950903236865997f,-0.9891765117645264f,-0.0980171412229538f, 0.9987954562051724f,
-    1.0000000000000000f,-0.1467304676771164f,-0.9569403529167175f, 0.4275550934302821f, 0.8314695954322815f,-0.6715589761734009f,-0.6343932747840881f, 0.8577286100002719f, 0.3826834261417389f,-0.9700312614440918f,-0.0980171412229538f, 0.9987954562051724f,-0.1950903236865997f,-0.9415440559387207f, 0.4713967442512512f, 0.8032075314806457f,-0.7071067690849304f,-0.5956993103027344f, 0.8819212913513184f, 0.3368898533922202f,-0.9807852506637573f,-0.0490676760673523f, 0.9951847195625305f,-0.2429801799032616f,-0.9238795042037964f, 0.5141027569770813f, 0.7730104327201843f,-0.7409511253549560f,-0.5555702447891235f, 0.9039893150329590f, 0.2902846634387970f,-0.9891765099647810f,
-    1.0000000000000000f,-0.2429801821708679f,-0.8819212913513184f, 0.6715589548470183f, 0.5555702447891235f,-0.9415440559387207f,-0.0980171412229538f, 0.9891765099647811f,-0.3826834261417389f,-0.8032075166702271f, 0.7730104327201843f, 0.4275550934302814f,-0.9807852506637573f, 0.0490676760673523f, 0.9569403529167175f,-0.5141027441932223f,-0.7071067690849304f, 0.8577286005020142f, 0.2902846634387970f,-0.9987954562051723f, 0.1950903236865997f, 0.9039893150329590f,-0.6343932747840881f,-0.5956993044924329f, 0.9238795042037964f, 0.1467304676771164f,-0.9951847195625305f, 0.3368898533922172f, 0.8314695954322815f,-0.7409511208534241f,-0.4713967442512512f, 0.9700312531945441f,
-    1.0000000000000000f,-0.3368898630142212f,-0.7730104327201843f, 0.8577286100002720f, 0.1950903236865997f,-0.9891765117645264f, 0.4713967442512512f, 0.6715589548470182f,-0.9238795042037964f,-0.0490676760673523f, 0.9569403529167175f,-0.5956993044924338f,-0.5555702447891235f, 0.9700312614440918f,-0.0980171412229538f,-0.9039892931234437f, 0.7071067690849304f, 0.4275550842285156f,-0.9951847195625305f, 0.2429801799032652f, 0.8314695954322815f,-0.8032075166702271f,-0.2902846634387970f, 0.9987954562051726f,-0.3826834261417389f,-0.7409511208534241f, 0.8819212913513184f, 0.1467304744553633f,-0.9807852506637573f, 0.5141027569770813f, 0.6343932747840881f,-0.9415440651830210f,
-    1.0000000000000000f,-0.4275550842285156f,-0.6343932747840881f, 0.9700312531945440f,-0.1950903236865997f,-0.8032075166702271f, 0.8819212913513184f, 0.0490676743274184f,-0.9238795042037964f, 0.7409511208534241f, 0.2902846634387970f,-0.9891765099647809f, 0.5555702447891235f, 0.5141027569770813f,-0.9951847195625305f, 0.3368898533922178f, 0.7071067690849304f,-0.9415440559387207f, 0.0980171412229538f, 0.8577286100002729f,-0.8314695954322815f,-0.1467304676771164f, 0.9569403529167175f,-0.6715589548470179f,-0.3826834261417389f, 0.9987954497337341f,-0.4713967442512512f,-0.5956993044924334f, 0.9807852506637573f,-0.2429801821708679f,-0.7730104327201843f, 0.9039892931234437f,
-    1.0000000000000000f,-0.5141027569770813f,-0.4713967442512512f, 0.9987954562051724f,-0.5555702447891235f,-0.4275550842285156f, 0.9951847195625305f,-0.5956993044924326f,-0.3826834261417389f, 0.9891765117645264f,-0.6343932747840881f,-0.3368898533922198f, 0.9807852506637573f,-0.6715589761734009f,-0.2902846634387970f, 0.9700312531945441f,-0.7071067690849304f,-0.2429801821708679f, 0.9569403529167175f,-0.7409511253549561f,-0.1950903236865997f, 0.9415440559387207f,-0.7730104327201843f,-0.1467304744553666f, 0.9238795042037964f,-0.8032075166702271f,-0.0980171412229538f, 0.9039892931234457f,-0.8314695954322815f,-0.0490676760673523f, 0.8819212913513184f,-0.8577286100002726f,
-    1.0000000000000000f,-0.5956993103027344f,-0.2902846634387970f, 0.9415440651830209f,-0.8314695954322815f, 0.0490676760673523f, 0.7730104327201843f,-0.9700312531945441f, 0.3826834261417389f, 0.5141027569770813f,-0.9951847195625305f, 0.6715589548470184f, 0.1950903236865997f,-0.9039893150329590f, 0.8819212913513184f,-0.1467304744553635f,-0.7071067690849304f, 0.9891765117645264f,-0.4713967442512512f,-0.4275550934302822f, 0.9807852506637573f,-0.7409511208534241f,-0.0980171412229538f, 0.8577286100002731f,-0.9238795042037964f, 0.2429801821708679f, 0.6343932747840881f,-0.9987954562051722f, 0.5555702447891235f, 0.3368898630142212f,-0.9569403529167175f, 0.8032075314806414f,
-    1.0000000000000000f,-0.6715589761734009f,-0.0980171412229538f, 0.8032075314806453f,-0.9807852506637573f, 0.5141027569770813f, 0.2902846634387970f,-0.9039892931234435f, 0.9238795042037964f,-0.3368898630142212f,-0.4713967442512512f, 0.9700312531945440f,-0.8314695954322815f, 0.1467304676771164f, 0.6343932747840881f,-0.9987954562051724f, 0.7071067690849304f, 0.0490676760673523f,-0.7730104327201843f, 0.9891765099647806f,-0.5555702447891235f,-0.2429801821708679f, 0.8819212913513184f,-0.9415440651830210f, 0.3826834261417389f, 0.4275550842285156f,-0.9569403529167175f, 0.8577286100002709f,-0.1950903236865997f,-0.5956993103027344f, 0.9951847195625305f,-0.7409511253549601f,
-    1.0000000000000000f,-0.7409511208534241f, 0.0980171412229538f, 0.5956993044924333f,-0.9807852506637573f, 0.8577286005020142f,-0.2902846634387970f,-0.4275550934302813f, 0.9238795042037964f,-0.9415440559387207f, 0.4713967442512512f, 0.2429801799032641f,-0.8314695954322815f, 0.9891765117645264f,-0.6343932747840881f,-0.0490676743274193f, 0.7071067690849304f,-0.9987954497337341f, 0.7730104327201843f,-0.1467304744553630f,-0.5555702447891235f, 0.9700312614440918f,-0.8819212913513184f, 0.3368898533922169f, 0.3826834261417389f,-0.9039893150329590f, 0.9569403529167175f,-0.5141027441932149f,-0.1950903236865997f, 0.8032075166702271f,-0.9951847195625305f, 0.6715589548470144f,
-    1.0000000000000000f,-0.8032075166702271f, 0.2902846634387970f, 0.3368898533922201f,-0.8314695954322815f, 0.9987954497337341f,-0.7730104327201843f, 0.2429801799032624f, 0.3826834261417389f,-0.8577286005020142f, 0.9951847195625305f,-0.7409511253549589f, 0.1950903236865997f, 0.4275550842285156f,-0.8819212913513184f, 0.9891765099647806f,-0.7071067690849304f, 0.1467304676771164f, 0.4713967442512512f,-0.9039892931234440f, 0.9807852506637573f,-0.6715589761734009f, 0.0980171412229538f, 0.5141027441932221f,-0.9238795042037964f, 0.9700312614440918f,-0.6343932747840881f, 0.0490676743274188f, 0.5555702447891235f,-0.9415440559387207f, 0.9569403529167175f,-0.5956993044924349f,
-    1.0000000000000000f,-0.8577286005020142f, 0.4713967442512512f, 0.0490676743274182f,-0.5555702447891235f, 0.9039893150329590f,-0.9951847195625305f, 0.8032075314806447f,-0.3826834261417389f,-0.1467304676771164f, 0.6343932747840881f,-0.9415440651830209f, 0.9807852506637573f,-0.7409511208534241f, 0.2902846634387970f, 0.2429801799032680f,-0.7071067690849304f, 0.9700312614440918f,-0.9569403529167175f, 0.6715589548470151f,-0.1950903236865997f,-0.3368898630142212f, 0.7730104327201843f,-0.9891765099647817f, 0.9238795042037964f,-0.5956993103027344f, 0.0980171412229538f, 0.4275550934302864f,-0.8314695954322815f, 0.9987954497337341f,-0.8819212913513184f, 0.5141027441932174f,
-    1.0000000000000000f,-0.9039893150329590f, 0.6343932747840881f,-0.2429801799032628f,-0.1950903236865997f, 0.5956993103027344f,-0.8819212913513184f, 0.9987954562051724f,-0.9238795042037964f, 0.6715589761734009f,-0.2902846634387970f,-0.1467304744553624f, 0.5555702447891235f,-0.8577286005020142f, 0.9951847195625305f,-0.9415440651830213f, 0.7071067690849304f,-0.3368898630142212f,-0.0980171412229538f, 0.5141027441932219f,-0.8314695954322815f, 0.9891765117645264f,-0.9569403529167175f, 0.7409511253549580f,-0.3826834261417389f,-0.0490676760673523f, 0.4713967442512512f,-0.8032075314806426f, 0.9807852506637573f,-0.9700312614440918f, 0.7730104327201843f,-0.4275550934302842f,
-    1.0000000000000000f,-0.9415440559387207f, 0.7730104327201843f,-0.5141027441932214f, 0.1950903236865997f, 0.1467304676771164f,-0.4713967442512512f, 0.7409511253549601f,-0.9238795042037964f, 0.9987954497337341f,-0.9569403529167175f, 0.8032075314806444f,-0.5555702447891235f, 0.2429801821708679f, 0.0980171412229538f,-0.4275550934302822f, 0.7071067690849304f,-0.9039893150329590f, 0.9951847195625305f,-0.9700312531945433f, 0.8314695954322815f,-0.5956993103027344f, 0.2902846634387970f, 0.0490676743274168f,-0.3826834261417389f, 0.6715589761734009f,-0.8819212913513184f, 0.9891765099647812f,-0.9807852506637573f, 0.8577286005020142f,-0.6343932747840881f, 0.3368898533922158f,
-    1.0000000000000000f,-0.9700312614440918f, 0.8819212913513184f,-0.7409511253549593f, 0.5555702447891235f,-0.3368898630142212f, 0.0980171412229538f, 0.1467304744553620f,-0.3826834261417389f, 0.5956993103027344f,-0.7730104327201843f, 0.9039892931234438f,-0.9807852506637573f, 0.9987954497337341f,-0.9569403529167175f, 0.8577286100002712f,-0.7071067690849304f, 0.5141027569770813f,-0.2902846634387970f, 0.0490676743274193f, 0.1950903236865997f,-0.4275550842285156f, 0.6343932747840881f,-0.8032075314806467f, 0.9238795042037964f,-0.9891765117645264f, 0.9951847195625305f,-0.9415440651830184f, 0.8314695954322815f,-0.6715589761734009f, 0.4713967442512512f,-0.2429801799032666f,
-    1.0000000000000000f,-0.9891765117645264f, 0.9569403529167175f,-0.9039892931234431f, 0.8314695954322815f,-0.7409511208534241f, 0.6343932747840881f,-0.5141027441932226f, 0.3826834261417389f,-0.2429801821708679f, 0.0980171412229538f, 0.0490676743274227f,-0.1950903236865997f, 0.3368898630142212f,-0.4713967442512512f, 0.5956993044924359f,-0.7071067690849304f, 0.8032075166702271f,-0.8819212913513184f, 0.9415440651830214f,-0.9807852506637573f, 0.9987954497337341f,-0.9951847195625305f, 0.9700312531945422f,-0.9238795042037964f, 0.8577286005020142f,-0.7730104327201843f, 0.6715589548470194f,-0.5555702447891235f, 0.4275550842285156f,-0.2902846634387970f, 0.1467304744553577f,
-    1.0000000000000000f,-0.9987954497337341f, 0.9951847195625305f,-0.9891765099647810f, 0.9807852506637573f,-0.9700312614440918f, 0.9569403529167175f,-0.9415440651830203f, 0.9238795042037964f,-0.9039893150329590f, 0.8819212913513184f,-0.8577286100002696f, 0.8314695954322815f,-0.8032075166702271f, 0.7730104327201843f,-0.7409511253549560f, 0.7071067690849304f,-0.6715589761734009f, 0.6343932747840881f,-0.5956993044924298f, 0.5555702447891235f,-0.5141027569770813f, 0.4713967442512512f,-0.4275550934302846f, 0.3826834261417389f,-0.3368898630142212f, 0.2902846634387970f,-0.2429801799032599f, 0.1950903236865997f,-0.1467304676771164f, 0.0980171412229538f,-0.0490676743274212f
-};
-
-const float  Ci_opt[512] = {
-     0.000000000f, 0.000101566f, 0.000971317f, 0.003134727f, 0.035780907f, 0.003134727f, 0.000971317f, 0.000101566f,
-    -0.000000477f, 0.000103951f, 0.000953674f, 0.002841473f, 0.035758972f, 0.003401756f, 0.000983715f, 0.000099182f,
-    -0.000000477f, 0.000105858f, 0.000930786f, 0.002521515f, 0.035694122f, 0.003643036f, 0.000991821f, 0.000096321f,
-    -0.000000477f, 0.000107288f, 0.000902653f, 0.002174854f, 0.035586357f, 0.003858566f, 0.000995159f, 0.000093460f,
-    -0.000000477f, 0.000108242f, 0.000868797f, 0.001800537f, 0.035435200f, 0.004049301f, 0.000994205f, 0.000090599f,
-    -0.000000477f, 0.000108719f, 0.000829220f, 0.001399517f, 0.035242081f, 0.004215240f, 0.000989437f, 0.000087261f,
-    -0.000000477f, 0.000108719f, 0.000783920f, 0.000971317f, 0.035007000f, 0.004357815f, 0.000980854f, 0.000083923f,
-    -0.000000954f, 0.000108242f, 0.000731945f, 0.000515938f, 0.034730434f, 0.004477024f, 0.000968933f, 0.000080585f,
-    -0.000000954f, 0.000106812f, 0.000674248f, 0.000033379f, 0.034412861f, 0.004573822f, 0.000954151f, 0.000076771f,
-    -0.000000954f, 0.000105381f, 0.000610352f,-0.000475883f, 0.034055710f, 0.004649162f, 0.000935555f, 0.000073433f,
-    -0.000000954f, 0.000102520f, 0.000539303f,-0.001011848f, 0.033659935f, 0.004703045f, 0.000915051f, 0.000070095f,
-    -0.000001431f, 0.000099182f, 0.000462532f,-0.001573563f, 0.033225536f, 0.004737377f, 0.000891685f, 0.000066280f,
-    -0.000001431f, 0.000095367f, 0.000378609f,-0.002161503f, 0.032754898f, 0.004752159f, 0.000866413f, 0.000062943f,
-    -0.000001907f, 0.000090122f, 0.000288486f,-0.002774239f, 0.032248020f, 0.004748821f, 0.000838757f, 0.000059605f,
-    -0.000001907f, 0.000084400f, 0.000191689f,-0.003411293f, 0.031706810f, 0.004728317f, 0.000809669f, 0.000055790f,
-    -0.000002384f, 0.000077724f, 0.000088215f,-0.004072189f, 0.031132698f, 0.004691124f, 0.000779152f, 0.000052929f,
-    -0.000002384f, 0.000069618f,-0.000021458f,-0.004756451f, 0.030526638f, 0.004638195f, 0.000747204f, 0.000049591f,
-    -0.000002861f, 0.000060558f,-0.000137329f,-0.005462170f, 0.029890060f, 0.004570484f, 0.000714302f, 0.000046253f,
-    -0.000003338f, 0.000050545f,-0.000259876f,-0.006189346f, 0.029224873f, 0.004489899f, 0.000680923f, 0.000043392f,
-    -0.000003338f, 0.000039577f,-0.000388145f,-0.006937027f, 0.028532982f, 0.004395962f, 0.000646591f, 0.000040531f,
-    -0.000003815f, 0.000027180f,-0.000522137f,-0.007703304f, 0.027815342f, 0.004290581f, 0.000611782f, 0.000037670f,
-    -0.000004292f, 0.000013828f,-0.000661850f,-0.008487225f, 0.027073860f, 0.004174709f, 0.000576973f, 0.000034809f,
-    -0.000004768f,-0.000000954f,-0.000806808f,-0.009287834f, 0.026310921f, 0.004048824f, 0.000542164f, 0.000032425f,
-    -0.000005245f,-0.000017166f,-0.000956535f,-0.010103703f, 0.025527000f, 0.003914356f, 0.000507355f, 0.000030041f,
-    -0.000006199f,-0.000034332f,-0.001111031f,-0.010933399f, 0.024725437f, 0.003771782f, 0.000472546f, 0.000027657f,
-    -0.000006676f,-0.000052929f,-0.001269817f,-0.011775017f, 0.023907185f, 0.003622532f, 0.000438213f, 0.000025272f,
-    -0.000007629f,-0.000072956f,-0.001432419f,-0.012627602f, 0.023074150f, 0.003467083f, 0.000404358f, 0.000023365f,
-    -0.000008106f,-0.000093937f,-0.001597881f,-0.013489246f, 0.022228718f, 0.003306866f, 0.000371456f, 0.000021458f,
-    -0.000009060f,-0.000116348f,-0.001766682f,-0.014358521f, 0.021372318f, 0.003141880f, 0.000339031f, 0.000019550f,
-    -0.000010014f,-0.000140190f,-0.001937389f,-0.015233517f, 0.020506859f, 0.002974033f, 0.000307560f, 0.000018120f,
-    -0.000011444f,-0.000165462f,-0.002110004f,-0.016112804f, 0.019634247f, 0.002803326f, 0.000277042f, 0.000016689f,
-    -0.000012398f,-0.000191212f,-0.002283096f,-0.016994476f, 0.018756866f, 0.002630711f, 0.000247478f, 0.000014782f,
-    -0.000013828f,-0.000218868f,-0.002457142f,-0.017876148f, 0.017876148f, 0.002457142f, 0.000218868f, 0.000013828f,
-    -0.000014782f,-0.000247478f,-0.002630711f,-0.018756866f, 0.016994476f, 0.002283096f, 0.000191212f, 0.000012398f,
-    -0.000016689f,-0.000277042f,-0.002803326f,-0.019634247f, 0.016112804f, 0.002110004f, 0.000165462f, 0.000011444f,
-    -0.000018120f,-0.000307560f,-0.002974033f,-0.020506859f, 0.015233517f, 0.001937389f, 0.000140190f, 0.000010014f,
-    -0.000019550f,-0.000339031f,-0.003141880f,-0.021372318f, 0.014358521f, 0.001766682f, 0.000116348f, 0.000009060f,
-    -0.000021458f,-0.000371456f,-0.003306866f,-0.022228718f, 0.013489246f, 0.001597881f, 0.000093937f, 0.000008106f,
-    -0.000023365f,-0.000404358f,-0.003467083f,-0.023074150f, 0.012627602f, 0.001432419f, 0.000072956f, 0.000007629f,
-    -0.000025272f,-0.000438213f,-0.003622532f,-0.023907185f, 0.011775017f, 0.001269817f, 0.000052929f, 0.000006676f,
-    -0.000027657f,-0.000472546f,-0.003771782f,-0.024725437f, 0.010933399f, 0.001111031f, 0.000034332f, 0.000006199f,
-    -0.000030041f,-0.000507355f,-0.003914356f,-0.025527000f, 0.010103703f, 0.000956535f, 0.000017166f, 0.000005245f,
-    -0.000032425f,-0.000542164f,-0.004048824f,-0.026310921f, 0.009287834f, 0.000806808f, 0.000000954f, 0.000004768f,
-    -0.000034809f,-0.000576973f,-0.004174709f,-0.027073860f, 0.008487225f, 0.000661850f,-0.000013828f, 0.000004292f,
-    -0.000037670f,-0.000611782f,-0.004290581f,-0.027815342f, 0.007703304f, 0.000522137f,-0.000027180f, 0.000003815f,
-    -0.000040531f,-0.000646591f,-0.004395962f,-0.028532982f, 0.006937027f, 0.000388145f,-0.000039577f, 0.000003338f,
-    -0.000043392f,-0.000680923f,-0.004489899f,-0.029224873f, 0.006189346f, 0.000259876f,-0.000050545f, 0.000003338f,
-    -0.000046253f,-0.000714302f,-0.004570484f,-0.029890060f, 0.005462170f, 0.000137329f,-0.000060558f, 0.000002861f,
-    -0.000049591f,-0.000747204f,-0.004638195f,-0.030526638f, 0.004756451f, 0.000021458f,-0.000069618f, 0.000002384f,
-    -0.000052929f,-0.000779152f,-0.004691124f,-0.031132698f, 0.004072189f,-0.000088215f,-0.000077724f, 0.000002384f,
-    -0.000055790f,-0.000809669f,-0.004728317f,-0.031706810f, 0.003411293f,-0.000191689f,-0.000084400f, 0.000001907f,
-    -0.000059605f,-0.000838757f,-0.004748821f,-0.032248020f, 0.002774239f,-0.000288486f,-0.000090122f, 0.000001907f,
-    -0.000062943f,-0.000866413f,-0.004752159f,-0.032754898f, 0.002161503f,-0.000378609f,-0.000095367f, 0.000001431f,
-    -0.000066280f,-0.000891685f,-0.004737377f,-0.033225536f, 0.001573563f,-0.000462532f,-0.000099182f, 0.000001431f,
-    -0.000070095f,-0.000915051f,-0.004703045f,-0.033659935f, 0.001011848f,-0.000539303f,-0.000102520f, 0.000000954f,
-    -0.000073433f,-0.000935555f,-0.004649162f,-0.034055710f, 0.000475883f,-0.000610352f,-0.000105381f, 0.000000954f,
-    -0.000076771f,-0.000954151f,-0.004573822f,-0.034412861f,-0.000033379f,-0.000674248f,-0.000106812f, 0.000000954f,
-    -0.000080585f,-0.000968933f,-0.004477024f,-0.034730434f,-0.000515938f,-0.000731945f,-0.000108242f, 0.000000954f,
-    -0.000083923f,-0.000980854f,-0.004357815f,-0.035007000f,-0.000971317f,-0.000783920f,-0.000108719f, 0.000000477f,
-    -0.000087261f,-0.000989437f,-0.004215240f,-0.035242081f,-0.001399517f,-0.000829220f,-0.000108719f, 0.000000477f,
-    -0.000090599f,-0.000994205f,-0.004049301f,-0.035435200f,-0.001800537f,-0.000868797f,-0.000108242f, 0.000000477f,
-    -0.000093460f,-0.000995159f,-0.003858566f,-0.035586357f,-0.002174854f,-0.000902653f,-0.000107288f, 0.000000477f,
-    -0.000096321f,-0.000991821f,-0.003643036f,-0.035694122f,-0.002521515f,-0.000930786f,-0.000105858f, 0.000000477f,
-    -0.000099182f,-0.000983715f,-0.003401756f,-0.035758972f,-0.002841473f,-0.000953674f,-0.000103951f, 0.000000477f
-};
-
-/* V A R I A B L E S */
-float  X_L[X_MEM+480];
-float  X_R[X_MEM+480];
-
-/* F U N C T I O N S */
-// vectoring & partial calculation
-static void
-Vectoring ( const float* x, float* y )
-{
-#ifndef FASTER
-    const float*  c = Ci_opt;
-    int           i;
-
-    for (i=0; i<16; ++i, c+=32, x+=4) {
-        *y++ = c[ 0] * x[  0] + c[ 1] * x[ 64] + c[ 2] * x[128] + c[ 3] * x[192]
-             + c[ 4] * x[256] + c[ 5] * x[320] + c[ 6] * x[384] + c[ 7] * x[448];
-
-        *y++ = c[ 8] * x[  1] + c[ 9] * x[ 65] + c[10] * x[129] + c[11] * x[193]
-             + c[12] * x[257] + c[13] * x[321] + c[14] * x[385] + c[15] * x[449];
-
-        *y++ = c[16] * x[  2] + c[17] * x[ 66] + c[18] * x[130] + c[19] * x[194]
-             + c[20] * x[258] + c[21] * x[322] + c[22] * x[386] + c[23] * x[450];
-
-        *y++ = c[24] * x[  3] + c[25] * x[ 67] + c[26] * x[131] + c[27] * x[195]
-             + c[28] * x[259] + c[29] * x[323] + c[30] * x[387] + c[31] * x[451];
-    }
-#else
-    const float*  c1;
-    const float*  c2;
-    const float*  x1;
-    const float*  x2;
-    int           i;
-
-    c1 = Ci_opt + 128;
-    x1 = x      +  16;
-    *y++ = c1[ 0] * x1[  0] + c1[ 1] * x1[ 64] + c1[ 2] * x1[128] + c1[ 3] * x1[192]
-         + c1[ 4] * x1[256] + c1[ 5] * x1[320] + c1[ 6] * x1[384] + c1[ 7] * x1[448];
-
-    c1 = Ci_opt + 128 - 8;
-    x1 = x      +  16 - 1;
-    c2 = Ci_opt + 128 + 8;
-    x2 = x      +  16 + 1;
-    for (i= 1; i<=16; ++i, c1-=8, x1-=1, c2+=8, x2+=1) {
-        *y++ = c1[ 0] * x1[  0] + c1[ 1] * x1[ 64] + c1[ 2] * x1[128] + c1[ 3] * x1[192]
-             + c1[ 4] * x1[256] + c1[ 5] * x1[320] + c1[ 6] * x1[384] + c1[ 7] * x1[448]
-             + c2[ 0] * x2[  0] + c2[ 1] * x2[ 64] + c2[ 2] * x2[128] + c2[ 3] * x2[192]
-             + c2[ 4] * x2[256] + c2[ 5] * x2[320] + c2[ 6] * x2[384] + c2[ 7] * x2[448];
-    }
-
-    c1 = Ci_opt + 128 + 136;
-    x1 = x      +  16 +  17;
-    c2 = Ci_opt + 640 - 136;
-    x2 = x      +  80 -  17;
-    *y++ = c1[ 0] * x1[  0] + c1[ 1] * x1[ 64] + c1[ 2] * x1[128] + c1[ 3] * x1[192]
-         + c1[ 4] * x1[256] + c1[ 5] * x1[320] + c1[ 6] * x1[384] + c1[ 7] * x1[448]
-         - c2[ 0] * x2[  0] - c2[ 1] * x2[ 64] - c2[ 2] * x2[128] - c2[ 3] * x2[192]
-         - c2[ 4] * x2[256] - c2[ 5] * x2[320] - c2[ 6] * x2[384] - c2[ 7] * x2[448];
-
-    c1 = Ci_opt + 128 + 144;
-    x1 = x      +  16 +  18;
-    c2 = Ci_opt + 640 - 144;
-    x2 = x      +  80 -  18;
-    for (i=18; i<=31; ++i, c1+=8, x1+=1, c2-=8, x2-=1) {
-        *y++ = c1[ 0] * x1[  0] + c1[ 1] * x1[ 64] + c1[ 2] * x1[128] + c1[ 3] * x1[192]
-             + c1[ 4] * x1[256] + c1[ 5] * x1[320] + c1[ 6] * x1[384] + c1[ 7] * x1[448]
-             - c2[ 0] * x2[  0] - c2[ 1] * x2[ 64] - c2[ 2] * x2[128] - c2[ 3] * x2[192]
-             - c2[ 4] * x2[256] - c2[ 5] * x2[320] - c2[ 6] * x2[384] - c2[ 7] * x2[448];
-    }
-#endif
-}
-
-// matrixing with Mi[32][32] = Mi[1024]
-static void
-Matrixing ( const int MaxBand, const float* mi, const float* y, float* samples )
-{
-    int   i;
-#ifdef FASTER
-    for (i=0; i<=MaxBand; ++i, mi+=32, samples+=72) { // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
-        *samples = y[0] + mi[ 1] * y[ 1] + mi[ 2] * y[ 2] + mi[ 3] * y[ 3] + mi[ 4] * y[ 4] +
-                          mi[ 5] * y[ 5] + mi[ 6] * y[ 6] + mi[ 7] * y[ 7] + mi[ 8] * y[ 8] +
-                          mi[ 9] * y[ 9] + mi[10] * y[10] + mi[11] * y[11] + mi[12] * y[12] +
-                          mi[13] * y[13] + mi[14] * y[14] + mi[15] * y[15] + mi[16] * y[16] +
-                          mi[17] * y[17] + mi[18] * y[18] + mi[19] * y[19] + mi[20] * y[20] +
-                          mi[21] * y[21] + mi[22] * y[22] + mi[23] * y[23] + mi[24] * y[24] +
-                          mi[25] * y[25] + mi[26] * y[26] + mi[27] * y[27] + mi[28] * y[28] +
-                          mi[29] * y[29] + mi[30] * y[30] + mi[31] * y[31];
-    }
-#else
-    for (i=0; i<=MaxBand; ++i, mi+=32, samples+=72) { // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
-        *samples = y[16] + mi[ 1] * (y[15]+y[17]) + mi[ 2] * (y[14]+y[18]) +
-                           mi[ 3] * (y[13]+y[19]) + mi[ 4] * (y[12]+y[20]) +
-                           mi[ 5] * (y[11]+y[21]) + mi[ 6] * (y[10]+y[22]) +
-                           mi[ 7] * (y[ 9]+y[23]) + mi[ 8] * (y[ 8]+y[24]) +
-                           mi[ 9] * (y[ 7]+y[25]) + mi[10] * (y[ 6]+y[26]) +
-                           mi[11] * (y[ 5]+y[27]) + mi[12] * (y[ 4]+y[28]) +
-                           mi[13] * (y[ 3]+y[29]) + mi[14] * (y[ 2]+y[30]) +
-                           mi[15] * (y[ 1]+y[31]) + mi[16] * (y[ 0]+y[32]) +
-                           mi[31] * (y[47]-y[49]) + mi[30] * (y[46]-y[50]) +
-                           mi[29] * (y[45]-y[51]) + mi[28] * (y[44]-y[52]) +
-                           mi[27] * (y[43]-y[53]) + mi[26] * (y[42]-y[54]) +
-                           mi[25] * (y[41]-y[55]) + mi[24] * (y[40]-y[56]) +
-                           mi[23] * (y[39]-y[57]) + mi[22] * (y[38]-y[58]) +
-                           mi[21] * (y[37]-y[59]) + mi[20] * (y[36]-y[60]) +
-                           mi[19] * (y[35]-y[61]) + mi[18] * (y[34]-y[62]) +
-                           mi[17] * (y[33]-y[63]);
-    }
-#endif
-}
-
-// Analysis-Filterbank
-void
-Analyse_Filter ( const PCMDataTyp* in, SubbandFloatTyp* out, const int MaxBand )
-{
-#ifndef FASTER
-    float Y_L[64],Y_R[64];
-#else
-    float Y_L[32],Y_R[32];
-#endif
-    float *x;
-    const float *pcm;
-    int n,i;
-
-    ENTER(3);
-    /************************* calculate L-signal ***************************/
-    memmove(X_L + X_MEM, X_L, 480*sizeof(float));
-    x     = X_L + X_MEM;
-    pcm   = in->L + 479;    // 479 = CENTER + 31
-    for (n=0; n<36; ++n, pcm+=64) {
-        // updating vector x
-        x  -= 32;
-        for (i=0; i<32; ++i) *(x+i) = *(pcm--);
-
-        // vectoring & partial calculation
-        Vectoring(x, Y_L);
-
-        // matrixing
-        Matrixing(MaxBand, M, Y_L, &out[0].L[n]);
-    }
-
-    /************************* calculate R-signal ***************************/
-    memmove(X_R + X_MEM, X_R, 480*sizeof(float));
-    x     = X_R + X_MEM;
-    pcm   = in->R + 479;    // 479 = CENTER + 31
-    for (n=0; n<36; ++n, pcm+=64) {
-        // updating vector x
-        x  -= 32;
-        for (i=0; i<32; ++i)
-            x[i] = *(pcm--);
-
-        // vectoring & partial calculation
-        Vectoring(x, Y_R);
-
-        // matrixing
-        Matrixing(MaxBand, M, Y_R, &out[0].R[n]);
-    }
-    LEAVE(3);
-}
Index: penc/trunk/analy_filter.c
===================================================================
--- /mppenc/trunk/analy_filter.c	(revision 96)
+++ 	(revision )
@@ -1,345 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string.h>
-#include "mppenc.h"
-
-#define FASTER
-
-/* C O N S T A N T S */
-
-#undef _
-#define _(value)  (float)(value##.##L / 0x200000)
-
-static float  Ci_opt [512] = {
-    _(   0), _(  213), _( 2037), _(  6574), _(75038), _( 6574), _(2037), _(213),
-    _(  -1), _(  218), _( 2000), _(  5959), _(74992), _( 7134), _(2063), _(208),
-    _(  -1), _(  222), _( 1952), _(  5288), _(74856), _( 7640), _(2080), _(202),
-    _(  -1), _(  225), _( 1893), _(  4561), _(74630), _( 8092), _(2087), _(196),
-    _(  -1), _(  227), _( 1822), _(  3776), _(74313), _( 8492), _(2085), _(190),
-    _(  -1), _(  228), _( 1739), _(  2935), _(73908), _( 8840), _(2075), _(183),
-    _(  -1), _(  228), _( 1644), _(  2037), _(73415), _( 9139), _(2057), _(176),
-    _(  -2), _(  227), _( 1535), _(  1082), _(72835), _( 9389), _(2032), _(169),
-    _(  -2), _(  224), _( 1414), _(    70), _(72169), _( 9592), _(2001), _(161),
-    _(  -2), _(  221), _( 1280), _(  -998), _(71420), _( 9750), _(1962), _(154),
-    _(  -2), _(  215), _( 1131), _( -2122), _(70590), _( 9863), _(1919), _(147),
-    _(  -3), _(  208), _(  970), _( -3300), _(69679), _( 9935), _(1870), _(139),
-    _(  -3), _(  200), _(  794), _( -4533), _(68692), _( 9966), _(1817), _(132),
-    _(  -4), _(  189), _(  605), _( -5818), _(67629), _( 9959), _(1759), _(125),
-    _(  -4), _(  177), _(  402), _( -7154), _(66494), _( 9916), _(1698), _(117),
-    _(  -5), _(  163), _(  185), _( -8540), _(65290), _( 9838), _(1634), _(111),
-    _(  -5), _(  146), _(  -45), _( -9975), _(64019), _( 9727), _(1567), _(104),
-    _(  -6), _(  127), _( -288), _(-11455), _(62684), _( 9585), _(1498), _( 97),
-    _(  -7), _(  106), _( -545), _(-12980), _(61289), _( 9416), _(1428), _( 91),
-    _(  -7), _(   83), _( -814), _(-14548), _(59838), _( 9219), _(1356), _( 85),
-    _(  -8), _(   57), _(-1095), _(-16155), _(58333), _( 8998), _(1283), _( 79),
-    _(  -9), _(   29), _(-1388), _(-17799), _(56778), _( 8755), _(1210), _( 73),
-    _( -10), _(   -2), _(-1692), _(-19478), _(55178), _( 8491), _(1137), _( 68),
-    _( -11), _(  -36), _(-2006), _(-21189), _(53534), _( 8209), _(1064), _( 63),
-    _( -13), _(  -72), _(-2330), _(-22929), _(51853), _( 7910), _( 991), _( 58),
-    _( -14), _( -111), _(-2663), _(-24694), _(50137), _( 7597), _( 919), _( 53),
-    _( -16), _( -153), _(-3004), _(-26482), _(48390), _( 7271), _( 848), _( 49),
-    _( -17), _( -197), _(-3351), _(-28289), _(46617), _( 6935), _( 779), _( 45),
-    _( -19), _( -244), _(-3705), _(-30112), _(44821), _( 6589), _( 711), _( 41),
-    _( -21), _( -294), _(-4063), _(-31947), _(43006), _( 6237), _( 645), _( 38),
-    _( -24), _( -347), _(-4425), _(-33791), _(41176), _( 5879), _( 581), _( 35),
-    _( -26), _( -401), _(-4788), _(-35640), _(39336), _( 5517), _( 519), _( 31),
-    _( -29), _( -459), _(-5153), _(-37489), _(37489), _( 5153), _( 459), _( 29),
-    _( -31), _( -519), _(-5517), _(-39336), _(35640), _( 4788), _( 401), _( 26),
-    _( -35), _( -581), _(-5879), _(-41176), _(33791), _( 4425), _( 347), _( 24),
-    _( -38), _( -645), _(-6237), _(-43006), _(31947), _( 4063), _( 294), _( 21),
-    _( -41), _( -711), _(-6589), _(-44821), _(30112), _( 3705), _( 244), _( 19),
-    _( -45), _( -779), _(-6935), _(-46617), _(28289), _( 3351), _( 197), _( 17),
-    _( -49), _( -848), _(-7271), _(-48390), _(26482), _( 3004), _( 153), _( 16),
-    _( -53), _( -919), _(-7597), _(-50137), _(24694), _( 2663), _( 111), _( 14),
-    _( -58), _( -991), _(-7910), _(-51853), _(22929), _( 2330), _(  72), _( 13),
-    _( -63), _(-1064), _(-8209), _(-53534), _(21189), _( 2006), _(  36), _( 11),
-    _( -68), _(-1137), _(-8491), _(-55178), _(19478), _( 1692), _(   2), _( 10),
-    _( -73), _(-1210), _(-8755), _(-56778), _(17799), _( 1388), _( -29), _(  9),
-    _( -79), _(-1283), _(-8998), _(-58333), _(16155), _( 1095), _( -57), _(  8),
-    _( -85), _(-1356), _(-9219), _(-59838), _(14548), _(  814), _( -83), _(  7),
-    _( -91), _(-1428), _(-9416), _(-61289), _(12980), _(  545), _(-106), _(  7),
-    _( -97), _(-1498), _(-9585), _(-62684), _(11455), _(  288), _(-127), _(  6),
-    _(-104), _(-1567), _(-9727), _(-64019), _( 9975), _(   45), _(-146), _(  5),
-    _(-111), _(-1634), _(-9838), _(-65290), _( 8540), _( -185), _(-163), _(  5),
-    _(-117), _(-1698), _(-9916), _(-66494), _( 7154), _( -402), _(-177), _(  4),
-    _(-125), _(-1759), _(-9959), _(-67629), _( 5818), _( -605), _(-189), _(  4),
-    _(-132), _(-1817), _(-9966), _(-68692), _( 4533), _( -794), _(-200), _(  3),
-    _(-139), _(-1870), _(-9935), _(-69679), _( 3300), _( -970), _(-208), _(  3),
-    _(-147), _(-1919), _(-9863), _(-70590), _( 2122), _(-1131), _(-215), _(  2),
-    _(-154), _(-1962), _(-9750), _(-71420), _(  998), _(-1280), _(-221), _(  2),
-    _(-161), _(-2001), _(-9592), _(-72169), _(  -70), _(-1414), _(-224), _(  2),
-    _(-169), _(-2032), _(-9389), _(-72835), _(-1082), _(-1535), _(-227), _(  2),
-    _(-176), _(-2057), _(-9139), _(-73415), _(-2037), _(-1644), _(-228), _(  1),
-    _(-183), _(-2075), _(-8840), _(-73908), _(-2935), _(-1739), _(-228), _(  1),
-    _(-190), _(-2085), _(-8492), _(-74313), _(-3776), _(-1822), _(-227), _(  1),
-    _(-196), _(-2087), _(-8092), _(-74630), _(-4561), _(-1893), _(-225), _(  1),
-    _(-202), _(-2080), _(-7640), _(-74856), _(-5288), _(-1952), _(-222), _(  1),
-    _(-208), _(-2063), _(-7134), _(-74992), _(-5959), _(-2000), _(-218), _(  1),
-};
-#undef _
-
-
-static float M [1024];
-
-void
-Klemm ( void )
-{
-    int    i;
-    int    k;
-    float  S [512];
-
-    for ( i=0; i<32; i++ ) {
-        for ( k=0; k<32; k++ ) {
-            M [i*32 + k] = (float) cos ( ((2*i+1)*k & 127) * M_PI/64 );
-        }
-    }
-
-#ifdef FASTER
-    for ( i = 0; i < 384; i++ )
-        S[i] = Ci_opt[i];
-    for ( i = 384; i < 392; i++ )
-        S[i] = 0;
-    for ( i = 392; i < 512; i++ )
-        S[i] = -Ci_opt[i];
-    for ( i = 0; i < 512; i++ )
-       Ci_opt[i] = S[i];
-    for ( i = 0; i < 128; i++ )
-       Ci_opt[i] = S[(i&7) + 120 - (i&120)];
-    for ( i = 128; i < 384; i++ )
-       Ci_opt[i] = S[i];
-    for ( i = 384; i < 512; i++ )
-       Ci_opt[i] = S[ 384 + (i&7) + 120 - (i&120)];
-#endif
-}
-
- /* D E F I N E S */
-#define X_MEM    1152
-
-/* V A R I A B L E S */
-float  X_L [ X_MEM + 480 ];
-float  X_R [ X_MEM + 480 ];
-
-
-/* F U N C T I O N S */
-// vectoring & partial calculation
-
-static void
-Vectoring ( const float* x, float* y )
-{
-#ifdef FASTER
-    int           i = 0;
-    const float*  c1;
-    const float*  c2;
-    const float*  x1;
-    const float*  x2;
-
-# define EXPR(c,x)  (c[0]*x[0] + c[1]*x[64] + c[2]*x[128] + c[3]*x[192] + c[4]*x[256] + c[5]*x[320] + c[6]*x[384] + c[7]*x[448])
-
-    i++;
-    *y++ = EXPR ((Ci_opt+128),(x+31));
-
-    c1 = Ci_opt - 8;
-    c2 = Ci_opt + 128;
-    x1 = x + 16;
-    x2 = x + 31;
-    do {
-        x1--, x2--, i++;
-        c1 += 8, c2 += 8;
-        *y++ = EXPR (c1,x1) + EXPR (c2,x2);
-    } while ( i < 16 );
-
-    i++;
-    *y++ = EXPR ((Ci_opt+120),(x+0)) + EXPR ((Ci_opt+256),(x+32));
-
-    c1 = Ci_opt + 384 - 8;
-    c2 = Ci_opt + 256;
-    x1 = x + 47;
-    x2 = x + 32;
-
-    do {
-        x1++, x2++, i++;
-        c1 += 8, c2 += 8;
-        *y++ = EXPR (c1,x1) + EXPR (c2,x2);
-    } while ( i < 32 );
-#else
-    int           i;
-    const float*  c = Ci_opt;
-
-    for ( i = 0; i < 16; i++, c += 32, x += 4, y += 4 ) {
-        y[0] = c[ 0] * x[  0] + c[ 1] * x[ 64] + c[ 2] * x[128] + c[ 3] * x[192] + c[ 4] * x[256] + c[ 5] * x[320] + c[ 6] * x[384] + c[ 7] * x[448];
-        y[1] = c[ 8] * x[  1] + c[ 9] * x[ 65] + c[10] * x[129] + c[11] * x[193] + c[12] * x[257] + c[13] * x[321] + c[14] * x[385] + c[15] * x[449];
-        y[2] = c[16] * x[  2] + c[17] * x[ 66] + c[18] * x[130] + c[19] * x[194] + c[20] * x[258] + c[21] * x[322] + c[22] * x[386] + c[23] * x[450];
-        y[3] = c[24] * x[  3] + c[25] * x[ 67] + c[26] * x[131] + c[27] * x[195] + c[28] * x[259] + c[29] * x[323] + c[30] * x[387] + c[31] * x[451];
-    }
-#endif
-}
-
-// matrixing with Mi[32][32] = Mi[1024]
-
-static void
-Matrixing ( const int MaxBand, const float* mi, const float* y, float* samples )
-{
-    int  i;
-#ifdef FASTER
-    for ( i = 0; i <= MaxBand; i++, mi += 32, samples += 72 ) {                          // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
-        samples[0] =          y[ 0] + mi[ 1] * y[ 1] + mi[ 2] * y[ 2] + mi[ 3] * y[ 3]
-                   + mi[ 4] * y[ 4] + mi[ 5] * y[ 5] + mi[ 6] * y[ 6] + mi[ 7] * y[ 7]
-                   + mi[ 8] * y[ 8] + mi[ 9] * y[ 9] + mi[10] * y[10] + mi[11] * y[11]
-                   + mi[12] * y[12] + mi[13] * y[13] + mi[14] * y[14] + mi[15] * y[15]
-                   + mi[16] * y[16] + mi[17] * y[17] + mi[18] * y[18] + mi[19] * y[19]
-                   + mi[20] * y[20] + mi[21] * y[21] + mi[22] * y[22] + mi[23] * y[23]
-                   + mi[24] * y[24] + mi[25] * y[25] + mi[26] * y[26] + mi[27] * y[27]
-                   + mi[28] * y[28] + mi[29] * y[29] + mi[30] * y[30] + mi[31] * y[31];
-    }
-#else
-    for ( i = 0; i <= MaxBand; i++, mi += 32, samples += 72 ) {                          // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
-        samples[0] =           y[16]        + mi[ 1] * (y[15]+y[17])
-                   + mi[ 2] * (y[14]+y[18]) + mi[ 3] * (y[13]+y[19])
-                   + mi[ 4] * (y[12]+y[20]) + mi[ 5] * (y[11]+y[21])
-                   + mi[ 6] * (y[10]+y[22]) + mi[ 7] * (y[ 9]+y[23])
-                   + mi[ 8] * (y[ 8]+y[24]) + mi[ 9] * (y[ 7]+y[25])
-                   + mi[10] * (y[ 6]+y[26]) + mi[11] * (y[ 5]+y[27])
-                   + mi[12] * (y[ 4]+y[28]) + mi[13] * (y[ 3]+y[29])
-                   + mi[14] * (y[ 2]+y[30]) + mi[15] * (y[ 1]+y[31])
-                   + mi[16] * (y[ 0]+y[32])
-                   + mi[31] * (y[47]-y[49]) + mi[30] * (y[46]-y[50])
-                   + mi[29] * (y[45]-y[51]) + mi[28] * (y[44]-y[52])
-                   + mi[27] * (y[43]-y[53]) + mi[26] * (y[42]-y[54])
-                   + mi[25] * (y[41]-y[55]) + mi[24] * (y[40]-y[56])
-                   + mi[23] * (y[39]-y[57]) + mi[22] * (y[38]-y[58])
-                   + mi[21] * (y[37]-y[59]) + mi[20] * (y[36]-y[60])
-                   + mi[19] * (y[35]-y[61]) + mi[18] * (y[34]-y[62])
-                   + mi[17] * (y[33]-y[63]);
-    }
-#endif
-}
-
-// Analysis-Filterbank
-void
-Analyse_Filter ( const PCMDataTyp* in, SubbandFloatTyp* out, const int MaxBand )
-{
-#ifdef FASTER
-    float         Y_L [32];
-    float         Y_R [32];
-#else
-    float         Y_L [64];
-    float         Y_R [64];
-#endif
-    float*        x;
-    const float*  pcm;
-    int           n;
-    int           i;
-
-    /************************* calculate L-signal ***************************/
-    ENTER(180);
-    memcpy ( X_L + X_MEM, X_L, 480*sizeof(*X_L) );
-    x      = X_L + X_MEM;
-    pcm    = in->L + 479;                               // 479 = CENTER + 31
-    for ( n = 0; n < 36; n++, pcm += 64 ) {
-        x  -= 32;                                       // updating vector x
-#ifdef FASTER
-        for ( i = 0; i < 16; i++ )
-            x[i] = *pcm--;
-        for ( i = 31; i >= 16; i-- )
-            x[i] = *pcm--;
-#else
-        for ( i = 0; i < 32; i++ )
-            x[i] = *pcm--;
-#endif
-        Vectoring ( x, Y_L );                           // vectoring & partial calculation
-        Matrixing ( MaxBand, M, Y_L, &out[0].L[n] );    // matrixing
-    }
-
-    /************************* calculate R-signal ***************************/
-    memcpy ( X_R + X_MEM, X_R, 480*sizeof(*X_R) );
-    x      = X_R + X_MEM;
-    pcm    = in->R + 479;                               // 479 = CENTER + 31
-    for ( n = 0; n < 36; n++, pcm += 64 ) {
-        x  -= 32;                                       // updating vector x
-#ifdef FASTER
-        for ( i = 0; i < 16; i++ )
-            x[i] = *pcm--;
-        for ( i = 31; i >= 16; i-- )
-            x[i] = *pcm--;
-#else
-        for ( i = 0; i < 32; i++ )
-            x[i] = *pcm--;
-#endif
-        Vectoring ( x, Y_R );                           // vectoring & partial calculation
-        Matrixing ( MaxBand, M, Y_R, &out[0].R[n] );    // matrixing
-    }
-    LEAVE(180);
-}
-
-void
-Analyse_Init ( float Left, float Right, SubbandFloatTyp* out, const int MaxBand )
-{
-#ifdef FASTER
-    float         Y_L [32];
-    float         Y_R [32];
-#else
-    float         Y_L [64];
-    float         Y_R [64];
-#endif
-    float*        x;
-    int           n;
-    int           i;
-
-    /************************* calculate L-signal ***************************/
-    ENTER(180);
-    memcpy ( X_L + X_MEM, X_L, 480*sizeof(*X_L) );
-    x      = X_L + X_MEM;
-
-    for ( n = 0; n < 36; n++ ) {
-        x  -= 32;                                       // updating vector x
-#ifdef FASTER
-        for ( i = 0; i < 16; i++ )
-            x[i] = Left;
-        for ( i = 31; i >= 16; i-- )
-            x[i] = Left;
-#else
-        for ( i = 0; i < 32; i++ )
-            x[i] = Left;
-#endif
-        Vectoring ( x, Y_L );                           // vectoring & partial calculation
-        Matrixing ( MaxBand, M, Y_L, &out[0].L[n] );    // matrixing
-    }
-
-    /************************* calculate R-signal ***************************/
-    memcpy ( X_R + X_MEM, X_R, 480*sizeof(*X_R) );
-    x      = X_R + X_MEM;
-    for ( n = 0; n < 36; n++ ) {
-        x  -= 32;                                       // updating vector x
-#ifdef FASTER
-        for ( i = 0; i < 16; i++ )
-            x[i] = Right;
-        for ( i = 31; i >= 16; i-- )
-            x[i] = Right;
-#else
-        for ( i = 0; i < 32; i++ )
-            x[i] = Right;
-#endif
-        Vectoring ( x, Y_R );                           // vectoring & partial calculation
-        Matrixing ( MaxBand, M, Y_R, &out[0].R[n] );    // matrixing
-    }
-    LEAVE(180);
-}
-
-/* end of analy_filter.c */
Index: penc/trunk/ans.c
===================================================================
--- /mppenc/trunk/ans.c	(revision 96)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *  Depending on how transient it is, it can be further reduced (up to 0=No ANS).
- *  Estimate coefficient for feedback at Order=1 over Mask_fu - Mask_fo.
- *  3 quantization routines: Order=0, Order=1, Order=2...6
- *  Order doesn't specify the power of the noise shaping, but only the flexibility of the form.
- *  Don't reset utilization of the "remains" at the frame borders;
- *  "remains"-utilization as scalefactor-independent values,
- *  so that a utilization beyond Subframe/Frame Borders is even possible.
- */
-
-#include "mppenc.h"
-
-
-static float  InvFourier [MAX_NS_ORDER + 1] [16];
-static float  Cos_Tab    [16] [MAX_NS_ORDER + 1];
-static float  Sin_Tab    [16] [MAX_NS_ORDER + 1];
-unsigned int  NS_Order;                         // Maximum order for ANS
-unsigned int  NS_Order_L [32];
-unsigned int  NS_Order_R [32];                  // frame-wise order of the Noiseshaping (0: off, 1...5: on)
-float         FIR_L      [32] [MAX_NS_ORDER];
-float         FIR_R      [32] [MAX_NS_ORDER];   // contains FIR-Filter for NoiseShaping
-float         ANSspec_L  [MAX_ANS_LINES];
-float         ANSspec_R  [MAX_ANS_LINES];       // L/R-masking thresholds for ANS
-float         ANSspec_M  [MAX_ANS_LINES];
-float         ANSspec_S  [MAX_ANS_LINES];       // M/S-masking thresholds for ANS
-
-
-void
-Init_ANS ( void )
-{
-    int  n;
-    int  k;
-
-    // calculate Fourier tables
-    for ( k = 0; k <= MAX_NS_ORDER; k++ ) {
-        for ( n = 0; n < 16; n++ ) {
-            InvFourier [k] [n] = (float) cos ( +2*M_PI/64 * (2*n)   *  k    ) / 16.;
-            Cos_Tab    [n] [k] = (float) cos ( -2*M_PI/64 * (2*n+1) * (k+1) );
-            Sin_Tab    [n] [k] = (float) sin ( -2*M_PI/64 * (2*n+1) * (k+1) );
-        }
-    }
-}
-
-
-// calculates optimal reflection coefficients and time response of a prediction filter in LPC analysis
-static __inline void
-durbin_akf_to_kh1( float*        k,     // out: reflection coefficients
-                   float*        h,     // out: time response
-                   const float*  akf )  // in : autocorrelation function (0..1 used)
-{
-    h[0] = k[0] = akf [1] / akf [0];
-}
-
-static __inline void
-durbin_akf_to_kh2( float*        k,     // out: reflection coefficients
-                   float*        h,     // out: time response
-                   const float*  akf )  // in : autocorrelation function (0..2 used)
-{
-    float tk,e;
-
-    tk    = akf [1] / akf[0];
-    e     = akf[0] * (1. - tk*tk);
-    h[0]  = k[0] = tk;
-    h[0] *= 1. - (h[1]  = k[1] = tk = (akf[2] - h[0] * akf[1]) / e);
-}
-
-static __inline void
-durbin_akf_to_kh3( float*        k,     // out: reflection coefficients
-                   float*        h,     // out: time response
-                   const float*  akf )  // in : autocorrelation function (0..3 used)
-{
-    float a,b,tk,e;
-
-    tk    = akf[1] / akf[0];
-    e     = akf[0] * (1. - tk*tk);
-    h[0]  = k[0] = tk;
-
-    tk    = (akf[2] - h[0] * akf[1]) / e;
-    e    *= 1. - tk*tk;
-    h[0] *= 1. - (h[1] = k[1] = tk);
-    h[2]  = k[2] = tk = (akf[3] - h[0] * akf[2] - h[1] * akf[1]) / e;
-
-    h[0]  = (a=h[0]) - (b=h[1])*tk;
-    h[1]  = b - a*tk;
-}
-
-
-static __inline void
-durbin_akf_to_kh ( float*        k,     // out: reflection coefficients
-                   float*        h,     // out: time response
-                   float*  akf,   // in : autocorrelation function (0..n used)
-                   const int     n )    // in : number of parameters to calculate
-{
-    int    i,j;
-    float  s,a,b,tk,e;
-    float* p;
-    float* q;
-
-    e = akf [0];
-    for ( i = 0; i < n; i++ ) {
-        s = 0.f;
-        p = h;
-        q = akf+i;
-        j = i;
-        while ( j-- )
-            s += *p++ * *q--;
-
-        tk   = (akf[i+1] - s) / e;
-        e   *= 1. - tk*tk;
-        h[i] = k[i] = tk;
-        p = h;
-        q = h + i - 1;
-
-        for ( ; p < q; p++, q-- ) {
-            a  = *p;
-            b  = *q;
-            *p = a - b*tk;
-            *q = b - a*tk;
-        }
-        if ( p == q )
-            *p *= 1. - tk;
-    }
-}
-
-static const unsigned char  maxANSOrder [32] = {
-    6, 5, 4, 3, 2, 2, 2, 2,
-    2, 2, 2, 2, 1, 1, 1, 1,
-    0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-static void
-FindOptimalANS ( const int             MaxBand,
-                 const unsigned char*  ms,
-                 const float*          spec0,
-                 const float*          spec1,
-                 unsigned int*         NS,
-                 float*                snr_comp,
-                 float                 fir [] [MAX_NS_ORDER],
-                 const float*          smr0,
-                 const float*          smr1,
-                 const int             scf [] [3],
-                 const int             Transient [32] )
-{
-    int           Band;
-    int           n;
-    int           k;
-    int           order;
-    float         akf     [MAX_NS_ORDER + 1];
-    float         h       [MAX_NS_ORDER];
-    float         reflex  [MAX_NS_ORDER];
-    float         spec    [16];
-    float         invspec [16];
-    float         norm;
-    float         ns_loss;
-    float         min_spec;
-    float         min_diff;
-    float         re;
-    float         im;
-    float         ns_energy;
-    float         gain;
-    float         NS_Gain;
-    float         actSMR;
-    int           max;
-    const float*  tmp;
-
-    ENTER(235);
-    for ( Band = 0; Band <= MaxBand  &&  maxANSOrder[Band]; Band++ ) {
-
-        if ( scf[Band][0] != scf[Band][1]  ||  scf[Band][1] != scf[Band][2] )
-            continue;
-
-        if ( Transient[Band] )
-            continue;
-
-        max = maxANSOrder [Band];
-
-        if ( ms[Band] ) {                       // setting pointer and SMR in relation to the M/S-flag
-            tmp    = &spec1 [Band<<4];          // pointer to MS-data
-            actSMR = smr1   [Band];             // selecting SMR
-        }
-        else {
-            tmp    = &spec0 [Band<<4];          // pointer to LR-data
-            actSMR = smr0   [Band];             // selecting SMR
-        }
-
-        if ( actSMR >= 1. ) {
-            NS_Gain =     1.f;                  // reset gain
-            norm    = 1.e-30f;
-
-            // Selection of the masking threshold of the current subband, also considering frequency inversion in every 2nd subband
-            if ( Band & 1 )
-                for ( n = 0, tmp += 15; n < 16; n++ )
-                    norm += spec[n] = *tmp--;
-            else
-                for ( n = 0; n < 16; n++ )
-                    norm += spec[n] = *tmp++;
-
-            // Preprocessing: normalization of the the power of spec[] to 1, and search for minimum of masking threshold
-            norm     = 16.f / norm;
-            min_spec = 1.e+12f;
-            for ( n = 0; n < 16; n++ ) {
-                invspec[n] = 1.f / (spec[n] *= norm);
-                if ( spec[n] < min_spec )               // normalize spec[]
-                    min_spec = spec[n];
-            }
-
-            // Calculation of the auto-correlation function
-            tmp = InvFourier [0];
-            for ( k = 0; k <= max; k++, tmp += 16 ) {
-                akf[k] = tmp[ 0]*invspec[ 0] + tmp[ 1]*invspec[ 1] + tmp[ 2]*invspec[ 2] + tmp[ 3]*invspec[ 3] +
-                         tmp[ 4]*invspec[ 4] + tmp[ 5]*invspec[ 5] + tmp[ 6]*invspec[ 6] + tmp[ 7]*invspec[ 7] +
-                         tmp[ 8]*invspec[ 8] + tmp[ 9]*invspec[ 9] + tmp[10]*invspec[10] + tmp[11]*invspec[11] +
-                         tmp[12]*invspec[12] + tmp[13]*invspec[13] + tmp[14]*invspec[14] + tmp[15]*invspec[15];
-            }
-
-            // Searching for the noise-shaper with maximum gain
-            for ( order = 1; order <= max; order++ ) {
-                switch ( order ) {                                              // calculating best FIR-Filter for the return
-                case  1: durbin_akf_to_kh1 (reflex, h, akf);        break;
-                case  2: durbin_akf_to_kh2 (reflex, h, akf);        break;
-                case  3: durbin_akf_to_kh3 (reflex, h, akf);        break;
-                default: durbin_akf_to_kh  (reflex, h, akf, order); break;
-                }
-
-                ns_loss  = 1.e-30f;                             // estimating the gain
-                min_diff = 1.e+12f;
-                for ( n = 0; n < 16; n++ ) {
-                    re = 1.f;                                   // calculating the obtained noise shaping
-                    im = 0.f;
-                    for ( k = 0; k < order; k++ ) {
-                        re -= h[k] * Cos_Tab[n][k];
-                        im += h[k] * Sin_Tab[n][k];
-                    }
-
-                    ns_energy = re*re + im*im;                  // calculated spectral shaped noise
-                    ns_loss  += ns_energy;                      // noise energy increases with shaping
-
-                    if ( spec[n] < min_diff * ns_energy )       // Searching for minimum distance between the shaped noise and the masking threshold
-                        min_diff = spec[n] / ns_energy;
-                }
-
-                // Updating the Filter if new gain is bigger than old gain and if the extra noise power through shaping is smaller than the SMR of this band
-                gain = 16. * min_diff / (min_spec * ns_loss);
-                if ( gain > NS_Gain  &&  ns_loss < actSMR ) {
-                    NS [Band] = order;
-                    NS_Gain   = gain;
-                    memcpy ( fir [Band], h, order * sizeof(*h) );
-                }
-            }
-
-            if ( NS_Gain > 1.f ) {                      // Activation of ANS if there is gain
-                snr_comp[Band] *= NS_Gain;
-            }
-        }
-    }
-
-    LEAVE(235);
-    return;
-}
-
-
-// perform ANS-analysis (calculation of FIR-filter and gain)
-void
-NS_Analyse ( const int             MaxBand,
-             const unsigned char*  MSflag,
-             const SMRTyp          smr,
-             const int*            Transient )
-{
-    ENTER(10);
-
-    // for L or M, respectively
-    memset ( FIR_L,      0, sizeof FIR_L      );         // reset FIR
-    memset ( NS_Order_L, 0, sizeof NS_Order_L );         // reset Flags
-    FindOptimalANS ( MaxBand, MSflag, ANSspec_L, ANSspec_M, NS_Order_L, SNR_comp_L, FIR_L, smr.L, smr.M, SCF_Index_L, Transient );
-
-    // for R or S, respectively
-    memset ( FIR_R,      0, sizeof FIR_R      );         // reset FIR
-    memset ( NS_Order_R, 0, sizeof NS_Order_R );         // reset Flags
-    FindOptimalANS ( MaxBand, MSflag, ANSspec_R, ANSspec_S, NS_Order_R, SNR_comp_R, FIR_R, smr.R, smr.S, SCF_Index_R, Transient );
-
-    LEAVE(10);
-    return;
-}
-
-/* end of ans.c */
Index: penc/trunk/bitstream.c
===================================================================
--- /mppenc/trunk/bitstream.c	(revision 96)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-
-Uint32_t      Buffer [BUFFER_FULL];    // Buffer for bitstream-file
-Uint32_t      dword         =  0;      // 32-bit-Word for Bitstream-I/O
-int           filled        = 32;      // Position in the the 32-bit-word that's currently about to be filled
-unsigned int  Zaehler       =  0;      // Position pointer for the processed bitstream-word (32 bit)
-UintMax_t     BufferedBits  =  0;      // Counter for the number of written bits in the bitstream
-
-
-/*
- *  Change_Endian32() changes the endianess of a 32-bit memory block in-place
- *  by swapping the byte order. This is a little bit tricky, but a well
- *  known method which is much much faster, especially on modern CPUs, than
- *  byte picking, because it avoids memory aliasing. Note that this method
- *  is poison for old 16-bit compilers!
- */
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-
-static void
-Change_Endian32 ( unsigned int* dst, size_t words32bit )
-{
-    ENTER(160);
-
-    for ( ; words32bit--; dst++ ) {
-# if  INT_MAX >= 2147483647L
-        unsigned int  tmp = *dst;
-        tmp  = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
-        tmp  = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
-        *dst = tmp;
-# else
-        char  tmp;
-        tmp             = ((char*)dst)[0];
-        ((char*)dst)[0] = ((char*)dst)[3];
-        ((char*)dst)[3] = tmp;
-        tmp             = ((char*)dst)[1];
-        ((char*)dst)[1] = ((char*)dst)[2];
-        ((char*)dst)[2] = tmp;
-# endif
-    }
-    LEAVE(160);
-    return;
-}
-
-#endif /* ENDIAN == HAVE_BIG_ENDIAN */
-
-
-void
-FlushBitstream ( FILE* fp, const Uint32_t* buffer, size_t words32bit )
-{
-    size_t           WrittenDwords = 0;
-    const Uint32_t*  p             = buffer;
-    size_t           CC            = words32bit;
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-    Change_Endian32 ( (Uint32_t*)buffer, CC );
-#endif
-
-    // Write Buffer
-    do {
-        WrittenDwords = fwrite ( p, sizeof(*buffer), words32bit, fp );
-        if ( WrittenDwords == 0 ) {
-            stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
-            sleep (10);
-        }
-        if ( WrittenDwords > 0 ) {
-            p          += WrittenDwords;
-            words32bit -= WrittenDwords;
-        }
-    } while ( words32bit != 0 );
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-    Change_Endian32 ( (Uint32_t*)buffer, CC );
-#endif
-}
-
-
-void
-UpdateHeader ( FILE* fp, Uint32_t Frames, Uint ValidSamples )
-{
-    Uint8_t  buff [4];
-
-    // Write framecount to header
-    if ( fseek ( fp, 4L, SEEK_SET ) < 0 )
-        return;
-
-    buff [0] = (Uint8_t)(Frames >>  0);
-    buff [1] = (Uint8_t)(Frames >>  8);
-    buff [2] = (Uint8_t)(Frames >> 16);
-    buff [3] = (Uint8_t)(Frames >> 24);
-
-    fwrite ( buff, 1, 4, fp );
-
-    // Write ValidSamples to header
-    if ( fseek ( fp, 22L, SEEK_SET ) < 0 )
-        return;
-
-    ValidSamples <<= 4;
-    ValidSamples  |= 0x8000;
-    buff [0] = (Uint8_t)(ValidSamples >>  0);
-    buff [1] = (Uint8_t)(ValidSamples >>  8);
-
-    fwrite ( buff, 1, 2, fp );
-
-
-    // Set filepointer to end of file (dirty method, should be old position!!)
-    fseek ( fp, 0L, SEEK_END );
-}
-
-
-void
-WriteBits ( const Uint32_t input, const unsigned int bits )
-{
-    BufferedBits += bits;
-    filled       -= bits;
-
-    if      ( filled > 0 ) {
-        dword  |= input << filled;
-    }
-    else if ( filled < 0 ) {
-        Buffer [Zaehler++] = dword | ( input >> -filled );
-        filled += 32;
-        dword   = input << filled;
-    }
-    else {
-        Buffer [Zaehler++] = dword | input;
-        filled  = 32;
-        dword   =  0;
-    }
-}
-
-// Bits in the original stream have to be 0, maximum X bits allowed to be set in input
-// Actual bitstream must have already written ptr[0] and ptr[1]
-void
-WriteBitsAt ( const Uint32_t input, const unsigned int bits, BitstreamPos const pos )
-{
-    Uint32_t*     ptr    = pos.ptr;
-    int           filled = pos.bit - bits;
-
-//    fprintf ( stderr, "%5u %2u %08lX %2u\n", input, bits, pos.ptr, pos.bit );
-
-    Buffer [Zaehler] = dword;
-
-    if      ( filled > 0 ) {
-        ptr [0] |= input << (  +filled);
-    }
-    else if ( filled < 0 ) {
-        ptr [0] |= input >> (  -filled);
-        ptr [1] |= input << (32+filled);
-    }
-    else {
-        ptr [0] |= input;
-    }
-
-    dword = Buffer [Zaehler];
-}
-
-
-void
-GetBitstreamPos ( BitstreamPos* const pos )
-{
-    pos -> ptr = Buffer + Zaehler;
-    pos -> bit = filled;
-}
-
-/* end of bitstream.c */
Index: penc/trunk/clipboard.c
===================================================================
--- /mppenc/trunk/clipboard.c	(revision 96)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <direct.h>
-#include <errno.h>
-#include <tchar.h>
-#include <windows.h>
-
-// EnumClipboardFormats
-
-void
-CopyToClipboard ( const char* src )
-{
-    TCHAR*   pClipboardText  = NULL;
-    BOOL     boClipboardOpen = FALSE;
-    BOOL     boReturnValue   = FALSE;
-    HGLOBAL  hGlobal         = NULL;
-
-    // Copy to clipboard
-    if ( ( hGlobal = GlobalAlloc ( GMEM_MOVEABLE | GMEM_DDESHARE, (strlen(src) + 1) * sizeof (TCHAR) ) ) == NULL )
-        goto Exit;
-    if ( ( pClipboardText = (TCHAR*) GlobalLock (hGlobal) ) == NULL )
-        goto Exit;
-    lstrcpy ( pClipboardText, src );
-    GlobalUnlock (hGlobal);
-
-    boClipboardOpen = OpenClipboard ( /*GetSafeHwnd()*/ NULL );
-    if ( ! boClipboardOpen )
-        goto LowOnMemoryExit;
-
-    EmptyClipboard ();
-    if ( SetClipboardData ( sizeof(char) != sizeof(TCHAR)  ?  CF_UNICODETEXT  :  CF_TEXT, hGlobal ) == 0 )
-        goto LowOnMemoryExit;
-
-        // Cleanup
-    hGlobal       = NULL ;
-    boReturnValue = TRUE ;
-
-Exit:
-    if ( boClipboardOpen )
-        CloseClipboard ();
-    if ( hGlobal != NULL )
-        GlobalFree (hGlobal);
-    return;
-
-LowOnMemoryExit:
-    fprintf ( stderr, "Low on memory\n" );
-    goto Exit;
-}
-
-
-int
-main ( void )
-{
-    CopyToClipboard ( "Ein Hase und ein Igel\n" );
-    return 0;
-}
Index: penc/trunk/clipboard.dsp
===================================================================
--- /mppenc/trunk/clipboard.dsp	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# Microsoft Developer Studio Project File - Name="clipboard" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=clipboard - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "clipboard.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "clipboard.mak" CFG="clipboard - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "clipboard - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "clipboard - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "clipboard - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "clipboard___Win32_Release"
-# PROP BASE Intermediate_Dir "clipboard___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "clipboard___Win32_Release"
-# PROP Intermediate_Dir "clipboard___Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "clipboard - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "clipboard - Win32 Release"
-# Name "clipboard - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\clipboard.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/clipboard.vcproj
===================================================================
--- /mppenc/trunk/clipboard.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="clipboard"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\clipboard___Win32_Release"
-			IntermediateDirectory=".\clipboard___Win32_Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\clipboard___Win32_Release/clipboard.pch"
-				AssemblerListingLocation=".\clipboard___Win32_Release/"
-				ObjectFile=".\clipboard___Win32_Release/"
-				ProgramDataBaseFileName=".\clipboard___Win32_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\clipboard___Win32_Release/clipboard.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\clipboard___Win32_Release/clipboard.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\clipboard___Win32_Release/clipboard.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/clipboard.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/clipboard.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/clipboard.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/clipboard.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="clipboard.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/clipstat.c
===================================================================
--- /mppenc/trunk/clipstat.c	(revision 96)
+++ 	(revision )
@@ -1,1186 +1,0 @@
-/*
- * known Bugs:
- *   Doesn't wait for the end of system (gnuplot). Does anyone know why?!
- *   Folder is being created even if no file was written
- *   Special characters in album- and filenames
- *   Scale division on all 4 axes
- *
- * to do:
- *   Write GetAlbumFromFilename()
- *   Write GetTitleFromFilename()
- *
- * Other interesting things
- *   - Uniformity of the LSBs (because of ADC-errors or non-linear coding (µ-law, DAT, some LSBs=0)
- *   - noise estimation via level and LPAC-Entropy
- */
-
-
-/* config section */
-#define GNUPLOT
-#define DIRECTORY  "results"
-
-#include <ctype.h>
-#include "mppdec.h"
-
-double
-derfc ( double x )
-{
-    double t, u, y;
-
-    t = 3.97886080735226 / (fabs(x) + 3.97886080735226);
-    u = t - 0.5;
-    y = ((((((((((0.00127109764952614092) * u + 1.19314022838340944e-4) * u -
-                  0.003963850973605135  ) * u - 8.70779635317295828e-4) * u +
-                  0.00773672528313526668) * u + 0.00383335126264887303) * u -
-                  0.0127223813782122755 ) * u - 0.0133823644533460069 ) * u +
-                  0.0161315329733252248 ) * u + 0.0390976845588484035 ) * u +
-                  0.00249367200053503304;
-    y = ((((((((((((y * u - 0.0838864557023001992) * u -
-                            0.119463959964325415 ) * u + 0.0166207924969367356) * u +
-                            0.357524274449531043 ) * u + 0.805276408752910567 ) * u +
-                            1.18902982909273333  ) * u + 1.37040217682338167  ) * u +
-                            1.31314653831023098  ) * u + 1.07925515155856677  ) * u +
-                            0.774368199119538609 ) * u + 0.490165080585318424 ) * u +
-                            0.275374741597376782 ) * t * exp(-x * x);
-    return x < 0  ?  2 - y  :  y;
-}
-
-
-double
-derf ( double x )
-{
-           int     k;
-           double  w, t, y;
-    static double  a[65] = {
-        5.958930743e-11, -1.13739022964e-9, 1.466005199839e-8, -1.635035446196e-7, 1.6461004480962e-6, -1.492559551950604e-5, 1.2055331122299265e-4, -8.548326981129666e-4,  0.00522397762482322257, -0.0268661706450773342,  0.11283791670954881569, -0.37612638903183748117, 1.12837916709551257377,
-        2.372510631e-11, -4.5493253732e-10, 5.90362766598e-9,  -6.642090827576e-8, 6.7595634268133e-7, -6.21188515924e-6,     5.10388300970969e-5,   -3.7015410692956173e-4, 0.00233307631218880978, -0.0125498847718219221,  0.05657061146827041994, -0.2137966477645600658,  0.84270079294971486929,
-        9.49905026e-12,  -1.8310229805e-10, 2.39463074e-9,     -2.721444369609e-8, 2.8045522331686e-7, -2.61830022482897e-6,  2.195455056768781e-5,  -1.6358986921372656e-4, 0.00107052153564110318, -0.00608284718113590151, 0.02986978465246258244, -0.13055593046562267625, 0.67493323603965504676,
-        3.82722073e-12,  -7.421598602e-11,  9.793057408e-10,   -1.126008898854e-8, 1.1775134830784e-7, -1.1199275838265e-6,   9.62023443095201e-6,   -7.404402135070773e-5,  5.0689993654144881e-4,  -0.00307553051439272889, 0.01668977892553165586, -0.08548534594781312114, 0.56909076642393639985,
-        1.55296588e-12,  -3.032205868e-11,  4.0424830707e-10,  -4.71135111493e-9,  5.011915876293e-8,  -4.8722516178974e-7,   4.30683284629395e-6,   -3.445026145385764e-5,  2.4879276133931664e-4,  -0.00162940941748079288, 0.00988786373932350462, -0.05962426839442303805, 0.49766113250947636708
-    };
-    static double  b[65] = {
-        -2.9734388465e-10, 2.69776334046e-9, -6.40788827665e-9, -1.6678201321e-8,   -2.1854388148686e-7,  2.66246030457984e-6,        1.612722157047886e-5, -2.5616361025506629e-4,        1.5380842432375365e-4, 0.00815533022524927908,        -0.01402283663896319337, -0.19746892495383021487,        0.71511720328842845913,
-        -1.951073787e-11, -3.2302692214e-10,  5.22461866919e-9,  3.42940918551e-9,  -3.5772874310272e-7,  1.9999935792654e-7,        2.687044575042908e-5, -1.1843240273775776e-4,        -8.0991728956032271e-4, 0.00661062970502241174,        0.00909530922354827295, -0.2016007277849101314,        0.51169696718727644908,
-         3.147682272e-11, -4.8465972408e-10,  6.3675740242e-10,  3.377623323271e-8, -1.5451139637086e-7, -2.03340624738438e-6,        1.947204525295057e-5, 2.854147231653228e-5,        -0.00101565063152200272, 0.00271187003520095655,        0.02328095035422810727, -0.16725021123116877197,        0.32490054966649436974,
-         2.31936337e-11,  -6.303206648e-11,  -2.64888267434e-9,  2.050708040581e-8,  1.1371857327578e-7, -2.11211337219663e-6,        3.68797328322935e-6, 9.823686253424796e-5,        -6.5860243990455368e-4, -7.5285814895230877e-4,        0.02585434424202960464, -0.11637092784486193258,        0.18267336775296612024,
-        -3.67789363e-12,   2.0876046746e-10, -1.93319027226e-9, -4.35953392472e-9,   1.8006992266137e-7, -7.8441223763969e-7,        -6.75407647949153e-6, 8.428418334440096e-5,        -1.7604388937031815e-4, -0.0023972961143507161,        0.0206412902387602297, -0.06905562880005864105,        0.09084526782065478489
-    };
-
-    w = fabs (x);
-    if ( w < 2.2 ) {
-        t = w * w;
-        k = (int) t;
-        t -= k;
-        k *= 13;
-        y = ((((((((((((a[k] * t + a[k + 1]) * t +
-            a[k +  2]) * t + a[k +  3]) * t + a[k +  4]) * t +
-            a[k +  5]) * t + a[k +  6]) * t + a[k +  7]) * t +
-            a[k +  8]) * t + a[k +  9]) * t + a[k + 10]) * t +
-            a[k + 11]) * t + a[k + 12]) * w;
-    } else if ( w < 6.9 ) {
-        k = (int) w;
-        t = w - k;
-        k = 13 * (k - 2);
-        y = (((((((((((b[k] * t + b[k + 1]) * t +
-            b[k +  2]) * t + b[k +  3]) * t + b[k +  4]) * t +
-            b[k +  5]) * t + b[k +  6]) * t + b[k +  7]) * t +
-            b[k +  8]) * t + b[k +  9]) * t + b[k + 10]) * t +
-            b[k + 11]) * t + b[k + 12];
-        y *= y;
-        y *= y;
-        y *= y;
-        y = 1 - y * y;
-    } else {
-        y = 1;
-    }
-    return x < 0  ?  -y  :  y;
-}
-
-
-double
-dierfc ( double y )
-{
-    double  s, t, u, w, x, z;
-
-    z = y > 1  ?  2. - y  :  y;
-    w = 0.916461398268964 - log (z);
-    u = sqrt (w);
-    s = (log (u) + 0.488826640273108) / w;
-    t = 1 / (u + 0.231729200323405);
-    x = u * (1 - s * (s * 0.124610454613712 + 0.5)) -
-        ((((-0.0728846765585675 * t + 0.269999308670029) * t +
-             0.150689047360223) * t + 0.116065025341614) * t +
-             0.499999303439796) * t;
-    t = 3.97886080735226 / (x + 3.97886080735226);
-    u = t - 0.5;
-    s = (((((((((0.00112648096188977922  * u +
-                 1.05739299623423047e-4) * u - 0.00351287146129100025) * u -
-                 7.71708358954120939e-4) * u + 0.00685649426074558612) * u +
-                 0.00339721910367775861) * u - 0.011274916933250487  ) * u -
-                 0.0118598117047771104 ) * u + 0.0142961988697898018 ) * u +
-                 0.0346494207789099922 ) * u + 0.00220995927012179067;
-    s = ((((((((((((s * u - 0.0743424357241784861) * u -
-        0.105872177941595488) * u + 0.0147297938331485121) * u +
-        0.316847638520135944) * u + 0.713657635868730364 ) * u +
-        1.05375024970847138 ) * u + 1.21448730779995237  ) * u +
-        1.16374581931560831 ) * u + 0.956464974744799006 ) * u +
-        0.686265948274097816) * u + 0.434397492331430115 ) * u +
-        0.244044510593190935) * t -
-        z * exp (x * x - 0.120782237635245222);
-    x += s * (x * s + 1);
-    return y > 1  ?   -x  :  +x;
-}
-
-
-double
-dgamma ( double x )
-{
-    int     k, n;
-    double  w, y;
-
-    n = x < 1.5  ?  -((int) (2.5 - x))  :  (int) (x - 1.5);
-    w = x - (n + 2);
-    y = ((((((((((((-1.99542863674e-7      * w + 1.337767384067e-6   ) * w -
-                     2.591225267689e-6   ) * w - 1.7545539395205e-5  ) * w +
-                     1.45596568617526e-4 ) * w - 3.60837876648255e-4 ) * w -
-                     8.04329819255744e-4 ) * w + 0.008023273027855346) * w -
-                     0.017645244547851414) * w - 0.024552490005641278) * w +
-                     0.19109110138763841 ) * w - 0.233093736421782878) * w -
-                     0.422784335098466784) * w + 0.99999999999999999;
-    if ( n > 0 ) {
-        w = x - 1;
-        for ( k = 2; k <= n; k++ ) {
-            w *= x - k;
-        }
-    } else {
-        w = 1;
-        for ( k = 0; k > n; k-- ) {
-            y *= x - k;
-        }
-    }
-    return w / y;
-}
-
-
-#ifdef GNUPLOT
-const char  __gnuplot [] =
-//"set grid\n"
-"set tics out\n"
-"set key bottom right\n"
-//"set nokey\n"
-"\n"
-"set xtics mirror\n"
-"set ytics mirror\n"
-"\n"
-"set xtics -10, 1, 10\n"
-"set ytics (\"32768\" 32768, \"24576\" 24576, \"16384\" 16384, \"8192\" 8192, \"0\" 0, \"-8192\" -8192, \"-16384\" -16384, \"-24576\" -24576, \"-32768\" -32768)"
-"\n"
-"set xrange[-5.5:5.5]\n"
-"set yrange[-32768:32768]\n"
-"\n"
-"set xlabel \"Sigma\"\n"
-"set ylabel \"Sample\"\n"
-"\n"
-"set data style lines\n"
-"\n"
-"set size 1024./128./5., 768./120./4.\n"
-"set terminal png color\n"
-;
-
-
-// fixme: needs to be written
-static const char*
-GetAlbumFromFilename ( const char* filename )
-{
-    static const char*  name = "Album";
-
-    return name;
-}
-
-
-// fixme: needs to be written
-static const char*
-GetTitleFromFilename ( const char* filename )
-{
-    static char  dstname [1024];
-    int          len = NULL==strrchr (filename, '.')  ?  strlen (filename)  :  strrchr (filename, '.') - filename;
-
-    sprintf ( dstname, "%*.*s", len, len, filename );
-
-    return dstname;
-}
-
-
-static int
-gnuplot ( int argc, const char** argv )
-{
-    int    i;
-    char   dstname [1024];
-    char   command [1024];
-    int    rc;
-    FILE*  fp;
-
-    stderr_printf ( "plotting ..." );
-
-    sprintf ( dstname, DIRECTORY"/%s.plot", GetAlbumFromFilename (argv[1]) );
-    if ( (fp = fopen ( dstname, "w")) == NULL ) {
-        stderr_printf ( "Can't create '%s'\n", dstname );
-        return -1;
-    }
-
-    fprintf ( fp, "%s\n", __gnuplot );
-    fprintf ( fp, "set title \"%s\"\n"     , GetAlbumFromFilename (argv[1]) );
-    fprintf ( fp, "set output \"%s.png\"\n", GetAlbumFromFilename (argv[1]) );
-
-
-    fprintf ( fp, "plot" );
-    for ( i = 1; i < argc; i++ ) {
-        fprintf ( fp, "%s\"%s\"", 1==i  ?  " "  :  ", ", GetTitleFromFilename (argv[i]) );
-    }
-    fprintf ( fp, "\n" );
-    fclose (fp);
-
-    if ( 0 != chdir (DIRECTORY) ) {
-        stderr_printf ( "\nCan't chdir %s\n", DIRECTORY );
-        return -1;
-    }
-
-    sprintf ( command, "gnuplot %s.plot &> /dev/null", GetAlbumFromFilename (argv[1]) );
-    stderr_printf ( "\n" );
-    rc = system (command);
-    /* system doesn't recognize most errors */
-    if ( 127 == rc ) {
-        /* fixme: errno should be checked here */
-        stderr_printf ( "Can't execute '%s'\n", command );
-    }
-    else if ( -1 == rc ) {
-        stderr_printf ( "Can't plot '%s'\n", GetAlbumFromFilename (argv[1]) );
-    }
-
-# if 0
-    for ( i = 1; i < argc; i++ ) {
-        sprintf ( command, "%s", GetTitleFromFilename (argv[i]) );
-        if ( 0 != unlink (command) ) {
-            stderr_printf ( "Can't delete '%s'\n", command );
-        }
-    }
-    sprintf ( command, "%s.plot", GetAlbumFromFilename (argv[1]) );
-    if ( 0 != unlink (command) ) {
-        stderr_printf ( "Can't delete '%s'\n", command );
-    }
-# endif
-
-    return rc;
-}
-
-#endif
-
-
-const char __1 [] =
-"#\n"
-"# ACE/gr parameter file\n"
-"#\n"
-"@version 40102\n"
-"@page layout free\n"
-"@ps linewidth begin 1\n"
-"@ps linewidth increment 2\n"
-"@hardcopy device 1\n"
-"@page 5\n"
-"@page inout 5\n"
-"@link page off\n"
-"@default linestyle 1\n"
-"@default linewidth 1\n"
-"@default color 1\n"
-"@default char size 1.0\n"
-"@default font 4\n"
-"@default font source 0\n"
-"@default symbol size 1.0\n"
-"@timestamp off\n"
-"@timestamp 0.03, 0.03\n"
-"@timestamp linewidth 1\n"
-"@timestamp color 1\n"
-"@timestamp rot 0\n"
-"@timestamp font 4\n"
-"@timestamp char size 1.0\n"
-"@timestamp def \"Wed Nov 28 22:36:22 2001\"\n"
-"@with g0\n"
-"@g0 on\n"
-"@g0 label off\n"
-"@g0 hidden false\n"
-"@g0 type xy\n"
-"@g0 autoscale type AUTO\n"
-"@g0 fixedpoint off\n"
-"@g0 fixedpoint type 0\n"
-"@g0 fixedpoint xy 0.0, 0.0\n"
-"@g0 fixedpoint format general general\n"
-"@g0 fixedpoint prec 6, 6\n"
-"@ world xmin -5.5\n"
-"@ world xmax 5.5\n"
-"@ world ymin -32768\n"
-"@ world ymax 32768\n"
-"@ stack world 0, 0, 0, 0 tick 0, 0, 0, 0\n"
-"@ view xmin 0.09\n"
-"@ view xmax 0.98\n"
-"@ view ymin 0.08\n"
-"@ view ymax 0.90\n"
-"@ title \"%*.*s\"\n"
-"@ title font 4\n"
-"@ title size 1.0\n"
-"@ title color 1\n"
-"@ title linewidth 1\n"
-"@ subtitle \"(amplitude statistics)\"\n"
-"@ subtitle font 4\n"
-"@ subtitle size 0.64\n"
-"@ subtitle color 1\n"
-"@ subtitle linewidth 1\n"
-"@ s0 symbol 0\n"
-"@ s0 symbol size 1.0\n"
-"@ s0 symbol fill 0\n"
-"@ s0 symbol color -1\n"
-"@ s0 symbol linewidth 1\n"
-"@ s0 symbol linestyle 1\n"
-"@ s0 symbol center false\n"
-"@ s0 symbol char 0\n"
-"@ s0 skip 0\n"
-"@ s0 linestyle 1\n"
-"@ s0 linewidth 1\n"
-"@ s0 color 1\n"
-"@ s0 fill 0\n"
-"@ s0 fill with color\n"
-"@ s0 fill color 1\n"
-"@ s0 fill pattern 0\n"
-"@ s0 errorbar type BOTH\n"
-"@ s0 errorbar length 1.0\n"
-"@ s0 errorbar linewidth 1\n"
-"@ s0 errorbar linestyle 1\n"
-"@ s0 errorbar riser on\n"
-"@ s0 errorbar riser linewidth 1\n"
-"@ s0 errorbar riser linestyle 1\n"
-"@ s0 xyz 0.0, 0.0\n"
-"@ s0 comment \"%*.*s\"\n"
-"@ xaxis  tick on\n"
-"@ xaxis  tick major 1\n"
-"@ xaxis  tick minor 0.2\n"
-"@ xaxis  tick offsetx 0.0\n"
-"@ xaxis  tick offsety 0.0\n"
-"@ xaxis  label \"deviation\"\n"
-"@ xaxis  label layout para\n"
-"@ xaxis  label place spec\n"
-"@ xaxis  label place 0.0, 0.06\n"
-"@ xaxis  label char size 0.80\n"
-"@ xaxis  label font 4\n"
-"@ xaxis  label color 1\n"
-"@ xaxis  label linewidth 1\n"
-"@ xaxis  ticklabel on\n"
-"@ xaxis  ticklabel type auto\n"
-"@ xaxis  ticklabel prec 5\n"
-"@ xaxis  ticklabel format general\n"
-"@ xaxis  ticklabel append \"s\"\n"
-"@ xaxis  ticklabel prepend \"\"\n"
-"@ xaxis  ticklabel layout horizontal\n"
-"@ xaxis  ticklabel place on ticks\n"
-"@ xaxis  ticklabel skip 0\n"
-"@ xaxis  ticklabel stagger 0\n"
-"@ xaxis  ticklabel op bottom\n"
-"@ xaxis  ticklabel sign normal\n"
-"@ xaxis  ticklabel start type spec\n"
-"@ xaxis  ticklabel start -5.0\n"
-"@ xaxis  ticklabel stop type spec\n"
-"@ xaxis  ticklabel stop 5.0\n"
-"@ xaxis  ticklabel char size 0.78\n"
-"@ xaxis  ticklabel font 8\n"
-"@ xaxis  ticklabel color 1\n"
-"@ xaxis  ticklabel linewidth 1\n"
-"@ xaxis  tick major on\n"
-"@ xaxis  tick minor on\n"
-"@ xaxis  tick default 6\n"
-"@ xaxis  tick in\n"
-"@ xaxis  tick major color 1\n"
-"@ xaxis  tick major linewidth 1\n"
-"@ xaxis  tick major linestyle 1\n"
-"@ xaxis  tick minor color 7\n"
-"@ xaxis  tick minor linewidth 1\n"
-"@ xaxis  tick minor linestyle 1\n"
-"@ xaxis  tick log off\n"
-"@ xaxis  tick size 0.72\n"
-"@ xaxis  tick minor size 0.48\n"
-"@ xaxis  bar off\n"
-"@ xaxis  bar color 1\n"
-"@ xaxis  bar linestyle 1\n"
-"@ xaxis  bar linewidth 1\n"
-"@ xaxis  tick major grid off\n"
-"@ xaxis  tick minor grid off\n"
-"@ xaxis  tick op both\n"
-"@ xaxis  tick type auto\n"
-"@ xaxis  tick spec 0\n"
-"@ yaxis  tick on\n"
-"@ yaxis  tick major 8192\n"
-"@ yaxis  tick minor 2048\n"
-"@ yaxis  tick offsetx 0.0\n"
-"@ yaxis  tick offsety 0.0\n"
-"@ yaxis  label \"Level\"\n"
-"@ yaxis  label layout para\n"
-"@ yaxis  label place spec\n"
-"@ yaxis  label place 0.065000, 0.0\n"
-"@ yaxis  label char size 1.0\n"
-"@ yaxis  label font 4\n"
-"@ yaxis  label color 1\n"
-"@ yaxis  label linewidth 1\n"
-"@ yaxis  ticklabel on\n"
-"@ yaxis  ticklabel type auto\n"
-"@ yaxis  ticklabel prec 5\n"
-"@ yaxis  ticklabel format general\n"
-"@ yaxis  ticklabel append \"\"\n"
-"@ yaxis  ticklabel prepend \"\"\n"
-"@ yaxis  ticklabel layout horizontal\n"
-"@ yaxis  ticklabel place on ticks\n"
-"@ yaxis  ticklabel skip 0\n"
-"@ yaxis  ticklabel stagger 0\n"
-"@ yaxis  ticklabel op left\n"
-"@ yaxis  ticklabel sign normal\n"
-"@ yaxis  ticklabel start type auto\n"
-"@ yaxis  ticklabel start 0.0\n"
-"@ yaxis  ticklabel stop type auto\n"
-"@ yaxis  ticklabel stop 0.0\n"
-"@ yaxis  ticklabel char size 0.72\n"
-"@ yaxis  ticklabel font 4\n"
-"@ yaxis  ticklabel color 1\n"
-"@ yaxis  ticklabel linewidth 1\n"
-"@ yaxis  tick major on\n"
-"@ yaxis  tick minor on\n"
-"@ yaxis  tick default 6\n"
-"@ yaxis  tick in\n"
-"@ yaxis  tick major color 1\n"
-"@ yaxis  tick major linewidth 1\n"
-"@ yaxis  tick major linestyle 1\n"
-"@ yaxis  tick minor color 7\n"
-"@ yaxis  tick minor linewidth 1\n"
-"@ yaxis  tick minor linestyle 1\n"
-"@ yaxis  tick log off\n"
-"@ yaxis  tick size 0.72\n"
-"@ yaxis  tick minor size 0.48\n"
-"@ yaxis  bar off\n"
-"@ yaxis  bar color 1\n"
-"@ yaxis  bar linestyle 1\n"
-"@ yaxis  bar linewidth 1\n"
-"@ yaxis  tick major grid off\n"
-"@ yaxis  tick minor grid off\n"
-"@ yaxis  tick op both\n"
-"@ yaxis  tick type auto\n"
-"@ yaxis  tick spec 0\n"
-"@ zeroxaxis  tick on\n"
-"@ zeroxaxis  tick major 5\n"
-"@ zeroxaxis  tick minor 2.5\n"
-"@ zeroxaxis  tick offsetx 0.0\n"
-"@ zeroxaxis  tick offsety 0.0\n"
-"@ zeroxaxis  label \"\"\n"
-"@ zeroxaxis  label layout para\n"
-"@ zeroxaxis  label place auto\n"
-"@ zeroxaxis  label char size 1.0\n"
-"@ zeroxaxis  label font 4\n"
-"@ zeroxaxis  label color 1\n"
-"@ zeroxaxis  label linewidth 1\n"
-"@ zeroxaxis  ticklabel off\n"
-"@ zeroxaxis  ticklabel type auto\n"
-"@ zeroxaxis  ticklabel prec 5\n"
-"@ zeroxaxis  ticklabel format general\n"
-"@ zeroxaxis  ticklabel append \"\"\n"
-"@ zeroxaxis  ticklabel prepend \"\"\n"
-"@ zeroxaxis  ticklabel layout horizontal\n"
-"@ zeroxaxis  ticklabel place on ticks\n"
-"@ zeroxaxis  ticklabel skip 0\n"
-"@ zeroxaxis  ticklabel stagger 0\n"
-"@ zeroxaxis  ticklabel op bottom\n"
-"@ zeroxaxis  ticklabel sign normal\n"
-"@ zeroxaxis  ticklabel start type auto\n"
-"@ zeroxaxis  ticklabel start 0.0\n"
-"@ zeroxaxis  ticklabel stop type auto\n"
-"@ zeroxaxis  ticklabel stop 0.0\n"
-"@ zeroxaxis  ticklabel char size 1.0\n"
-"@ zeroxaxis  ticklabel font 4\n"
-"@ zeroxaxis  ticklabel color 1\n"
-"@ zeroxaxis  ticklabel linewidth 1\n"
-"@ zeroxaxis  tick major off\n"
-"@ zeroxaxis  tick minor on\n"
-"@ zeroxaxis  tick default 6\n"
-"@ zeroxaxis  tick in\n"
-"@ zeroxaxis  tick major color 1\n"
-"@ zeroxaxis  tick major linewidth 1\n"
-"@ zeroxaxis  tick major linestyle 1\n"
-"@ zeroxaxis  tick minor color 7\n"
-"@ zeroxaxis  tick minor linewidth 1\n"
-"@ zeroxaxis  tick minor linestyle 1\n"
-"@ zeroxaxis  tick log off\n"
-"@ zeroxaxis  tick size 0.72\n"
-"@ zeroxaxis  tick minor size 0.48\n"
-"@ zeroxaxis  bar off\n"
-"@ zeroxaxis  bar color 1\n"
-"@ zeroxaxis  bar linestyle 1\n"
-"@ zeroxaxis  bar linewidth 1\n"
-"@ zeroxaxis  tick major grid off\n"
-"@ zeroxaxis  tick minor grid off\n"
-"@ zeroxaxis  tick op both\n"
-"@ zeroxaxis  tick type auto\n"
-"@ zeroxaxis  tick spec 0\n"
-"@ zeroyaxis  tick on\n"
-"@ zeroyaxis  tick major 20000\n"
-"@ zeroyaxis  tick minor 10000\n"
-"@ zeroyaxis  tick offsetx 0.0\n"
-"@ zeroyaxis  tick offsety 0.0\n"
-"@ zeroyaxis  label \"\"\n"
-"@ zeroyaxis  label layout para\n"
-"@ zeroyaxis  label place auto\n"
-"@ zeroyaxis  label char size 1.0\n"
-"@ zeroyaxis  label font 4\n"
-"@ zeroyaxis  label color 1\n"
-"@ zeroyaxis  label linewidth 1\n"
-"@ zeroyaxis  ticklabel off\n"
-"@ zeroyaxis  ticklabel type auto\n"
-"@ zeroyaxis  ticklabel prec 5\n"
-"@ zeroyaxis  ticklabel format general\n"
-"@ zeroyaxis  ticklabel append \"\"\n"
-"@ zeroyaxis  ticklabel prepend \"\"\n"
-"@ zeroyaxis  ticklabel layout horizontal\n"
-"@ zeroyaxis  ticklabel place on ticks\n"
-"@ zeroyaxis  ticklabel skip 0\n"
-"@ zeroyaxis  ticklabel stagger 0\n"
-"@ zeroyaxis  ticklabel op left\n"
-"@ zeroyaxis  ticklabel sign normal\n"
-"@ zeroyaxis  ticklabel start type auto\n"
-"@ zeroyaxis  ticklabel start 0.0\n"
-"@ zeroyaxis  ticklabel stop type auto\n"
-"@ zeroyaxis  ticklabel stop 0.0\n"
-"@ zeroyaxis  ticklabel char size 1.0\n"
-"@ zeroyaxis  ticklabel font 4\n"
-"@ zeroyaxis  ticklabel color 1\n"
-"@ zeroyaxis  ticklabel linewidth 1\n"
-"@ zeroyaxis  tick major off\n"
-"@ zeroyaxis  tick minor on\n"
-"@ zeroyaxis  tick default 6\n"
-"@ zeroyaxis  tick in\n"
-"@ zeroyaxis  tick major color 1\n"
-"@ zeroyaxis  tick major linewidth 1\n"
-"@ zeroyaxis  tick major linestyle 1\n"
-"@ zeroyaxis  tick minor color 7\n"
-"@ zeroyaxis  tick minor linewidth 1\n"
-"@ zeroyaxis  tick minor linestyle 1\n"
-"@ zeroyaxis  tick log off\n"
-"@ zeroyaxis  tick size 0.72\n"
-"@ zeroyaxis  tick minor size 0.48\n"
-"@ zeroyaxis  bar off\n"
-"@ zeroyaxis  bar color 1\n"
-"@ zeroyaxis  bar linestyle 1\n"
-"@ zeroyaxis  bar linewidth 1\n"
-"@ zeroyaxis  tick major grid off\n"
-"@ zeroyaxis  tick minor grid off\n"
-"@ zeroyaxis  tick op both\n"
-"@ zeroyaxis  tick type auto\n"
-"@ zeroyaxis  tick spec 0\n"
-"@ legend on\n"
-"@ legend loctype view\n"
-"@ legend layout 0\n"
-"@ legend vgap 2\n"
-"@ legend hgap 1\n"
-"@ legend length 4\n"
-"@ legend box on\n"
-"@ legend box fill on\n"
-"@ legend box fill with color\n"
-"@ legend box fill color 0\n"
-"@ legend box fill pattern 1\n"
-"@ legend box color 1\n"
-"@ legend box linewidth 1\n"
-"@ legend box linestyle 1\n"
-"@ legend x1 0.2\n"
-"@ legend y1 0.8\n"
-"@ legend font 4\n"
-"@ legend char size 0.5\n"
-"@ legend linestyle 1\n"
-"@ legend linewidth 1\n"
-"@ legend color 1\n"
-"@ frame on\n"
-"@ frame type 0\n"
-"@ frame linestyle 1\n"
-"@ frame linewidth 1\n"
-"@ frame color 1\n"
-"@ frame fill off\n"
-"@ frame background color 0\n"
-"@WITH G0\n"
-"@G0 ON\n"
-"@TARGET S0\n"
-"@TYPE xy\n"
-;
-
-const char __2 [] =
-"#\n"
-"# ACE/gr parameter file\n"
-"#\n"
-"@version 40102\n"
-"@page layout free\n"
-"@ps linewidth begin 1\n"
-"@ps linewidth increment 2\n"
-"@hardcopy device 1\n"
-"@page 5\n"
-"@page inout 5\n"
-"@link page off\n"
-"@default linestyle 1\n"
-"@default linewidth 1\n"
-"@default color 1\n"
-"@default char size 1.0\n"
-"@default font 4\n"
-"@default font source 0\n"
-"@default symbol size 1.0\n"
-"@timestamp off\n"
-"@timestamp 0.03, 0.03\n"
-"@timestamp linewidth 1\n"
-"@timestamp color 1\n"
-"@timestamp rot 0\n"
-"@timestamp font 4\n"
-"@timestamp char size 1.0\n"
-"@timestamp def \"Wed Nov 28 22:36:22 2001\"\n"
-"@with g0\n"
-"@g0 on\n"
-"@g0 label off\n"
-"@g0 hidden false\n"
-"@g0 type xy\n"
-"@g0 autoscale type AUTO\n"
-"@g0 fixedpoint off\n"
-"@g0 fixedpoint type 0\n"
-"@g0 fixedpoint xy 0.0, 0.0\n"
-"@g0 fixedpoint format general general\n"
-"@g0 fixedpoint prec 6, 6\n"
-"@ world xmin -33500\n"
-"@ world xmax 33500\n"
-"@ world ymin 0\n"
-"@ world ymax %f\n"
-"@ stack world 0, 0, 0, 0 tick 0, 0, 0, 0\n"
-"@ view xmin 0.09\n"
-"@ view xmax 0.98\n"
-"@ view ymin 0.08\n"
-"@ view ymax 0.90\n"
-"@ title \"%*.*s\"\n"
-"@ title font 4\n"
-"@ title size 1.0\n"
-"@ title color 1\n"
-"@ title linewidth 1\n"
-"@ subtitle \"(amplitude statistics)\"\n"
-"@ subtitle font 4\n"
-"@ subtitle size 0.64\n"
-"@ subtitle color 1\n"
-"@ subtitle linewidth 1\n"
-"@ s0 symbol 0\n"
-"@ s0 symbol size 1.0\n"
-"@ s0 symbol fill 0\n"
-"@ s0 symbol color -1\n"
-"@ s0 symbol linewidth 1\n"
-"@ s0 symbol linestyle 1\n"
-"@ s0 symbol center false\n"
-"@ s0 symbol char 0\n"
-"@ s0 skip 0\n"
-"@ s0 linestyle 1\n"
-"@ s0 linewidth 1\n"
-"@ s0 color 1\n"
-"@ s0 fill 0\n"
-"@ s0 fill with color\n"
-"@ s0 fill color 1\n"
-"@ s0 fill pattern 0\n"
-"@ s0 errorbar type BOTH\n"
-"@ s0 errorbar length 1.0\n"
-"@ s0 errorbar linewidth 1\n"
-"@ s0 errorbar linestyle 1\n"
-"@ s0 errorbar riser on\n"
-"@ s0 errorbar riser linewidth 1\n"
-"@ s0 errorbar riser linestyle 1\n"
-"@ s0 xyz 0.0, 0.0\n"
-"@ s0 comment \"%*.*s\"\n"
-"@ xaxis  tick on\n"
-"@ xaxis  tick major 8192\n"
-"@ xaxis  tick minor 2048\n"
-"@ xaxis  tick offsetx 0.0\n"
-"@ xaxis  tick offsety 0.0\n"
-"@ xaxis  label \"Level\"\n"
-"@ xaxis  label layout para\n"
-"@ xaxis  label place spec\n"
-"@ xaxis  label place 0.0, 0.06\n"
-"@ xaxis  label char size 0.80\n"
-"@ xaxis  label font 4\n"
-"@ xaxis  label color 1\n"
-"@ xaxis  label linewidth 1\n"
-"@ xaxis  ticklabel on\n"
-"@ xaxis  ticklabel type auto\n"
-"@ xaxis  ticklabel prec 5\n"
-"@ xaxis  ticklabel format general\n"
-"@ xaxis  ticklabel append \"\"\n"
-"@ xaxis  ticklabel prepend \"\"\n"
-"@ xaxis  ticklabel layout horizontal\n"
-"@ xaxis  ticklabel place on ticks\n"
-"@ xaxis  ticklabel skip 0\n"
-"@ xaxis  ticklabel stagger 0\n"
-"@ xaxis  ticklabel op bottom\n"
-"@ xaxis  ticklabel sign normal\n"
-"@ xaxis  ticklabel start type spec\n"
-"@ xaxis  ticklabel start -32768\n"
-"@ xaxis  ticklabel stop type spec\n"
-"@ xaxis  ticklabel stop 32768\n"
-"@ xaxis  ticklabel char size 0.78\n"
-"@ xaxis  ticklabel font 8\n"
-"@ xaxis  ticklabel color 1\n"
-"@ xaxis  ticklabel linewidth 1\n"
-"@ xaxis  tick major on\n"
-"@ xaxis  tick minor on\n"
-"@ xaxis  tick default 6\n"
-"@ xaxis  tick out\n"
-"@ xaxis  tick major color 1\n"
-"@ xaxis  tick major linewidth 1\n"
-"@ xaxis  tick major linestyle 1\n"
-"@ xaxis  tick minor color 7\n"
-"@ xaxis  tick minor linewidth 1\n"
-"@ xaxis  tick minor linestyle 1\n"
-"@ xaxis  tick log off\n"
-"@ xaxis  tick size 0.72\n"
-"@ xaxis  tick minor size 0.48\n"
-"@ xaxis  bar off\n"
-"@ xaxis  bar color 1\n"
-"@ xaxis  bar linestyle 1\n"
-"@ xaxis  bar linewidth 1\n"
-"@ xaxis  tick major grid off\n"
-"@ xaxis  tick minor grid off\n"
-"@ xaxis  tick op both\n"
-"@ xaxis  tick type auto\n"
-"@ xaxis  tick spec 0\n"
-"@ yaxis  tick on\n"
-"@ yaxis  tick major 1\n"
-"@ yaxis  tick minor 0.2\n"
-"@ yaxis  tick offsetx 0.0\n"
-"@ yaxis  tick offsety 0.0\n"
-"@ yaxis  label \"rel. Abundance\"\n"
-"@ yaxis  label layout para\n"
-"@ yaxis  label place spec\n"
-"@ yaxis  label place 0.065000, 0.0\n"
-"@ yaxis  label char size 1.0\n"
-"@ yaxis  label font 4\n"
-"@ yaxis  label color 1\n"
-"@ yaxis  label linewidth 1\n"
-"@ yaxis  ticklabel on\n"
-"@ yaxis  ticklabel type auto\n"
-"@ yaxis  ticklabel prec 5\n"
-"@ yaxis  ticklabel format general\n"
-"@ yaxis  ticklabel append \"**2\"\n"
-"@ yaxis  ticklabel prepend \"\"\n"
-"@ yaxis  ticklabel layout horizontal\n"
-"@ yaxis  ticklabel place on ticks\n"
-"@ yaxis  ticklabel skip 0\n"
-"@ yaxis  ticklabel stagger 0\n"
-"@ yaxis  ticklabel op left\n"
-"@ yaxis  ticklabel sign normal\n"
-"@ yaxis  ticklabel start type auto\n"
-"@ yaxis  ticklabel start 0.0\n"
-"@ yaxis  ticklabel stop type auto\n"
-"@ yaxis  ticklabel stop 0.0\n"
-"@ yaxis  ticklabel char size 0.72\n"
-"@ yaxis  ticklabel font 4\n"
-"@ yaxis  ticklabel color 1\n"
-"@ yaxis  ticklabel linewidth 1\n"
-"@ yaxis  tick major on\n"
-"@ yaxis  tick minor on\n"
-"@ yaxis  tick default 6\n"
-"@ yaxis  tick in\n"
-"@ yaxis  tick major color 1\n"
-"@ yaxis  tick major linewidth 1\n"
-"@ yaxis  tick major linestyle 1\n"
-"@ yaxis  tick minor color 7\n"
-"@ yaxis  tick minor linewidth 1\n"
-"@ yaxis  tick minor linestyle 1\n"
-"@ yaxis  tick log off\n"
-"@ yaxis  tick size 0.72\n"
-"@ yaxis  tick minor size 0.48\n"
-"@ yaxis  bar off\n"
-"@ yaxis  bar color 1\n"
-"@ yaxis  bar linestyle 1\n"
-"@ yaxis  bar linewidth 1\n"
-"@ yaxis  tick major grid off\n"
-"@ yaxis  tick minor grid off\n"
-"@ yaxis  tick op both\n"
-"@ yaxis  tick type auto\n"
-"@ yaxis  tick spec 0\n"
-"@ zeroxaxis  tick on\n"
-"@ zeroxaxis  tick major 5\n"
-"@ zeroxaxis  tick minor 2.5\n"
-"@ zeroxaxis  tick offsetx 0.0\n"
-"@ zeroxaxis  tick offsety 0.0\n"
-"@ zeroxaxis  label \"\"\n"
-"@ zeroxaxis  label layout para\n"
-"@ zeroxaxis  label place auto\n"
-"@ zeroxaxis  label char size 1.0\n"
-"@ zeroxaxis  label font 4\n"
-"@ zeroxaxis  label color 1\n"
-"@ zeroxaxis  label linewidth 1\n"
-"@ zeroxaxis  ticklabel off\n"
-"@ zeroxaxis  ticklabel type auto\n"
-"@ zeroxaxis  ticklabel prec 5\n"
-"@ zeroxaxis  ticklabel format general\n"
-"@ zeroxaxis  ticklabel append \"\"\n"
-"@ zeroxaxis  ticklabel prepend \"\"\n"
-"@ zeroxaxis  ticklabel layout horizontal\n"
-"@ zeroxaxis  ticklabel place on ticks\n"
-"@ zeroxaxis  ticklabel skip 0\n"
-"@ zeroxaxis  ticklabel stagger 0\n"
-"@ zeroxaxis  ticklabel op bottom\n"
-"@ zeroxaxis  ticklabel sign normal\n"
-"@ zeroxaxis  ticklabel start type auto\n"
-"@ zeroxaxis  ticklabel start 0.0\n"
-"@ zeroxaxis  ticklabel stop type auto\n"
-"@ zeroxaxis  ticklabel stop 0.0\n"
-"@ zeroxaxis  ticklabel char size 1.0\n"
-"@ zeroxaxis  ticklabel font 4\n"
-"@ zeroxaxis  ticklabel color 1\n"
-"@ zeroxaxis  ticklabel linewidth 1\n"
-"@ zeroxaxis  tick major off\n"
-"@ zeroxaxis  tick minor on\n"
-"@ zeroxaxis  tick default 6\n"
-"@ zeroxaxis  tick out\n"
-"@ zeroxaxis  tick major color 1\n"
-"@ zeroxaxis  tick major linewidth 1\n"
-"@ zeroxaxis  tick major linestyle 1\n"
-"@ zeroxaxis  tick minor color 7\n"
-"@ zeroxaxis  tick minor linewidth 1\n"
-"@ zeroxaxis  tick minor linestyle 1\n"
-"@ zeroxaxis  tick log off\n"
-"@ zeroxaxis  tick size 0.72\n"
-"@ zeroxaxis  tick minor size 0.48\n"
-"@ zeroxaxis  bar off\n"
-"@ zeroxaxis  bar color 1\n"
-"@ zeroxaxis  bar linestyle 1\n"
-"@ zeroxaxis  bar linewidth 1\n"
-"@ zeroxaxis  tick major grid off\n"
-"@ zeroxaxis  tick minor grid off\n"
-"@ zeroxaxis  tick op both\n"
-"@ zeroxaxis  tick type auto\n"
-"@ zeroxaxis  tick spec 0\n"
-"@ zeroyaxis  tick on\n"
-"@ zeroyaxis  tick major 5\n"
-"@ zeroyaxis  tick minor 2.5\n"
-"@ zeroyaxis  tick offsetx 0.0\n"
-"@ zeroyaxis  tick offsety 0.0\n"
-"@ zeroyaxis  label \"\"\n"
-"@ zeroyaxis  label layout para\n"
-"@ zeroyaxis  label place auto\n"
-"@ zeroyaxis  label char size 1.0\n"
-"@ zeroyaxis  label font 4\n"
-"@ zeroyaxis  label color 1\n"
-"@ zeroyaxis  label linewidth 1\n"
-"@ zeroyaxis  ticklabel off\n"
-"@ zeroyaxis  ticklabel type auto\n"
-"@ zeroyaxis  ticklabel prec 5\n"
-"@ zeroyaxis  ticklabel format general\n"
-"@ zeroyaxis  ticklabel append \"\"\n"
-"@ zeroyaxis  ticklabel prepend \"\"\n"
-"@ zeroyaxis  ticklabel layout horizontal\n"
-"@ zeroyaxis  ticklabel place on ticks\n"
-"@ zeroyaxis  ticklabel skip 0\n"
-"@ zeroyaxis  ticklabel stagger 0\n"
-"@ zeroyaxis  ticklabel op left\n"
-"@ zeroyaxis  ticklabel sign normal\n"
-"@ zeroyaxis  ticklabel start type auto\n"
-"@ zeroyaxis  ticklabel start 0.0\n"
-"@ zeroyaxis  ticklabel stop type auto\n"
-"@ zeroyaxis  ticklabel stop 0.0\n"
-"@ zeroyaxis  ticklabel char size 1.0\n"
-"@ zeroyaxis  ticklabel font 4\n"
-"@ zeroyaxis  ticklabel color 1\n"
-"@ zeroyaxis  ticklabel linewidth 1\n"
-"@ zeroyaxis  tick major off\n"
-"@ zeroyaxis  tick minor on\n"
-"@ zeroyaxis  tick default 6\n"
-"@ zeroyaxis  tick in\n"
-"@ zeroyaxis  tick major color 1\n"
-"@ zeroyaxis  tick major linewidth 1\n"
-"@ zeroyaxis  tick major linestyle 1\n"
-"@ zeroyaxis  tick minor color 7\n"
-"@ zeroyaxis  tick minor linewidth 1\n"
-"@ zeroyaxis  tick minor linestyle 1\n"
-"@ zeroyaxis  tick log off\n"
-"@ zeroyaxis  tick size 0.72\n"
-"@ zeroyaxis  tick minor size 0.48\n"
-"@ zeroyaxis  bar off\n"
-"@ zeroyaxis  bar color 1\n"
-"@ zeroyaxis  bar linestyle 1\n"
-"@ zeroyaxis  bar linewidth 1\n"
-"@ zeroyaxis  tick major grid off\n"
-"@ zeroyaxis  tick minor grid off\n"
-"@ zeroyaxis  tick op both\n"
-"@ zeroyaxis  tick type auto\n"
-"@ zeroyaxis  tick spec 0\n"
-"@ legend on\n"
-"@ legend loctype view\n"
-"@ legend layout 0\n"
-"@ legend vgap 2\n"
-"@ legend hgap 1\n"
-"@ legend length 4\n"
-"@ legend box on\n"
-"@ legend box fill on\n"
-"@ legend box fill with color\n"
-"@ legend box fill color 0\n"
-"@ legend box fill pattern 1\n"
-"@ legend box color 1\n"
-"@ legend box linewidth 1\n"
-"@ legend box linestyle 1\n"
-"@ legend x1 0.2\n"
-"@ legend y1 0.8\n"
-"@ legend font 4\n"
-"@ legend char size 0.5\n"
-"@ legend linestyle 1\n"
-"@ legend linewidth 1\n"
-"@ legend color 1\n"
-"@ frame on\n"
-"@ frame type 0\n"
-"@ frame linestyle 1\n"
-"@ frame linewidth 1\n"
-"@ frame color 1\n"
-"@ frame fill off\n"
-"@ frame background color 0\n"
-"@WITH G0\n"
-"@G0 ON\n"
-"@TARGET S0\n"
-"@TYPE xy\n"
-;
-
-
-const char __9 [] =
-"&\n";
-
-
-#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
-
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
-
-    while ( bytes > 0 ) {
-        ret = read ( fd, dest, bytes );
-        if ( ret == 0  ||  ret == (size_t)-1 )
-            break;
-        dest       = (void*)(((char*)dest) + ret);
-        bytes     -= ret;
-        bytesread += ret;
-    }
-    return bytesread;
-}
-
-#endif
-
-
-static int
-Stat ( const char* filename, Uint8_t p[4][65536] )
-{
-    FILE*          fp;
-    Int16_t        buff [2048];
-    Uint32_t       header [11];
-    size_t         len;
-    size_t         i;
-    Uint16_t       val;
-    unsigned long  samples = -1;
-    unsigned long  sread   =  0;
-    char*          ext = NULL==strrchr (filename, '.')  ?  ""  :  strrchr (filename, '.') + 1;
-
-    if ( 0 == strcasecmp (ext, "pac") ) {
-        if ((fp = pipeopen ( "lpac -x -o #", filename)) == NULL) {
-            stderr_printf ( "Can't decode '%s'\n", filename );
-            exit (9);
-        } else {
-            stderr_printf ( "PAC-File: %s", filename );
-            if (fread ( header, 4, 11, fp ) != 11 )
-                return -1;
-            samples = header[10] / 2;
-        }
-    }
-    else if ( 0 == strcasecmp (ext, "mpc")  ||  0 == strcasecmp (ext, "mp+")  ||  0 == strcasecmp (ext, "mpp") ) {
-        if ((fp = pipeopen ( "mppdec --silent - - < #", filename)) == NULL) {
-            stderr_printf ( "Can't decode '%s'\n", filename );
-            exit (9);
-        } else {
-            stderr_printf ( "MPEGplus-File: %s", filename );
-            if (fread ( header, 4, 11, fp ) != 11 )
-                return -1;
-        }
-    }
-    else if ( 0 == strcmp (ext, "mp3") ) {
-        if ((fp = pipeopen ( "mpg123 --quiet --stereo --wav - # 2> /dev/null", filename)) == NULL) {
-            stderr_printf ( "Can't decode '%s'\n", filename );
-            exit (9);
-        } else {
-            stderr_printf ( "MP3-File: %s", filename );
-            if (fread ( header, 4, 11, fp ) != 11 )
-                return -1;
-        }
-    }
-    else if ( 0 == strcmp (ext, "wav") ) {
-        if ((fp = fopen ( filename, "rb" )) == NULL) {
-            stderr_printf ( "Can't open '%s'\n", filename );
-            exit (9);
-        } else {
-            stderr_printf ( "Wav-File: %s", filename );
-            if (fread ( header, 4, 11, fp ) != 11 )
-                return -1;
-            samples = header[10] / 2;
-        }
-    }
-    else if ( 0 == strcmp (filename, "-") ) {
-        fp = stdin;
-        stderr_printf ( "Unknown Format: stdin" );
-    }
-    else {
-        if ((fp = fopen ( filename, "rb" )) == NULL) {
-            stderr_printf ( "Can't open '%s'\n", filename );
-            exit (9);
-        } else {
-            stderr_printf ( "Unknown Format: %s", filename );
-        }
-    }
-
-    if ( (Uint32_t)-1 != samples )
-        stderr_printf ( " (%lu.%03lu.%03lu samples) ", samples/1000000/2, samples/1000/2 % 1000, samples/2 % 1000 );
-    else
-        stderr_printf ( " (unknown number of samples) ");
-
-    memset ( p, 0, 4 * 65536 );
-
-    while (( len = fread (buff, 2, samples < sizeof(buff)/sizeof(*buff) ? samples : sizeof(buff)/sizeof(*buff), fp) ) > 0 ) {
-        samples -= len;
-        sread   += len;
-        for ( i = 0; i < len; i++ ) {
-            val = (Uint16_t) buff[i];
-            if (++p[0][val] == 0)
-                if (++p[1][val] == 0)
-                    if (++p[2][val] == 0)
-                        ++p[3][val];
-        }
-        if ( sread % 5242880 == 0 )
-            stderr_printf ( "*");
-    }
-
-    stderr_printf ( "\n");
-    PCLOSE (fp);
-    return 0;
-}
-
-
-static double
-inverfc (double x )
-{
-#ifdef _WIN32
-    return dierfc (x) * sqrt (2.);
-#else
-    double  ret = 0;
-    int     i;
-
-    if ( x > 1 )
-        return -inverfc (2.-x);
-
-    for ( i = 0; i < 32; i++ ) {
-        if ( erfc (ret + 4./(1LU<<i)) >= x )
-            ret += 4. / (1LU << i);
-    }
-
-    return ret * sqrt(2.);
-#endif
-}
-
-static void
-analyseFile ( const char* name )
-{
-    Uint8_t  p [4] [65536];
-    long     __q   [65536];
-    long*    q = __q + 32768;
-    long     qmax;
-    double   __s   [65536];
-    double*  s = __s + 32768;
-    long     i;
-    double   tot;
-    double   sum;
-    char     dstname [1024];
-    int      len = NULL==strrchr (name, '.')  ?  strlen (name)  :  strrchr (name, '.') - name;
-
-    if ( Stat (name, p) < 0 )
-        return;
-
-    for ( i = 0; i < 65536; i++ )
-        __q [(Uint16_t)(i+0x8000)] = p[0][i] + 256*p[1][i] + 65536*p[2][i] + 16777216*p[3][i];
-
-    sum = 0.;
-    for ( i = -32768; i < 32768; i++ ) {
-        s[i] = 2. * sum + q[i];
-        sum += q[i];
-    }
-    tot = sum;
-    for ( i = 32767; i >= 0; i-- ) {
-        s[i] = 2. * sum - q[i];
-        sum -= q[i];
-    }
-
-    sprintf (dstname, DIRECTORY"/%*.*s.xmgr-1", len, len, name );
-    if ( NULL == freopen (dstname, "w", stdout) ) {
-        stderr_printf ("Can't create '%s'\n", dstname);
-        return;
-    }
-
-    printf ( __1, len, len, name, len, len, name );
-    for ( i = -32768; i < 32768; i++ ) {
-        if ( s[i-1] != s[i]  ||  s[i] != s[i+1] )
-            printf ( "%7.4f\t%6ld\n", inverfc (s[i] / tot), -i );
-    }
-    puts (__9);
-
-#ifdef GNUPLOT
-    sprintf ( dstname, DIRECTORY"/%s", GetTitleFromFilename (name) );
-    if ( NULL == freopen (dstname, "w", stdout) ) {
-        stderr_printf ( "Can't create '%s'\n", dstname );
-        return;
-    }
-    for ( i = -32768; i < 32768; i++ ) {
-        if ( s[i-1] != s[i]  ||  s[i] != s[i+1] )
-            printf ( "%7.4f\t%6ld\n", inverfc (s[i] / tot), -i );
-    }
-#endif
-
-    sprintf ( dstname, DIRECTORY"/%s.xmgr-2", GetTitleFromFilename (name) );
-    if ( NULL == freopen (dstname, "w", stdout) ) {
-        stderr_printf ( "Can't create '%s'\n", dstname );
-        return;
-    }
-    qmax = 0;
-    for ( i = -32768; i < 32768; i += i != -64 ? 1 : 128 ) {
-        if ( q[i] > qmax )
-            qmax = q[i];
-    }
-    printf ( __2, 256.*1.01/sqrt(sum) * (sqrt ( (qmax+1)) - 1 ), len, len, name, len, len, name );
-    for ( i = -32768; i < 32768;  i++ ) {
-        double tmp = abs(i) < 32 ? (q[32]*(i+32) + q[-32]*(32-i))/64. : q[i];
-        printf ( "%6ld\t%8.6f\n", i, 256. / sqrt(sum) * ( sqrt(tmp+1) - 1 ) );
-    }
-    puts (__9);
-
-    fflush (stdout);
-    return;
-}
-
-
-int Cdecl
-main ( int argc, char** argv )
-{
-    int  i;
-
-    MKDIR (DIRECTORY, 0777);
-
-    for ( i = 1; i < argc; i++ )
-        analyseFile ( argv [i] );
-
-#ifdef GNUPLOT
-    return gnuplot ( argc, argv );
-#endif
-
-    return 0;
-}
-
-/* end of stat.c */
Index: penc/trunk/clipstat.dsp
===================================================================
--- /mppenc/trunk/clipstat.dsp	(revision 96)
+++ 	(revision )
@@ -1,108 +1,0 @@
-# Microsoft Developer Studio Project File - Name="clipstat" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=clipstat - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "clipstat.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "clipstat.mak" CFG="clipstat - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "clipstat - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "clipstat - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "clipstat - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "clipstat___Win32_Release"
-# PROP BASE Intermediate_Dir "clipstat___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "clipstat - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "clipstat___Win32_Debug"
-# PROP BASE Intermediate_Dir "clipstat___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "clipstat - Win32 Release"
-# Name "clipstat - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\clipstat.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\pipeopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/clipstat.vcproj
===================================================================
--- /mppenc/trunk/clipstat.vcproj	(revision 96)
+++ 	(revision )
@@ -1,202 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="clipstat"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/clipstat.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/clipstat.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/clipstat.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/clipstat.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/clipstat.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/clipstat.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/clipstat.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/clipstat.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="clipstat.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="pipeopen.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/codepage.c
===================================================================
--- /mppenc/trunk/codepage.c	(revision 96)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#include <stdio.h>
-#include <windows.h>
-
-/*
-int
-MultiByteToWideChar ( UINT      CodePage,           // code page
-                      DWORD     dwFlags,            // character-type options
-                      LPCSTR    lpMultiByteStr,     // address of string to map
-                      int       cchMultiByte,       // number of bytes in string
-                      LPWSTR    lpWideCharStr,      // address of wide-character buffer
-                      int       cchWideChar         // size of buffer
-);
-*/
-
-void
-test ( int CP )
-{
-    int      i;
-    int      j;
-    char     b [16];
-    wchar_t  a [ 8];
-    int      count = 0;
-
-    fprintf (stderr, "Codepage %u\n", CP );
-
-    for ( i = 1; i < 256; i++ ) {
-        b [0] = i;
-        if ( i == 2  &&  count == 0 )
-            return;
-        if ( 1 == MultiByteToWideChar ( CP, 0, b, 1, a, 8 )  &&  a[0] != 0 ) {
-            if ( count == 0 )
-                printf ("\n\n\n****** CP-%u ******\n\n", CP );
-            printf ("CP-%-4u    %02X  u%04X\n", CP, i, a[0] );
-            count++;
-        } else {
-            for ( j = 1; j < 256; j++ ) {
-                b [0] = i;
-                b [1] = j;
-                // printf ("\r%02u %02u", i, j );
-                if ( 1 == MultiByteToWideChar ( CP, 0, b, 2, a, 8 )  &&  a[0] != 0x30FB ) {
-                    if ( count == 0 )
-                        printf ("\n\n\n****** CP-%u ******\n\n", CP );
-                    printf ("CP-%-4u  %02X%02X  u%04X\n", CP, i, j, a[0] ),
-                    count++;
-                }
-            }
-        }
-    }
-
-    fflush ( stdout);
-}
-
-int
-main ( int argc, char** argv )
-{
-    int  i;
-
-    freopen ( "codepage.txt", "w", stdout );
-
-    for ( i = 0; i <= 11000; i++ )
-        test ( i );
-
-   return 0;
-}
Index: penc/trunk/codepage.dsp
===================================================================
--- /mppenc/trunk/codepage.dsp	(revision 96)
+++ 	(revision )
@@ -1,108 +1,0 @@
-# Microsoft Developer Studio Project File - Name="codepage" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=codepage - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "codepage.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "codepage.mak" CFG="codepage - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "codepage - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "codepage - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "codepage - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "codepage - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "codepage - Win32 Release"
-# Name "codepage - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\codepage.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Results"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\codepage.txt
-# End Source File
-# End Group
-# End Target
-# End Project
Index: penc/trunk/codepage.vcproj
===================================================================
--- /mppenc/trunk/codepage.vcproj	(revision 96)
+++ 	(revision )
@@ -1,173 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="codepage"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/codepage.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/codepage.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/codepage.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/codepage.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/codepage.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/codepage.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/codepage.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/codepage.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="codepage.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Results"
-			Filter="">
-			<File
-				RelativePath="codepage.txt">
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/config.c
===================================================================
--- /mppenc/trunk/config.c	(revision 96)
+++ 	(revision )
@@ -1,263 +1,0 @@
-#include <stdio.h>
-#include <limits.h>
-#define  NOT_INCLUDE_CONFIG_H
-#include "mppdec.h"
-
-
-static void
-version ( FILE* fp )
-{
-    FILE*  fpi = fopen ("version", "r");
-    char   buff [256];
-    char   version [16];
-
-    fprintf ( fp, "/* parsed values from file \"version\" */\n\n" );
-    while ( fgets ( buff, sizeof buff, fpi ) ) {
-        if ( 1 == sscanf ( buff, "MPPDEC_VERSION=%15[0-9.a-z]", version ) ) {
-            fprintf ( fp, "#ifndef MPPDEC_VERSION\n# define MPPDEC_VERSION   \"%s\"\n#endif\n\n", version );
-            switch ( version[3]-'0' ) {
-            case 1: case 3: case 5: case 7: case 9:
-                fprintf ( fp, "#define MPPDEC_BUILD  \"--Alpha--\"\n\n" );
-                break;
-            case 2: case 4: case 6: case 8:
-                fprintf ( fp, "#define MPPDEC_BUILD  \"-Beta-\"\n\n" );
-                break;
-            case 0:
-                fprintf ( fp, "#define MPPDEC_BUILD  \"Release\"\n\n" );
-                break;
-            }
-        }
-        else
-        if ( 1 == sscanf ( buff, "MPPENC_VERSION=%15[0-9.a-z]", version ) ) {
-            fprintf ( fp, "#ifndef MPPENC_VERSION\n# define MPPENC_VERSION   \"%s\"\n#endif\n\n", version );
-            switch ( version[3]-'0' ) {
-            case 1: case 3: case 5: case 7: case 9:
-                fprintf ( fp, "#define MPPENC_BUILD  \"--Alpha--\"\n\n" );
-                break;
-            case 2: case 4: case 6: case 8:
-                fprintf ( fp, "#define MPPENC_BUILD  \"-Beta-\"\n\n" );
-                break;
-            case 0:
-                fprintf ( fp, "#define MPPENC_BUILD  \"Release\"\n\n" );
-                break;
-            }
-        }
-    }
-
-    fclose (fpi);
-
-}
-
-
-
-unsigned long   v_lng = (unsigned long ) 0x8877665544332211L;
-unsigned short  v_sht = (unsigned short) 0x8877665544332211L;
-unsigned int    v_int = (unsigned int  ) 0x8877665544332211L;
-
-unsigned char*  lo = (unsigned char*) &v_lng;
-unsigned char*  sh = (unsigned char*) &v_sht;
-unsigned char*  in = (unsigned char*) &v_int;
-
-#define ROUND32_1(x)   ( floattmp = (x) + (Int32_t)0x00FF8000L, *(Int32_t*)(&floattmp) - (Int32_t)0x4B7F8000L )
-#define ROUND32_2(x)   ( (Int32_t) floor ((x) + 0.5) )
-
-#define ROUND64_1(x)   ( doubletmp = (x) + (Int64_t)0x001FFFFF80000000L, *(Int64_t*)(&doubletmp) - (Int64_t)0x433FFFFF80000000L )
-#define ROUND64_2(x)   ( (Int64_t) floor ((x) + 0.5) )
-
-
-int
-test_round_16 ( float x )
-{
-    float    floattmp;
-    Int32_t  tmp1 = ROUND32_1 (x);
-    Int32_t  tmp2 = ROUND32_2 (x);
-
-    if ( tmp1 != tmp2 )
-        return 1;
-
-    return 0;
-}
-
-
-int
-test_round_32 ( double x )
-{
-#ifdef NO_INT64_T
-    return 1;
-#else
-    double   doubletmp;
-    Int64_t  tmp1 = ROUND64_1 (x);
-    Int64_t  tmp2 = ROUND64_2 (x);
-
-    if ( tmp1 != tmp2 )
-        return 1;
-
-    return 0;
-#endif
-}
-
-
-static void
-Convert_to_80bit_BE_IEEE854_Float ( unsigned char* p, long double val )
-{
-    unsigned long  word32 = 0x401E;
-
-    if ( val > 0.L )
-        while ( val < (long double)0x80000000 )
-            word32--, val *= 2.L;
-
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);
-    word32 = (Uint32_t) val;
-    *p++   = (Uint8_t)(word32 >> 24);
-    *p++   = (Uint8_t)(word32 >> 16);
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);
-    word32 = (Uint32_t) ( (val - word32) * 4294967296.L );
-    *p++   = (Uint8_t)(word32 >> 24);
-    *p++   = (Uint8_t)(word32 >> 16);
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);
-}
-
-
-int
-test_long_double ( int endian )
-{
-    long double           val;
-    unsigned char         p [10];
-    const unsigned char*  q = (const unsigned char*) & val;
-    int                   i;
-
-    if ( sizeof (val) < 10  ||  sizeof(val) > 16 )
-        return 0;
-    if ( endian == 0 )
-        return 0;
-
-    for ( val = 4.29e9; val >= 1.e-35; val *= 0.999 ) {
-        Convert_to_80bit_BE_IEEE854_Float ( p, val );
-        for ( i = 0; i < 10; i++ )
-            if ( p[i] != q[endian==2 ? i : 9-i] ) {
-                printf ("%40.30Lf ", val );
-                for ( i = 0; i<10; i++ ) printf ("%02X %02X  ", p[i], q[endian==2 ? i : 9-i] );
-                printf ("\n");
-                return 0;
-            }
-    }
-
-    return 1;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    int           flag = 0;  // Bit 0: little, Bit 1: big, Bit 2: unknown
-    unsigned int  k;
-    long          m;
-    FILE*         fp   = fopen ( "config.h", "w" );
-    int           endian;
-
-    if ( fp == NULL ) {
-        fprintf ( stderr, "config: Can't write 'config.h'\n");
-        return 1;
-    }
-
-    if ( argc > 1 )
-        fprintf ( stderr, "\n*** Compile sources with ***\n\n%s\n\n", argv[1] );
-
-    if ( argc > 2 )
-        fprintf ( stderr, "\n*** Execute binary with ***\n\n%s\n\n", argv[2] );
-
-    fprintf ( fp, "\n" );
-    fprintf ( fp, "/* Determine Endianess of the machine */\n" );
-    fprintf ( fp, "\n" );
-    fprintf ( fp, "#define HAVE_LITTLE_ENDIAN  1234\n" );
-    fprintf ( fp, "#define HAVE_BIG_ENDIAN     4321\n" );
-    fprintf ( fp, "\n" );
-
-        flag = 0;
-    for ( k = 0; k < sizeof(v_int); k++ )
-        if      ( in[k] == 0x11 * (k+1)             ) flag |= 1;
-        else if ( in[k] == 0x11 * (sizeof(v_int)-k) ) flag |= 2;
-        else                                          flag |= 4;
-
-    for ( k = 0; k < sizeof(v_lng); k++ )
-        if      ( lo[k] == 0x11 * (k+1)             ) flag |= 1;
-        else if ( lo[k] == 0x11 * (sizeof(v_lng)-k) ) flag |= 2;
-        else                                          flag |= 4;
-
-    for ( k = 0; k < sizeof(v_sht); k++ )
-        if      ( sh[k] == 0x11 * (k+1)             ) flag |= 1;
-        else if ( sh[k] == 0x11 * (sizeof(v_sht)-k) ) flag |= 2;
-        else                                          flag |= 4;
-
-    switch (flag) {
-    case 1:
-        endian = 1;
-        fprintf ( fp, "#define ENDIAN              HAVE_LITTLE_ENDIAN\n" );
-        break;
-    case 2:
-        endian = 2;
-        fprintf ( fp, "#define ENDIAN              HAVE_BIG_ENDIAN\n" );
-        break;
-    default:
-        endian = 0;
-        fprintf ( fp, "/* unknown endianess */\n" );
-        break;
-
-    }
-    fprintf ( fp, "\n" );
-
-
-    fprintf ( fp, "\n" );
-    fprintf ( fp, "/* Test the fast float-to-int rounding trick works */\n" );
-    fprintf ( fp, "\n" );
-    flag = 0;
-    for ( m = 0; m <= 32767; m++ ) {
-        flag |= test_round_16 ( (float)(+m - 0.499) );
-        flag |= test_round_16 ( (float)(+m        ) );
-        flag |= test_round_16 ( (float)(+m + 0.499) );
-        flag |= test_round_16 ( (float)(-m - 0.499) );
-        flag |= test_round_16 ( (float)(-m        ) );
-        flag |= test_round_16 ( (float)(-m + 0.499) );
-    }
-    if ( flag == 0 )
-        fprintf ( fp, "#define HAVE_IEEE754_FLOAT\n" );
-    else
-        fprintf ( fp, "/* #define HAVE_IEEE754_FLOAT */\n" );
-
-
-    flag = 0;
-    for ( m = 0; (unsigned long)m <= 0x7FFFFFFF; m += 1 + (m>>16) ) {
-        flag |= test_round_32 ( +m - 0.499 );
-        flag |= test_round_32 ( +m         );
-        flag |= test_round_32 ( +m + 0.499 );
-        flag |= test_round_32 ( -m - 0.499 );
-        flag |= test_round_32 ( -m         );
-        flag |= test_round_32 ( -m + 0.499 );
-    }
-    if ( flag == 0 )
-        fprintf ( fp, "#define HAVE_IEEE754_DOUBLE\n" );
-    else
-        fprintf ( fp, "/* #define HAVE_IEEE754_DOUBLE */\n" );
-    fprintf ( fp, "\n" );
-
-
-    fprintf ( fp, "\n" );
-    fprintf ( fp, "/* Test the presence of a 80 bit floating point type for writing AIFF headers */\n" );
-    fprintf ( fp, "\n" );
-    if ( test_long_double(endian) )
-        fprintf ( fp, "#define HAVE_IEEE854_LONGDOUBLE\n" );
-    else
-        fprintf ( fp, "/* #define HAVE_IEEE854_LONGDOUBLE */\n" );
-
-
-    fprintf ( fp, "\n\n" );
-    version ( fp );
-    fprintf ( fp, "/* end of config.h */\n" );
-    fclose (fp);
-    return 0;
-}
-
-/* end of config.h */
Index: penc/trunk/config.dsp
===================================================================
--- /mppenc/trunk/config.dsp	(revision 96)
+++ 	(revision )
@@ -1,102 +1,0 @@
-# Microsoft Developer Studio Project File - Name="config" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=config - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "config.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "config.mak" CFG="config - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "config - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "config - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "config - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "config - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "config - Win32 Release"
-# Name "config - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\config.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/config.h
===================================================================
--- /mppenc/trunk/config.h	(revision 96)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-/* Determine Endianess of the machine */
-
-#define HAVE_LITTLE_ENDIAN  1234
-#define HAVE_BIG_ENDIAN     4321
-
-#define ENDIAN              HAVE_LITTLE_ENDIAN
-
-
-/* Test the fast float-to-int rounding trick works */
-
-#define HAVE_IEEE754_FLOAT
-#define HAVE_IEEE754_DOUBLE
-
-
-/* Test the presence of a 80-bit floating point type for writing AIFF headers */
-
-#define HAVE_IEEE854_LONGDOUBLE
-
-
-/* parsed values from file "version" */
-
-#ifndef MPPDEC_VERSION
-# define MPPDEC_VERSION   "1.15v"
-#endif
-
-#define MPPDEC_BUILD  "--Alpha--"
-
-#ifndef MPPENC_VERSION
-# define MPPENC_VERSION   "1.15v"
-#endif
-
-#define MPPENC_BUILD  "--Alpha--"
-
-/* end of config.h */
Index: penc/trunk/config.vcproj
===================================================================
--- /mppenc/trunk/config.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="config"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/config.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/config.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/config.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/config.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/config.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/config.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/config.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/config.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="config.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/cpu_feat.nas
===================================================================
--- /mppenc/trunk/cpu_feat.nas	(revision 96)
+++ 	(revision )
@@ -1,142 +1,0 @@
-; Musepack audio compression
-; Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
-; 
-; This library is free software; you can redistribute it and/or
-; modify it under the terms of the GNU Lesser General Public
-; License as published by the Free Software Foundation; either
-; version 2.1 of the License, or (at your option) any later version.
-; 
-; This library is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-; Lesser General Public License for more details.
-; 
-; You should have received a copy of the GNU Lesser General Public
-; License along with this library; if not, write to the Free Software
-; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-;
-;  Assembler routines to detect CPU features for Intel x86 compatible CPUs
-;  (Intel, AMD, Rise, Cyrix). CPU must be at least a 386SX, otherwise the
-;  detection routines fail with an "Illegal Instruction Trap".
-;
-;  But note:
-;    - you currently need at least a high end 486 CPU to run in realtime
-;    - this is only important if you want to built a 16 bit executable
-;      running on 80286 and on modern CPUs with Katmai/3DNow! support
-;
-
-%include "tools.inc"
-
-        globaldef       Has_MMX
-        globaldef       Has_3DNow
-        globaldef       Has_SIMD
-        globaldef       Has_SIMD2
-
-
-        segment_code
-
-testCPUID:
-        pushfd
-        pop     eax
-        mov     ecx,eax
-        xor     eax,0x200000
-        push    eax
-        popfd
-        pushfd
-        pop     eax
-        cmp     eax,ecx
-        mov     eax,1
-        ret
-
-;-------------------------------------;
-;    bool_t  Has_MMX (void)           ;
-;-------------------------------------;
-
-proc    Has_MMX
-        pushad
-        call    testCPUID
-        jz      return0         ; no CPUID command, so no MMX
-
-        CPUID
-        test    edx,0x800000
-        jz      return0         ; no MMX support
-        jmp     short return1   ; MMX support
-endproc
-
-;-------------------------------------;
-;    bool_t  Has_SIMD (void)          ;
-;-------------------------------------;
-
-proc    Has_SIMD
-        pushad
-        call    testCPUID
-        jz      return0         ; no CPUID command, so no SIMD
-
-        CPUID
-        test    edx,0x02000000
-        jz      return0         ; no SIMD support
-        jmp     short return1   ; SIMD support
-endproc
-
-;-------------------------------------;
-;    bool_t  Has_SIMD2 (void)         ;
-;-------------------------------------;
-
-proc    Has_SIMD2
-        pushad
-        call    testCPUID
-        jz      return0         ; no CPUID command, so no SIMD2
-
-        CPUID
-        test    edx,0x04000000
-        jz      return0         ; no SIMD2 support
-                                ; SIMD2 support
-return1:
-        popad
-        xor     eax,eax
-        inc     eax
-        ret
-
-return0:
-        popad
-        xor     eax,eax
-        ret
-
-endproc
-
-;-------------------------------------;
-;    bool_t  Has_3DNow (void)         ;
-;-------------------------------------;
-
-proc    Has_3DNow
-        pushad
-        call    testCPUID
-        jz      return0         ; no CPUID command, so no 3DNow!
-
-        mov     eax,0x80000000
-        CPUID
-        cmp     eax,0x80000000
-        jbe     return0         ; no extended MSR(1), so no 3DNow!
-
-        mov     eax,0x80000001
-        CPUID
-        test    edx,0x80000000
-        jz      return0         ; no 3DNow! support
-        jmp     short return1   ; 3DNow! support
-endproc
-
-;-------------------------------------;
-;    void  Init_FPU2 (void)           ;
-;-------------------------------------;
-
-
-proc    Init_FPU2
-        push    eax
-        fstcw   [esp]
-        and     byte [esp+1], 0FCh
-        fldcw   [esp]
-        pop     eax
-endproc
-
-        end
Index: penc/trunk/cvd-new.c
===================================================================
--- /mppenc/trunk/cvd-new.c	(revision 96)
+++ 	(revision )
@@ -1,243 +1,0 @@
-#include "mppenc.h"
-
-/* C O N S T A N T S */
-// from MatLab-Simulation (Fourier-transforms of the Cos-Rolloff)
-#if 0
-static const float  Puls [11] = {
-    -0.02724753942504f, -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,
-     0.49549552704050f,  0.64201253447071f,  0.49549552704050f,  0.18006206051664f,
-    -0.06198987803623f, -0.10670808991329f, -0.02724753942504f
-};
-#endif
-
-static const float  Puls [ 9] = {
-    -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,  0.49549552704050f,
-     0.64201253447071f,  0.49549552704050f,  0.18006206051664f, -0.06198987803623f,
-    -0.10670808991329f
-};
-
-/*
-// Generating the Cos-Rolloff of the Cepstral-analysis, Cos-Rolloff from 5512,5 Hz to 11025 Hz
-// for ( k = 0; k <= 1024; k++ ) {
-//     if      (k < 256) CosWin [k-256] = 1;
-//     else if (k < 512) CosWin [k-256] = 0.5 + 0.5*cos (M_PI*(k-256)/256);
-//     else              CosWin [k-256] = 0;
-// }
-*/
-static const float  CosWin [256] = {
-    1.0000000000000000f, 0.9999623298645020f, 0.9998494386672974f, 0.9996612071990967f, 0.9993977546691895f, 0.9990590810775757f, 0.9986452460289002f, 0.9981563091278076f, 0.9975923895835877f, 0.9969534873962402f, 0.9962397813796997f, 0.9954513311386108f, 0.9945882558822632f, 0.9936507344245911f, 0.9926388263702393f, 0.9915527701377869f, 0.9903926253318787f, 0.9891586899757385f, 0.9878510832786560f, 0.9864699840545654f, 0.9850156307220459f, 0.9834882616996765f, 0.9818880558013916f, 0.9802152514457703f, 0.9784701466560364f, 0.9766530394554138f, 0.9747641086578369f, 0.9728036522865295f, 0.9707720279693604f, 0.9686695337295532f, 0.9664964079856873f, 0.9642530679702759f, 0.9619397521018982f, 0.9595569372177124f, 0.9571048617362976f, 0.9545840024948120f, 0.9519946575164795f, 0.9493372440338135f, 0.9466121792793274f, 0.9438198208808899f, 0.9409606456756592f, 0.9380350708961487f, 0.9350435137748718f, 0.9319864511489868f, 0.9288643002510071f, 0.9256775975227356f, 0.9224267601966858f, 0.9191123247146606f, 0.9157348275184631f, 0.9122946262359619f, 0.9087924361228943f, 0.9052286148071289f, 0.9016037583351135f, 0.8979184627532959f, 0.8941732048988342f, 0.8903686404228210f, 0.8865052461624146f, 0.8825836181640625f, 0.8786044120788574f, 0.8745682239532471f, 0.8704755902290344f, 0.8663271069526672f, 0.8621235489845276f, 0.8578653931617737f,
-    0.8535534143447876f, 0.8491881489753723f, 0.8447702527046204f, 0.8403005003929138f, 0.8357794880867004f, 0.8312078714370728f, 0.8265864253044128f, 0.8219157457351685f, 0.8171966671943665f, 0.8124297261238098f, 0.8076158165931702f, 0.8027555346488953f, 0.7978496551513672f, 0.7928989529609680f, 0.7879040837287903f, 0.7828658819198608f, 0.7777851223945618f, 0.7726625204086304f, 0.7674987912178040f, 0.7622948288917542f, 0.7570513486862183f, 0.7517691850662231f, 0.7464491128921509f, 0.7410919070243835f, 0.7356983423233032f, 0.7302693724632263f, 0.7248056530952454f, 0.7193081378936768f, 0.7137775421142578f, 0.7082147598266602f, 0.7026206851005554f, 0.6969960331916809f, 0.6913416981697083f, 0.6856585741043091f, 0.6799474954605103f, 0.6742093563079834f, 0.6684449315071106f, 0.6626551747322083f, 0.6568408608436585f, 0.6510030031204224f, 0.6451423168182373f, 0.6392598152160645f, 0.6333563923835754f, 0.6274328231811523f, 0.6214900612831116f, 0.6155290603637695f, 0.6095505952835083f, 0.6035556793212891f, 0.5975451469421387f, 0.5915199518203735f, 0.5854809284210205f, 0.5794290900230408f, 0.5733652114868164f, 0.5672903656959534f, 0.5612053275108337f, 0.5551111102104187f, 0.5490085482597351f, 0.5428986549377441f, 0.5367822647094727f, 0.5306603908538818f, 0.5245338082313538f, 0.5184035897254944f, 0.5122706294059753f, 0.5061357617378235f,
-    0.5000000000000000f, 0.4938642382621765f, 0.4877294003963471f, 0.4815963804721832f, 0.4754661619663239f, 0.4693396389484406f, 0.4632177054882050f, 0.4571013450622559f, 0.4509914219379425f, 0.4448888897895813f, 0.4387946724891663f, 0.4327096343040466f, 0.4266347587108612f, 0.4205709397792816f, 0.4145190417766571f, 0.4084800481796265f, 0.4024548530578613f, 0.3964443206787109f, 0.3904493749141693f, 0.3844709396362305f, 0.3785099089145660f, 0.3725671768188477f, 0.3666436076164246f, 0.3607401549816132f, 0.3548576533794403f, 0.3489970266819000f, 0.3431591391563416f, 0.3373448550701141f, 0.3315550684928894f, 0.3257906734943390f, 0.3200524747371674f, 0.3143413960933685f, 0.3086582720279694f, 0.3030039668083191f, 0.2973793447017670f, 0.2917852103710175f, 0.2862224578857422f, 0.2806918919086456f, 0.2751943469047546f, 0.2697306573390961f, 0.2643016278743744f, 0.2589081227779388f, 0.2535509169101715f, 0.2482308149337769f, 0.2429486215114594f, 0.2377051562070847f, 0.2325011938810349f, 0.2273375093936920f, 0.2222148776054382f, 0.2171340882778168f, 0.2120959013700485f, 0.2071010768413544f, 0.2021503448486328f, 0.1972444802522659f, 0.1923841983079910f, 0.1875702589750290f, 0.1828033626079559f, 0.1780842244625092f, 0.1734135746955872f, 0.1687921136617661f, 0.1642205268144608f, 0.1596994996070862f, 0.1552297323942184f, 0.1508118808269501f,
-    0.1464466154575348f, 0.1421345919370651f, 0.1378764659166336f, 0.1336728632450104f, 0.1295244395732880f, 0.1254318058490753f, 0.1213955804705620f, 0.1174163669347763f, 0.1134947761893272f, 0.1096313893795013f, 0.1058267876505852f, 0.1020815446972847f, 0.0983962342143059f, 0.0947714000940323f, 0.0912075936794281f, 0.0877053514122963f, 0.0842651948332787f, 0.0808876454830170f, 0.0775732174515724f, 0.0743224024772644f, 0.0711356922984123f, 0.0680135712027550f, 0.0649565011262894f, 0.0619649514555931f, 0.0590393692255020f, 0.0561801902949810f, 0.0533878505229950f, 0.0506627671420574f, 0.0480053536593914f, 0.0454160086810589f, 0.0428951233625412f, 0.0404430739581585f, 0.0380602329969406f, 0.0357469581067562f, 0.0335035994648933f, 0.0313304923474789f, 0.0292279683053494f, 0.0271963365375996f, 0.0252359099686146f, 0.0233469791710377f, 0.0215298328548670f, 0.0197847411036491f, 0.0181119665503502f, 0.0165117643773556f, 0.0149843730032444f, 0.0135300243273377f, 0.0121489353477955f, 0.0108413146808743f, 0.0096073597669601f, 0.0084472559392452f, 0.0073611787520349f, 0.0063492907211185f, 0.0054117450490594f, 0.0045486823655665f, 0.0037602325901389f, 0.0030465149320662f, 0.0024076367262751f, 0.0018436938989908f, 0.0013547716662288f, 0.0009409435442649f, 0.0006022718735039f, 0.0003388077020645f, 0.0001505906548118f, 0.0000376490788767f,
-};
-
-
-/* F U N C T I O N S */
-// sets all the harmonics
-static void
-SetVoiceLines ( int* VoiceLine, const float base, int val )
-{
-    int    n;
-    int    max = (int) (MAX_CVD_LINE * base / 1024.f);  // harmonics up to Index MAX_CVD_LINE (spectral lines outside of that don't make sense)
-    int    line;
-    float  frq = 1024.f / base;                         // frq = 1024./i is the Index of the basic harmonic
-
-    // go through all harmonics
-    for ( n = 1; n <= max; n++ ) {
-        line = (int) (n * frq);
-        VoiceLine [line] = VoiceLine [line+1] = val;
-    }
-}
-
-
-// Analyze the Cepstrum, search for the basic harmonic
-static void
-CEP_Analyse2048 ( float* res1, float* res2, const float* cep )
-{
-    int           n;
-    int           line;
-    float         cc [2 * MAX_ANALYZED_IDX + 3];    // cross correlation
-    float         cp [2 * MAX_ANALYZED_IDX + 3];
-    float         ref;
-    float         line_sum;
-    float         sum;
-    float         kkf;
-    float         norm;
-    const float*  x;
-
-    // cross-correlation with pulse shape
-    // Calculate idx = MIN_ANALYZED_IDX-2  to  MAX_ANALYZED_IDX+2,
-    // because they are read during search for maximum
-    // 50 -> 882 Hz, 700 -> 63 Hz base frequency
-
-    *res1 = *res2 = 0. ;
-    memset ( cc, 0  , sizeof cc );
-    memcpy ( cp, cep, sizeof cp );
-
-    for ( n = 0; n < sizeof(cp)/sizeof(*cp)/2; n++ ) {
-        cp [2*n  ] += 1.0f * cep [n];
-        cp [2*n+1] += 0.5f * (cep [n] + cep[n+1]);
-    }
-
-
-    for ( n = 0; n < 2 * MAX_ANALYZED_IDX + 3; n++ ) {
-        x      = cp + n;
-        if ( x[0] > 0. ) {
-            norm = x[-4] * x[-4] +
-                   x[-3] * x[-3] +
-                   x[-2] * x[-2] +
-                   x[-1] * x[-1] +
-                   x[ 0] * x[ 0] +
-                   x[ 1] * x[ 1] +
-                   x[ 2] * x[ 2] +
-                   x[ 3] * x[ 3] +
-                   x[ 4] * x[ 4];
-            kkf  = x[-4] * Puls [0] +
-                   x[-3] * Puls [1] +
-                   x[-2] * Puls [2] +
-                   x[-1] * Puls [3] +
-                   x[ 0] * Puls [4] +
-                   x[ 1] * Puls [5] +
-                   x[ 2] * Puls [6] +
-                   x[ 3] * Puls [7] +
-                   x[ 4] * Puls [8];
-            cc [n] = kkf * kkf / norm;         // calculate the square of ncc to avoid sqrt()
-        }
-    }
-
-#if 1
-#define MMM     2*MAX_ANALYZED_IDX*0+100
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5u", n );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cep[n] );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cp[n] );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cc[n] );
-    printf ("\n");
-#endif
-    {
-        static unsigned int x = 0;
-
-        printf ("%7.3f s   ", (x/2)*1152./44100 );
-        x++;
-    }
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MED_ANALYZED_IDX;
-    for ( n = 2 * MAX_ANALYZED_IDX; n >= 2 * MED_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n]     > ref          &&
-             cp[n]     > 0.00f        &&
-             cc[n>>1]  > 0.25f * ref  &&
-             cp[n>>1]  > 0.00f
-           )
-            ref  = cc[line = n];
-    }
-
-    printf ("ref=%5.3f ", ref );
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cp + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    ref = 0.5 * cp[line-1] + cp[line] + 0.5 * cp[line-1];
-
-    printf ("ref=%5.3f line=%5.1f *res1=%7.3f f=%8.3f    ", ref, 0.5 * line, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    if ( ref > 0.15f )
-        *res1 = 0.5 * line_sum / sum;
-
-    if ( CVD_used < 2 )
-        return;
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MIN_ANALYZED_IDX;
-
-    for ( n = 2*MED_ANALYZED_IDX; n >= 2*MIN_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n]                   > ref         &&
-             cp[n]                   > 0.00f       &&
-             cc[n>>1]                > 0.25 * ref  &&
-             cp[n>>1]                > 0.00f
-           )
-            ref  = cc[line = n];
-    }
-
-    printf ("ref=%5.3f ", ref );
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cp + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    ref = 0.5 * cp[line-1] + cp[line] + 0.5 * cp[line-1];
-
-    printf ("ref=%5.3f line=%5.1f *res2=%8.3f f=%8.3f\n", ref, 0.5 * line, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    if ( ref >= 0.15f )
-        *res2 = 0.5 * line_sum / sum;
-
-    return;
-}
-
-#ifndef CVD_FASTLOG
-# define logfast(x)     ((float) log (x))
-#else
-
-static __inline float   /* This is a rough estimation with an accuracy of |x|<0.0037 */
-logfast ( float x )
-{
-    double  y = x * x;
-    y *= y;
-    y *= y;
-    return (((int*)(&y))[1] + (45127.5 - 1072693248.)) * ( M_LN2 / (1L<<23) );
-}
-
-#endif
-
-// ClearVoiceDetection for spectrum *spec
-// input : Spectrum *spec
-// output: Array *vocal contains information if the FFT-Line is a harmonic component
-int
-CVD2048 ( const float* spec, int* vocal )
-{
-    static float  cep [4096];     // cep[4096] -- array, which is also used for the 2048 FFT
-    const float*  win = CosWin;   // pointer to cos-roll-off
-    float         res1;
-    float         res2;
-    int           n;
-
-    ENTER(20);
-    // Calculating logarithmated, windowed spectrum cep[]
-    // cep[512...1024] = 0 -- cep[1025...2047] doesn't matter, because the first have to be filled by fft
-    for ( n =   0; n < 256; n++ )
-        cep[n] = logfast (*spec++);
-    for ( n = 256; n < 512; n++ )
-        cep[n] = logfast (*spec++) * *win++;
-
-    memset ( cep+512, 0, 513*sizeof(*cep) );
-
-    // Calculating cepstrum of cep[] (the function Cepstrum() outputs the cepstrum in-place)
-    Cepstrum2048 ( cep, MAX_ANALYZED_IDX );
-
-    // search the harmonic
-    CEP_Analyse2048 ( &res1, &res2, cep );
-#include "cvd.h"
-    if ( res1 > 0.f  ||  res2 > 0.f ) {
-        if ( res1 > 0. ) SetVoiceLines ( vocal, res1, 10 );
-        if ( res2 > 0. ) SetVoiceLines ( vocal, res2,  2 );
-        LEAVE(20);
-        return 1;
-    }
-    LEAVE(20);
-    return 0;
-}
Index: penc/trunk/cvd-new2.c
===================================================================
--- /mppenc/trunk/cvd-new2.c	(revision 96)
+++ 	(revision )
@@ -1,239 +1,0 @@
-#include "mppenc.h"
-
-#define LIMIT1          0.032f
-#define LIMIT2          0.032f
-#define REF(line)       cc[line-1] * cp[line-1] \
-                      + cc[line  ] * cp[line  ] \
-                      + cc[line+1] * cp[line+1]
-
-/* C O N S T A N T S */
-// from MatLab-Simulation (Fourier-transforms of the Cos-Rolloff)
-#if 0
-static const float  Puls [11] = {
-    -0.02724753942504f, -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,
-     0.49549552704050f,  0.64201253447071f,  0.49549552704050f,  0.18006206051664f,
-    -0.06198987803623f, -0.10670808991329f, -0.02724753942504f
-};
-#endif
-
-static const float  Puls [ 9] = {
-    -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,  0.49549552704050f,
-     0.64201253447071f,  0.49549552704050f,  0.18006206051664f, -0.06198987803623f,
-    -0.10670808991329f
-};
-
-/*
-// Generating the Cos-Rolloff of the Cepstral-analysis, Cos-Rolloff from 5512,5 Hz to 11025 Hz
-// for ( k = 0; k <= 1024; k++ ) {
-//     if      (k < 256) CosWin [k-256] = 1;
-//     else if (k < 512) CosWin [k-256] = 0.5 + 0.5*cos (M_PI*(k-256)/256);
-//     else              CosWin [k-256] = 0;
-// }
-*/
-static const float  CosWin [256] = {
-    1.0000000000000000f, 0.9999623298645020f, 0.9998494386672974f, 0.9996612071990967f, 0.9993977546691895f, 0.9990590810775757f, 0.9986452460289002f, 0.9981563091278076f, 0.9975923895835877f, 0.9969534873962402f, 0.9962397813796997f, 0.9954513311386108f, 0.9945882558822632f, 0.9936507344245911f, 0.9926388263702393f, 0.9915527701377869f, 0.9903926253318787f, 0.9891586899757385f, 0.9878510832786560f, 0.9864699840545654f, 0.9850156307220459f, 0.9834882616996765f, 0.9818880558013916f, 0.9802152514457703f, 0.9784701466560364f, 0.9766530394554138f, 0.9747641086578369f, 0.9728036522865295f, 0.9707720279693604f, 0.9686695337295532f, 0.9664964079856873f, 0.9642530679702759f, 0.9619397521018982f, 0.9595569372177124f, 0.9571048617362976f, 0.9545840024948120f, 0.9519946575164795f, 0.9493372440338135f, 0.9466121792793274f, 0.9438198208808899f, 0.9409606456756592f, 0.9380350708961487f, 0.9350435137748718f, 0.9319864511489868f, 0.9288643002510071f, 0.9256775975227356f, 0.9224267601966858f, 0.9191123247146606f, 0.9157348275184631f, 0.9122946262359619f, 0.9087924361228943f, 0.9052286148071289f, 0.9016037583351135f, 0.8979184627532959f, 0.8941732048988342f, 0.8903686404228210f, 0.8865052461624146f, 0.8825836181640625f, 0.8786044120788574f, 0.8745682239532471f, 0.8704755902290344f, 0.8663271069526672f, 0.8621235489845276f, 0.8578653931617737f,
-    0.8535534143447876f, 0.8491881489753723f, 0.8447702527046204f, 0.8403005003929138f, 0.8357794880867004f, 0.8312078714370728f, 0.8265864253044128f, 0.8219157457351685f, 0.8171966671943665f, 0.8124297261238098f, 0.8076158165931702f, 0.8027555346488953f, 0.7978496551513672f, 0.7928989529609680f, 0.7879040837287903f, 0.7828658819198608f, 0.7777851223945618f, 0.7726625204086304f, 0.7674987912178040f, 0.7622948288917542f, 0.7570513486862183f, 0.7517691850662231f, 0.7464491128921509f, 0.7410919070243835f, 0.7356983423233032f, 0.7302693724632263f, 0.7248056530952454f, 0.7193081378936768f, 0.7137775421142578f, 0.7082147598266602f, 0.7026206851005554f, 0.6969960331916809f, 0.6913416981697083f, 0.6856585741043091f, 0.6799474954605103f, 0.6742093563079834f, 0.6684449315071106f, 0.6626551747322083f, 0.6568408608436585f, 0.6510030031204224f, 0.6451423168182373f, 0.6392598152160645f, 0.6333563923835754f, 0.6274328231811523f, 0.6214900612831116f, 0.6155290603637695f, 0.6095505952835083f, 0.6035556793212891f, 0.5975451469421387f, 0.5915199518203735f, 0.5854809284210205f, 0.5794290900230408f, 0.5733652114868164f, 0.5672903656959534f, 0.5612053275108337f, 0.5551111102104187f, 0.5490085482597351f, 0.5428986549377441f, 0.5367822647094727f, 0.5306603908538818f, 0.5245338082313538f, 0.5184035897254944f, 0.5122706294059753f, 0.5061357617378235f,
-    0.5000000000000000f, 0.4938642382621765f, 0.4877294003963471f, 0.4815963804721832f, 0.4754661619663239f, 0.4693396389484406f, 0.4632177054882050f, 0.4571013450622559f, 0.4509914219379425f, 0.4448888897895813f, 0.4387946724891663f, 0.4327096343040466f, 0.4266347587108612f, 0.4205709397792816f, 0.4145190417766571f, 0.4084800481796265f, 0.4024548530578613f, 0.3964443206787109f, 0.3904493749141693f, 0.3844709396362305f, 0.3785099089145660f, 0.3725671768188477f, 0.3666436076164246f, 0.3607401549816132f, 0.3548576533794403f, 0.3489970266819000f, 0.3431591391563416f, 0.3373448550701141f, 0.3315550684928894f, 0.3257906734943390f, 0.3200524747371674f, 0.3143413960933685f, 0.3086582720279694f, 0.3030039668083191f, 0.2973793447017670f, 0.2917852103710175f, 0.2862224578857422f, 0.2806918919086456f, 0.2751943469047546f, 0.2697306573390961f, 0.2643016278743744f, 0.2589081227779388f, 0.2535509169101715f, 0.2482308149337769f, 0.2429486215114594f, 0.2377051562070847f, 0.2325011938810349f, 0.2273375093936920f, 0.2222148776054382f, 0.2171340882778168f, 0.2120959013700485f, 0.2071010768413544f, 0.2021503448486328f, 0.1972444802522659f, 0.1923841983079910f, 0.1875702589750290f, 0.1828033626079559f, 0.1780842244625092f, 0.1734135746955872f, 0.1687921136617661f, 0.1642205268144608f, 0.1596994996070862f, 0.1552297323942184f, 0.1508118808269501f,
-    0.1464466154575348f, 0.1421345919370651f, 0.1378764659166336f, 0.1336728632450104f, 0.1295244395732880f, 0.1254318058490753f, 0.1213955804705620f, 0.1174163669347763f, 0.1134947761893272f, 0.1096313893795013f, 0.1058267876505852f, 0.1020815446972847f, 0.0983962342143059f, 0.0947714000940323f, 0.0912075936794281f, 0.0877053514122963f, 0.0842651948332787f, 0.0808876454830170f, 0.0775732174515724f, 0.0743224024772644f, 0.0711356922984123f, 0.0680135712027550f, 0.0649565011262894f, 0.0619649514555931f, 0.0590393692255020f, 0.0561801902949810f, 0.0533878505229950f, 0.0506627671420574f, 0.0480053536593914f, 0.0454160086810589f, 0.0428951233625412f, 0.0404430739581585f, 0.0380602329969406f, 0.0357469581067562f, 0.0335035994648933f, 0.0313304923474789f, 0.0292279683053494f, 0.0271963365375996f, 0.0252359099686146f, 0.0233469791710377f, 0.0215298328548670f, 0.0197847411036491f, 0.0181119665503502f, 0.0165117643773556f, 0.0149843730032444f, 0.0135300243273377f, 0.0121489353477955f, 0.0108413146808743f, 0.0096073597669601f, 0.0084472559392452f, 0.0073611787520349f, 0.0063492907211185f, 0.0054117450490594f, 0.0045486823655665f, 0.0037602325901389f, 0.0030465149320662f, 0.0024076367262751f, 0.0018436938989908f, 0.0013547716662288f, 0.0009409435442649f, 0.0006022718735039f, 0.0003388077020645f, 0.0001505906548118f, 0.0000376490788767f,
-};
-
-
-/* F U N C T I O N S */
-// sets all the harmonics
-static void
-SetVoiceLines ( int* VoiceLine, const float base, int val )
-{
-    int    n;
-    int    max = (int) (MAX_CVD_LINE * base / 1024.f);  // harmonics up to Index MAX_CVD_LINE (spectral lines outside of that don't make sense)
-    int    line;
-    float  frq = 1024.f / base;                         // frq = 1024./i is the Index of the basic harmonic
-
-    // go through all harmonics
-    for ( n = 1; n <= max; n++ ) {
-        line = (int) (n * frq);
-        VoiceLine [line] = VoiceLine [line+1] = val;
-    }
-}
-
-
-// Analyze the Cepstrum, search for the basic harmonic
-static void
-CEP_Analyse2048 ( float* res1, float* res2, const float* cp )
-{
-    int           n;
-    int           line;
-    float         cc [MAX_ANALYZED_IDX + 3];    // cross correlation
-    float         ref;
-    float         line_sum;
-    float         sum;
-    float         kkf;
-    float         norm;
-    const float*  x;
-
-    // cross-correlation with pulse shape
-    // Calculate idx = MIN_ANALYZED_IDX-2  to  MAX_ANALYZED_IDX+2,
-    // because they are read during search for maximum
-    // 50 -> 882 Hz, 700 -> 63 Hz base frequency
-
-    *res1 = *res2 = 0. ;
-
-    for ( n = 0; n < MAX_ANALYZED_IDX + 3; n++ ) {
-        x      = cp + n;
-        if ( x[0] > 0. ) {
-            norm = x[-4] * x[-4] +
-                   x[-3] * x[-3] +
-                   x[-2] * x[-2] +
-                   x[-1] * x[-1] +
-                   x[ 0] * x[ 0] +
-                   x[ 1] * x[ 1] +
-                   x[ 2] * x[ 2] +
-                   x[ 3] * x[ 3] +
-                   x[ 4] * x[ 4];
-            kkf  = x[-4] * Puls [0] +
-                   x[-3] * Puls [1] +
-                   x[-2] * Puls [2] +
-                   x[-1] * Puls [3] +
-                   x[ 0] * Puls [4] +
-                   x[ 1] * Puls [5] +
-                   x[ 2] * Puls [6] +
-                   x[ 3] * Puls [7] +
-                   x[ 4] * Puls [8];
-            cc [n] = kkf * kkf / norm;         // calculate the square of ncc to avoid sqrt()
-        }
-    }
-
-#if 0
-#define MMM     2*MAX_ANALYZED_IDX*0+100
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5u", n );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cep[n] );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cp[n] );
-    printf ("\n");
-    for ( n = 0; n < MMM; n++ )
-        printf ("%5.2f", cc[n] );
-    printf ("\n");
-#endif
-    {
-        static unsigned int x = 0;
-
-        printf ("%7.3f s   ", (x/2)*1152./44100 );
-        x++;
-    }
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MED_ANALYZED_IDX;
-    for ( n = MAX_ANALYZED_IDX; n >= MED_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n]     > ref          &&
-             cp[n]     > 0.00f
-           )
-         if ( REF(n) > LIMIT1 )
-            ref  = cc[line = n];
-    }
-
-    printf ("ref=%5.3f ", ref );
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cp + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    ref = cc[line-1] * cp[line-1]
-        + cc[line  ] * cp[line  ]
-        + cc[line+1] * cp[line+1];
-
-    printf ("ref=%5.3f line=%5.1f *res1=%7.3f f=%8.3f    ", ref, 0.5 * line, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    if ( ref > LIMIT1 )
-        *res1 = line_sum / sum;
-
-    if ( CVD_used < 2 )
-        return;
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MIN_ANALYZED_IDX;
-
-    for ( n = MED_ANALYZED_IDX; n >= MIN_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n]                   > ref         &&
-             cp[n]                   > 0.00f
-           )
-         if ( REF(n) > LIMIT2 )
-            ref  = cc[line = n];
-    }
-
-    printf ("ref=%5.3f ", ref );
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cp + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-
-    printf ("ref=%5.3f line=%5.1f *res2=%8.3f f=%8.3f\n", ref, 0.5 * line, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    if ( ref >= LIMIT2 )
-        *res2 = line_sum / sum;
-
-    return;
-}
-
-#ifndef CVD_FASTLOG
-# define logfast(x)     ((float) log (x))
-#else
-
-static __inline float   /* This is a rough estimation with an accuracy of |x|<0.0037 */
-logfast ( float x )
-{
-    double  y = x * x;
-    y *= y;
-    y *= y;
-    return (((int*)(&y))[1] + (45127.5 - 1072693248.)) * ( M_LN2 / (1L<<23) );
-}
-
-#endif
-
-// ClearVoiceDetection for spectrum *spec
-// input : Spectrum *spec
-// output: Array *vocal contains information if the FFT-Line is a harmonic component
-int
-CVD2048 ( const float* spec, int* vocal )
-{
-    static float  cep [4096];     // cep[4096] -- array, which is also used for the 2048 FFT
-    const float*  win = CosWin;   // pointer to cos-roll-off
-    float         res1;
-    float         res2;
-    int           n;
-
-    ENTER(20);
-    // Calculating logarithmated, windowed spectrum cep[]
-    // cep[512...1024] = 0 -- cep[1025...2047] doesn't matter, because the first have to be filled by fft
-    for ( n =   0; n < 256; n++ )
-        cep[n] = logfast (*spec++);
-    for ( n = 256; n < 512; n++ )
-        cep[n] = logfast (*spec++) * *win++;
-
-    memset ( cep+512, 0, 513*sizeof(*cep) );
-
-    // Calculating cepstrum of cep[] (the function Cepstrum() outputs the cepstrum in-place)
-    Cepstrum2048 ( cep, MAX_ANALYZED_IDX );
-
-    // search the harmonic
-    CEP_Analyse2048 ( &res1, &res2, cep );
-//#include "cvd.h"
-    if ( res1 > 0.f  ||  res2 > 0.f ) {
-        if ( res1 > 0. ) SetVoiceLines ( vocal, res1, 10 );
-        if ( res2 > 0. ) SetVoiceLines ( vocal, res2,  2 );
-        LEAVE(20);
-        return 1;
-    }
-    LEAVE(20);
-    return 0;
-}
Index: penc/trunk/cvd-old.c
===================================================================
--- /mppenc/trunk/cvd-old.c	(revision 96)
+++ 	(revision )
@@ -1,237 +1,0 @@
-#include "mppenc.h"
-
-/* C O N S T A N T S */
-// from MatLab-Simulation (Fourier-transforms of the Cos-Rolloff)
-#if 0
-static const float  Puls [11] = {
-    -0.02724753942504f, -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,
-     0.49549552704050f,  0.64201253447071f,  0.49549552704050f,  0.18006206051664f,
-    -0.06198987803623f, -0.10670808991329f, -0.02724753942504f
-};
-#endif
-
-static const float  Puls [ 9] = {
-    -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,  0.49549552704050f,
-     0.64201253447071f,  0.49549552704050f,  0.18006206051664f, -0.06198987803623f,
-    -0.10670808991329f
-};
-
-/*
-// Generating the Cos-Rolloff of the Cepstral-analysis, Cos-Rolloff from 5512,5 Hz to 11025 Hz
-// for ( k = 0; k <= 1024; k++ ) {
-//     if      (k < 256) CosWin [k-256] = 1;
-//     else if (k < 512) CosWin [k-256] = 0.5 + 0.5*cos (M_PI*(k-256)/256);
-//     else              CosWin [k-256] = 0;
-// }
-*/
-static const float  CosWin [256] = {
-    1.0000000000000000f, 0.9999623298645020f, 0.9998494386672974f, 0.9996612071990967f, 0.9993977546691895f, 0.9990590810775757f, 0.9986452460289002f, 0.9981563091278076f, 0.9975923895835877f, 0.9969534873962402f, 0.9962397813796997f, 0.9954513311386108f, 0.9945882558822632f, 0.9936507344245911f, 0.9926388263702393f, 0.9915527701377869f, 0.9903926253318787f, 0.9891586899757385f, 0.9878510832786560f, 0.9864699840545654f, 0.9850156307220459f, 0.9834882616996765f, 0.9818880558013916f, 0.9802152514457703f, 0.9784701466560364f, 0.9766530394554138f, 0.9747641086578369f, 0.9728036522865295f, 0.9707720279693604f, 0.9686695337295532f, 0.9664964079856873f, 0.9642530679702759f, 0.9619397521018982f, 0.9595569372177124f, 0.9571048617362976f, 0.9545840024948120f, 0.9519946575164795f, 0.9493372440338135f, 0.9466121792793274f, 0.9438198208808899f, 0.9409606456756592f, 0.9380350708961487f, 0.9350435137748718f, 0.9319864511489868f, 0.9288643002510071f, 0.9256775975227356f, 0.9224267601966858f, 0.9191123247146606f, 0.9157348275184631f, 0.9122946262359619f, 0.9087924361228943f, 0.9052286148071289f, 0.9016037583351135f, 0.8979184627532959f, 0.8941732048988342f, 0.8903686404228210f, 0.8865052461624146f, 0.8825836181640625f, 0.8786044120788574f, 0.8745682239532471f, 0.8704755902290344f, 0.8663271069526672f, 0.8621235489845276f, 0.8578653931617737f,
-    0.8535534143447876f, 0.8491881489753723f, 0.8447702527046204f, 0.8403005003929138f, 0.8357794880867004f, 0.8312078714370728f, 0.8265864253044128f, 0.8219157457351685f, 0.8171966671943665f, 0.8124297261238098f, 0.8076158165931702f, 0.8027555346488953f, 0.7978496551513672f, 0.7928989529609680f, 0.7879040837287903f, 0.7828658819198608f, 0.7777851223945618f, 0.7726625204086304f, 0.7674987912178040f, 0.7622948288917542f, 0.7570513486862183f, 0.7517691850662231f, 0.7464491128921509f, 0.7410919070243835f, 0.7356983423233032f, 0.7302693724632263f, 0.7248056530952454f, 0.7193081378936768f, 0.7137775421142578f, 0.7082147598266602f, 0.7026206851005554f, 0.6969960331916809f, 0.6913416981697083f, 0.6856585741043091f, 0.6799474954605103f, 0.6742093563079834f, 0.6684449315071106f, 0.6626551747322083f, 0.6568408608436585f, 0.6510030031204224f, 0.6451423168182373f, 0.6392598152160645f, 0.6333563923835754f, 0.6274328231811523f, 0.6214900612831116f, 0.6155290603637695f, 0.6095505952835083f, 0.6035556793212891f, 0.5975451469421387f, 0.5915199518203735f, 0.5854809284210205f, 0.5794290900230408f, 0.5733652114868164f, 0.5672903656959534f, 0.5612053275108337f, 0.5551111102104187f, 0.5490085482597351f, 0.5428986549377441f, 0.5367822647094727f, 0.5306603908538818f, 0.5245338082313538f, 0.5184035897254944f, 0.5122706294059753f, 0.5061357617378235f,
-    0.5000000000000000f, 0.4938642382621765f, 0.4877294003963471f, 0.4815963804721832f, 0.4754661619663239f, 0.4693396389484406f, 0.4632177054882050f, 0.4571013450622559f, 0.4509914219379425f, 0.4448888897895813f, 0.4387946724891663f, 0.4327096343040466f, 0.4266347587108612f, 0.4205709397792816f, 0.4145190417766571f, 0.4084800481796265f, 0.4024548530578613f, 0.3964443206787109f, 0.3904493749141693f, 0.3844709396362305f, 0.3785099089145660f, 0.3725671768188477f, 0.3666436076164246f, 0.3607401549816132f, 0.3548576533794403f, 0.3489970266819000f, 0.3431591391563416f, 0.3373448550701141f, 0.3315550684928894f, 0.3257906734943390f, 0.3200524747371674f, 0.3143413960933685f, 0.3086582720279694f, 0.3030039668083191f, 0.2973793447017670f, 0.2917852103710175f, 0.2862224578857422f, 0.2806918919086456f, 0.2751943469047546f, 0.2697306573390961f, 0.2643016278743744f, 0.2589081227779388f, 0.2535509169101715f, 0.2482308149337769f, 0.2429486215114594f, 0.2377051562070847f, 0.2325011938810349f, 0.2273375093936920f, 0.2222148776054382f, 0.2171340882778168f, 0.2120959013700485f, 0.2071010768413544f, 0.2021503448486328f, 0.1972444802522659f, 0.1923841983079910f, 0.1875702589750290f, 0.1828033626079559f, 0.1780842244625092f, 0.1734135746955872f, 0.1687921136617661f, 0.1642205268144608f, 0.1596994996070862f, 0.1552297323942184f, 0.1508118808269501f,
-    0.1464466154575348f, 0.1421345919370651f, 0.1378764659166336f, 0.1336728632450104f, 0.1295244395732880f, 0.1254318058490753f, 0.1213955804705620f, 0.1174163669347763f, 0.1134947761893272f, 0.1096313893795013f, 0.1058267876505852f, 0.1020815446972847f, 0.0983962342143059f, 0.0947714000940323f, 0.0912075936794281f, 0.0877053514122963f, 0.0842651948332787f, 0.0808876454830170f, 0.0775732174515724f, 0.0743224024772644f, 0.0711356922984123f, 0.0680135712027550f, 0.0649565011262894f, 0.0619649514555931f, 0.0590393692255020f, 0.0561801902949810f, 0.0533878505229950f, 0.0506627671420574f, 0.0480053536593914f, 0.0454160086810589f, 0.0428951233625412f, 0.0404430739581585f, 0.0380602329969406f, 0.0357469581067562f, 0.0335035994648933f, 0.0313304923474789f, 0.0292279683053494f, 0.0271963365375996f, 0.0252359099686146f, 0.0233469791710377f, 0.0215298328548670f, 0.0197847411036491f, 0.0181119665503502f, 0.0165117643773556f, 0.0149843730032444f, 0.0135300243273377f, 0.0121489353477955f, 0.0108413146808743f, 0.0096073597669601f, 0.0084472559392452f, 0.0073611787520349f, 0.0063492907211185f, 0.0054117450490594f, 0.0045486823655665f, 0.0037602325901389f, 0.0030465149320662f, 0.0024076367262751f, 0.0018436938989908f, 0.0013547716662288f, 0.0009409435442649f, 0.0006022718735039f, 0.0003388077020645f, 0.0001505906548118f, 0.0000376490788767f,
-};
-
-
-// sets all the harmonics
-static void
-SetVoiceLines ( int* VoiceLine, const float base, int val )
-{
-    int    n;
-    int    max = (int) (MAX_CVD_LINE * base / 1024.f);  // harmonics up to Index MAX_CVD_LINE (spectral lines outside of that don't make sense)
-    int    line;
-    float  frq = 1024.f / base;                         // frq = 1024./i is the Index of the basic harmonic
-
-    // go through all harmonics
-    for ( n = 1; n <= max; n++ ) {
-        line = (int) (n * frq);
-        VoiceLine [line] = VoiceLine [line+1] = val;
-    }
-}
-
-
-// Analyze the Cepstrum, search for the basic harmonic
-static void
-CEP_Analyse2048 ( float* res1, float* res2, float *cep )
-{
-    int           n;
-    int           line;
-    float         cc [MAX_ANALYZED_IDX + 3];    // cross correlation
-    float         ref;
-    float         line_sum;
-    float         sum;
-    float         kkf;
-    float         norm;
-    const float*  x;
-
-    // cross-correlation with pulse shape
-    // Calculate idx = MIN_ANALYZED_IDX-2  to  MAX_ANALYZED_IDX+2,
-    // because they are read during search for maximum
-    // 50 -> 882 Hz, 700 -> 63 Hz base frequency
-
-    *res1 = *res2 = 0. ;
-    memset ( cc, 0, sizeof cc );
-
-    for ( n = MIN_ANALYZED_IDX - 2; n <= MAX_ANALYZED_IDX + 2; n++ ) {
-        x    = cep + n;
-        norm = x[-4] * x[-4] +
-               x[-3] * x[-3] +
-               x[-2] * x[-2] +
-               x[-1] * x[-1] +
-               x[ 0] * x[ 0] +
-               x[ 1] * x[ 1] +
-               x[ 2] * x[ 2] +
-               x[ 3] * x[ 3] +
-               x[ 4] * x[ 4];
-        kkf  = x[-4] * Puls [0] +
-               x[-3] * Puls [1] +
-               x[-2] * Puls [2] +
-               x[-1] * Puls [3] +
-               x[ 0] * Puls [4] +
-               x[ 1] * Puls [5] +
-               x[ 2] * Puls [6] +
-               x[ 3] * Puls [7] +
-               x[ 4] * Puls [8];
-        cc [n] = norm > 0. ?  kkf * kkf / norm  :  0.f;         // calculate the square of ncc to avoid sqrt()
-    }
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MED_ANALYZED_IDX;
-    for ( n = MAX_ANALYZED_IDX; n >= MED_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n] * cep[n] * cep[n] > ref      &&
-             cc[n]                   > 0.85f    &&      /* e33 (02) */
-             cep[n]                  > 0.00f    &&      /* e33 (02) */
-             cc[n  ]                >= cc[n+1]  &&
-             cc[n  ]                >= cc[n-1]  &&
-             cc[n+1]                >= cc[n+2]  &&
-             cc[n-1]                >= cc[n-2]
-           )
-        {
-            ref  = cc[n] * cep[n] * cep[n];
-            line = n;
-        }
-    }
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cep + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    /* e33 (04) */
-    ref = cc[line  ] * cep[line  ] * cep[line  ]
-        + cc[line-1] * cep[line-1] * cep[line-1]
-        + cc[line+1] * cep[line+1] * cep[line+1];
-
-    {
-        static unsigned int x = 0;
-
-        printf ("%7.3f s   ", (x/2)*1152./44100 );
-        x++;
-    }
-
-    printf ("ref=%5.3f *res1=%7.3f f=%8.3f    ", ref, line_sum / sum, 44100. / (line_sum / sum) );
-
-    if ( ref > 0.015f )
-        *res1 = line_sum / sum;
-
-    if ( CVD_used < 2 )
-        return;
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MIN_ANALYZED_IDX;
-
-    for ( n = MED_ANALYZED_IDX + 1; n >= MIN_ANALYZED_IDX - 1; n-- ) {
-        cc  [2*n  ] += 0.5 * cc [n];
-        cc  [2*n+1] += 0.5 * (cc [n] + cc[n+1]);
-        cep [2*n  ] += 0.5 * cep [n];
-        cep [2*n+1] += 0.5 * (cep [n] + cep[n+1]);
-    }
-
-    for ( n = 2*MED_ANALYZED_IDX; n >= 2*MIN_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n] * cep[n] * cep[n] > ref      &&
-             cc[n]                   > 0.85f    &&      /* e33 (02) */
-             cep[n]                  > 0.00f    &&      /* e33 (02) */
-             cc[n  ]                >= cc[n+1]  &&
-             cc[n  ]                >= cc[n-1]  &&
-             cc[n+1]                >= cc[n+2]  &&
-             cc[n-1]                >= cc[n-2]
-           )
-        {
-            ref  = cc[n] * cep[n] * cep[n];
-            line = n;
-        }
-    }
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cep + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    /* e33 (04) */
-    ref = cc[line  ] * cep[line  ] * cep[line  ]
-        + cc[line-1] * cep[line-1] * cep[line-1]
-        + cc[line+1] * cep[line+1] * cep[line+1];
-
-    printf ("ref=%5.3f *res2=%8.3f f=%8.3f\n", ref, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    if ( ref >= 0.1f )
-        *res2 = 0.5 * line_sum / sum;
-
-    return;
-}
-
-#ifndef CVD_FASTLOG
-# define logfast(x)     ((float) log (x))
-#else
-
-static __inline float   /* This is a rough estimation with an accuracy of |x|<0.0037 */
-logfast ( float x )
-{
-    double  y = x * x;
-    y *= y;
-    y *= y;
-    return (((int*)(&y))[1] + (45127.5 - 1072693248.)) * ( M_LN2 / (1L<<23) );
-}
-
-#endif
-
-// ClearVoiceDetection for spectrum *spec
-// input : Spectrum *spec
-// output: Array *vocal contains information if the FFT-Line is a harmonic component
-int
-CVD2048 ( const float* spec, int* vocal )
-{
-    static float  cep [4096];     // cep[4096] -- array, which is also used for the 2048 FFT
-    const float*  win = CosWin;   // pointer to cos-roll-off
-    float         res1;
-    float         res2;
-    int           n;
-
-    ENTER(20);
-    // Calculating logarithmated, windowed spectrum cep[]
-    // cep[512...1024] = 0 -- cep[1025...2047] doesn't matter, because the first have to be filled by fft
-    for ( n =   0; n < 256; n++ )
-        cep[n] = logfast (*spec++);
-    for ( n = 256; n < 512; n++ )
-        cep[n] = logfast (*spec++) * *win++;
-
-    memset ( cep+512, 0, 513*sizeof(*cep) );
-
-    // Calculating cepstrum of cep[] (the function Cepstrum() outputs the cepstrum in-place)
-    Cepstrum2048 ( cep, MAX_ANALYZED_IDX );
-
-    // search the harmonic
-    CEP_Analyse2048 ( &res1, &res2, cep );
-#include "cvd.h"
-    if ( res1 > 0.f  ||  res2 > 0.f ) {
-        if ( res1 > 0. ) SetVoiceLines ( vocal, res1, 10 );
-        if ( res2 > 0. ) SetVoiceLines ( vocal, res2,  2 );
-        LEAVE(20);
-        return 1;
-    }
-    LEAVE(20);
-    return 0;
-}
Index: penc/trunk/cvd.c
===================================================================
--- /mppenc/trunk/cvd.c	(revision 96)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-/* C O N S T A N T S */
-// from MatLab-Simulation (Fourier-transforms of the Cos-Rolloff)
-#if 0
-static const float  Puls [11] = {
-    -0.02724753942504f, -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,
-     0.49549552704050f,  0.64201253447071f,  0.49549552704050f,  0.18006206051664f,
-    -0.06198987803623f, -0.10670808991329f, -0.02724753942504f
-};
-#endif
-
-static const float  Puls [ 9] = {
-    -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,  0.49549552704050f,
-     0.64201253447071f,  0.49549552704050f,  0.18006206051664f, -0.06198987803623f,
-    -0.10670808991329f
-};
-
-/*
-// Generating the Cos-Rolloff of the Cepstral-analysis, Cos-Rolloff from 5512,5 Hz to 11025 Hz
-// for ( k = 0; k <= 1024; k++ ) {
-//     if      (k < 256) CosWin [k-256] = 1;
-//     else if (k < 512) CosWin [k-256] = 0.5 + 0.5*cos (M_PI*(k-256)/256);
-//     else              CosWin [k-256] = 0;
-// }
-*/
-static const float  CosWin [256] = {
-    1.0000000000000000f, 0.9999623298645020f, 0.9998494386672974f, 0.9996612071990967f, 0.9993977546691895f, 0.9990590810775757f, 0.9986452460289002f, 0.9981563091278076f, 0.9975923895835877f, 0.9969534873962402f, 0.9962397813796997f, 0.9954513311386108f, 0.9945882558822632f, 0.9936507344245911f, 0.9926388263702393f, 0.9915527701377869f, 0.9903926253318787f, 0.9891586899757385f, 0.9878510832786560f, 0.9864699840545654f, 0.9850156307220459f, 0.9834882616996765f, 0.9818880558013916f, 0.9802152514457703f, 0.9784701466560364f, 0.9766530394554138f, 0.9747641086578369f, 0.9728036522865295f, 0.9707720279693604f, 0.9686695337295532f, 0.9664964079856873f, 0.9642530679702759f, 0.9619397521018982f, 0.9595569372177124f, 0.9571048617362976f, 0.9545840024948120f, 0.9519946575164795f, 0.9493372440338135f, 0.9466121792793274f, 0.9438198208808899f, 0.9409606456756592f, 0.9380350708961487f, 0.9350435137748718f, 0.9319864511489868f, 0.9288643002510071f, 0.9256775975227356f, 0.9224267601966858f, 0.9191123247146606f, 0.9157348275184631f, 0.9122946262359619f, 0.9087924361228943f, 0.9052286148071289f, 0.9016037583351135f, 0.8979184627532959f, 0.8941732048988342f, 0.8903686404228210f, 0.8865052461624146f, 0.8825836181640625f, 0.8786044120788574f, 0.8745682239532471f, 0.8704755902290344f, 0.8663271069526672f, 0.8621235489845276f, 0.8578653931617737f,
-    0.8535534143447876f, 0.8491881489753723f, 0.8447702527046204f, 0.8403005003929138f, 0.8357794880867004f, 0.8312078714370728f, 0.8265864253044128f, 0.8219157457351685f, 0.8171966671943665f, 0.8124297261238098f, 0.8076158165931702f, 0.8027555346488953f, 0.7978496551513672f, 0.7928989529609680f, 0.7879040837287903f, 0.7828658819198608f, 0.7777851223945618f, 0.7726625204086304f, 0.7674987912178040f, 0.7622948288917542f, 0.7570513486862183f, 0.7517691850662231f, 0.7464491128921509f, 0.7410919070243835f, 0.7356983423233032f, 0.7302693724632263f, 0.7248056530952454f, 0.7193081378936768f, 0.7137775421142578f, 0.7082147598266602f, 0.7026206851005554f, 0.6969960331916809f, 0.6913416981697083f, 0.6856585741043091f, 0.6799474954605103f, 0.6742093563079834f, 0.6684449315071106f, 0.6626551747322083f, 0.6568408608436585f, 0.6510030031204224f, 0.6451423168182373f, 0.6392598152160645f, 0.6333563923835754f, 0.6274328231811523f, 0.6214900612831116f, 0.6155290603637695f, 0.6095505952835083f, 0.6035556793212891f, 0.5975451469421387f, 0.5915199518203735f, 0.5854809284210205f, 0.5794290900230408f, 0.5733652114868164f, 0.5672903656959534f, 0.5612053275108337f, 0.5551111102104187f, 0.5490085482597351f, 0.5428986549377441f, 0.5367822647094727f, 0.5306603908538818f, 0.5245338082313538f, 0.5184035897254944f, 0.5122706294059753f, 0.5061357617378235f,
-    0.5000000000000000f, 0.4938642382621765f, 0.4877294003963471f, 0.4815963804721832f, 0.4754661619663239f, 0.4693396389484406f, 0.4632177054882050f, 0.4571013450622559f, 0.4509914219379425f, 0.4448888897895813f, 0.4387946724891663f, 0.4327096343040466f, 0.4266347587108612f, 0.4205709397792816f, 0.4145190417766571f, 0.4084800481796265f, 0.4024548530578613f, 0.3964443206787109f, 0.3904493749141693f, 0.3844709396362305f, 0.3785099089145660f, 0.3725671768188477f, 0.3666436076164246f, 0.3607401549816132f, 0.3548576533794403f, 0.3489970266819000f, 0.3431591391563416f, 0.3373448550701141f, 0.3315550684928894f, 0.3257906734943390f, 0.3200524747371674f, 0.3143413960933685f, 0.3086582720279694f, 0.3030039668083191f, 0.2973793447017670f, 0.2917852103710175f, 0.2862224578857422f, 0.2806918919086456f, 0.2751943469047546f, 0.2697306573390961f, 0.2643016278743744f, 0.2589081227779388f, 0.2535509169101715f, 0.2482308149337769f, 0.2429486215114594f, 0.2377051562070847f, 0.2325011938810349f, 0.2273375093936920f, 0.2222148776054382f, 0.2171340882778168f, 0.2120959013700485f, 0.2071010768413544f, 0.2021503448486328f, 0.1972444802522659f, 0.1923841983079910f, 0.1875702589750290f, 0.1828033626079559f, 0.1780842244625092f, 0.1734135746955872f, 0.1687921136617661f, 0.1642205268144608f, 0.1596994996070862f, 0.1552297323942184f, 0.1508118808269501f,
-    0.1464466154575348f, 0.1421345919370651f, 0.1378764659166336f, 0.1336728632450104f, 0.1295244395732880f, 0.1254318058490753f, 0.1213955804705620f, 0.1174163669347763f, 0.1134947761893272f, 0.1096313893795013f, 0.1058267876505852f, 0.1020815446972847f, 0.0983962342143059f, 0.0947714000940323f, 0.0912075936794281f, 0.0877053514122963f, 0.0842651948332787f, 0.0808876454830170f, 0.0775732174515724f, 0.0743224024772644f, 0.0711356922984123f, 0.0680135712027550f, 0.0649565011262894f, 0.0619649514555931f, 0.0590393692255020f, 0.0561801902949810f, 0.0533878505229950f, 0.0506627671420574f, 0.0480053536593914f, 0.0454160086810589f, 0.0428951233625412f, 0.0404430739581585f, 0.0380602329969406f, 0.0357469581067562f, 0.0335035994648933f, 0.0313304923474789f, 0.0292279683053494f, 0.0271963365375996f, 0.0252359099686146f, 0.0233469791710377f, 0.0215298328548670f, 0.0197847411036491f, 0.0181119665503502f, 0.0165117643773556f, 0.0149843730032444f, 0.0135300243273377f, 0.0121489353477955f, 0.0108413146808743f, 0.0096073597669601f, 0.0084472559392452f, 0.0073611787520349f, 0.0063492907211185f, 0.0054117450490594f, 0.0045486823655665f, 0.0037602325901389f, 0.0030465149320662f, 0.0024076367262751f, 0.0018436938989908f, 0.0013547716662288f, 0.0009409435442649f, 0.0006022718735039f, 0.0003388077020645f, 0.0001505906548118f, 0.0000376490788767f,
-};
-
-
-/* F U N C T I O N S */
-// sets all the harmonics
-static void
-SetVoiceLines ( int* VoiceLine, const float base, int val )
-{
-    int    n;
-    int    max = (int) (MAX_CVD_LINE * base / 1024.f);  // harmonics up to Index MAX_CVD_LINE (spectral lines outside of that don't make sense)
-    int    line;
-    float  frq = 1024.f / base;                         // frq = 1024./i is the Index of the basic harmonic
-
-    // go through all harmonics
-    for ( n = 1; n <= max; n++ ) {
-        line = (int) (n * frq);
-        VoiceLine [line] = VoiceLine [line+1] = val;
-    }
-}
-
-
-// Analyze the Cepstrum, search for the basic harmonic
-static void
-CEP_Analyse2048 ( float* res1,
-                  float* res2,
-                  float* qual1,
-                  float* qual2,
-                  float* cep )
-{
-    int           n;
-    int           line;
-    float         cc [MAX_ANALYZED_IDX + 3];    // cross correlation
-    float         ref;
-    float         line_sum;
-    float         sum;
-    float         kkf;
-    float         norm;
-    const float*  x;
-
-    // cross-correlation with pulse shape
-    // Calculate idx = MIN_ANALYZED_IDX-2  to  MAX_ANALYZED_IDX+2,
-    // because they are read during search for maximum
-    // 50 -> 882 Hz, 700 -> 63 Hz base frequency
-
-    *res1 = *res2 = 0. ;
-    memset ( cc, 0, sizeof cc );
-
-    for ( n = MIN_ANALYZED_IDX - 2; n <= MAX_ANALYZED_IDX + 2; n++ ) {
-        x    = cep + n;
-        if ( x[0] > 0 ) {
-            norm = x[-4] * x[-4] +
-                   x[-3] * x[-3] +
-                   x[-2] * x[-2] +
-                   x[-1] * x[-1] +
-                   x[ 0] * x[ 0] +
-                   x[ 1] * x[ 1] +
-                   x[ 2] * x[ 2] +
-                   x[ 3] * x[ 3] +
-                   x[ 4] * x[ 4];
-            kkf  = x[-4] * Puls [0] +
-                   x[-3] * Puls [1] +
-                   x[-2] * Puls [2] +
-                   x[-1] * Puls [3] +
-                   x[ 0] * Puls [4] +
-                   x[ 1] * Puls [5] +
-                   x[ 2] * Puls [6] +
-                   x[ 3] * Puls [7] +
-                   x[ 4] * Puls [8];
-            cc [n] = kkf * kkf / norm;         // calculate the square of ncc to avoid sqrt()
-        }
-    }
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MED_ANALYZED_IDX;
-    for ( n = MAX_ANALYZED_IDX; n >= MED_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n] * cep[n] * cep[n] > ref      &&
-             cc[n]                   > 0.40f    &&      // e33 (02)     0.85
-             cep[n]                  > 0.00f    &&      // e33 (02)
-             cc[n  ]                >= cc[n+1]  &&
-             cc[n  ]                >= cc[n-1]  &&
-             cc[n+1]                >= cc[n+2]  &&
-             cc[n-1]                >= cc[n-2]
-           )
-        {
-            ref  = cc[n] * cep[n] * cep[n];
-            line = n;
-        }
-    }
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cep + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    /* e33 (04) */
-    ref = cc[line  ] * cep[line  ] * cep[line  ]
-        + cc[line-1] * cep[line-1] * cep[line-1]
-        + cc[line+1] * cep[line+1] * cep[line+1];
-
-    //{
-    //    static unsigned int x = 0;
-    //
-    //    printf ("%7.3f s   ", (x/2)*1152./44100       );
-    //  x++;
-    //}
-
-    //printf ("ref=%5.3f *res1=%7.3f f=%8.3f    ", ref, line_sum / sum, 44100. / (line_sum / sum) );
-
-    *qual1 = ref;
-    if ( ref > 0.015f )
-        *res1 = line_sum / sum;
-
-    if ( CVD_used < 2 )
-        return;
-
-    // search for the (relative) maximum
-    ref  = 0.f;
-    line = MIN_ANALYZED_IDX;
-
-    for ( n = MED_ANALYZED_IDX + 1; n >= MIN_ANALYZED_IDX - 1; n-- ) {
-        cc  [2*n  ] += 0.5 * cc [n];
-        cc  [2*n+1] += 0.5 * (cc [n] + cc[n+1]);
-        cep [2*n  ] += 0.5 * cep [n];
-        cep [2*n+1] += 0.5 * (cep [n] + cep[n+1]);
-    }
-
-    for ( n = 2*MED_ANALYZED_IDX; n >= 2*MIN_ANALYZED_IDX; n-- ) {
-        if (
-             cc[n] * cep[n] * cep[n] > ref      &&
-             cc[n]                   > 0.85f    &&      /* e33 (02) */
-             cep[n]                  > 0.00f    &&      /* e33 (02) */
-             cc[n  ]                >= cc[n+1]  &&
-             cc[n  ]                >= cc[n-1]  &&
-             cc[n+1]                >= cc[n+2]  &&
-             cc[n-1]                >= cc[n-2]
-           )
-        {
-            ref  = cc[n] * cep[n] * cep[n];
-            line = n;
-        }
-    }
-
-    // Calculating the center of the maximum (Interpolation)
-    x        = cep + line;
-    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
-    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
-
-    /* e33 (04) */
-    ref = cc[line  ] * cep[line  ] * cep[line  ]
-        + cc[line-1] * cep[line-1] * cep[line-1]
-        + cc[line+1] * cep[line+1] * cep[line+1];
-
-    //printf ("ref=%5.3f *res2=%8.3f f=%8.3f\n", ref, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
-
-    *qual2 = ref;
-    if ( ref >= 0.1f )
-        *res2 = 0.5 * line_sum / sum;
-
-    return;
-}
-
-#ifndef CVD_FASTLOG
-# define logfast(x)     ((float) log (x))
-#else
-
-static __inline float   /* This is a rough estimation with an accuracy of |x|<0.0037 */
-logfast ( float x )
-{
-    double  y = x * x;
-    y *= y;
-    y *= y;
-    return (((int*)(&y))[1] + (45127.5 - 1072693248.)) * ( M_LN2 / (1L<<23) );
-}
-
-#endif
-
-// ClearVoiceDetection for spectrum *spec
-// input : Spectrum *spec
-// output: Array *vocal contains information if the FFT-Line is a harmonic component
-int
-CVD2048 ( const float* spec, int* vocal )
-{
-    static float  cep [4096];     // cep[4096] -- array, which is also used for the 2048 FFT
-    const float*  win = CosWin;   // pointer to cos-roll-off
-    float         res1;
-    float         res2;
-    float         qual1;
-    float         qual2;
-    int           n;
-
-    ENTER(20);
-    // Calculating logarithmated, windowed spectrum cep[]
-    // cep[512...1024] = 0 -- cep[1025...2047] doesn't matter, because the first have to be filled by fft
-    for ( n =   0; n < 256; n++ )
-        cep[n] = logfast (*spec++);
-    for ( n = 256; n < 512; n++ )
-        cep[n] = logfast (*spec++) * *win++;
-
-    memset ( cep+512, 0, 513*sizeof(*cep) );
-
-    // Calculating cepstrum of cep[] (the function Cepstrum() outputs the cepstrum in-place)
-    Cepstrum2048 ( cep, MAX_ANALYZED_IDX );
-
-    // search the harmonic
-    CEP_Analyse2048 ( &res1, &res2, &qual1, &qual2, cep );
-//#include "cvd.h"
-    if ( res1 > 0.f  ||  res2 > 0.f ) {
-        if ( res1 > 0. ) SetVoiceLines ( vocal, res1, 100 );
-        if ( res2 > 0. ) SetVoiceLines ( vocal, res2,  20 );
-        LEAVE(20);
-        return 1;
-    }
-    LEAVE(20);
-    return 0;
-}
Index: penc/trunk/cvd.h
===================================================================
--- /mppenc/trunk/cvd.h	(revision 96)
+++ 	(revision )
@@ -1,9 +1,0 @@
-{
-    static FILE* fp = NULL;
-    static int   x = 0;
-
-    if ( fp == NULL ) fp = fopen ( "cvd.txt", "a" );
-    fprintf ( fp, "%7.3f  %6.2f %7.2f\n", (x>>1)*1152./44100, res1, res2 );
-
-    x++;
-}
Index: penc/trunk/decode.c
===================================================================
--- /mppenc/trunk/decode.c	(revision 96)
+++ 	(revision )
@@ -1,1088 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string.h>
-#include <assert.h>
-#include "mppdec.h"
-
-// Todo:
-// Intercept InputBuff-Buffer Overflows less frequently, but leave some headroom???
-// Cleanly number the functions...
-// Calculate_New_V: Save at all relevant places at the end
-// Make 3DNow!-Code (Assembler instructions) more independent from each other (reorder)
-// Determine bit-demand of the seperate bands to adjust RES/SFI/Q-bitdemand against each other
-
-#define BITS     (CHAR_BIT * sizeof(*InputBuff))      // Bits per InputBuff-Word
-#define INC      InputCnt = (InputCnt + 1) & IBUFMASK
-
-Ibuf_t           InputBuff [IBUFSIZE /* +128 */ ];  // contains the read-buffer
-static Uint32_t  mask      [32 + 1];
-size_t           InputCnt;             // current position in the read-buffer
-static Ibuf_t    dword;                // BITS Bit-Word for Bitstream-I/O
-static Uint      pos;                  // position in the currently decoded BITS-bit-Word
-static size_t    LastInputCnt = 0;
-static Uint      Wraps        = 0;
-
-
-/*
- *  Initialize all tables and variables
- */
-
-void
-Bitstream_init ( void )
-{
-    Int       i;
-    Uint32_t  val;
-
-    InputCnt     = (size_t)-1;
-    pos          = BITS;
-    dword        = 0;     // Values are initialized in a way that during the next read of at least 1 bit, the first DWORD is collected automatically
-    LastInputCnt = 0;
-    Wraps        = 0;
-
-    for ( val = 0, i = 0; i <= 32; i++, val += val+1 )
-        mask [i] = val;
-}
-
-
-/*
- *  Skip a given number of bits, only forward-skips possible
- */
-
-void
-Bitstream_skip ( Uint  bits )
-{
-    pos     += bits;
-    InputCnt = (InputCnt + pos/BITS) & IBUFMASK;
-    dword    = InputBuff [InputCnt];
-    pos     %= BITS;
-}
-
-
-/*
- *  Read a fixed number of bits from the bitstream. Guaranteed 0...16 bits can be read,
- *  with accesses aligned to 16 bits, it can be up to 32 bits.
- */
-
-Uint32_t
-Bitstream_read ( Int bits )
-{
-    Uint32_t  ret;
-
-    ENTER(78);
-
-    ret = dword;
-    if ( (pos += bits) < BITS ) {
-        ret >>= BITS - pos;
-    }
-    else {
-        pos  -= BITS;
-        INC; ReadLE32 ( dword,  InputBuff+ InputCnt );
-        if ( pos > 0 ) {
-            ret <<= pos;
-            ret  |= dword >> (BITS - pos);
-        }
-    }
-    ret &= mask [bits];
-
-    LEAVE(78);
-    REP (printf ( "read(%2u) = %u\n", bits, ret ));
-    return ret;
-}
-
-/*
- *  Fast form for Bitstream_read(1)
- */
-
-static Uint
-Bitstream_read1 ( void )
-{
-    Uint  ret;
-
-    ENTER(93);
-
-    ret = (Uint)( dword >> ( BITS - ++pos) ) & 1;
-    if ( pos >= BITS ) {
-        INC; ReadLE32 ( dword,  InputBuff+ InputCnt );
-        pos  -= BITS;
-    }
-
-    LEAVE(93);
-    REP (printf ( "read( 1) = %u\n", ret ));
-    return ret;
-}
-
-
-/*
- *  Read of n bits (Restrictions see Bitstream_read), without acknowledging them
- */
-
-Uint32_t
-Bitstream_preview ( Int bits )
-{
-    Uint      new_pos = pos + bits;
-    Uint32_t  ret     = dword;
-    Uint32_t  tmp;
-
-    if ( new_pos < BITS ) {
-        ret >>= BITS - new_pos;
-    }
-    else if ( new_pos > BITS ) {
-        ret <<= new_pos - BITS;
-        ReadLE32 ( tmp, & InputBuff [(InputCnt+1) & IBUFMASK] );
-        ret  |= tmp >> (2*BITS - new_pos);
-    }
-    return ret /* & mask[bits] */;
-}
-
-
-/*
- *  Decode Huffman-code, which can be a maximum of 14 bits long.
- *  Decoding simply scans the table.
- */
-
-static Int
-Huffman_Decode ( const Huffman_t* Table )
-{
-    Uint32_t  code;
-    Uint32_t  tmp;
-
-    ENTER(79);
-
-    code = dword << pos;
-    if ( pos > BITS - 14 ) {
-        ReadLE32 ( tmp, & InputBuff [(InputCnt+1) & IBUFMASK] );
-        code |= tmp >> (BITS - pos);
-    }
-
-    while ( code < Table->Code )
-        Table++;
-
-    // Set Bitstream-position without dummy-read
-    if ( (pos += Table->Length) >= BITS ) {
-        pos   -= BITS;
-        INC; ReadLE32 ( dword,  InputBuff+ InputCnt );
-    }
-
-    LEAVE(79);
-    REP (printf ( "decode() = %d\n", Table->Value ));
-    return Table->Value;
-}
-
-
-/*
- *  Decode Huffman-code, which can be a maximum of 14 bits long.
- *  Decoding works with rough positioning via a helper table (tab,unused_bits),
- *  after which it continues to scan until the value is reached.
- */
-
-static Int
-Huffman_Decode_faster ( const Huffman_t* Table, const Uint8_t* tab, Int unused_bits )
-{
-    Uint32_t  code;
-    Uint32_t  tmp;
-
-    ENTER(93);
-
-    code = dword << pos;
-    if ( pos > BITS - 14 ) {
-        ReadLE32 ( tmp, & InputBuff [(InputCnt+1) & IBUFMASK] );
-        code |= tmp >> (BITS - pos);
-    }
-
-    Table += tab [(size_t)(code >> unused_bits) ];
-
-    while ( code < Table->Code )
-        Table++;
-
-    // Set Bitstream-position without dummy-read
-    if ( (pos += Table->Length) >= BITS ) {
-        pos   -= BITS;
-        INC; ReadLE32 ( dword,  InputBuff+ InputCnt );
-    }
-
-    LEAVE(93);
-    REP (printf ( "decode() = %d\n", Table->Value ));
-    return Table->Value;
-}
-
-#define HUFFMAN_DECODE_FASTER(a,b,c)  Huffman_Decode_faster ( (a), (b), 32-(c) )
-
-
-/*
- *  Decode Huffman-code, which can be a maximum of 16 bits long.
- *  Decoding works with a table lookup, therefore only usable for "short" codes,
- *  otherwise we would need huge tables.
- */
-
-static Int
-Huffman_Decode_fastest ( const Huffman_t* Table, const Uint8_t* tab, Int unused_bits )
-{
-    Uint32_t  code;
-    Uint32_t  tmp;
-
-    ENTER(91);
-
-    code = dword << pos;
-    // is the following line optimal?
-    if ( pos > unused_bits + BITS - 32 ) {
-        ReadLE32 ( tmp, & InputBuff [(InputCnt+1) & IBUFMASK] );
-        code |= tmp >> (BITS - pos);
-    }
-
-    Table += tab [ (size_t) (code >> unused_bits) ];
-
-    // Set Bitstream-position without dummy-read
-    if ( (pos += Table->Length) >= BITS ) {
-        pos   -= BITS;
-        INC; ReadLE32 ( dword,  InputBuff+ InputCnt );
-    }
-
-    LEAVE(91);
-    REP (printf ( "decode() = %d\n", Table->Value ));
-    return Table->Value;
-}
-
-#define HUFFMAN_DECODE_FASTEST(a,b,c)  Huffman_Decode_fastest ( (a), (b), 32-(c) )
-
-
-/*
- * Decode huffmann-coded SCFI-Bundle (SV 4...6)
- * Not optimized.
- */
-
-static Uint
-SCFIBundle_read ( const Huffman_t* Table ) // is always called with Arg SCFI_Bundle
-{
-    Uint32_t   code;
-
-    ENTER(81);
-
-    code = dword << pos;
-    if (pos > BITS-6)
-        code |= InputBuff [(InputCnt+1) & IBUFMASK] >> (BITS-pos);
-
-    while ( code < Table->Code )
-        Table++;
-
-    // Set Bitstream-position without dummy-read
-    if ( (pos += Table->Length) >= BITS ) {
-        pos   -= BITS;
-        dword  = InputBuff [InputCnt = (InputCnt+1) & IBUFMASK];
-    }
-
-    LEAVE(81);
-    return (Uint)Table->Value;
-}
-
-
-Ulong
-BitsRead ( void )
-{
-    if (LastInputCnt > InputCnt) Wraps++;
-    LastInputCnt = InputCnt;
-
-    return ((Ulong)Wraps*IBUFSIZE + InputCnt) * BITS + pos;
-}
-
-#if  DUMPSELECT > 0
-# include "dump.c"
-Ulong              __x[8];
-# define BITPOS(x)  __x[x] = BitsRead ()
-#else
-# define BITPOS(x)
-#endif
-
-/*
- *  Own function or macro, so that one can centrally modify it
- */
-
-#define Decode_DSCF()   HUFFMAN_DECODE_FASTEST ( HuffDSCF, LUTDSCF, 6 )
-
-/*
- *  Higher resolutions (8 upwards) aren't huffman-coded anymore, number of bits that will then be read directly
- *  Bits per sample for selected resolution, only for the higher resolutions without huffman-coding
- */
-
-#define RES_BIT(x)      ((x)-1)
-
-/******************************************************************************************/
-/****************************************** SV 6 ******************************************/
-/******************************************************************************************/
-void
-Read_Bitstream_SV6 ( void )
-{
-    Int                Band;
-    Uint               k;
-    const Huffman_t*   Table;
-    const Huffman_t*   xL;
-    const Huffman_t*   xR;
-    Int                Max_Used_Band = 0;
-
-    ENTER(6);
-
-    /********* Read resolution and LR/MS for all Subbands and define last Subband *********************/
-
-    BITPOS(0);
-    for ( Band = 0; Band <= Max_Band; Band++ ) {
-        Table = Region [Band];
-
-        Res[Band].L = Q_res[Band][Bitrate <= 128  ?  Huffman_Decode(Table)  :  (Int) Bitstream_read(Q_bit[Band])];
-        Res[Band].R = 0;
-
-        // Don't read for IS for bands from MinBand+1 on
-        if ( !IS_used  ||  Band < Min_Band ) {
-            MS_Band[Band] = 0;
-            if (MS_used)
-                MS_Band[Band] = Bitstream_read1 ();
-            Res[Band].R = Q_res[Band][Bitrate <= 128  ?  Huffman_Decode(Table)  :  (Int) Bitstream_read(Q_bit[Band])];
-        }
-        // Define last used Subband (following operations are just executed up until this one)
-        if ( Res[Band].L  ||  Res[Band].R )
-            Max_Used_Band = Band;
-    }
-
-    /********* Read used Scalebandfactor-Splitting of the last 36 Samples per Subband and Value-addressing (abs./rel.) */
-
-    BITPOS(1);
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-        if ( Res[Band].L )
-            SCFI[Band].L = SCFIBundle_read (SCFI_Bundle);
-        if ( Res[Band].R  ||  (Res[Band].L  &&  IS_used  &&  Band >= Min_Band) )
-            SCFI[Band].R = SCFIBundle_read (SCFI_Bundle);
-    }
-
-    /********* Read Scalefactors for all Subbands three times for 12 Samples each **************************/
-
-    BITPOS(2);
-    Table = DSCF_Entropie;
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-        if ( Res[Band].L ) {
-            switch ( SCFI[Band].L ) {
-            case 0:                                     // without Differential SCF
-                SCF_Index[0][Band].L = (Int) Bitstream_read(6);
-                SCF_Index[1][Band].L = (Int) Bitstream_read(6);
-                SCF_Index[2][Band].L = (Int) Bitstream_read(6);
-                break;
-            case 2:
-                SCF_Index[0][Band].L = (Int) Bitstream_read(6);
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = (Int) Bitstream_read(6);
-                break;
-            case 4:
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L = (Int) Bitstream_read(6);
-                SCF_Index[2][Band].L = (Int) Bitstream_read(6);
-                break;
-            case 6:
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = (Int) Bitstream_read(6);
-                break;
-            case 1:                                     // with Differential SCF
-                SCF_Index[0][Band].L = SCF_Index[2][Band].L + Huffman_Decode(Table);
-                SCF_Index[1][Band].L = SCF_Index[0][Band].L + Huffman_Decode(Table);
-                SCF_Index[2][Band].L = SCF_Index[1][Band].L + Huffman_Decode(Table);
-                break;
-            default:
-                assert (0);
-            case 3:
-                SCF_Index[0][Band].L = SCF_Index[2][Band].L + Huffman_Decode(Table);
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = SCF_Index[0][Band].L + Huffman_Decode(Table);
-                break;
-            case 5:
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L = SCF_Index[2][Band].L + Huffman_Decode(Table);
-                SCF_Index[2][Band].L = SCF_Index[1][Band].L + Huffman_Decode(Table);
-                break;
-            case 7:
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = SCF_Index[2][Band].L + Huffman_Decode(Table);
-                break;
-            }
-        }
-
-        if ( Res[Band].R  ||  (Res[Band].L  &&  IS_used  &&  Band >= Min_Band) ) {
-            switch ( SCFI[Band].R ) {
-            case 0:
-                SCF_Index[0][Band].R = (Int) Bitstream_read(6);
-                SCF_Index[1][Band].R = (Int) Bitstream_read(6);
-                SCF_Index[2][Band].R = (Int) Bitstream_read(6);
-                break;
-            case 2:
-                SCF_Index[0][Band].R = (Int) Bitstream_read(6);
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = (Int) Bitstream_read(6);
-                break;
-            case 4:
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R = (Int) Bitstream_read(6);
-                SCF_Index[2][Band].R = (Int) Bitstream_read(6);
-                break;
-            case 6:
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = (Int) Bitstream_read(6);
-                break;
-            case 1:
-                SCF_Index[0][Band].R = SCF_Index[2][Band].R + Huffman_Decode(Table);
-                SCF_Index[1][Band].R = SCF_Index[0][Band].R + Huffman_Decode(Table);
-                SCF_Index[2][Band].R = SCF_Index[1][Band].R + Huffman_Decode(Table);
-                break;
-            default:
-                assert (0);
-            case 3:
-                SCF_Index[0][Band].R = SCF_Index[2][Band].R + Huffman_Decode(Table);
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = SCF_Index[0][Band].R + Huffman_Decode(Table);
-                break;
-            case 5:
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R = SCF_Index[2][Band].R + Huffman_Decode(Table);
-                SCF_Index[2][Band].R = SCF_Index[1][Band].R + Huffman_Decode(Table);
-                break;
-            case 7:
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = SCF_Index[2][Band].R + Huffman_Decode(Table);
-                break;
-            }
-        }
-    }
-
-    /********* Read the quantized Samples per Subband (without Offsets, i.e. values lie zero-symmetric) */
-
-    BITPOS(3);
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-        xL = Entropie [Res[Band].L];
-        xR = Entropie [Res[Band].R];
-
-        if ( xL != NULL  ||  xR != NULL )
-            for (k=0; k<36; k++) {
-                if ( xL != NULL )
-                    Q[Band].L[k] = Huffman_Decode (xL);
-                if ( xR != NULL )
-                    Q[Band].R[k] = Huffman_Decode (xR);
-            }
-
-        if ( Res[Band].L >= 8  ||  Res[Band].R >= 8 )
-            for (k=0; k<36; k++) {
-                if ( Res[Band].L >= 8 )
-                    Q[Band].L[k] = (Int) Bitstream_read (RES_BIT(Res[Band].L)) - Dc[Res[Band].L];
-                if ( Res[Band].R >= 8 )
-                    Q[Band].R[k] = (Int) Bitstream_read (RES_BIT(Res[Band].R)) - Dc[Res[Band].R];
-            }
-    }
-
-    BITPOS(4);
-#if  DUMPSELECT > 0
-    Dump ( Max_Used_Band, MS_Band, Res, SCF_Index, Q, 6, __x );
-#endif
-
-    LEAVE(6);
-    return;
-}
-
-
-static Schar  tab30 [3*3*3] = { -1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1,-1, 0,+1 };
-static Schar  tab31 [3*3*3] = { -1,-1,-1, 0, 0, 0,+1,+1,+1,-1,-1,-1, 0, 0, 0,+1,+1,+1,-1,-1,-1, 0, 0, 0,+1,+1,+1 };
-static Schar  tab32 [3*3*3] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0,+1,+1,+1,+1,+1,+1,+1,+1,+1 };
-static Schar  tab50 [5*5  ] = { -2,-1, 0,+1,+2,-2,-1, 0,+1,+2,-2,-1, 0,+1,+2,-2,-1, 0,+1,+2,-2,-1, 0,+1,+2 };
-static Schar  tab51 [5*5  ] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0,+1,+1,+1,+1,+1,+2,+2,+2,+2,+2 };
-#ifdef USE_SV8
-static Schar  tab70 [7*7  ] = { -3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3,-3,-2,-1, 0,+1,+2,+3 };
-static Schar  tab71 [7*7  ] = { -3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0,+1,+1,+1,+1,+1,+1,+1,+2,+2,+2,+2,+2,+2,+2,+3,+3,+3,+3,+3,+3,+3 };
-#endif
-// 229 Bytes
-
-#if 0
-static void
-CalculateTNS ( Float* TNS, const CPair_t *Res, const Quant_t* Q, int Band )     // For a non-shaped output the vector should be all 65536 / 5 = 13170.2
-{
-    int    i;
-    int    j;
-    Float  Sum;
-
-    for ( i = 0; i < 36; i++ )
-        TNS [i] = 3.;
-
-    for ( j = (Band+1)/2; j-- > 0; ) {
-        do {
-            Q--;
-            if (Band-- == 0) goto cont;
-        } while ( (--Res) -> L <= 0 );
-        for ( i = 0; i < 36; i++ )
-            TNS [i] += Q->L [i] * Q->L [i];
-    }
-cont:
-
-    for ( j = 0; j < 3; j++ ) {
-        Sum = 0;
-        for ( i = 0; i < 12; i++ )
-            Sum += TNS [12*j + i];
-        Sum = sqrt (12. / Sum) * 13170.2;
-        for ( i = 0; i < 12; i++ )
-            TNS [12*j + i] = sqrt (TNS [12*j + i]) * Sum;
-    }
-}
-#endif
-
-/******************************************************************************************/
-/****************************************** SV 7 ******************************************/
-/******************************************************************************************/
-
-void
-Read_Bitstream_SV7 ( void )
-{
-//  Float               TNS [2] [36];
-    Int                 Band;
-    Uint                k;
-    Int*                p;
-    const Huffman_t*    Table;
-    Int                 diff;
-    Uint                idx;
-    Uint32_t            tmp;
-    Int                 Max_Used_Band = -1;
-
-    ENTER(7);
-
-    /********* Read resolution and LR/MS for Subband 0 *******************************************************/
-
-    BITPOS(0);
-    Res[0].L = (Int) Bitstream_read(4);
-    Res[0].R = 0;
-    if ( !IS_used  ||  Min_Band > 0 ) {
-        Res[0].R = (Int) Bitstream_read(4);
-        MS_Band[0] = 0;
-        if ( MS_used  &&  (Res[0].L  ||  Res[0].R) )
-            MS_Band[0] = Bitstream_read1 ();
-    }
-    if ( Res[0].L  ||  Res[0].R )
-        Max_Used_Band = 0;
-
-    /********* Read resolution and LR/MS for following subbands and determine last Subband *****************/
-
-    Table = HuffHdr;
-    for ( Band = 1; Band <= Max_Band; Band++ ) {
-
-        diff = Huffman_Decode (Table);
-        Res[Band].L = diff != 4  ?  Res[Band-1].L + diff  :  (Int) Bitstream_read(4);
-        Res[Band].R = 0;
-
-        // Don't read for IS for bands from MinBand+1 on
-        if ( !IS_used  ||  Min_Band > Band ) {
-            diff = Huffman_Decode (Table);
-            Res[Band].R = diff != 4  ?  Res[Band-1].R + diff  :  (Int) Bitstream_read(4);
-            MS_Band[Band] = 0;
-            if ( MS_used  &&  (Res[Band].L  ||  Res[Band].R) )
-                switch ( Res[Band].R ) {
-                case -3: MS_Band[Band] = Bitstream_read (2) << 2;
-                         break;
-                case -2: MS_Band[Band] = Bitstream_read (4) << 0;
-                         break;
-                default: MS_Band[Band] = Bitstream_read1 ();
-                         break;
-                }
-        }
-        // Define last used Subband (following operations are just executed up until this one)
-        if ( Res[Band].L  ||  Res[Band].R )
-            Max_Used_Band = Band;
-    }
-
-    /********* Read used Scalebandfactor-Splitting of the last 36 Samples per Subband ************************/
-
-    BITPOS(1);
-    Table = HuffSCFI;
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-        if ( Res[Band].L > 0  ||  Res[Band].L == -1 )
-            SCFI[Band].L = Huffman_Decode (Table);
-        if ( (Res[Band].R > 0  ||  Res[Band].R == -1)  ||  (Res[Band].L  &&  IS_used  &&  Band >= Min_Band) )
-            SCFI[Band].R = Huffman_Decode (Table);
-    }
-
-    /********* Read Scalefaktors for all Subbands three times for 12 Samples each **************************/
-
-    BITPOS(2);
-    Table = HuffDSCF;
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-
-        if ( Res[Band].L > 0  ||  Res[Band].L == -1 ) {
-
-            switch ( SCFI[Band].L ) {
-            case 0:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].L = diff!=8  ?  SCF_Index[2][Band].L + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[1][Band].L = diff!=8  ?  SCF_Index[0][Band].L + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[2][Band].L = diff!=8  ?  SCF_Index[1][Band].L + diff  :  (Int) Bitstream_read(6);
-                break;
-            case 1:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].L = diff!=8  ?  SCF_Index[2][Band].L + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = diff!=8  ?  SCF_Index[0][Band].L + diff  :  (Int) Bitstream_read(6);
-                break;
-            case 2:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L = diff!=8  ?  SCF_Index[2][Band].L + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[2][Band].L = diff!=8  ?  SCF_Index[1][Band].L + diff  :  (Int) Bitstream_read(6);
-                break;
-            default:
-                assert (0);
-            case 3:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].L =
-                SCF_Index[1][Band].L =
-                SCF_Index[2][Band].L = diff!=8  ?  SCF_Index[2][Band].L + diff  :  (Int) Bitstream_read(6);
-                break;
-            }
-        }
-
-        if ( ( Res[Band].R > 0  ||  Res[Band].R == -1 )  ||  ( Res[Band].L  &&  IS_used  &&  Band >= Min_Band ) ) {
-
-            switch ( SCFI[Band].R ) {
-            case 0:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].R = diff!=8  ?  SCF_Index[2][Band].R + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[1][Band].R = diff!=8  ?  SCF_Index[0][Band].R + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[2][Band].R = diff!=8  ?  SCF_Index[1][Band].R + diff  :  (Int) Bitstream_read(6);
-                break;
-            case 1:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].R = diff!=8  ?  SCF_Index[2][Band].R + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = diff!=8  ?  SCF_Index[0][Band].R + diff  :  (Int) Bitstream_read(6);
-                break;
-            case 2:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R = diff!=8  ?  SCF_Index[2][Band].R + diff  :  (Int) Bitstream_read(6);
-                diff = Decode_DSCF ();
-                SCF_Index[2][Band].R = diff!=8  ?  SCF_Index[1][Band].R + diff  :  (Int) Bitstream_read(6);
-                break;
-            default:
-                assert (0);
-            case 3:
-                diff = Decode_DSCF ();
-                SCF_Index[0][Band].R =
-                SCF_Index[1][Band].R =
-                SCF_Index[2][Band].R = diff!=8  ?  SCF_Index[2][Band].R + diff  :  (Int) Bitstream_read(6);
-                break;
-            }
-        }
-    }
-
-    /********* Read the quantized Samples per Subband (without Offsets, i.e. values lie zero-symmetric) */
-
-    BITPOS(3);
-    for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-
-        p = Q[Band].L;
-        switch ( Res[Band].L ) {
-        case  -2: case  -3:
-            for (k=0; k<36; k++)
-                *p++ = 0;
-            break;
-        case -1:
-#if 0
-            if ( Res[Band-1].L != -1 )
-                CalculateTNS ( TNS[0], (CPair_t *)&Res[Band].L, (Quant_t*)p, Band );
-            tmp = random_int ();
-            for (k=0; k<36/2; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2)) * TNS [0][k];
-            tmp = random_int ();
-            for (k=36/2; k<36; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2)) * TNS [0][k];
-#elif 0
-            tmp = random_int ();
-            for (k=0; k<36/2; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2));
-            tmp = random_int ();
-            for (k=36/2; k<36; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2));
-#else
-            for (k=0; k<36; k++ ) {
-                tmp  = random_int ();
-                *p++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >>  8) & 0xFF) + ((tmp >>  0) & 0xFF) - 510;
-            }
-#endif
-            break;
-        case 0:
-            // Subband samples are not used in this case, see Requant Routines
-            break;
-        case 1:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36/3; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ1[1], LUT1_1,  9 );
-                    *p++ = tab30[idx];
-                    *p++ = tab31[idx];
-                    *p++ = tab32[idx];
-                }
-            else
-                for (k=0; k<36/3; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ1[0], LUT1_0,  6 );
-                    *p++ = tab30[idx];
-                    *p++ = tab31[idx];
-                    *p++ = tab32[idx];
-                }
-            break;
-        case 2:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36/2; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ2[1], LUT2_1, 10 );
-                    *p++ = tab50[idx];
-                    *p++ = tab51[idx];
-                }
-            else
-                for (k=0; k<36/2; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ2[0], LUT2_0,  7 );
-                    *p++ = tab50[idx];
-                    *p++ = tab51[idx];
-                }
-            break;
-        case 3:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ3[1], LUT3_1,  5 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ3[0], LUT3_0,  4 );
-            break;
-        case 4:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ4[1], LUT4_1,  5 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ4[0], LUT4_0,  4 );
-            break;
-        case 5:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ5[1], LUT5_1,  8 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ5[0], LUT5_0,  6 );
-            break;
-        case 6:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTER  ( HuffQ6[1], LUT6_1,  7 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ6[0], LUT6_0,  7 );
-            break;
-        case 7:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTER  ( HuffQ7[1], LUT7_1,  8 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ7[0], LUT7_0,  8 );
-            break;
-#if 0
-            Table = HuffQ [Bitstream_read1 ()] [Res[Band].R];
-            for (k=0; k<36; k++)
-                *p++ = Huffman_Decode (Table);
-            break;
-#endif
-        case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
-            tmp = Dc[Res[Band].L];
-            for (k=0; k<36; k++)
-                *p++ = (Int) Bitstream_read (RES_BIT(Res[Band].L)) - tmp;
-            break;
-        default:
-            return;
-        }
-
-        p = Q[Band].R;
-        switch ( Res[Band].R ) {
-        case  -2: case  -3:
-            for (k=0; k<36; k++)
-                *p++ = 0;
-            break;
-        case -1:
-#if 0
-            if ( Res[Band-1].R != -1 )
-                CalculateTNS ( TNS[1], (CPair_t *)&Res[Band].R, (Quant_t*)p, Band );
-            tmp = random_int ();
-            for (k=0; k<36/2; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2)) * TNS [1][k];
-            tmp = random_int ();
-            for (k=36/2; k<36; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2)) * TNS [1][k];
-#elif 0
-            tmp = random_int ();
-            for (k=0; k<36/2; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2));
-            tmp = random_int ();
-            for (k=36/2; k<36; k++, tmp >>= 1)
-                *p++ = (int)(1 - (tmp & 2));
-#else
-            for (k=0; k<36; k++ ) {
-                tmp  = random_int ();
-                *p++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >>  8) & 0xFF) + ((tmp >>  0) & 0xFF) - 510;
-            }
-#endif
-            break;
-        case 0:
-            // Subband samples are not used in this case, see Requant Routines
-            break;
-        case 1:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36/3; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ1[1], LUT1_1,  9 );
-                    *p++ = tab30[idx];
-                    *p++ = tab31[idx];
-                    *p++ = tab32[idx];
-                }
-            else
-                for (k=0; k<36/3; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ1[0], LUT1_0,  6 );
-                    *p++ = tab30[idx];
-                    *p++ = tab31[idx];
-                    *p++ = tab32[idx];
-                }
-            break;
-        case 2:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36/2; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ2[1], LUT2_1, 10 );
-                    *p++ = tab50[idx];
-                    *p++ = tab51[idx];
-                }
-            else
-                for (k=0; k<36/2; k++) {
-                    idx  = HUFFMAN_DECODE_FASTEST ( HuffQ2[0], LUT2_0,  7 );
-                    *p++ = tab50[idx];
-                    *p++ = tab51[idx];
-                }
-            break;
-        case 3:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ3[1], LUT3_1,  5 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ3[0], LUT3_0,  4 );
-            break;
-        case 4:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ4[1], LUT4_1,  5 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ4[0], LUT4_0,  4 );
-            break;
-        case 5:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ5[1], LUT5_1,  8 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ5[0], LUT5_0,  6 );
-            break;
-        case 6:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTER  ( HuffQ6[1], LUT6_1,  7 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ6[0], LUT6_0,  7 );
-            break;
-        case 7:
-            if ( Bitstream_read1 () )
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTER  ( HuffQ7[1], LUT7_1,  8 );
-            else
-                for (k=0; k<36; k++)
-                    *p++ = HUFFMAN_DECODE_FASTEST ( HuffQ7[0], LUT7_0,  8 );
-            break;
-#if 0
-            Table = HuffQ [Bitstream_read1 ()] [Res[Band].R];
-            for (k=0; k<36; k++)
-                *p++ = Huffman_Decode (Table);
-            break;
-#endif
-        case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
-            tmp = Dc[Res[Band].R];
-            for (k=0; k<36; k++)
-                *p++ = (Int) Bitstream_read (RES_BIT(Res[Band].R)) - tmp;
-            break;
-        default:
-            return;
-        }
-    }
-
-    BITPOS(4);
-
-#if  DUMPSELECT > 0
-    Dump ( Max_Used_Band, MS_Band, Res, SCF_Index, Q, 7, __x );
-#endif
-
-    LEAVE(7);
-    return;
-}
-
-
-/******************************************************************************************/
-/****************************************** SV 8 ******************************************/
-/******************************************************************************************/
-
-#ifdef USE_SV8
-void
-Read_Bitstream_SV8 ( void )
-{
-    Int                Band;
-    Int                k;
-    Int                Channel;
-    Int                idx;
-    Int                Max_Channel;
-    Int                Max_Used_Band;
-    CPair_t*           Res_p;
-    CPairArray*        SCF_p;
-    Int*               p;
-    const Huffman_t*   Table;
-
-    ENTER(8);
-
-    memset ( Res    , 0, sizeof(Res)     );
-    memset ( MS_Band, 0, sizeof(MS_Band) );
-    memset ( Q      , 0, sizeof(Q)       );
-
-    /********************************* Header *****************************/
-    Max_Used_Band = (Int) Bitstream_read(6) - 1; // maximum non-zero band
-    if ( (Int)Max_Used_Band < 0 )
-        return;
-
-    Max_Channel   = (Int) Bitstream_read (3);    // number of channels
-    MS_used       = Bitstream_read1 ();          // M/S-coding
-
-    /******************************* Res ******************************/
-    for ( Channel = 0; Channel < Max_Channel; Channel++ ) {
-        Res_p = Channel  ?  (CPair_t*)&(Res[0].R)  :  (CPair_t*)&(Res[0].L);
-
-        for ( Band = 0; Band <= Max_Used_Band; Band++ )
-            Res_p[Band].L = (Int) Bitstream_read (4);
-    }
-
-    /******************************* MS *******************************/
-    if ( MS_used ) {
-        for ( Channel = 0; Channel < Max_Channel-1; Channel++) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                MS_Band[Band] = Bitstream_read1 ();
-        }
-    }
-
-    /**************************** SCF/DSCF ****************************/
-    for ( Channel = 0; Channel < Max_Channel; Channel++ ) {
-        if ( Channel == 0 ) {
-            SCF_p = (CPairArray*) &(SCF_Index [0][0].L);
-            Res_p = (CPair_t*) &(Res [0].L);
-        } else {
-            SCF_p = (CPairArray*) &(SCF_Index [0][0].R);
-            Res_p = (CPair_t*) &(Res [0].R);
-        }
-
-        for ( Band = 0; Band <= Max_Used_Band; Band++ ) {
-            if ( Res_p[Band].L ) {
-                SCF_p[0][Band].L = (Int) Bitstream_read (7);
-                SCF_p[1][Band].L = (Int) Bitstream_read (7);
-                SCF_p[2][Band].L = (Int) Bitstream_read (7);
-            }
-        }
-    }
-
-    /***************************** Samples ****************************/
-    for ( Channel = 0; Channel < Max_Channel; Channel++ ) {
-        if ( Channel == 0 ) {
-            p     = Q[0].L;
-            Res_p = (CPair_t*)&(Res[0].L);
-        } else {
-            p     = Q[0].R;
-            Res_p = (CPair_t*)&(Res[0].R);
-        }
-
-        for ( Band = 0; Band <= Max_Used_Band; Band++, p+=36 ) {
-            REP (printf ("Channel %u, Band %2u (%2u)\n", Channel, Band, Res_p[Band].L ));
-            switch ( Res_p[Band].L ) {
-            case 0:
-                p += 36;
-                break;
-            case 1:
-                Table = HuffN [(Int) Bitstream_read(1)] [1];
-                for (k=0; k<36/3; k++) {
-                    idx = Huffman_Decode (Table);
-                    *p++ = tab30[idx];
-                    *p++ = tab31[idx];
-                    *p++ = tab32[idx];
-                }
-                break;
-            case 2:
-                Table = HuffN [(Int) Bitstream_read(1)] [2];
-                for (k=0; k<36/2; k++) {
-                    idx = Huffman_Decode (Table);
-                    *p++ = tab50[idx];
-                    *p++ = tab51[idx];
-                }
-                break;
-            case 3:
-                Table = HuffN [(Int) Bitstream_read(1)] [3];
-                for (k=0; k<36/2; k++) {
-                    idx = Huffman_Decode (Table);
-                    *p++ = tab70[idx];
-                    *p++ = tab71[idx];
-                }
-                break;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 8:
-                Table = HuffN [(Int) Bitstream_read(1)][Res_p[Band].L];
-                for (k=0; k<36; k++)
-                    *p++ = Huffman_Decode (Table);
-                break;
-            default:
-                for (k=0; k<36; k++)
-                    *p++ = (Int) Bitstream_read (RES_BIT(Res_p[Band].L)) - Dc[Res_p[Band].L];
-                break;
-            }
-        }
-    }
-
-# if  DUMPSELECT > 0
-    Dump ( Max_Used_Band, MS_Band, Res, SCF_Index, Q, 8, __x );
-#endif
-
-    LEAVE(8);
-    return;
-}
-#endif
-
-/* end of decode.c */
Index: penc/trunk/dump.c
===================================================================
--- /mppenc/trunk/dump.c	(revision 96)
+++ 	(revision )
@@ -1,203 +1,0 @@
-
-#if  DUMPSELECT > 0
-
-static Int
-digits ( Int no )
-{
-    if (no >= 0) {
-        if ( no <=     9 ) return 1;
-        if ( no <=    99 ) return 2;
-        if ( no <=   999 ) return 3;
-        if ( no <=  9999 ) return 4;
-        return 5;
-    } else {
-        if ( no >=    -9 ) return 2;
-        if ( no >=   -99 ) return 3;
-        if ( no >=  -999 ) return 4;
-        if ( no >= -9999 ) return 5;
-        return 6;
-    }
-}
-
-
-static void
-Dump ( Int                Max_Used_Band,
-       const Bool_t*      MS_Band,
-       const CPair_t*     Res,
-       const CPairArray*  SCF_Index,
-       const Quant_t*     Q,
-       Int                SV,
-       const Ulong*       bitpostab )
-{
-    static Ulong     Frame= 0;
-    static FILE*     fp0  = NULL;
-    static FILE*     fp1  = NULL;
-    static FILE*     fp2  = NULL;
-    static FILE*     fp3  = NULL;
-    static FILE*     fp4  = NULL;
-    static FILE*     fp5  = NULL;
-    static FILE*     fp6  = NULL;
-    static FILE*     fp7  = NULL;
-    static Int       Init = 0;
-    static Uint32_t  Bits = (Uint32_t)-1;
-    Int              Band;
-    Int              i;
-    Int              k;
-    Int              d;
-
-    if ( Init == 0 ) {
-        fp0  = fopen ( LOGPATH "report-maxband.txt", "a" );
-        fp1  = fopen ( LOGPATH "report-msbits.txt" , "a" );
-        fp2  = fopen ( LOGPATH "report-resol.txt"  , "a" );
-        fp3  = fopen ( LOGPATH "report-scf.txt"    , "a" );
-        fp4  = fopen ( LOGPATH "report-quant.txt"  , "a" );
-        fp5  = fopen ( LOGPATH "report-rate.txt"   , "a" );
-        fp6  = fopen ( LOGPATH "report-usage.txt"  , "a" );
-        fp7  = fopen ( LOGPATH "report-requant.txt", "a" );
-        Init = 1;
-    }
-
-    // Stop if 400 MByte has been dumped for each log file
-    if ( fp0 != NULL  &&  ftell (fp0) > 409600000 ) fp0 = NULL;
-    if ( fp1 != NULL  &&  ftell (fp1) > 409600000 ) fp1 = NULL;
-    if ( fp2 != NULL  &&  ftell (fp2) > 409600000 ) fp2 = NULL;
-    if ( fp3 != NULL  &&  ftell (fp3) > 409600000 ) fp3 = NULL;
-    if ( fp4 != NULL  &&  ftell (fp4) > 409600000 ) fp4 = NULL;
-    if ( fp5 != NULL  &&  ftell (fp5) > 409600000 ) fp5 = NULL;
-    if ( fp6 != NULL  &&  ftell (fp6) > 409600000 ) fp6 = NULL;
-
-    // last used band
-    if ((DUMPSELECT & 1)  &&  fp0 != NULL) {
-        fprintf ( fp0, "%4lu\t%2d\n", Frame, Max_Used_Band );
-    }
-
-    // last used band + MS bits for every band
-    if ((DUMPSELECT & 2)  &&  fp1 != NULL) {
-        fprintf ( fp1, "%4lu\t%2d\t", Frame, Max_Used_Band );
-        for ( Band = 0; Band <= Max_Used_Band; Band++ )
-            if ( Res[Band].L  ||  Res[Band].R )
-                fprintf ( fp1, MS_Band[Band] ? "#" : "." );
-            else
-                fprintf ( fp1, " " );
-        fprintf ( fp1, "\n" );
-    }
-
-    // Resolution for every band and channel AND also MS bits
-    if ((DUMPSELECT & 4)  &&  fp2 != NULL) {
-        fprintf ( fp2, "--- %4lu ---\n", Frame );
-        for ( Band = 0; Band <= Max_Used_Band; Band++ )
-            if ( Res[Band].L )
-                fprintf ( fp2, " %2d", Res[Band].L );
-            else
-                fprintf ( fp2, "   " );
-        fprintf ( fp2, "\n" );
-        for ( Band = 0; Band <= Max_Used_Band; Band++ )
-            if ( Res[Band].R )
-                fprintf ( fp2, " %2d", Res[Band].R );
-            else
-                fprintf ( fp2, "   " );
-        fprintf ( fp2, "\n" );
-        for ( Band = 0; Band <= Max_Used_Band; Band++ )
-            if ( Res[Band].L  ||  Res[Band].R )
-                fprintf ( fp2, "  %c", MS_Band[Band] ? '#' : '.' );
-            else
-                fprintf ( fp2, "   " );
-        fprintf ( fp2, "\n\n" );
-    }
-
-    // SCF for every channel, subframe and subband
-    if ((DUMPSELECT & 8)  &&  fp3 != NULL) {
-        fprintf ( fp3, "--- %4lu ---\n", Frame );
-        for ( i = 0; i < 3; i++ ) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                if ( Res[Band].L )
-                    fprintf ( fp3, " %2d", SV > 7  ?  SCF_Index[i][Band].L  :  63 - SCF_Index[i][Band].L );
-                else
-                    fprintf ( fp3, "   " );
-            fprintf ( fp3, "\n" );
-        }
-        for ( i = 0; i < 3; i++ ) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                if ( Res[Band].R )
-                    fprintf ( fp3, " %2d", SV > 7  ?  SCF_Index[i][Band].R  :  63 - SCF_Index[i][Band].R );
-                else
-                    fprintf ( fp3, "   " );
-            fprintf ( fp3, "\n" );
-        }
-        fprintf ( fp3, "\n" );
-    }
-
-    // quantized subband samples
-    if ((DUMPSELECT & 16)  &&  fp4 != NULL) {
-        int  max = 0;
-
-        fprintf ( fp4, "--- %4lu ---\n", Frame );
-        for (k=0; k<36; k++) {
-            d = digits (Q[0].L[k]); if ( d > max ) max = d;
-            d = digits (Q[0].R[k]); if ( d > max ) max = d;
-            for ( Band = 1; Band <= Max_Used_Band; Band++ ) {
-                d = 1+digits (Q[Band].L[k]); if ( d > max ) max = d;
-                d = 1+digits (Q[Band].R[k]); if ( d > max ) max = d;
-            }
-        }
-        for (k=0; k<36; k++) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                if ( Res[Band].L )
-                    fprintf ( fp4, "%*d", max, Q[Band].L[k] );
-                else
-                    fprintf ( fp4, "%*s", max, "" );
-            fprintf ( fp4, "\n");
-        }
-        fprintf ( fp4, "\n");
-        for ( k=0; k<36; k++) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                if ( Res[Band].R )
-                    fprintf ( fp4, "%*d", max, Q[Band].R[k] );
-                else
-                    fprintf ( fp4, "%*s", max, "" );
-            fprintf ( fp4, "\n");
-        }
-        fprintf ( fp4, "\n\n");
-    }
-
-    // block size and bitrate
-    if ((DUMPSELECT & 32)  &&  fp5 != NULL) {
-        if ( Bits > BitsRead () ) Bits = 200;
-        k    = BitsRead () - Bits;
-        Bits = BitsRead ();
-        fprintf ( fp5, "%4lu\t%5u bit\t%5.1f kbps\n", Frame, k, k * (44.1/1152) );
-    }
-
-    // used bits of the individual sections
-    if ((DUMPSELECT & 64)  &&  fp6 != NULL) {
-        fprintf ( fp6, "%4lu %4lu%5lu%5lu%6lu\n", Frame,
-                  bitpostab[1] - bitpostab[0], bitpostab[2] - bitpostab[1],
-                  bitpostab[3] - bitpostab[2], bitpostab[4] - bitpostab[3] );
-    }
-
-    // requantized subband samples
-    if ((DUMPSELECT & 128)  &&  fp7 != NULL) {
-        int  max = 0;
-
-        fprintf ( fp7, "--- %4lu ---\n", Frame );
-        for (k=0; k<36; k++) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                fprintf ( fp7, "%9.1f", Q[Band].L[k] * SCF[SCF_Index[k/12][Band].L] * Cc[Res[Band].L] );
-            fprintf ( fp7, "\n");
-        }
-        fprintf ( fp7, "\n");
-        for ( k=0; k<36; k++) {
-            for ( Band = 0; Band <= Max_Used_Band; Band++ )
-                fprintf ( fp7, "%9.1f", Q[Band].R[k] * SCF[SCF_Index[k/12][Band].R] * Cc[Res[Band].R] );
-            fprintf ( fp7, "\n");
-        }
-        fprintf ( fp7, "\n\n");
-    }
-
-    Frame++;
-    return;
-}
-
-#endif
-
-/* end of dump.c */
Index: penc/trunk/encode_sv7.c
===================================================================
--- /mppenc/trunk/encode_sv7.c	(revision 96)
+++ 	(revision )
@@ -1,455 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-/*
- *  SV1:   DATE 13.12.1998
- *  SV2:   DATE 12.06.1999
- *  SV3:   DATE 19.10.1999
- *  SV4:   DATE 20.10.1999
- *  SV5:   DATE 18.06.2000
- *  SV6:   DATE 10.08.2000
- *  SV7:   DATE 23.08.2000
- *  SV7.f: DATE 20.07.2002
- */
-
-unsigned char         MS_Flag     [32];         // Flag to save if Subband was MS- or LR-coded
-int                   SCF_Last_L  [32];
-int                   SCF_Last_R  [32];         // Last coded SCF value
-static unsigned char  DSCF_RLL_L  [32];
-static unsigned char  DSCF_RLL_R  [32];         // Duration of the differential SCF-coding for RLL (run length limitation)
-int                   Res_L       [32];
-int                   Res_R       [32];         // Quantization precision of the subbands
-int                   SCF_Index_L [32] [3];
-int                   SCF_Index_R [32] [3];     // Scalefactor index for quantized subband values
-
-
-// initialize SV7
-void
-Init_SV7 ( void )
-{
-    Init_Huffman_Encoder_SV7 ();
-}
-
-
-// writes SV7-header
-void
-WriteHeader_SV7 ( const unsigned int  MaxBand,
-                  const unsigned int  Profile,
-                  const unsigned int  MS_on,
-                  const Uint32_t      TotalFrames,
-                  const unsigned int  SamplesRest,
-                  const unsigned int  StreamVersion,
-                  const unsigned int  SampleFreq )
-{
-    WriteBits ( StreamVersion,  8 );    // StreamVersion
-    WriteBits ( 0x2B504D     , 24 );    // Magic Number "MP+"
-
-    WriteBits ( TotalFrames  , 32 );    // # of frames
-
-    WriteBits ( 0            ,  1 );    // former IS-Flag (not supported anymore)
-    WriteBits ( MS_on        ,  1 );    // MS-Coding Flag
-    WriteBits ( MaxBand      ,  6 );    // Bandwidth
-
-#if 0
-    if ( MPPENC_VERSION [3] & 1 )
-        WriteBits ( 1        ,  4 );    // 1: Experimental profile
-    else
-#endif
-
-        WriteBits ( Profile  ,  4 );    // 5...15: below Telephone...above BrainDead
-    WriteBits ( 0            ,  2 );    // for future use
-    switch ( SampleFreq ) {
-        case 44100: WriteBits ( 0, 2 ); break;
-        case 48000: WriteBits ( 1, 2 ); break;
-        case 37800: WriteBits ( 2, 2 ); break;
-        case 32000: WriteBits ( 3, 2 ); break;
-        default   : stderr_printf ( "Internal error\n");
-                    exit (1);
-    }
-    WriteBits ( 0            , 16 );    // maximum input sample value, currently filled by replaygain
-
-    WriteBits ( 0            , 32 );    // title based gain controls, currently filled by replaygain
-
-    WriteBits ( 0            , 32 );    // album based gain controls, currently filled by replaygain
-
-    WriteBits ( 1            ,  1 );    // true gapless: used?
-    WriteBits ( SamplesRest  , 11 );    // true gapless: valid samples in last frame
-    WriteBits ( 1            , 1 );		// we now support fast seeking
-    WriteBits ( 0            , 19 );
-
-    WriteBits ( (MPPENC_VERSION[0]&15)*100 + (MPPENC_VERSION[2]&15)*10 + (MPPENC_VERSION[3]&15),
-                                8 );    // for future use
-}
-
-
-void
-FinishBitstream ( void )
-{
-    Buffer [Zaehler++] = dword;         // Assigning the "last" word
-}
-
-
-#define ENCODE_SCF1( new, old, rll )                         \
-        d = new - old + 7;                                   \
-        if ( d <= 14u  && rll < 32) {                        \
-            WriteBits ( Table[d].Code, Table[d].Length );    \
-        }                                                    \
-        else {                                               \
-            if ( new < 0 ) new = 0, Overflows++;             \
-            WriteBits ( Table[15].Code, Table[15].Length );  \
-            WriteBits ( (unsigned int)new, 6 );              \
-            rll = 0;                                         \
-        }
-
-#define ENCODE_SCFn( new, old, rll )                         \
-        d = new - old + 7;                                   \
-        if ( d <= 14u ) {                                    \
-            WriteBits ( Table[d].Code, Table[d].Length );    \
-        }                                                    \
-        else {                                               \
-            if ( new < 0 ) new = 0, Overflows++;             \
-            WriteBits ( Table[15].Code, Table[15].Length );  \
-            WriteBits ( (unsigned int)new, 6 );              \
-            rll = 0;                                         \
-        }
-
-
-static void
-test ( const unsigned int* const Res, const int* q )
-{
-#if 0
-    int  i;
-
-    switch ( *Res ) {
-    case 1:
-        for ( i = 0; i < 36; i ++ )
-            if ( q[i] != 1 )
-                return;
-        fprintf ( stderr, "Alles Nullsamples, aber Auflösung = %u\n", *Res );
-        *Res = 0;
-        break;
-    case 2:
-        for ( i = 0; i < 36; i ++ )
-            if ( q[i] != 2 )
-                return;
-        fprintf ( stderr, "Alles Nullsamples, aber Auflösung = %u\n", *Res );
-        *Res = 0;
-        break;
-    }
-#endif
-}
-
-
-// formatting and writing SV7-bitstream for one frame
-void
-WriteBitstream_SV7 ( const int               MaxBand,
-                     const SubbandQuantTyp*  Q )
-{
-    int                  n;
-    int                  k;
-    unsigned int         d;
-    unsigned int         idx;
-    unsigned int         book;
-    const Huffman_t*     Table;
-    const Huffman_t*     Table0;
-    const Huffman_t*     Table1;
-    int                  sum;
-    const unsigned int*  q;
-    unsigned char        SCFI_L [32];
-    unsigned char        SCFI_R [32];
-
-    ENTER(110);
-
-    /************************************ Resolution *********************************/
-    WriteBits ( (unsigned int)Res_L[0], 4 );                            // subband 0
-    WriteBits ( (unsigned int)Res_R[0], 4 );
-    if ( MS_Channelmode > 0  &&  !(Res_L[0]==0  &&  Res_R[0]==0) )
-         WriteBits ( MS_Flag[0] , 1 );
-
-    Table = HuffHdr;                                                    // subband 1...MaxBand
-    for ( n = 1; n <= MaxBand; n++ ) {
-        test ( Res_L+n, Q[n].L );
-
-        d = Res_L[n] - Res_L[n-1] + 5;
-        if ( d <= 8u ) {
-            WriteBits ( Table[d].Code, Table[d].Length );
-        }
-        else {
-            WriteBits ( Table[9].Code, Table[9].Length );
-            WriteBits ( Res_L[n]     , 4               );
-        }
-
-        test ( Res_R+n, Q[n].R );
-        d = Res_R[n] - Res_R[n-1] + 5;
-        if ( d <= 8u ) {
-            WriteBits ( Table[d].Code, Table[d].Length );
-        }
-        else {
-            WriteBits ( Table[9].Code, Table[9].Length );
-            WriteBits ( Res_R[n]     , 4               );
-        }
-        if ( MS_Channelmode > 0  &&  !(Res_L[n]==0 && Res_R[n]==0) )
-            WriteBits ( MS_Flag[n], 1 );
-    }
-
-    /************************************ SCF encoding type ***********************************/
-    Table = HuffSCFI;
-    for ( n = 0; n <= MaxBand; n++ ) {
-        if ( Res_L[n] ) {
-            SCFI_L[n] = 2 * (SCF_Index_L[n][0] == SCF_Index_L[n][1]) + (SCF_Index_L[n][1] == SCF_Index_L[n][2]);
-            WriteBits ( Table[SCFI_L[n]].Code, Table[SCFI_L[n]].Length );
-        }
-        if ( Res_R[n] ) {
-            SCFI_R[n] = 2 * (SCF_Index_R[n][0] == SCF_Index_R[n][1]) + (SCF_Index_R[n][1] == SCF_Index_R[n][2]);
-            WriteBits ( Table[SCFI_R[n]].Code, Table[SCFI_R[n]].Length );
-        }
-    }
-
-    /************************************* SCF **********************************/
-    Table = HuffDSCF;
-    for ( n = 0; n <= MaxBand; n++ ) {
-
-        if ( Res_L[n] ) {
-            switch ( SCFI_L[n] ) {
-            default:
-                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L [n]   , DSCF_RLL_L[n] );
-                ENCODE_SCFn ( SCF_Index_L[n][1], SCF_Index_L[n][0], DSCF_RLL_L[n] );
-                ENCODE_SCFn ( SCF_Index_L[n][2], SCF_Index_L[n][1], DSCF_RLL_L[n] );
-                SCF_Last_L[n] = SCF_Index_L[n][2];
-                break;
-            case 1:
-                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L [n]   , DSCF_RLL_L[n] );
-                ENCODE_SCFn ( SCF_Index_L[n][1], SCF_Index_L[n][0], DSCF_RLL_L[n] );
-                SCF_Last_L[n] = SCF_Index_L[n][1];
-                break;
-            case 2:
-                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L[n]    , DSCF_RLL_L[n] );
-                ENCODE_SCFn ( SCF_Index_L[n][2], SCF_Index_L[n][0], DSCF_RLL_L[n] );
-                SCF_Last_L[n] = SCF_Index_L[n][2];
-                break;
-            case 3:
-                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L[n]    , DSCF_RLL_L[n] );
-                SCF_Last_L[n] = SCF_Index_L[n][0];
-                break;
-            }
-        }
-        if (DSCF_RLL_L[n] <= 32)
-            DSCF_RLL_L[n]++;        // Increased counters for SCF that haven't been initialized again
-
-        if ( Res_R[n] ) {
-            switch ( SCFI_R[n] ) {
-            default:
-                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
-                ENCODE_SCFn ( SCF_Index_R[n][1], SCF_Index_R[n][0], DSCF_RLL_R[n] );
-                ENCODE_SCFn ( SCF_Index_R[n][2], SCF_Index_R[n][1], DSCF_RLL_R[n] );
-                SCF_Last_R[n] = SCF_Index_R[n][2];
-                break;
-            case 1:
-                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
-                ENCODE_SCFn ( SCF_Index_R[n][1], SCF_Index_R[n][0], DSCF_RLL_R[n] );
-                SCF_Last_R[n] = SCF_Index_R[n][1];
-                break;
-            case 2:
-                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
-                ENCODE_SCFn ( SCF_Index_R[n][2], SCF_Index_R[n][0], DSCF_RLL_R[n] );
-                SCF_Last_R[n] = SCF_Index_R[n][2];
-                break;
-            case 3:
-                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
-                SCF_Last_R[n] = SCF_Index_R[n][0];
-                break;
-            }
-        }
-        if (DSCF_RLL_R[n] <= 32)
-            DSCF_RLL_R[n]++;          // Increased counters for SCF that haven't been freshly initialized
-    }
-
-    /*********************************** Samples *********************************/
-    for ( n = 0; n <= MaxBand; n++ ) {
-
-        sum = 0;
-        q   = Q[n].L;
-
-        switch ( Res_L[n] ) {
-        case -1:
-        case  0:
-            break;
-        case  1:
-            Table0 = HuffQ [0][1];
-            Table1 = HuffQ [1][1];
-            for ( k = 0; k < 36; k += 3 ) {
-                idx  = q[k+0] + 3*q[k+1] + 9*q[k+2];
-                sum += Table0 [idx].Length;
-                sum -= Table1 [idx].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][1];
-            for ( k = 0; k < 36; k += 3 ) {
-                idx = q[k+0] + 3*q[k+1] + 9*q[k+2];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        case  2:
-            Table0 = HuffQ [0][2];
-            Table1 = HuffQ [1][2];
-            for ( k = 0; k < 36; k += 2 ) {
-                idx  = q[k+0] + 5*q[k+1];
-                sum += Table0 [idx].Length;
-                sum -= Table1 [idx].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][2];
-            for ( k = 0; k < 36; k += 2 ) {
-                idx = q[k+0] + 5*q[k+1];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        case  3:
-        case  4:
-        case  5:
-        case  6:
-        case  7:
-            Table0 = HuffQ [0][Res_L[n]];
-            Table1 = HuffQ [1][Res_L[n]];
-            for ( k = 0; k < 36; k++ ) {
-                sum += Table0 [q[k]].Length;
-                sum -= Table1 [q[k]].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][Res_L[n]];
-            for ( k = 0; k < 36; k++ ) {
-                idx = q[k];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        default:
-            for ( k = 0; k < 36; k++ )
-                WriteBits ( q[k], Res_L[n]-1 );
-            break;
-        }
-
-        sum = 0;
-        q   = Q[n].R;
-
-        switch ( Res_R[n] ) {
-        case -1:
-        case  0:
-            break;
-        case  1:
-            Table0 = HuffQ [0][1];
-            Table1 = HuffQ [1][1];
-            for ( k = 0; k < 36; k += 3 ) {
-                idx  = q[k+0] + 3*q[k+1] + 9*q[k+2];
-                sum += Table0 [idx].Length;
-                sum -= Table1 [idx].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][1];
-            for ( k = 0; k < 36; k += 3 ) {
-                idx = q[k+0] + 3*q[k+1] + 9*q[k+2];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        case  2:
-            Table0 = HuffQ [0][2];
-            Table1 = HuffQ [1][2];
-            for ( k = 0; k < 36; k += 2 ) {
-                idx  = q[k+0] + 5*q[k+1];
-                sum += Table0 [idx].Length;
-                sum -= Table1 [idx].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][2];
-            for ( k = 0; k < 36; k += 2 ) {
-                idx = q[k+0] + 5*q[k+1];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        case  3:
-        case  4:
-        case  5:
-        case  6:
-        case  7:
-            Table0 = HuffQ [0][Res_R[n]];
-            Table1 = HuffQ [1][Res_R[n]];
-            for ( k = 0; k < 36; k++ ) {
-                sum += Table0 [q[k]].Length;
-                sum -= Table1 [q[k]].Length;
-            }
-            book = sum >= 0;
-            WriteBits ( book, 1 );
-            Table = HuffQ [book][Res_R[n]];
-            for ( k = 0; k < 36; k++ ) {
-                idx = q[k];
-                WriteBits ( Table[idx].Code, Table[idx].Length );
-            }
-            break;
-        default:
-            for ( k = 0; k < 36; k++ )
-                WriteBits ( q[k], Res_R[n] - 1 );
-            break;
-        }
-
-    }
-
-    LEAVE(110);
-    return;
-}
-
-#undef ENCODE_SCF1
-#undef ENCODE_SCFn
-
-
-#if 0
-void
-Dump ( const unsigned int* q, const int Res )
-{
-    switch ( Res ) {
-    case  1:
-        for ( k = 0; k < 36; k++, q++ )
-            printf ("%2d%c", *q-1, k==35?'\n':' ');
-        break;
-    case  2:
-        for ( k = 0; k < 36; k++, q++ )
-            printf ("%2d%c", *q-2, k==35?'\n':' ');
-        break;
-    case  3: case  4: case  5: case  6: case  7:
-        if ( Res == 5 )
-            for ( k = 0; k < 36; k++, q++ )
-                printf ("%2d%c", *q-7, k==35?'\n':' ');
-        break;
-    case  8: case  9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
-        printf ("%2u: ", Res-1 );
-        for ( k = 0; k < 36; k++, q++ ) {
-            printf ("%6d", *q - (1 << (Res-2)) );
-        }
-        printf ("\n");
-        break;
-    }
-}
-#endif
-
-/* end of encode_sv7.c */
Index: penc/trunk/fastmath.c
===================================================================
--- /mppenc/trunk/fastmath.c	(revision 96)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-#ifdef FAST_MATH
-
-const float  tabatan2   [ 2*TABSTEP+1] [2];
-const float  tabcos     [26*TABSTEP+1] [2];
-const float  tabsqrt_ex [256];
-const float  tabsqrt_m  [   TABSTEP+1] [2];
-
-
-void   Init_FastMath ( void )
-{
-    int     i;
-    float   X;
-    float   Y;
-    double  xm;
-    double  x0;
-    double  xp;
-    double  x;
-    double  y;
-    float*  p;
-
-    p = (float*) tabatan2;
-    for ( i = -TABSTEP; i <= TABSTEP; i++ ) {
-        xm = atan ((i-0.5)/TABSTEP);
-        x0 = atan ((i+0.0)/TABSTEP);
-        xp = atan ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-
-    p = (float*) tabcos;
-    for ( i = -13*TABSTEP; i <= 13*TABSTEP; i++ ) {
-        xm = cos ((i-0.5)/TABSTEP);
-        x0 = cos ((i+0.0)/TABSTEP);
-        xp = cos ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-
-    p = (float*) tabsqrt_ex;
-    for ( i = 0; i < 255; i++ ) {
-        *(int*)&X = (i << 23);
-        *(int*)&Y = (i << 23) + (1<<23) - 1;
-        *p++ = sqrt(X);
-    }
-    *(int*)&X = (255 << 23) - 1;
-    *p++ = sqrt(X);
-
-    p = (float*) tabsqrt_m;
-    for ( i = 1*TABSTEP; i <= 2*TABSTEP; i++ ) {
-        xm = sqrt ((i-0.5)/TABSTEP);
-        x0 = sqrt ((i+0.0)/TABSTEP);
-        xp = sqrt ((i+0.5)/TABSTEP);
-        x  = x0/2 + (xm + xp)/4;
-        y  = xp - xm;
-        *p++ = x;
-        *p++ = y;
-    }
-}
-
-#endif
Index: penc/trunk/fastmath.h
===================================================================
--- /mppenc/trunk/fastmath.h	(revision 96)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#if 1
-# define ROUND32(x)   ( floattmp = (x) + (int)0x00FD8000L, *(int*)(&floattmp) - (int)0x4B7D8000L )
-#else
-# define ROUND32(x)   ( (int) floor ((x) + 0.5) )
-#endif
-
-#ifdef FAST_MATH
-
-static __inline float
-my_atan2 ( float x, float y )
-{
-    float  t;
-    int    i;
-    float  ret;
-    float  floattmp;
-
-    if ( (*(int*)&x & 0x7FFFFFFF) < (*(int*)&y & 0x7FFFFFFF) ) {
-        i   = ROUND32 (t = TABSTEP * (x / y));
-        ret = tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (t-i);
-        if ( *(int*)&y < 0 )
-           ret = (float)(ret - M_PI);
-    }
-    else if ( *(int*)&x < 0) {
-        i   = ROUND32 (t = TABSTEP * (y / x));
-        ret = - M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
-    }
-    else if ( *(int*)&x > 0) {
-        i   = ROUND32 (t = TABSTEP * (y / x));
-        ret = + M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
-    }
-    else {
-        ret = 0.;
-    }
-    return ret;
-}
-
-
-static __inline float
-my_cos ( float x )
-{
-    float  t;
-    int    i;
-    float  ret;
-    float  floattmp;
-
-    i   = ROUND32 (t = TABSTEP * x);
-    ret = tabcos [13*TABSTEP+i][0] + tabcos [13*TABSTEP+i][1] * (t-i);
-    return ret;
-}
-
-
-static __inline int
-my_ifloor ( float x )
-{
-    x = x + (0x0C00000L + 0.500000001);
-    return *(int*)&x - 1262485505;
-}
-
-
-static __inline float
-my_sqrt ( float x )
-{
-    float  ret;
-    int    i;
-    int    ex = *(int*)&x >> 23;                                // get the exponent
-    float  floattmp;
-
-    *(int*)&x = (*(int*)&x & 0x7FFFFF) | 0x42800000;            // delete the exponent
-    i    = ROUND32 (x);                                         // Integer-part of the mantissa  (round ????????????)
-    ret  = tabsqrt_m [i-TABSTEP][0] + tabsqrt_m [i-TABSTEP][1] * (x-i); // calculate value
-    ret *= tabsqrt_ex [ex];
-    return ret;
-}
-
-#endif
Index: penc/trunk/fft4g.c
===================================================================
--- /mppenc/trunk/fft4g.c	(revision 96)
+++ 	(revision )
@@ -1,670 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-/* F U N C T I O N S */
-static          void  makewt       ( const int nw, int* ip, float* w );
-static          void  makect       ( const int nc, int* ip, float* c );
-static __inline void  bitrv2       ( const int n, int* ip, float* a );                   //
-static __inline void  cftfsub      ( const int n, float* a, float* w );                  //
-static __inline void  rftfsub      ( const int n, float* a, int nc, float* c );          //
-static __inline void  cft1st       ( const int n, float* a, float* w );                  //
-static __inline void  cftmdl_i386  ( const int n, const int l, float* a, float* w );     // 5648
-static __inline void  cftmdl_3DNow ( const int n, const int l, float* a, float* w );     // 4954
-
-#if 0
-# define cftmdl(n,l,a,w)   cftmdl_3DNow ( n, l, a, w )
-#else
-# define cftmdl(n,l,a,w)   cftmdl_i386  ( n, l, a, w )
-#endif
-
-// generates lookup-tables
-void
-Generate_FFT_Tables ( const int n, int* ip, float* w )
-{
-    int  nw;
-    int  nc;
-
-    nw = n >> 2;
-    makewt ( nw, ip, w );
-
-    nc = n >> 2;
-    makect ( nc, ip, w + nw );
-}
-
-
-// patched to only-forward
-void
-rdft ( const int n, float* a, int* ip, float* w )
-{
-    float  xi;
-
-    ENTER(30);
-    if ( n > 4) {
-        bitrv2  ( n, ip + 2, a );
-        cftfsub ( n, a, w );
-        rftfsub ( n, a, ip[1], w + ip[0] );
-    }
-    else if ( n == 4 ) {
-        cftfsub ( n, a, w );
-    }
-    xi    = a[0] - a[1];
-    a[0] += a[1];
-    a[1]  = xi;
-    LEAVE(30);
-    return;
-}
-
-
-/* -------- initializing routines -------- */
-static void
-makewt ( const int nw, int* ip, float* w )
-{
-    int     j;
-    int     nwh;
-    float   x;
-    float   y;
-    double  delta;
-
-    ENTER(31);
-    ip[0] = nw;
-    ip[1] = 1;
-    if ( nw > 2 ) {
-        nwh        = nw >> 1;
-        delta      = (M_PI/4) / nwh;
-        w[0]       = 1.;
-        w[1]       = 0.;
-        w[nwh]     = COS (delta * nwh);
-        w[nwh + 1] = w[nwh];
-        if ( nwh > 2 ) {
-            for ( j = 2; j < nwh; j += 2 ) {
-                x             = COS (delta * j);
-                y             = SIN (delta * j);
-                w[j]          = x;
-                w[j + 1]      = y;
-                w[nw - j]     = y;
-                w[nw - j + 1] = x;
-            }
-            bitrv2 ( nw, ip + 2, w );
-        }
-    }
-    LEAVE(31);
-    return;
-}
-
-
-static void
-makect ( const int nc, int* ip, float* c )
-{
-    int     j;
-    int     nch;
-    double  delta;
-
-    ENTER(32);
-    ip[1] = nc;
-    if ( nc > 1 ) {
-        nch    = nc >> 1;
-        delta  = (M_PI/4) / nch;
-        c[0]   = COS (delta * nch);
-        c[nch] = 0.5f * c[0];
-        for ( j = 1; j < nch; j++ ) {
-            c[j]      = 0.5f * COS (delta * j);
-            c[nc - j] = 0.5f * SIN (delta * j);
-        }
-    }
-    LEAVE(32);
-    return;
-}
-
-
-/* -------- child routines -------- */
-static void
-bitrv2 ( const int n, int* ip, float* a )
-{
-    int    j, j1, k, k1, l, m, m2;
-    float  xr, xi, yr, yi;
-
-    ENTER(33);
-    ip[0] = 0;
-    l     = n;
-    m     = 1;
-    while ( (m << 3) < l ) {
-        l >>= 1;
-        for ( j = 0; j < m; j++ ) {
-            ip[m + j] = ip[j] + l;
-        }
-        m <<= 1;
-    }
-    m2 = 2 * m;
-    if ( (m << 3) == l ) {
-        for ( k = 0; k < m; k++ ) {
-            for ( j = 0; j < k; j++ ) {
-                j1        = 2 * j + ip[k];
-                k1        = 2 * k + ip[j];
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-                j1       += m2;
-                k1       += 2 * m2;
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-                j1       += m2;
-                k1       -= m2;
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-                j1       += m2;
-                k1       += 2 * m2;
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-            }
-            j1        = 2 * k + m2 + ip[k];
-            k1        = j1 + m2;
-            xr        = a[j1];
-            xi        = a[j1 + 1];
-            yr        = a[k1];
-            yi        = a[k1 + 1];
-            a[j1]     = yr;
-            a[j1 + 1] = yi;
-            a[k1]     = xr;
-            a[k1 + 1] = xi;
-        }
-    } else {
-        for ( k = 1; k < m; k++ ) {
-            for ( j = 0; j < k; j++ ) {
-                j1        = 2 * j + ip[k];
-                k1        = 2 * k + ip[j];
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-                j1       += m2;
-                k1       += m2;
-                xr        = a[j1];
-                xi        = a[j1 + 1];
-                yr        = a[k1];
-                yi        = a[k1 + 1];
-                a[j1]     = yr;
-                a[j1 + 1] = yi;
-                a[k1]     = xr;
-                a[k1 + 1] = xi;
-            }
-        }
-    }
-    LEAVE(33);
-    return;
-}
-
-
-static void
-cftfsub ( const int n, float* a, float* w )
-{
-    int    j, j1, j2, j3, l;
-    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
-
-    ENTER(34);
-    l = 2;
-    if ( n > 8 ) {
-        cft1st ( n, a, w );
-        l = 8;
-        while ( (l << 2) < n ) {
-            cftmdl ( n, l, a, w );
-            l <<= 2;
-        }
-    }
-    if ( (l << 2) == n ) {
-        j = 0;
-        do {
-            j1        = j  + l;
-            j2        = j1 + l;
-            j3        = j2 + l;
-            x0r       = a[j]      + a[j1];
-            x0i       = a[j + 1]  + a[j1 + 1];
-            x1r       = a[j]      - a[j1];
-            x1i       = a[j + 1]  - a[j1 + 1];
-            x2r       = a[j2]     + a[j3];
-            x2i       = a[j2 + 1] + a[j3 + 1];
-            x3r       = a[j2]     - a[j3];
-            x3i       = a[j2 + 1] - a[j3 + 1];
-            a[j]      = x0r + x2r;
-            a[j + 1]  = x0i + x2i;
-            a[j2]     = x0r - x2r;
-            a[j2 + 1] = x0i - x2i;
-            a[j1]     = x1r - x3i;
-            a[j1 + 1] = x1i + x3r;
-            a[j3]     = x1r + x3i;
-            a[j3 + 1] = x1i - x3r;
-        } while ( j += 2, j < l );
-    } else {
-        j = 0;
-        do {
-            j1        = j + l;
-            x0r       = a[j]     - a[j1];
-            x0i       = a[j + 1] - a[j1 + 1];
-            a[j]     += a[j1];
-            a[j + 1] += a[j1 + 1];
-            a[j1]     = x0r;
-            a[j1 + 1] = x0i;
-        } while ( j += 2, j < l );
-    }
-    LEAVE(34);
-    return;
-}
-
-
-static void
-cft1st ( const int n, float* a, float* w )
-{
-    int    j, k1;
-    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
-    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
-
-    ENTER(35);
-    x0r   = a[ 0] + a[ 2];
-    x0i   = a[ 1] + a[ 3];
-    x1r   = a[ 0] - a[ 2];
-    x1i   = a[ 1] - a[ 3];
-    x2r   = a[ 4] + a[ 6];
-    x2i   = a[ 5] + a[ 7];
-    x3r   = a[ 4] - a[ 6];
-    x3i   = a[ 5] - a[ 7];
-    a[ 0] = x0r + x2r;
-    a[ 1] = x0i + x2i;
-    a[ 4] = x0r - x2r;
-    a[ 5] = x0i - x2i;
-    a[ 2] = x1r - x3i;
-    a[ 3] = x1i + x3r;
-    a[ 6] = x1r + x3i;
-    a[ 7] = x1i - x3r;
-    wk1r  = w[ 2];
-    x0r   = a[ 8] + a[10];
-    x0i   = a[ 9] + a[11];
-    x1r   = a[ 8] - a[10];
-    x1i   = a[ 9] - a[11];
-    x2r   = a[12] + a[14];
-    x2i   = a[13] + a[15];
-    x3r   = a[12] - a[14];
-    x3i   = a[13] - a[15];
-    a[ 8] = x0r + x2r;
-    a[ 9] = x0i + x2i;
-    a[12] = x2i - x0i;
-    a[13] = x0r - x2r;
-    x0r   = x1r - x3i;
-    x0i   = x1i + x3r;
-    a[10] = wk1r * (x0r - x0i);
-    a[11] = wk1r * (x0r + x0i);
-    x0r   = x3i + x1r;
-    x0i   = x3r - x1i;
-    a[14] = wk1r * (x0i - x0r);
-    a[15] = wk1r * (x0i + x0r);
-
-    k1 = 0;
-    j  = 16;
-    do {
-        k1       += 2;
-        wk2r      = w[k1];
-        wk2i      = w[k1 + 1];
-        wk1r      = w[2*k1];
-        wk1i      = w[2*k1 + 1];
-        wk3r      = wk1r - 2 * wk2i * wk1i;
-        wk3i      = 2 * wk2i * wk1r - wk1i;
-        x0r       = a[j]     + a[j + 2];
-        x0i       = a[j + 1] + a[j + 3];
-        x1r       = a[j]     - a[j + 2];
-        x1i       = a[j + 1] - a[j + 3];
-        x2r       = a[j + 4] + a[j + 6];
-        x2i       = a[j + 5] + a[j + 7];
-        x3r       = a[j + 4] - a[j + 6];
-        x3i       = a[j + 5] - a[j + 7];
-        a[j]      = x0r + x2r;
-        a[j + 1]  = x0i + x2i;
-        x0r      -= x2r;
-        x0i      -= x2i;
-        a[j + 4]  = wk2r * x0r - wk2i * x0i;
-        a[j + 5]  = wk2r * x0i + wk2i * x0r;
-        x0r       = x1r - x3i;
-        x0i       = x1i + x3r;
-        a[j + 2]  = wk1r * x0r - wk1i * x0i;
-        a[j + 3]  = wk1r * x0i + wk1i * x0r;
-        x0r       = x1r + x3i;
-        x0i       = x1i - x3r;
-        a[j + 6]  = wk3r * x0r - wk3i * x0i;
-        a[j + 7]  = wk3r * x0i + wk3i * x0r;
-        wk1r      = w[2*k1 + 2];
-        wk1i      = w[2*k1 + 3];
-        wk3r      = wk1r - 2 * wk2r * wk1i;
-        wk3i      = 2 * wk2r * wk1r - wk1i;
-        x0r       = a[j +  8] + a[j + 10];
-        x0i       = a[j +  9] + a[j + 11];
-        x1r       = a[j +  8] - a[j + 10];
-        x1i       = a[j +  9] - a[j + 11];
-        x2r       = a[j + 12] + a[j + 14];
-        x2i       = a[j + 13] + a[j + 15];
-        x3r       = a[j + 12] - a[j + 14];
-        x3i       = a[j + 13] - a[j + 15];
-        a[j + 8]  = x0r + x2r;
-        a[j + 9]  = x0i + x2i;
-        x0r      -= x2r;
-        x0i      -= x2i;
-        a[j + 12] = -wk2i * x0r - wk2r * x0i;
-        a[j + 13] = -wk2i * x0i + wk2r * x0r;
-        x0r       = x1r - x3i;
-        x0i       = x1i + x3r;
-        a[j + 10] = wk1r * x0r - wk1i * x0i;
-        a[j + 11] = wk1r * x0i + wk1i * x0r;
-        x0r       = x1r + x3i;
-        x0i       = x1i - x3r;
-        a[j + 14] = wk3r * x0r - wk3i * x0i;
-        a[j + 15] = wk3r * x0i + wk3i * x0r;
-    } while ( j += 16, j < n );
-    LEAVE(35);
-    return;
-}
-
-extern void Cdecl cftmdl_3DNow_1 ( const int n, const int l, float* a, float* w );
-extern void Cdecl cftmdl_3DNow_2 ( const int n, const int l, float* a, float* w );
-
-
-static void
-cftmdl_i386 ( const int n, const int l, float* a, float* w )
-{
-    int    j, j1, j2, j3, k, k1, m, m2;
-    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
-    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
-
-    ENTER(36);
-    m = l << 2;
-
-    for ( j = 0; j < l; j += 2 ) {
-        j1        = j  + l;
-        j2        = j1 + l;
-        j3        = j2 + l;
-        x0r       = a[j]      + a[j1];
-        x0i       = a[j + 1]  + a[j1 + 1];
-        x1r       = a[j]      - a[j1];
-        x1i       = a[j + 1]  - a[j1 + 1];
-        x2r       = a[j2]     + a[j3];
-        x2i       = a[j2 + 1] + a[j3 + 1];
-        x3r       = a[j2]     - a[j3];
-        x3i       = a[j2 + 1] - a[j3 + 1];
-        a[j]      = x0r + x2r;
-        a[j + 1]  = x0i + x2i;
-        a[j2]     = x0r - x2r;
-        a[j2 + 1] = x0i - x2i;
-        a[j1]     = x1r - x3i;
-        a[j1 + 1] = x1i + x3r;
-        a[j3]     = x1r + x3i;
-        a[j3 + 1] = x1i - x3r;
-    }
-
-    wk1r = w[2];
-    for ( j = m; j < l + m; j += 2 ) {
-        j1        = j  + l;
-        j2        = j1 + l;
-        j3        = j2 + l;
-        x0r       = a[j]      + a[j1];
-        x0i       = a[j + 1]  + a[j1 + 1];
-        x1r       = a[j]      - a[j1];
-        x1i       = a[j + 1]  - a[j1 + 1];
-        x2r       = a[j2]     + a[j3];
-        x2i       = a[j2 + 1] + a[j3 + 1];
-        x3r       = a[j2]     - a[j3];
-        x3i       = a[j2 + 1] - a[j3 + 1];
-        a[j]      = x0r + x2r;
-        a[j + 1]  = x0i + x2i;
-        a[j2]     = x2i - x0i;
-        a[j2 + 1] = x0r - x2r;
-        x0r       = x1r - x3i;
-        x0i       = x1i + x3r;
-        a[j1]     = wk1r * (x0r - x0i);
-        a[j1 + 1] = wk1r * (x0r + x0i);
-        x0r       = x3i + x1r;
-        x0i       = x3r - x1i;
-        a[j3]     = wk1r * (x0i - x0r);
-        a[j3 + 1] = wk1r * (x0i + x0r);
-    }
-    LEAVE(36);
-
-    ENTER(39);
-    k1 = 0;
-    m2 = 2 * m;
-    for ( k = m2; k < n; k += m2 ) {
-        k1  += 2;
-        wk2r = w[k1];
-        wk2i = w[k1 + 1];
-        wk1r = w[2*k1];
-        wk1i = w[2*k1 + 1];
-        wk3r = wk1r - 2 * wk2i * wk1i;
-        wk3i = 2 * wk2i * wk1r - wk1i;
-        j    = k;
-        do {
-            j1        = j  + l;
-            j2        = j1 + l;
-            j3        = j2 + l;
-            x0r       = a[j]      + a[j1];
-            x0i       = a[j + 1]  + a[j1 + 1];
-            x1r       = a[j]      - a[j1];
-            x1i       = a[j + 1]  - a[j1 + 1];
-            x2r       = a[j2]     + a[j3];
-            x2i       = a[j2 + 1] + a[j3 + 1];
-            x3r       = a[j2]     - a[j3];
-            x3i       = a[j2 + 1] - a[j3 + 1];
-            a[j]      = x0r + x2r;
-            a[j + 1]  = x0i + x2i;
-            x0r      -= x2r;
-            x0i      -= x2i;
-            a[j2]     = wk2r * x0r - wk2i * x0i;
-            a[j2 + 1] = wk2r * x0i + wk2i * x0r;
-            x0r       = x1r - x3i;
-            x0i       = x1i + x3r;
-            a[j1]     = wk1r * x0r - wk1i * x0i;
-            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-            x0r       = x1r + x3i;
-            x0i       = x1i - x3r;
-            a[j3]     = wk3r * x0r - wk3i * x0i;
-            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
-        } while ( j += 2, j < l + k );
-
-        wk1r = w[2*k1 + 2];
-        wk1i = w[2*k1 + 3];
-        wk3r = wk1r - 2 * wk2r * wk1i;
-        wk3i = 2 * wk2r * wk1r - wk1i;
-        j    = k + m;
-        do {
-            j1        = j  + l;
-            j2        = j1 + l;
-            j3        = j2 + l;
-            x0r       = a[j]      + a[j1];
-            x0i       = a[j + 1]  + a[j1 + 1];
-            x1r       = a[j]      - a[j1];
-            x1i       = a[j + 1]  - a[j1 + 1];
-            x2r       = a[j2]     + a[j3];
-            x2i       = a[j2 + 1] + a[j3 + 1];
-            x3r       = a[j2]     - a[j3];
-            x3i       = a[j2 + 1] - a[j3 + 1];
-            a[j]      = x0r + x2r;
-            a[j + 1]  = x0i + x2i;
-            x0r      -= x2r;
-            x0i      -= x2i;
-            a[j2]     = -wk2i * x0r - wk2r * x0i;
-            a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
-            x0r       = x1r - x3i;
-            x0i       = x1i + x3r;
-            a[j1]     = wk1r * x0r - wk1i * x0i;
-            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-            x0r       = x1r + x3i;
-            x0i       = x1i - x3r;
-            a[j3]     = wk3r * x0r - wk3i * x0i;
-            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
-        } while ( j += 2, j < l+k+m );
-    }
-    LEAVE(39);
-    return;
-}
-
-
-static void
-cftmdl_3DNow ( const int n, const int l, float* a, float* w )
-{
-    int    j, j1, j2, j3, k, k1, m, m2;
-    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
-    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
-
-    ENTER(36);
-    cftmdl_3DNow_1 (n,l,a,w);
-    LEAVE(36);
-
-    ENTER(39);
-    m  = l << 2;
-    k1 = 0;
-    m2 = 2 * m;
-    for ( k = m2; k < n; k += m2 ) {
-        k1  += 2;
-        wk2r = w[k1];
-        wk2i = w[k1 + 1];
-        wk1r = w[2*k1];
-        wk1i = w[2*k1 + 1];
-        wk3r = wk1r - 2 * wk2i * wk1i;
-        wk3i = 2 * wk2i * wk1r - wk1i;
-        j    = k;
-        do {
-            j1        = j  + l;
-            j2        = j1 + l;
-            j3        = j2 + l;
-            x0r       = a[j]      + a[j1];
-            x0i       = a[j + 1]  + a[j1 + 1];
-            x1r       = a[j]      - a[j1];
-            x1i       = a[j + 1]  - a[j1 + 1];
-            x2r       = a[j2]     + a[j3];
-            x2i       = a[j2 + 1] + a[j3 + 1];
-            x3r       = a[j2]     - a[j3];
-            x3i       = a[j2 + 1] - a[j3 + 1];
-            a[j]      = x0r + x2r;
-            a[j + 1]  = x0i + x2i;
-            x0r      -= x2r;
-            x0i      -= x2i;
-            a[j2]     = wk2r * x0r - wk2i * x0i;
-            a[j2 + 1] = wk2r * x0i + wk2i * x0r;
-            x0r       = x1r - x3i;
-            x0i       = x1i + x3r;
-            a[j1]     = wk1r * x0r - wk1i * x0i;
-            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-            x0r       = x1r + x3i;
-            x0i       = x1i - x3r;
-            a[j3]     = wk3r * x0r - wk3i * x0i;
-            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
-        } while ( j += 2, j < l + k );
-
-        wk1r = w[2*k1 + 2];
-        wk1i = w[2*k1 + 3];
-        wk3r = wk1r - 2 * wk2r * wk1i;
-        wk3i = 2 * wk2r * wk1r - wk1i;
-        j    = k + m;
-        do {
-            j1        = j + l;
-            j2        = j1 + l;
-            j3        = j2 + l;
-            x0r       = a[j]      + a[j1];
-            x0i       = a[j + 1]  + a[j1 + 1];
-            x1r       = a[j]      - a[j1];
-            x1i       = a[j + 1]  - a[j1 + 1];
-            x2r       = a[j2]     + a[j3];
-            x2i       = a[j2 + 1] + a[j3 + 1];
-            x3r       = a[j2]     - a[j3];
-            x3i       = a[j2 + 1] - a[j3 + 1];
-            a[j]      = x0r + x2r;
-            a[j + 1]  = x0i + x2i;
-            x0r      -= x2r;
-            x0i      -= x2i;
-            a[j2]     = -wk2i * x0r - wk2r * x0i;
-            a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
-            x0r       = x1r - x3i;
-            x0i       = x1i + x3r;
-            a[j1]     = wk1r * x0r - wk1i * x0i;
-            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-            x0r       = x1r + x3i;
-            x0i       = x1i - x3r;
-            a[j3]     = wk3r * x0r - wk3i * x0i;
-            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
-        } while ( j += 2, j < l+k+m );
-    }
-    LEAVE(39);
-    return;
-}
-
-
-static void
-rftfsub ( const int n, float* a, int nc, float* c )
-{
-    int    j, k, kk, ks, m;
-    float  wkr, wki, xr, xi, yr, yi;
-
-    ENTER(37);
-    m  = n >> 1;
-    ks = 2 * nc / m;
-    kk = ks;
-    j  = 2;
-    k  = n;
-    do {
-        k        -= 2;
-        nc       -= ks;
-        wkr       = 0.5f - c[nc];
-        wki       = c[kk];
-        xr        = a[j]     - a[k];
-        xi        = a[j + 1] + a[k + 1];
-        yr        = wkr * xr - wki * xi;
-        yi        = wkr * xi + wki * xr;
-        a[j]     -= yr;
-        a[j + 1] -= yi;
-        a[k]     += yr;
-        a[k + 1] -= yi;
-        kk       += ks;
-    } while ( j += 2, j < m );
-    LEAVE(37);
-    return;
-}
-
-/* end of fft4g.c */
Index: penc/trunk/fft4gasm.nas
===================================================================
--- /mppenc/trunk/fft4gasm.nas	(revision 96)
+++ 	(revision )
@@ -1,424 +1,0 @@
-; Musepack audio compression
-; Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
-; 
-; This library is free software; you can redistribute it and/or
-; modify it under the terms of the GNU Lesser General Public
-; License as published by the Free Software Foundation; either
-; version 2.1 of the License, or (at your option) any later version.
-; 
-; This library is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-; Lesser General Public License for more details.
-; 
-; You should have received a copy of the GNU Lesser General Public
-; License along with this library; if not, write to the Free Software
-; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-;
-%include "tools.inc"
-;
-%define reg0    eax
-%define reg1    eax + esi
-%define reg2    eax + edx
-%define reg3    eax + edi
-
-%define off1    esi
-%define off2    edx
-%define off3    edi
-;
-                segment_data
-;
-                align   32
-negativ         dd       0x80000000, 0
-;
-%macro          turn 2                          ; dst, tmp
-                punpckldq       %2, %1          ; tmp = src.l | tmp.l
-                punpckhdq       %1, %2          ; src = src.l | src.h
-%endmacro
-
-;
-; cftmdl ( const int n, const int l, float* a, float* w );
-;
-                segment_code
-
-                align 32
-proc            cftmdl_3DNow_1
-                pushd   ebx, esi, edi, ebp
-$n1             arg     4
-$l1             arg     4
-$a1             arg     4
-$w1             arg     4
-
-;    for ( j = 0; j < l; j += 2 ) {             a, a+l a+2*l a+3*l
-;        j1        = j  + l;
-;        j2        = j1 + l;
-;        j3        = j2 + l;
-;        x0r       = a[j]      + a[j1];
-;        x0i       = a[j + 1]  + a[j1 + 1];
-;        x1r       = a[j]      - a[j1];
-;        x1i       = a[j + 1]  - a[j1 + 1];
-;        x2r       = a[j2]     + a[j3];
-;        x2i       = a[j2 + 1] + a[j3 + 1];
-;        x3r       = a[j2]     - a[j3];
-;        x3i       = a[j2 + 1] - a[j3 + 1];
-;        a[j]      = x0r + x2r;
-;        a[j + 1]  = x0i + x2i;
-;        a[j2]     = x0r - x2r;
-;        a[j2 + 1] = x0i - x2i;
-;        a[j1]     = x1r - x3i; -x3i
-;        a[j1 + 1] = x1i + x3r; +x3r
-;        a[j3]     = x1r + x3i;
-;        a[j3 + 1] = x1i - x3r;
-;    }
-
-                pmov    mm7, qword [negativ]    ; + | -
-                mov     eax, [sp($a1)]          ; eax = a
-                xor     ebx, ebx                ; ebx = j
-                mov     ecx, [sp($l1)]          ; ecx = l
-
-                lea     off1, [4*ecx]
-                lea     off2, [8*ecx]
-                lea     off3, [off1 + 8*ecx]
-                shr     ecx, 1
-lbl1:
-                pmov    mm0, [reg0]
-                pfadd   mm0, [reg1]             ; x0r, x0i
-                pmov    mm1, [reg0]
-                pfsub   mm1, [reg1]             ; x1r, x1i
-                pmov    mm2, [reg2]
-                pfadd   mm2, [reg3]             ; x2r, x2i
-                pmov    mm3, [reg2]
-                pfsub   mm3, [reg3]             ; x3r, x3i
-                pmov    mm4, mm0
-                pfadd   mm4, mm2
-                pmov    [reg0], mm4
-                pfsub   mm0, mm2
-                pmov    [reg2], mm0
-                turn    mm3, mm4
-                pxor    mm3, mm7
-                pmov    mm4, mm1
-                pfadd   mm4, mm3
-                pmov    [reg1], mm4
-                pfsub   mm1, mm3
-                pmov    [reg3], mm1
-                add     eax, byte 8
-                dec     ecx
-                jnz     lbl1
-
-;    m    = l << 2;                             ; ebp = m
-;    wk1r = w[2];
-;    for ( j = m; j < l + m; j += 2 ) {
-;        j1        = j  + l;
-;        j2        = j1 + l;
-;        j3        = j2 + l;
-;        x0r       = a[j]      + a[j1];
-;        x0i       = a[j + 1]  + a[j1 + 1];
-;        x1r       = a[j]      - a[j1];
-;        x1i       = a[j + 1]  - a[j1 + 1];
-;        x2r       = a[j2]     + a[j3];
-;        x2i       = a[j2 + 1] + a[j3 + 1];
-;        x3r       = a[j2]     - a[j3];
-;        x3i       = a[j2 + 1] - a[j3 + 1];
-;        a[j]      = x0r + x2r;
-;        a[j + 1]  = x0i + x2i;
-;        a[j2]    =-(x0i - x2i);
-;        a[j2 + 1] = x0r - x2r;
-;        x0r       = x1r - x3i;                 ; x1r -x3i
-;        x0i       = x1i + x3r;                 ; x1i  x3r
-;        a[j1]     = wk1r * (x0r - x0i);
-;        a[j1 + 1] = wk1r * (x0r + x0i);
-;        x0r       = x3i + x1r;                 ; x1r -x3i      1 - 3   x1r + x3i
-;        x0i       = x3r - x1i;                 ; x1i  x3r              x1i - x3r
-;        a[j3]     = wk1r * (x0i - x0r);
-;        a[j3 + 1] = wk1r * (x0i + x0r);
-;    }
-
-                mov     eax, [sp($a1)]          ; eax = a
-                mov     ecx, [sp($l1)]          ; ecx = l
-                mov     ebp, [sp($w1)]          ; ebp = w
-                pmov    mm6, [ebp + 8]          ; mm6 =  ?   | w[2]
-                punpckldq mm6, mm6              ; mm6 = w[2] | w[2]
-
-                lea     eax, [eax + 8*ecx]
-                lea     eax, [eax + 8*ecx]
-
-                lea     off1, [4*ecx]
-                lea     off2, [8*ecx]
-                lea     off3, [off1 + 8*ecx]
-                shr     ecx, 1
-lbl2:
-                pmov    mm0, [reg0]
-                pfadd   mm0, [reg1]             ; x0r, x0i
-                pmov    mm1, [reg0]
-                pfsub   mm1, [reg1]             ; x1r, x1i
-                pmov    mm2, [reg2]
-                pfadd   mm2, [reg3]             ; x2r, x2i
-                pmov    mm3, [reg2]
-                pfsub   mm3, [reg3]             ; x3r, x3i
-                pmov    mm4, mm0
-                pfadd   mm4, mm2
-                pmov    [reg0], mm4
-                pfsub   mm0, mm2
-                turn    mm0, mm4
-                pxor    mm0, mm7
-                pmov    [reg2], mm0
-                turn    mm3, mm4
-                pxor    mm3, mm7
-                pmov    mm4, mm1
-                pfadd   mm4, mm3
-                pmov    mm5, mm4
-                punpckldq mm4, mm4
-                punpckhdq mm5, mm5              ;  r r
-                pxor    mm5, mm7                ; -i i
-                pfadd   mm4, mm5
-                pfmul   mm4, mm6
-                pmov    [reg1], mm4
-
-                pfsub   mm1, mm3
-                pmov    mm4, mm1
-                punpckldq mm1, mm1
-                pxor    mm1, mm7                ; -r r
-                punpckhdq mm4, mm4              ;  i i
-                pfsubr  mm4, mm1
-                pfmul   mm4, mm6
-                pmov    [reg3], mm4
-
-                add     eax, byte 8
-                dec     ecx
-                jnz     near lbl2
-
-                femms
-                popd    ebx, esi, edi, ebp
-                ret
-
-
-                align 32
-proc            cftmdl_3DNow_2
-                pushd   ebx, esi, edi, ebp
-$n2             arg     4
-$l2             arg     4
-$a2             arg     4
-$w2             arg     4
-
-                mov     eax, [sp($a2)]          ; eax = a
-                mov     ecx, [sp($l2)]          ; ecx = l
-                mov     ebp, [sp($w2)]          ; ebp = w
-
-                push    ebp                     ; w + 2*k1      = (esp+20)
-                push    ebp                     ; w + k1        = (esp+16)
-
-                lea     ebx, [4*ecx]
-                push    dword 0                 ; k1 = 0        = (esp+12)
-                push    ebx                     ; m  = 4*l      = (esp+ 8)
-                add     ebx, ebx
-                push    ebx                     ; k  = 2*m      = (esp+ 4)
-                push    dword 0                 ; k1 = 0        = (esp+ 0)
-
-;    for ( k = 2*m; k < n; k += 2*m ) {
-;        k1  += 2;
-;        wk2r = w[k1];
-;        wk2i = w[k1 + 1];
-;        wk1r = w[2*k1];
-;        wk1i = w[2*k1 + 1];
-;        wk3r = wk1r - 2 * wk2i * wk1i;
-;        wk3i = wk1i - 2 * wk2i * wk1r;
-
-
-lbl3:
-                add     dword [esp+16], byte  8
-                add     dword [esp+20], byte 16
-                mov     ebx, [esp+16]
-                pmov    mm6, [ebx]              ; mm6 = wk2
-                mov     ebx, [esp+20]
-                pmov    mm5, [ebx]              ; mm5 = mk1
-                pmov    mm4, mm6                ; mk1
-                punpckhdq mm4, mm4              ; mk1i mk1i
-                pfadd   mm4, mm4                ; 2*mk1i 2*mk1i
-                pmov    mm3, mm5
-                turn    mm3, mm2
-                pfmul   mm4, mm3
-                pfsubr  mm4, mm5                ; mm4 = mk3
-
-;        j    = k;
-
-lbl4:
-;        do {
-;            j1        = j  + l;
-;            j2        = j1 + l;
-;            j3        = j2 + l;
-;            x0r       = a[j]      + a[j1];
-;            x0i       = a[j + 1]  + a[j1 + 1];
-;            x1r       = a[j]      - a[j1];
-;            x1i       = a[j + 1]  - a[j1 + 1];
-;            x2r       = a[j2]     + a[j3];
-;            x2i       = a[j2 + 1] + a[j3 + 1];
-;            x3r       = a[j2]     - a[j3];
-;            x3i       = a[j2 + 1] - a[j3 + 1];
-;
-                pmov    mm0, [reg0]
-                pfadd   mm0, [reg1]
-                pmov    mm1, [reg0]
-                pfsub   mm1, [reg1]
-                pmov    mm2, [reg2]
-                pfadd   mm2, [reg3]
-                pmov    mm3, [reg2]
-                pfsub   mm3, [reg3]
-
-;            a[j]      = x0r + x2r;
-;            a[j + 1]  = x0i + x2i;
-
-                pmov    mm7, mm0
-                pfadd   mm7, mm2
-                pmov    [reg0], mm7
-
-;            x0r      -= x2r;
-;            x0i      -= x2i;
-
-                pfsub   mm0, mm2
-
-;            a[j2]     = wk2r * x0r - wk2i * x0i;
-;            a[j2 + 1] = wk2r * x0i + wk2i * x0r;       // frei sind (mm0), mm2, mm7
-
-                pmov    mm2, mm0
-                turn    mm2, mm7                ; x0i  x0r
-                pmov    mm7, mm6
-                punpckhdq mm7, mm7              ; wk2i wk2i
-                pxor    mm2, [negativ]          ;-x0i  x0r
-                pfmul   mm2, mm7
-                pmov    mm7, mm6
-                punpckldq mm7, mm7              ; wk2r wk2r
-                pfmul   mm7, mm0
-                pfadd   mm2, mm7
-                pmov    [reg2], mm2
-
-;            x0r       = x1r - x3i;
-;            x0i       = x1i + x3r;
-
-                turn    mm3, mm2
-                pxor    mm3, [negativ]
-                pmov    mm0, mm1
-                pfadd   mm0, mm3
-
-;            a[j1]     = wk1r * x0r - wk1i * x0i;
-;            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-
-;            x1r      += x3i;
-;            x1i      -= x3r;
-
-                pfsub   mm1, mm3
-
-;            a[j3]     = wk3r * x1r + wk3i * x1i;
-;            a[j3 + 1] = wk3r * x1i - wk3i * x1r;
-
-;        } while ( j += 2, j < l + k );
-;
-                dec     ecx
-                jnz     near lbl4
-
-
-;        wk1r = w[2*k1 + 2];
-;        wk1i = w[2*k1 + 3];
-;        wk3r = wk1r - 2 * wk2r * wk1i;
-;        wk3i = wk1i - 2 * wk2r * wk1r;
-
-                mov     ebx, [esp+20]
-                pmov    mm5, [ebx+ 8]           ; mm5 = mk1
-                pmov    mm4, mm6                ; mk1
-                punpckldq mm4, mm4              ; mk1r mk1r
-                pfadd   mm4, mm4                ; 2*mk1i 2*mk1i
-                pmov    mm3, mm5
-                turn    mm3, mm2
-                pfmul   mm4, mm3
-                pfsubr  mm4, mm5                ; mm4 = mk3
-
-
-
-
-;        j    = k + m;
-
-lbl5:
-
-;        do {
-;            j1        = j  + l;
-;            j2        = j1 + l;
-;            j3        = j2 + l;
-;            x0r       = a[j]      + a[j1];
-;            x0i       = a[j + 1]  + a[j1 + 1];
-;            x1r       = a[j]      - a[j1];
-;            x1i       = a[j + 1]  - a[j1 + 1];
-;            x2r       = a[j2]     + a[j3];
-;            x2i       = a[j2 + 1] + a[j3 + 1];
-;            x3r       = a[j2]     - a[j3];
-;            x3i       = a[j2 + 1] - a[j3 + 1];
-
-                pmov    mm0, [reg0]
-                pfadd   mm0, [reg1]
-                pmov    mm1, [reg0]
-                pfsub   mm1, [reg1]
-                pmov    mm2, [reg2]
-                pfadd   mm2, [reg3]
-                pmov    mm3, [reg2]
-                pfsub   mm3, [reg3]
-
-;            a[j]      = x0r + x2r;
-;            a[j + 1]  = x0i + x2i;
-
-                pmov    mm7, mm0
-                pfadd   mm7, mm2
-                pmov    [reg0], mm7
-
-;            x0r      -= x2r;
-;            x0i      -= x2i;
-
-                pfsub   mm0, mm2
-
-;            a[j2]     = -wk2i * x0r - wk2r * x0i;
-;            a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
-
-                pmov    mm2, mm0
-                turn    mm2, mm7                ; x0i  x0r
-                pmov    mm7, mm6
-                punpckldq mm7, mm7              ; wk2i wk2i
-                pxor    mm2, [negativ]          ;-x0i  x0r
-                pfmul   mm2, mm7
-                pmov    mm7, mm6
-                punpckhdq mm7, mm7              ; wk2r wk2r
-                pfmul   mm7, mm0
-                pfsubr  mm2, mm7                ; ?
-                pmov    [reg2], mm2
-
-;            x0r       = x1r - x3i;
-;            x0i       = x1i + x3r;
-
-                turn    mm3, mm2
-                pxor    mm3, [negativ]
-                pmov    mm0, mm1
-                pfadd   mm0, mm3
-
-;            a[j1]     = wk1r * x0r - wk1i * x0i;
-;            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
-
-;            x1r      -= x3i;
-;            x1i      -= x3r;
-
-                pfsub   mm1, mm3
-
-;            a[j3]     = wk3r * x1r + wk3i * x1i;
-;            a[j3 + 1] = wk3r * x1i - wk3i * x1r;
-
-;        } while ( j += 2, j < l+k+m );
-
-                dec     ecx
-                jnz     near lbl5
-;    }
-
-                jc      near lbl3
-
-                femms
-                add     esp, 16
-                popd    ebx, esi, edi, ebp
-                ret
-
-
-;##################################################################
Index: penc/trunk/fft_routines.c
===================================================================
--- /mppenc/trunk/fft_routines.c	(revision 96)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-#define CX0     -1.
-#define CX1      0.5
-
-#define SX1     -1.
-#define SX2      (2./9/  1)
-#define SX3      (2./9/  4)
-#define SX4      (2./9/ 10)
-#define SX5      (2./9/ 20)
-#define SX6      (2./9/ 35)
-#define SX7      (2./9/ 56)
-#define SX8      (2./9/ 84)
-#define SX9      (2./9/120)
-#define SX10     (2./9/165)
-
-
-#ifdef EXTRA_DECONV
-# define DECONV \
-    {  \
-    tmp      = (CX0*aix[0] + CX1*aix[2]) * (1./(CX0*CX0+CX1*CX1)); \
-    aix[ 0] -= CX0*tmp; \
-    aix[ 2] -= CX1*tmp; \
-    tmp      = (SX1*aix[3] + SX2*aix[5] + SX3*aix[7] + SX4*aix[9] + SX5*aix[11]) * (1./(SX1*SX1+SX2*SX2+SX3*SX3+SX4*SX4+SX5*SX5)); \
-    aix[ 3] -= SX1*tmp; \
-    aix[ 5] -= SX2*tmp; \
-    aix[ 7] -= SX3*tmp; \
-    aix[ 9] -= SX4*tmp; \
-    aix[11] -= SX5*tmp; \
-    }
-#elif 0
-# define DECONV \
-    {  \
-    float A[20]; \
-    int   i; \
-    memcpy (A, aix, 20*sizeof(aix)); \
-    tmp      = (CX0*aix[0] + CX1*aix[2]) * (1./(CX0*CX0+CX1*CX1)); \
-    aix[ 0] -= CX0*tmp; \
-    aix[ 2] -= CX1*tmp; \
-    tmp      = (SX1*aix[3] + SX2*aix[5] + SX3*aix[7] + SX4*aix[9] + SX5*aix[11]) * (1./(SX1*SX1+SX2*SX2+SX3*SX3+SX4*SX4+SX5*SX5)); \
-    aix[ 3] -= SX1*tmp; \
-    aix[ 5] -= SX2*tmp; \
-    aix[ 7] -= SX3*tmp; \
-    aix[ 9] -= SX4*tmp; \
-    aix[11] -= SX5*tmp; \
-    for ( i=0; i<10; i++) \
-        printf ("%u%9.0f%7.0f%9.0f%7.0f\n",i, A[i+i], A[i+i+1], aix[i+i], aix[i+i+1] ); \
-    }
-#else
-# define DECONV
-#endif
-
-
-/* V A R I A B L E S */
-static int    ip [4096];   // bitinverse for maximum 2048 FFT
-static float  w  [4096];   // butterfly-coefficient for maximum 2048 FFT
-static float  a  [4096];   // holds real input for FFT
-static float  Hann_256  [ 256];
-static float  Hann_1024 [1024];
-static float  Hann_1600 [1600];
-
-
-//////////////////////////////
-//
-// BesselI0 -- Regular Modified Cylindrical Bessel Function (Bessel I).
-//
-
-static double
-Bessel_I_0 ( double x )
-{
-    double  denominator;
-    double  numerator;
-    double  z;
-
-    if (x == 0.)
-        return 1.;
-
-    z = x * x;
-    numerator = z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z*
-                   0.210580722890567e-22  + 0.380715242345326e-19 ) +
-                   0.479440257548300e-16) + 0.435125971262668e-13 ) +
-                   0.300931127112960e-10) + 0.160224679395361e-07 ) +
-                   0.654858370096785e-05) + 0.202591084143397e-02 ) +
-                   0.463076284721000e+00) + 0.754337328948189e+02 ) +
-                   0.830792541809429e+04) + 0.571661130563785e+06 ) +
-                   0.216415572361227e+08) + 0.356644482244025e+09 ) +
-                   0.144048298227235e+10;
-
-    denominator = z* (z* (z - 0.307646912682801e+04) + 0.347626332405882e+07) - 0.144048298227235e+10;
-
-    return - numerator / denominator;
-}
-
-static double
-residual ( double x )
-{
-    return sqrt ( 1. - x*x );
-}
-
-//////////////////////////////
-//
-// KBDWindow -- Kaiser Bessel Derived Window
-//      fills the input window array with size samples of the
-//      KBD window with the given tuning parameter alpha.
-//
-
-
-static void
-KBDWindow ( float* window, unsigned int size, float alpha )
-{
-    double  sumvalue = 0.;
-    double  scale;
-    int     i;
-
-    scale = 0.25 / sqrt (size);
-    for ( i = 0; i < (int)size/2; i++ )
-        window [i] = sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*i/size - 1.) );
-
-    // need to add one more value to the nomalization factor at size/2:
-    sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*(size/2)/size-1.) );
-
-    // normalize the window and fill in the righthand side of the window:
-    for ( i = 0; i < (int)size/2; i++ )
-        window [size-1-i] = window [i] = /*sqrt*/ ( window [i] / sumvalue ) * scale;
-}
-
-static void
-CosWindow ( float* window, unsigned int size )
-{
-    double  x;
-    double  scale;
-    int     i;
-
-    scale = 0.25 / sqrt (size);
-    for ( i = 0; i < (int)size/2; i++ ) {
-        x = cos ( (i+0.5) * (M_PI / size) );
-        window [size/2-1-i] = window [size/2+i] = scale * x * x;
-    }
-}
-
-static void
-Window ( float* window, unsigned int size, float alpha )
-{
-    if ( alpha < 0. )
-        CosWindow ( window, size ) ;
-    else
-        KBDWindow ( window, size, alpha );
-}
-
-
-/* F U N C T I O N S */
-// generates FFT lookup-tables
-void
-Init_FFT ( void )
-{
-    int     n;
-    double  x;
-    double  scale;
-
-    // normalized hann functions
-    Window ( Hann_256 ,  256, KBD1 );
-    Window ( Hann_1024, 1024, KBD2 );
-    scale = 0.25 / sqrt (2048.);
-    for ( n = 0; n < 800; n++ )
-        x = cos ((n+0.5) * (M_PI/1600)), Hann_1600 [799-n] = Hann_1600 [800+n] = (float)(x * x * scale);
-
-    Generate_FFT_Tables ( 2048, ip, w );
-}
-
-// input : Signal *x
-// output: energy spectrum *erg
-void
-PowSpec256 ( const float* x, float* erg )
-{
-    const float*  win = Hann_256;
-    float*        aix = a;
-    int           i;
-
-    ENTER(40);
-    // windowing
-    i = 256;
-    while (i--)
-        *aix++ = *x++ * *win++;
-
-    // perform FFT
-    rdft ( 256, a, ip, w );
-
-    // calculate power
-    aix = a;    // reset pointer
-    i   = 128;
-    while (i--) {
-        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
-        aix += 2;
-    }
-    LEAVE(40);
-}
-
-// input : Signal *x
-// output: energy spectrum *erg
-void
-PowSpec1024 ( const float* x, float* erg )
-{
-    const float*  win = Hann_1024;
-    float*        aix = a;
-    int           i;
-
-    ENTER(41);
-    i = 1024;                   // windowing
-    while (i--)
-        *aix++ = *x++ * *win++;
-
-//    for (i=0; i<1024; i++)
-//        a[i] = Hann_1024[i] * ((i==0 ? 0 : i-512) + 1000);
-
-    rdft ( 1024, a, ip, w );    // perform FFT
-
-    aix = a;                    // calculate power
-    i   = 512;
-
-
-    DECONV;
-//    for (i = 0; i <= 512; i++ )
-//        printf ("%3u %12.6f %12.6f\n", i, a[i+i], a[i+i+1]);
-//    exit(1);
-    while (i--) {
-        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
-        aix += 2;
-    }
-    LEAVE(41);
-}
-
-// input : Signal *x
-// output: energy spectrum *erg
-void
-PowSpec2048 ( const float* x, float* erg )
-{
-    const float*  win = Hann_1600;
-    float*        aix = a;
-    int           i;
-
-    ENTER(42);
-    // windowing (only 1600 samples available -> centered in 2048!)
-    memset ( a     , 0, 224*sizeof(*a) );
-    aix = a + 224;
-    i   = 1600;
-    while (i--)
-        *aix++ = *x++ * *win++;
-    memset ( a+1824, 0, 224*sizeof(*a) );
-
-    rdft ( 2048, a, ip, w );    // perform FFT
-
-    aix = a;                    // calculate power
-    i   = 1024;
-    while (i--) {
-        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
-        aix += 2;
-    }
-    LEAVE(42);
-}
-
-#include "fastmath.h"
-
-// input : Signal *x
-// output: energy spectrum *erg and phase spectrum *phs
-void
-PolarSpec1024 ( const float* x, float* erg, float* phs )
-{
-    const float*  win = Hann_1024;
-    float*        aix = a;
-    int           i;
-
-    ENTER(43);
-    i = 1024;                   // windowing
-    while (i--)
-        *aix++ = *x++ * *win++;
-
-    rdft ( 1024, a, ip, w );    // perform FFT
-
-    // calculate power and phase
-    aix = a;    // reset pointer
-    i   = 512;
-    while (i--) {
-        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
-        *phs++ = ATAN2F (aix[1], aix[0]);
-        aix += 2;
-    }
-    LEAVE(43);
-}
-
-// input : logarithmized energy spectrum *cep
-// output: Cepstrum *cep (in-place)
-void
-Cepstrum2048 ( float* cep, const int MaxLine )
-{
-    float*  aix = cep;
-    float*  bix = cep + 2048;
-    int     i;
-
-    ENTER(44);
-    // generate real, even spectrum (symmetric around 1024, cep[2048-i] = cep[i])
-    for ( i = 0; i < 1024; i++ )
-        *bix-- = *aix++;
-
-    // perform IFFT
-    rdft ( 2048, cep, ip, w );
-
-    // only real part as outcome (all even indexes of cep[])
-    aix = cep;
-    bix = cep;
-    i   = MaxLine + 1;
-    while (i--) {
-        *aix = *bix * (float) (0.9888 / 2048.);
-//      *aix = *bix * 0.0004828125f;
-        aix ++;
-        bix += 2;
-    }
-    LEAVE(44);
-}
Index: penc/trunk/gain_analysis.c
===================================================================
--- /mppenc/trunk/gain_analysis.c	(revision 96)
+++ 	(revision )
@@ -1,460 +1,0 @@
-#define KLEMM
-/*
- *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change
- *  Copyright (C) 2001 David Robinson and Glen Sawyer
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  concept and filter values by David Robinson (David@Robinson.org)
- *    -- blame him if you think the idea is flawed
- *  coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
- *    -- blame him if you think this runs too slowly, or the coding is otherwise flawed
- *
- *  For an explanation of the concepts and the basic algorithms involved, go to:
- *    http://www.replaygain.org/
- */
-
-/*
- *  Here's the deal. Call
- *
- *    InitGainAnalysis ( long double samplefreq );
- *
- *  to initialize everything. Call
- *
- *    AnalyzeSamples ( const Float_t*  left_samples,
- *                     const Float_t*  right_samples,
- *                     size_t          num_samples,
- *                     int             num_channels );
- *
- *  as many times as you want, with as many or as few samples as you want.
- *  If mono, pass the sample buffer in through left_samples, leave
- *  right_samples NULL, and make sure num_channels = 1.
- *
- *    GetTitleGain()
- *
- *  will return the recommended dB level change for all samples analyzed
- *  SINCE THE LAST TIME you called GetTitleGain() OR InitGainAnalysis().
- *
- *    GetAlbumGain()
- *
- *  will return the recommended dB level change for all samples analyzed
- *  since InitGainAnalysis() was called and finalized with GetTitleGain().
- *
- *  Pseudo-code to process an album:
- *
- *    Float_t       l_samples [4096];
- *    Float_t       r_samples [4096];
- *    size_t        num_samples;
- *    unsigned int  num_songs;
- *    unsigned int  i;
- *
- *    InitGainAnalysis ( 44100. );
- *    for ( i = 1; i <= num_songs; i++ ) {
- *        while ( ( num_samples = getSongSamples ( song[i], left_samples, right_samples ) ) > 0 )
- *            AnalyzeSamples ( left_samples, right_samples, num_samples, 2 );
- *        fprintf ("Recommended dB change for song %2d: %+6.2f dB\n", i, GetTitleGain() );
- *    }
- *    fprintf ("Recommended dB change for whole album: %+6.2f dB\n", GetAlbumGain() );
- */
-
-/*
- *  So here's the main source of potential code confusion:
- *
- *  The filters applied to the incoming samples are IIR filters,
- *  meaning they rely on up to <filter order> number of previous samples
- *  AND up to <filter order> number of previous filtered samples.
- *
- *  I set up the AnalyzeSamples routine to minimize memory usage and interface
- *  complexity. The speed isn't compromised too much (I don't think), but the
- *  internal complexity is higher than it should be for such a relatively
- *  simple routine.
- *
- *  Optimization/clarity suggestions are welcome.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "gain_analysis.h"
-
-typedef unsigned short  Uint16_t;
-typedef signed short    Int16_t;
-typedef unsigned int    Uint32_t;
-typedef signed int      Int32_t;
-
-#define YULE_ORDER         10
-#define BUTTER_ORDER        2
-#define RMS_PERCENTILE      0.95        	// percentile which is louder than the proposed level
-#define MAX_SAMP_FREQ   48000.          	// maximum allowed sample frequency [Hz]
-#ifdef KLEMM
-# define RMS_WINDOW_TIME    0.01      		// Time slice length in [s], 10 ms, use post processing
-#else
-# define RMS_WINDOW_TIME    0.05      		// Time slice length in [s], 50 ms, Zwicker says something around 80 ms, see also DIN 45405
-#endif
-#define STEPS_per_dB      100.          // Table entries per dB
-#define MAX_dB            120.          // Table entries for 0...MAX_dB (normal max. values are 70...80 dB)
-
-#define MAX_ORDER               (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
-#define MAX_SAMPLES_PER_WINDOW  (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 0.99999999)      // max. Samples per Time slice
-#define PINK_REF                65.                                             // calibration value
-
-Float_t          linprebuf [MAX_ORDER * 2];
-Float_t*         linpre;                                          // left input samples, with pre-buffer
-Float_t          lstepbuf  [MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
-Float_t*         lstep;                                           // left "first step" (i.e. post first filter) samples
-Float_t          loutbuf   [MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
-Float_t*         lout;                                            // left "out" (i.e. post second filter) samples
-Float_t          rinprebuf [MAX_ORDER * 2];
-Float_t*         rinpre;                                          // right input samples ...
-Float_t          rstepbuf  [MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
-Float_t*         rstep;
-Float_t          routbuf   [MAX_SAMPLES_PER_WINDOW + MAX_ORDER];
-Float_t*         rout;
-int              sampleWindow;                                    // number of samples required to reach number of milliseconds required for RMS window
-unsigned long    totsamp;
-double           lsum;
-double           rsum;
-int              freqindex;
-int              first;
-static Uint16_t  A [(size_t)(STEPS_per_dB * MAX_dB)];
-static Uint16_t  B [(size_t)(STEPS_per_dB * MAX_dB)];
-
-// for each filter:
-// [0] 48 kHz, [1] 44.1 kHz, [2] 32 kHz, [3] 24 kHz, [4] 22050 Hz, [5] 16 kHz, [6] 12 kHz, [7] is 11025 Hz, [8] 8 kHz
-
-#pragma warning ( disable : 4305 )
-
-const Float_t  AYule [9] [11] = {
-    { 1., -3.84664617118067,  7.81501653005538,-11.34170355132042, 13.05504219327545,-12.28759895145294,  9.48293806319790, -5.87257861775999,  2.75465861874613, -0.86984376593551, 0.13919314567432 },
-    { 1., -3.47845948550071,  6.36317777566148, -8.54751527471874,  9.47693607801280, -8.81498681370155,  6.85401540936998, -4.39470996079559,  2.19611684890774, -0.75104302451432, 0.13149317958808 },
-    { 1., -2.37898834973084,  2.84868151156327, -2.64577170229825,  2.23697657451713, -1.67148153367602,  1.00595954808547, -0.45953458054983,  0.16378164858596, -0.05032077717131, 0.02347897407020 },
-    { 1., -1.61273165137247,  1.07977492259970, -0.25656257754070, -0.16276719120440, -0.22638893773906,  0.39120800788284, -0.22138138954925,  0.04500235387352,  0.02005851806501, 0.00302439095741 },
-    { 1., -1.49858979367799,  0.87350271418188,  0.12205022308084, -0.80774944671438,  0.47854794562326, -0.12453458140019, -0.04067510197014,  0.08333755284107, -0.04237348025746, 0.02977207319925 },
-    { 1., -0.62820619233671,  0.29661783706366, -0.37256372942400,  0.00213767857124, -0.42029820170918,  0.22199650564824,  0.00613424350682,  0.06747620744683,  0.05784820375801, 0.03222754072173 },
-    { 1., -1.04800335126349,  0.29156311971249, -0.26806001042947,  0.00819999645858,  0.45054734505008, -0.33032403314006,  0.06739368333110, -0.04784254229033,  0.01639907836189, 0.01807364323573 },
-    { 1., -0.51035327095184, -0.31863563325245, -0.20256413484477,  0.14728154134330,  0.38952639978999, -0.23313271880868, -0.05246019024463, -0.02505961724053,  0.02442357316099, 0.01818801111503 },
-    { 1., -0.25049871956020, -0.43193942311114, -0.03424681017675, -0.04678328784242,  0.26408300200955,  0.15113130533216, -0.17556493366449, -0.18823009262115,  0.05477720428674, 0.04704409688120 }
-};
-
-const Float_t  BYule [9] [11] = {
-    { 0.03857599435200, -0.02160367184185, -0.00123395316851, -0.00009291677959, -0.01655260341619,  0.02161526843274, -0.02074045215285,  0.00594298065125,  0.00306428023191,  0.00012025322027,  0.00288463683916 },
-    { 0.05418656406430, -0.02911007808948, -0.00848709379851, -0.00851165645469, -0.00834990904936,  0.02245293253339, -0.02596338512915,  0.01624864962975, -0.00240879051584,  0.00674613682247, -0.00187763777362 },
-    { 0.15457299681924, -0.09331049056315, -0.06247880153653,  0.02163541888798, -0.05588393329856,  0.04781476674921,  0.00222312597743,  0.03174092540049, -0.01390589421898,  0.00651420667831, -0.00881362733839 },
-    { 0.30296907319327, -0.22613988682123, -0.08587323730772,  0.03282930172664, -0.00915702933434, -0.02364141202522, -0.00584456039913,  0.06276101321749, -0.00000828086748,  0.00205861885564, -0.02950134983287 },
-    { 0.33642304856132, -0.25572241425570, -0.11828570177555,  0.11921148675203, -0.07834489609479, -0.00469977914380, -0.00589500224440,  0.05724228140351,  0.00832043980773, -0.01635381384540, -0.01760176568150 },
-    { 0.44915256608450, -0.14351757464547, -0.22784394429749, -0.01419140100551,  0.04078262797139, -0.12398163381748,  0.04097565135648,  0.10478503600251, -0.01863887810927, -0.03193428438915,  0.00541907748707 },
-    { 0.56619470757641, -0.75464456939302,  0.16242137742230,  0.16744243493672, -0.18901604199609,  0.30931782841830, -0.27562961986224,  0.00647310677246,  0.08647503780351, -0.03788984554840, -0.00588215443421 },
-    { 0.58100494960553, -0.53174909058578, -0.14289799034253,  0.17520704835522,  0.02377945217615,  0.15558449135573, -0.25344790059353,  0.01628462406333,  0.06920467763959, -0.03721611395801, -0.00749618797172 },
-    { 0.53648789255105, -0.42163034350696, -0.00275953611929,  0.04267842219415, -0.10214864179676,  0.14590772289388, -0.02459864859345, -0.11202315195388, -0.04060034127000,  0.04788665548180, -0.02217936801134 }
-};
-
-const Float_t  AButter [9] [3] = {
-    { 1., -1.97223372919527, 0.97261396931306 },
-    { 1., -1.96977855582618, 0.97022847566350 },
-    { 1., -1.95835380975398, 0.95920349965459 },
-    { 1., -1.95002759149878, 0.95124613669835 },
-    { 1., -1.94561023566527, 0.94705070426118 },
-    { 1., -1.92783286977036, 0.93034775234268 },
-    { 1., -1.91858953033784, 0.92177618768381 },
-    { 1., -1.91542108074780, 0.91885558323625 },
-    { 1., -1.88903307939452, 0.89487434461664 }
-};
-
-const Float_t  BButter [9] [3] = {
-    { 0.98621192462708, -1.97242384925416, 0.98621192462708 },
-    { 0.98500175787242, -1.97000351574484, 0.98500175787242 },
-    { 0.97938932735214, -1.95877865470428, 0.97938932735214 },
-    { 0.97531843204928, -1.95063686409857, 0.97531843204928 },
-    { 0.97316523498161, -1.94633046996323, 0.97316523498161 },
-    { 0.96454515552826, -1.92909031105652, 0.96454515552826 },
-    { 0.96009142950541, -1.92018285901082, 0.96009142950541 },
-    { 0.95856916599601, -1.91713833199203, 0.95856916599601 },
-    { 0.94597685600279, -1.89195371200558, 0.94597685600279 }
-};
-
-#pragma warning ( default : 4305 )
-
-
-// set percentile
-
-static float  percentile      = 1. - RMS_PERCENTILE;
-static float  percentile_corr = 0.;
-
-void
-SetPercentile ( float value )
-{
-    percentile      = 1.f - value;
-    percentile_corr = ( log (0.05) - log (percentile) ) * 1.3;
-}
-
-
-// When calling this procedure, make sure that ip[-order] and op[-order] point to real data!
-
-static void
-Filter ( const Float_t* input, Float_t* output, size_t nSamples, const Float_t* a, const Float_t* b, size_t order )
-{
-    double  y;
-    size_t  i;
-    size_t  k;
-
-    for ( i = 0; i < nSamples; i++ ) {
-        y = input[i] * b[0];
-        for ( k = 1; k <= order; k++ )
-            y += input[i-k] * b[k] - output[i-k] * a[k];
-        output[i] = (Float_t)y;
-    }
-}
-
-// returns a INIT_GAIN_ANALYSIS_OK if successful, INIT_GAIN_ANALYSIS_ERROR if not
-
-int
-InitGainAnalysis ( long double samplefreq )
-{
-    int  i;
-
-    // zero out initial values
-    for ( i = 0; i < MAX_ORDER; i++ )
-        linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.;
-
-    switch ( (int)(samplefreq) ) {
-        case 48000: freqindex = 0; break;
-        case 44100: freqindex = 1; break;
-        case 32000: freqindex = 2; break;
-        case 24000: freqindex = 3; break;
-        case 22050: freqindex = 4; break;
-        case 16000: freqindex = 5; break;
-        case 12000: freqindex = 6; break;
-        case 11025: freqindex = 7; break;
-        case  8000: freqindex = 8; break;
-        default:    return INIT_GAIN_ANALYSIS_ERROR;
-    }
-
-    sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME);
-
-    linpre       = linprebuf + MAX_ORDER;
-    rinpre       = rinprebuf + MAX_ORDER;
-    lstep        = lstepbuf  + MAX_ORDER;
-    rstep        = rstepbuf  + MAX_ORDER;
-    lout         = loutbuf   + MAX_ORDER;
-    rout         = routbuf   + MAX_ORDER;
-
-    lsum         = 0.;
-    rsum         = 0.;
-    totsamp      = 0;
-    first        = !0;
-
-    memset ( A, 0, sizeof(A) );
-    memset ( B, 0, sizeof(B) );
-
-    return INIT_GAIN_ANALYSIS_OK;
-}
-
-
-// returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not
-
-static float  val_last = -1.e+37f;
-static float  pwr_last = 0.f;
-
-int
-AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels )
-{
-    const Float_t*  curleft;
-    const Float_t*  curright;
-    long            batchsamples;
-    long            cursamples;
-    long            cursamplepos;
-    int             i;
-
-    if ( num_samples == 0 )
-        return GAIN_ANALYSIS_OK;
-
-    cursamplepos = 0;
-    batchsamples = num_samples;
-
-    switch ( num_channels) {
-    case  1: right_samples = left_samples;
-    case  2: break;
-    default: return GAIN_ANALYSIS_ERROR;
-    }
-
-    if ( num_samples < MAX_ORDER ) {
-        memcpy ( linprebuf + MAX_ORDER, left_samples , num_samples * sizeof(Float_t) );
-        memcpy ( rinprebuf + MAX_ORDER, right_samples, num_samples * sizeof(Float_t) );
-    }
-    else {
-        memcpy ( linprebuf + MAX_ORDER, left_samples,  MAX_ORDER   * sizeof(Float_t) );
-        memcpy ( rinprebuf + MAX_ORDER, right_samples, MAX_ORDER   * sizeof(Float_t) );
-    }
-
-    while ( batchsamples > 0 ) {
-        cursamples = batchsamples > sampleWindow-totsamp  ?  sampleWindow - totsamp  :  batchsamples;
-        if ( cursamplepos < MAX_ORDER ) {
-            curleft  = linpre+cursamplepos;
-            curright = rinpre+cursamplepos;
-            if (cursamples > MAX_ORDER - cursamplepos )
-                cursamples = MAX_ORDER - cursamplepos;
-        }
-        else {
-            curleft  = left_samples  + cursamplepos;
-            curright = right_samples + cursamplepos;
-        }
-
-        Filter ( curleft , lstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER );
-        Filter ( curright, rstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER );
-
-        Filter ( lstep + totsamp, lout + totsamp, cursamples, AButter[freqindex], BButter[freqindex], BUTTER_ORDER );
-        Filter ( rstep + totsamp, rout + totsamp, cursamples, AButter[freqindex], BButter[freqindex], BUTTER_ORDER );
-
-        for ( i = 0; i < cursamples; i++ ) {             // Get the squared values
-            lsum += lout [totsamp+i] * lout [totsamp+i];
-            rsum += rout [totsamp+i] * rout [totsamp+i];
-        }
-
-        batchsamples -= cursamples;
-        cursamplepos += cursamples;
-        totsamp      += cursamples;
-        if ( totsamp == sampleWindow ) {  // Get the Root Mean Square (RMS) for this set of samples
-            double      val  = 0.5 * (lsum+rsum) / totsamp;
-            int         ival;
-
-
-#ifdef KLEMM
-            pwr_last = 0.875 * pwr_last + 0.125 * val;
-            val      = STEPS_per_dB * 10. * log10 ( pwr_last + 1.e-37 );
-#else
-            val      = STEPS_per_dB * 10. * log10 ( val + 1.e-37 );
-#endif
-            ival = (int) val;
-            if ( ival <                     0 ) ival = 0;
-            if ( ival >= sizeof(A)/sizeof(*A) ) ival = sizeof(A)/sizeof(*A) - 1;
-            A [ival]++;
-            lsum = rsum = 0.;
-            memmove ( loutbuf , loutbuf  + totsamp, MAX_ORDER * sizeof(Float_t) );
-            memmove ( routbuf , routbuf  + totsamp, MAX_ORDER * sizeof(Float_t) );
-            memmove ( lstepbuf, lstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) );
-            memmove ( rstepbuf, rstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) );
-            totsamp = 0;
-        }
-        if ( totsamp > sampleWindow )   // somehow I really screwed up: Error in programming! Contact author about totsamp > sampleWindow
-            return GAIN_ANALYSIS_ERROR;
-    }
-    if ( num_samples < MAX_ORDER ) {
-        memmove ( linprebuf,                           linprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(Float_t) );
-        memmove ( rinprebuf,                           rinprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(Float_t) );
-        memcpy  ( linprebuf + MAX_ORDER - num_samples, left_samples,          num_samples             * sizeof(Float_t) );
-        memcpy  ( rinprebuf + MAX_ORDER - num_samples, right_samples,         num_samples             * sizeof(Float_t) );
-    }
-    else {
-        memcpy  ( linprebuf, left_samples  + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) );
-        memcpy  ( rinprebuf, right_samples + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) );
-    }
-
-    return GAIN_ANALYSIS_OK;
-}
-
-
-static float
-AnalyzeResult ( Uint16_t* Array, size_t len )
-{
-    Uint32_t  elems;
-    Int32_t   upper;
-    size_t    i;
-
-    elems = 0;
-    for ( i = 0; i < len; i++ )
-        elems += Array[i];
-    if ( elems == 0 )
-        return 0.f;
-
-    upper = (Int32_t) ceil (elems * percentile);
-    for ( i = len; i-- > 0; ) {
-        if ( (upper -= Array[i]) <= 0 )
-            break;
-    }
-
-    return (float) (PINK_REF - (int)i / (float)STEPS_per_dB) + percentile_corr;
-}
-
-
-static float
-AnalyzeDynamic ( Uint16_t* Array, size_t len )
-{
-    Uint32_t  elems;
-    Int32_t   upper;
-    size_t    i;
-    size_t    j;
-
-    elems = 0;
-    for ( i = 0; i < len; i++ )
-        elems += Array[i];
-    if ( elems == 0 )
-        return 0.f;
-
-    upper = (Int32_t) ceil (elems * 0.05);
-    for ( i = len; i-- > 0; ) {
-        if ( (upper -= Array[i]) <= 0 )
-            break;
-    }
-
-    upper = (Int32_t) ceil (elems * 0.15);
-    for ( j = 0; j < len; j++ ) {
-        if ( (upper -= Array[j]) <= 0 )
-            break;
-    }
-    printf ("\n%5u %5u %6.2f dB\n", i, j, (i - j) / (float) STEPS_per_dB );
-    return (i - j) / (float) STEPS_per_dB;
-}
-
-
-float
-GetTitleDynamics ( void )
-{
-    return AnalyzeDynamic ( A, sizeof(A)/sizeof(*A) );
-}
-
-
-float
-GetTitleGain ( void )
-{
-    float  retval;
-    int    i;
-
-    retval = AnalyzeResult ( A, sizeof(A)/sizeof(*A) );
-
-    for ( i = 0; i < sizeof(A)/sizeof(*A); i++ ) {
-        B[i] += A[i];
-        A[i]  = 0;
-    }
-
-    for ( i = 0; i < MAX_ORDER; i++ )
-        linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.f;
-
-    totsamp  = 0;
-    lsum     = rsum = 0.;
-    val_last = -1.e+37;
-    pwr_last = 0.f;
-    return retval;
-}
-
-
-float
-GetAlbumGain ( void )
-{
-    return AnalyzeResult ( B, sizeof(B)/sizeof(*B) );
-}
-
-/* end of gain_analysis.c */
Index: penc/trunk/gain_analysis.h
===================================================================
--- /mppenc/trunk/gain_analysis.h	(revision 96)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change
- *  Copyright (C) 2001 David Robinson and Glen Sawyer
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  concept and filter values by David Robinson (David@Robinson.org)
- *    -- blame him if you think the idea is flawed
- *  coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
- *    -- blame him if you think this runs too slowly, or the coding is otherwise flawed
- *
- *  For an explanation of the concepts and the basic algorithms involved, go to:
- *    http://www.replaygain.org/
- */
-
-#ifndef GAIN_ANALYSIS_H
-#define GAIN_ANALYSIS_H
-
-#include <stddef.h>
-
-#define GAIN_NOT_ENOUGH_SAMPLES  -24601
-#define GAIN_ANALYSIS_ERROR           0
-#define GAIN_ANALYSIS_OK              1
-
-#define INIT_GAIN_ANALYSIS_ERROR      0
-#define INIT_GAIN_ANALYSIS_OK         1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef float  Float_t;         // Type used for filtering
-
-int     InitGainAnalysis ( long double samplefreq );
-int     AnalyzeSamples   ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
-float   GetTitleGain     ( void );
-float   GetAlbumGain     ( void );
-float   GetTitleDynamics ( void );
-void    SetPercentile    ( float value );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GAIN_ANALYSIS_H */
Index: penc/trunk/http.c
===================================================================
--- /mppenc/trunk/http.c	(revision 96)
+++ 	(revision )
@@ -1,489 +1,0 @@
-/*
- *   http.c
- *   Adapted from: Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include "mppdec.h"
-
-
-#ifdef USE_HTTP
-
-# define ACCEPT_HEAD  "Accept: audio/mpeg, audio/x-mpegurl, */*\r\n"
-# define PROGRAMNAME  "Mozilla/4.72P4"
-# define BUFFERLEN    1024
-
-
-typedef Uint32_t  IP_t;
-typedef Uint16_t  port_t;
-
-
-# ifdef ZEISS_PROXY
-char*         proxyurl       = "kdejenspi01.zeiss.de";
-IP_t          proxyip        = 0;
-char*         proxyport      = "8080";
-char*         proxyuser      = "zjfkl";
-char*         proxypasswd    = "hantel4";
-# else
-char*         proxyurl       = NULL;
-IP_t          proxyip        = 0;
-char*         proxyport      = NULL;
-char*         proxyuser      = NULL;
-char*         proxypasswd    = NULL;
-# endif /* ZEISS_PROXY */
-char*         httpauth       = NULL;
-char          httpauth1 [256];
-static char*  defaultportstr = "80";
-
-
-# ifndef _WIN32
-#  include <netdb.h>
-#  include <sys/param.h>
-#  include <sys/types.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-# else
-#  include <sys/types.h>
-# endif /* _WIN32 */
-
-# ifndef INADDR_NONE
-#  define INADDR_NONE  (IP_t)(-1)
-# endif
-
-#ifdef _WIN32
-
-static int
-Init_WinSocket ( void )
-{
-    WORD     VersionRequested;
-    WSADATA  wsaData;
-    int      err;
-
-    VersionRequested = MAKEWORD (2, 2);
-
-    err = WSAStartup ( VersionRequested, &wsaData );
-    if ( err != 0 ) {                                     // Tell the user that we could not find a usable WinSock DLL
-        stderr_printf ("Can't find WinSock DLL\n");
-        return -1;
-    }
-
-    // Confirm that the WinSock DLL supports 2.2.
-    // Note that if the DLL supports versions greater than 2.2 in addition to 2.2,
-    // it will still return 2.2 in Version since that is the version we requested.
-
-    if ( LOBYTE (wsaData.wVersion)  != 2  ||  HIBYTE (wsaData.wVersion) != 2 ) {
-        // Tell the user that we could not find a usable WinSock DLL.
-        stderr_printf ("Wrong version of WinSock DLL: %d.%d\n", HIBYTE (wsaData.wVersion), LOBYTE (wsaData.wVersion) );
-        WSACleanup ();
-        return -1;
-    }
-    return 0;
-}
-
-#endif
-
-static char*
-secure_calloc ( size_t size )
-{
-    char*  p = (char*) calloc ( size, 1 );
-
-    if ( p == NULL ) {
-        stderr_printf ("\n"PROG_NAME": Out of memory, aborting...\n");
-        _exit (1);
-    }
-    return p;
-}
-
-
-static int
-writestring ( int fd, const char* string )
-{
-    int     result;
-    size_t  bytes = strlen (string);
-
-    while ( bytes > 0 ) {
-        if ( (result = WRITE_SOCKET (fd, string, bytes)) < 0  &&  errno != EINTR ) {
-            stderr_printf ("\n"PROG_NAME": write to socket: %s\n", strerror (errno) );
-            return -1;
-        }
-        else if (result == 0) {
-            stderr_printf ("\n"PROG_NAME": write to socket: %s\n", "socket closed unexpectedly");
-            return -1;
-        }
-        string += result;
-        bytes  -= result;
-    }
-    return 0;
-}
-
-static int
-readstring ( char* string, size_t maxlen, int fd )
-{
-    size_t  pos = 0;
-
-    while (1) {
-        if ( READ_SOCKET ( fd, string + pos, 1) == 1 ) {
-            if ( string [pos++] == '\n' ) {
-                string [pos]   = '\0';
-                return 0;
-            } else if ( pos+2 >= maxlen ) {
-                string [pos++] = '\n';
-                string [pos]   = '\0';
-                return 0;
-            }
-        }
-        else if ( errno != EINTR ) {
-            stderr_printf ("\n"PROG_NAME": read from socket: Error reading from socket or unexpected EOF\n");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-
-static void
-encode64 ( const unsigned char* src, char* dst )
-{
-    static const char  Base64Digits [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-    int                ssiz            = strlen (src);
-    int                i;
-    Uint32_t           buf;
-
-    for ( i = 0 ; i < ssiz ; i += 3 ) {
-        buf      = src [i+0] << 16;
-        if ( i+1 < ssiz )
-            buf |= src [i+1] <<  8;
-        if ( i+2 < ssiz )
-            buf |= src [i+2] <<  0;
-
-        *dst++ =                Base64Digits [(buf >> 18) & 63];
-        *dst++ =                Base64Digits [(buf >> 12) & 63];
-        *dst++ = i+1 < ssiz  ?  Base64Digits [(buf >>  6) & 63]  :  '=';
-        *dst++ = i+2 < ssiz  ?  Base64Digits [(buf >>  0) & 63]  :  '=';
-    }
-    *dst++ = '\0';
-    return;
-}
-
-
-/*
- *  Extracts a user name from URL while removing the user name from the string.
- *  Input  has the form "http://user@..."
- *  Output has the form "http://..."  and "user" is copied to auth
- */
-
-static int
-getauthfromURL ( char* url, char* auth )  /* VERY simple auth-from-URL grabber */
-{
-    char*  pos;
-    int    i;
-
-    *auth = '\0';
-
-    if      ( 0 == strncasecmp (url, "http://", 7) )
-        url += 7;
-    else if ( 0 == strncasecmp (url, "ftp://" , 6) )
-        url += 6;
-
-    if ( (pos = strchr (url, '@')) != NULL ) {
-        for ( i = 0; i < pos-url; i++ ) {
-            if ( url [i] == '/' )
-                return 0;
-        }
-        strncpy ( auth, url, pos-url );
-        auth [pos - url] = '\0';
-        strcpy ( url, pos+1 );
-        return 1;
-    }
-    return 0;
-}
-
-
-static char*
-url2hostport ( char* url, char** hostname, IP_t* hip, char** port )
-{
-    char*   h;
-    char*   p;
-    char*   hostptr;
-    char*   r_hostptr;
-    char*   pathptr;
-    char*   portptr;
-    char*   p0;
-    size_t  stringlength;
-
-    p = url;
-    if       ( 0 == strncasecmp (p, "http://", 7) )
-        p += 7;
-    else  if ( 0 == strncasecmp (p, "ftp://" , 6) )
-        p += 6;
-    hostptr = p;                                        // hostptr points to the hostname, usually a "www..." or "ftp...."
-
-    while ( *p != '\0'  &&  *p != '/' )
-        p++;
-    pathptr = p;                                        // pathptr points to the first '/' after the hostname, usually a "/pub/..."
-
-    r_hostptr = --p;
-    while ( p > hostptr  &&  *p != ':'  &&  *p != ']' ) // ']' for IPv6, IPv6 is separated by ':', so the host is encapsulated by "[]", i.e. "http://[1080::8:800:200C:417A]:80/"
-        p--;
-
-    if ( p == hostptr  ||  *p != ':' ) {                // "http:/1080::8:800:200C:417A/..." is wrong parsed
-        portptr   = NULL;
-    }
-    else {
-        portptr   = p + 1;
-        r_hostptr = p - 1;
-    }
-
-    if ( *hostptr == '['  &&  *r_hostptr == ']' ) {
-        hostptr  ++;
-        r_hostptr--;
-    }
-
-    stringlength = r_hostptr - hostptr + 1;
-    h = secure_calloc ( stringlength + 1 );
-    memcpy ( h, hostptr, stringlength );
-    *hostname = h;
-
-    if ( portptr != NULL ) {
-        stringlength = pathptr - portptr;
-        if (stringlength == 0)
-            portptr = NULL;
-    }
-
-    if ( portptr == NULL ) {
-        portptr      = defaultportstr;
-        stringlength = strlen (defaultportstr);
-    }
-
-    p0 = secure_calloc (stringlength + 1);
-    memcpy ( p0, portptr, stringlength );
-
-    for ( p = p0; *p != '\0'  &&  isdigit (*p); p++ )
-        ;
-
-    *p    = '\0';
-    *port = p0;
-
-    return pathptr;
-}
-
-
-int
-http_open ( const char* url )
-{
-    char*               purl;
-    char*               hostname  = NULL;
-    char*               request;
-    char*               sptr;
-    int                 linelength;
-    IP_t                myip;
-    char*               myport    = NULL;
-    int                 sock;
-    int                 relocate;
-    int                 numrelocs = 0;
-    int                 i;
-    int                 j;
-# ifdef USE_IPv4_6
-    struct addrinfo     hints;
-    struct addrinfo*    res;
-    struct addrinfo*    res0;
-    int                 error;
-# else
-    struct hostent*     hp;
-    struct sockaddr_in  sin;
-# endif
-
-#ifdef _WIN32
-    static int          init = 0;
-
-    if ( init == 0  &&  Init_WinSocket () != 0 )
-        return -1;
-    init = 1;
-#endif
-
-    if ( strchr ( url, '/' ) == NULL )
-        return -1;
-
-    proxyport = NULL;
-
-    if ( proxyip == 0L ) {
-        if ( proxyurl == NULL )
-            if ( (proxyurl = getenv ("MP3_HTTP_PROXY")) == NULL )
-                if ( (proxyurl = getenv ("http_proxy")) == NULL )
-                    proxyurl = getenv ("HTTP_PROXY");
-        if ( proxyurl != NULL  &&  proxyurl[0]  &&  strcmp (proxyurl, "none") ) {
-            if ( url2hostport (proxyurl, &hostname, &proxyip, &proxyport) == NULL ) {
-                stderr_printf ("\n"PROG_NAME": Unknown proxy host \"%s\".\n", hostname ? hostname : "" );
-                return -1;
-            }
-        }
-        else {
-            proxyip = INADDR_NONE;
-        }
-    }
-
-
-    if ( proxyip == INADDR_NONE )
-        if ( 0 == strncasecmp (url, "ftp://", 6) ) {
-            stderr_printf ("\n"PROG_NAME": Downloading from ftp servers without PROXY not allowed\n" );
-            return -1;
-        }
-
-    linelength = strlen (url) + BUFFERLEN;
-    request    = secure_calloc (linelength);
-    purl       = secure_calloc (BUFFERLEN);
-
-    // copying url to purl while converting special characters
-    i = j = 0;
-    do {
-        switch ( url[i] ) {
-        case ' ': purl [j++] = '%', purl [j++] = '2', purl [j++] = '0'; break;
-        default : purl [j++] = url [i];                                 break;
-        }
-    } while ( url [i++] != '\0' );
-
-    getauthfromURL ( purl, httpauth1 );
-
-    do {
-        strcpy ( request, "GET ");
-        if ( proxyip != INADDR_NONE ) {
-            if ( strncasecmp (url, "http://", 7) != 0  &&  strncasecmp (url, "ftp://", 6) != 0 )
-                strcat ( request, "http://");
-            strcat ( request, purl);
-            myport = proxyport;
-            myip   = proxyip;
-        }
-        else {
-            if ( hostname != NULL ) {
-                free (hostname);
-                hostname = NULL;
-            }
-            if ( proxyport != NULL ) {
-                free (proxyport);
-                proxyport = NULL;
-            }
-            if ( (sptr = url2hostport (purl, &hostname, &myip, &myport)) == NULL ) {
-                stderr_printf ("\n"PROG_NAME": Unknown host \"%s\".\n", hostname ? hostname : "");
-                return -1;
-            }
-            strcat ( request, sptr);
-        }
-        sprintf ( request + strlen (request), " HTTP/1.0\r\nUser-Agent: %s\r\n", PROGRAMNAME );
-        if ( hostname != NULL )
-            sprintf ( request + strlen(request), "Host: %s:%s\r\n", hostname, myport);
-
-        strcat ( request, ACCEPT_HEAD);
-
-# ifdef USE_IPv4_6
-
-        memset ( &hints, 0, sizeof(hints) );
-        hints.ai_socktype = SOCK_STREAM;
-        error = getaddrinfo ( hostname, myport, &hints, &res0 );
-        if ( error != 0 ) {
-            stderr_printf ("\n"PROG_NAME": getaddrinfo: %s\n", gai_strerror (error) );
-            return -1;
-        }
-
-        sock = -1;
-        for ( res = res0; res != NULL; res = res->ai_next ) {
-            if ((sock = socket (res->ai_family, res->ai_socktype, res->ai_protocol)) < 0)
-                continue;
-
-            if ( connect (sock, res->ai_addr, res->ai_addrlen) != 0 ) {
-                close (sock);
-                sock = -1;
-                continue;
-            }
-            break;
-        }
-
-        freeaddrinfo (res0);
-
-# else /* USE_IPv4_6 */
-
-        if ( (hp = gethostbyname (hostname)) == NULL )
-            goto fail;
-        if ( hp->h_length != sizeof (sin.sin_addr) )
-            goto fail;
-        if ( (sock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 )
-            goto fail;
-        memset ( &sin, 0, sizeof(sin) );
-        sin.sin_family = AF_INET;
-        /* sin.sin_len = sizeof (struct sockaddr_in); */
-        memcpy ( &sin.sin_addr, hp->h_addr, hp->h_length );
-        sin.sin_port = htons ( (unsigned short) atoi (myport) );
-        if ( connect ( sock, (struct sockaddr*)&sin, sizeof (struct sockaddr_in) ) < 0 ) {
-            close (sock);
-            goto fail;
-        }
-
-# endif /* USE_IPv4_6 */
-
-        if ( sock < 0 ) {
-            fail:
-            stderr_printf ("\n"PROG_NAME": Could not open/connect socket: %s\n", strerror (errno) );
-            return -1;
-        }
-
-        if ( strlen (httpauth1) > 0  ||  httpauth != NULL ) {
-            char  buf [BUFFERLEN - 1];
-
-            strcat ( request, "Authorization: Basic ");
-            if ( strlen (httpauth1) > 0 )
-                encode64 ( httpauth1, buf );
-            else
-                encode64 ( httpauth , buf );
-            strcat ( request, buf );
-            strcat ( request, "\r\n" );
-        }
-        strcat ( request, "\r\n" );
-
-        writestring ( sock, request );
-        *purl = '\0';
-        readstring ( request, linelength-1, sock );
-        relocate = 0;
-        if ( (sptr = strchr ( request, ' ')) != NULL ) {
-            switch ( sptr [1] ) {
-            case '3':
-                relocate = 1;
-            case '2':
-                break;
-            default:
-                stderr_printf ("\n"PROG_NAME": HTTP request failed:%s", sptr ); /* ' ' and '\n' is included */
-                return -1;
-            }
-        }
-
-        do {
-            readstring ( request, linelength-1, sock );
-            if ( 0 == strncmp ( request, "Location:", 9) )
-                strncpy ( purl, request+10, BUFFERLEN - 1 );
-        } while ( request [0] != '\r'  &&  request [0] != '\n' );
-
-    } while ( relocate != 0  &&  purl[0] != '\0'  &&  numrelocs++ < 5 );
-
-    if ( relocate ) {
-        stderr_printf ("\n"PROG_NAME": Too many HTTP relocations.\n");
-        return -1;
-    }
-
-    free (purl);
-    free (request);
-    free (hostname);
-    free (proxyport);
-    free (myport);
-
-#ifdef _WIN32
-    return sock + 0x4000;
-#else
-    return sock;
-#endif
-}
-
-#endif /* USE_HTTP */
-
-/* end of http.c */
Index: penc/trunk/huffman.c
===================================================================
--- /mppenc/trunk/huffman.c	(revision 96)
+++ 	(revision )
@@ -1,463 +1,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
-#include <stdlib.h>
-
-#define BASE    "website/sv8/"
-
-
-const char*  MemberOf   = "";
-const char*  ReturnLink = "";
-FILE*        fp_c;
-FILE*        fp_html;
-
-
-typedef struct _Code_t {
-    long double      Probability;
-    unsigned long    CodeWord;
-    unsigned long    Power;
-    unsigned short   CodeNumber;
-    unsigned char    Bits;
-    struct _Code_t*  l1;
-    struct _Code_t*  l2;
-} Code_t;
-
-
-static int
-cmpfn_1 ( const void* p1, const void* p2 )
-{
-    if ( ((const Code_t*)p1)->Probability < ((const Code_t*)p2)->Probability )
-        return +1;
-    if ( ((const Code_t*)p1)->Probability > ((const Code_t*)p2)->Probability )
-        return -1;
-    return 0;
-}
-
-
-static int
-cmpfn_2 ( const void* p1, const void* p2 )
-{
-    if ( ((const Code_t*)p1)->Bits < ((const Code_t*)p2)->Bits )
-        return -1;
-    if ( ((const Code_t*)p1)->Bits > ((const Code_t*)p2)->Bits )
-        return +1;
-    if ( ((const Code_t*)p1)->CodeNumber < ((const Code_t*)p2)->CodeNumber )
-        return -1;
-    if ( ((const Code_t*)p1)->CodeNumber > ((const Code_t*)p2)->CodeNumber )
-        return +1;
-    return 0;
-}
-
-
-static int
-cmpfn_3 ( const void* p1, const void* p2 )
-{
-    if ( ((const Code_t*)p1)->CodeNumber < ((const Code_t*)p2)->CodeNumber )
-        return -1;
-    if ( ((const Code_t*)p1)->CodeNumber > ((const Code_t*)p2)->CodeNumber )
-        return +1;
-    return 0;
-}
-
-
-static Code_t  Codes  [729 * 729 * 2];
-
-
-static void
-CountBits ( Code_t* p, int no )
-{
-    if ( p -> l1  &&  p -> l2 ) {
-        CountBits ( p -> l1, no+1 );
-        CountBits ( p -> l2, no+1 );
-    }
-    else if ( p -> l1  ||  p -> l2 ) {
-        fprintf ( stderr, "Error in Huffman Tree\n" );
-    }
-    else {
-        p -> Bits = no;
-    }
-}
-
-
-const char*
-Graph ( unsigned long x, int n )
-{
-    static char  buff [128];
-    char*        p = buff;
-    int          i;
-
-    for ( i = 0; i < n; i++ ) {
-        if ( (i & 7) == 7 )
-            *p++ = '<', *p++ = 'b', *p++ = '>';
-        *p++ = x & (0x80000000 >> i) ? '#' : '.';
-        if ( (i & 7) == 7 )
-            *p++ = '<', *p++ = '/', *p++ = 'b', *p++ = '>';
-    }
-    *p = '\0';
-    return buff;
-}
-
-
-void
-compute_type1 ( long double* p, int min, int max, int coupling, int maxcodes )
-{
-    int            i;
-    int            i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11;
-    int            cnt;
-    long double    Sum;
-    long double    ProbabilityS;
-    long double    ProbabilityH;
-    long double    Huffman;
-    long double    Shannon;
-    long double    Power;
-    unsigned long  Code;
-
-    for ( i = 0; i < sizeof(Codes)/sizeof(*Codes); i++ ) {
-        Codes [i].CodeNumber  = i;
-        Codes [i].Probability = 0.;
-        Codes [i].Bits        = 255;
-        Codes [i].CodeWord    = 0x00000000;
-        Codes [i].l1          = NULL;
-        Codes [i].l2          = NULL;
-    }
-
-    cnt = 0;
-    switch ( coupling ) {
-    case 12:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ )
-                                    for ( i7 = min; i7 <= max; i7++ )
-                                        for ( i8 = min; i8 <= max; i8++ )
-                                            for ( i9 = min; i9 <= max; i9++ )
-                                                for ( i10 = min; i10 <= max; i10++ )
-                                                    for ( i11 = min; i11 <= max; i11++ ) {
-                                                    Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6] * p[i7] * p[i8] * p[i9] * p [i10] * p[i11];
-                                                    Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6 + i7*i7 + i8*i8 + i9*i9 + i10*i10 + i11*i11;
-                                                    cnt++;
-                                                }
-        break;
-
-    case 11:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ )
-                                    for ( i7 = min; i7 <= max; i7++ )
-                                        for ( i8 = min; i8 <= max; i8++ )
-                                            for ( i9 = min; i9 <= max; i9++ )
-                                                for ( i10 = min; i10 <= max; i10++ ) {
-                                                    Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6] * p[i7] * p[i8] * p[i9] * p [i10];
-                                                    Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6 + i7*i7 + i8*i8 + i9*i9 + i10*i10;
-                                                    cnt++;
-                                                }
-        break;
-
-    case 10:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ )
-                                    for ( i7 = min; i7 <= max; i7++ )
-                                        for ( i8 = min; i8 <= max; i8++ )
-                                            for ( i9 = min; i9 <= max; i9++ ) {
-                                                Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6] * p[i7] * p[i8] * p[i9];
-                                                Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6 + i7*i7 + i8*i8 + i9*i9;
-                                                cnt++;
-                                            }
-        break;
-
-    case 9:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ )
-                                    for ( i7 = min; i7 <= max; i7++ )
-                                        for ( i8 = min; i8 <= max; i8++ ) {
-                                            Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6] * p[i7] * p[i8];
-                                            Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6 + i7*i7 + i8*i8;
-                                            cnt++;
-                                        }
-        break;
-
-    case 8:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ )
-                                    for ( i7 = min; i7 <= max; i7++ ) {
-                                        Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6] * p[i7];
-                                        Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6 + i7*i7;
-                                        cnt++;
-                                    }
-        break;
-
-    case 7:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ )
-                                for ( i6 = min; i6 <= max; i6++ ) {
-                                    Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5] * p[i6];
-                                    Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5 + i6*i6;
-                                    cnt++;
-                                }
-        break;
-
-    case 6:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ )
-                            for ( i5 = min; i5 <= max; i5++ ) {
-                                Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4] * p[i5];
-                                Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4 + i5*i5;
-                                cnt++;
-                            }
-        break;
-
-    case 5:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ )
-                        for ( i4 = min; i4 <= max; i4++ ) {
-                            Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3] * p[i4];
-                            Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3 + i4*i4;
-                            cnt++;
-                        }
-        break;
-
-    case 4:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ )
-                    for ( i3 = min; i3 <= max; i3++ ) {
-                        Codes [cnt].Probability = p[i0] * p[i1] * p[i2] * p[i3];
-                        Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2 + i3*i3;
-                        cnt++;
-                    }
-        break;
-
-    case 3:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ )
-                for ( i2 = min; i2 <= max; i2++ ) {
-                    Codes [cnt].Probability = p[i0] * p[i1] * p[i2];
-                    Codes [cnt].Power       = i0*i0 + i1*i1 + i2*i2;
-                    cnt++;
-                }
-        break;
-
-    case 2:
-        for ( i0 = min; i0 <= max; i0++ )
-            for ( i1 = min; i1 <= max; i1++ ) {
-                Codes [cnt].Probability = p[i0] * p[i1];
-                Codes [cnt].Power       = i0*i0 + i1*i1;
-                cnt++;
-            }
-        break;
-
-    case 1:
-        for ( i0 = min; i0 <= max; i0++ ) {
-            Codes [cnt].Probability = p[i0];
-            Codes [cnt].Power       = i0*i0;
-            cnt++;
-        }
-        break;
-    }
-
-    qsort ( Codes, cnt, sizeof(*Codes), cmpfn_1 );
-
-    if ( cnt < maxcodes )
-        fprintf ( stderr, "Error: Too less codes generated: max possible: %u, requested: %u\n", cnt, maxcodes );
-
-    for ( Sum = 0., i = maxcodes; --i >= 0; )
-        Sum += Codes [i].Probability;
-
-    for ( i = maxcodes; --i >= 0; )
-        Codes [i].Probability /= Sum;
-
-    for ( Sum = 0., i = maxcodes; --i >= 1; )
-        Sum += Codes [i].Probability;
-
-    Codes [0].Probability = 1. - Sum;
-
-    for ( i = maxcodes-2; i >= 0; i-- ) {
-        //fprintf ( stderr, "Merge %3u and %3u -> %3u (%7.3f%% + %7.3f%% = %7.3f%%)\n", i+0, i+1, i+0, 100 * Codes [i+0].Probability, 100 * Codes [i+1].Probability, 100 * Codes [i+0].Probability + 100 * Codes [i+1].Probability );
-        Codes [i+i+2]            = Codes   [i+0];
-        Codes [i+i+3]            = Codes   [i+1];
-        Codes [i+0].Probability += Codes   [i+1].Probability;
-        Codes [i+0].l1           = Codes + (i+i+2);
-        Codes [i+0].l2           = Codes + (i+i+3);
-        qsort ( Codes, i+1, sizeof(*Codes), cmpfn_1 );
-    }
-    CountBits ( Codes, 0 );
-
-    qsort ( Codes, 2*maxcodes, sizeof(*Codes), cmpfn_2 );
-
-    ProbabilityS = 0.;
-    ProbabilityH = 0.;
-    Huffman      = 0.;
-    Shannon      = 0.;
-    Power        = 0.;
-    for ( i = 0; i < maxcodes; i++ ) {
-        double  ps = Codes [i].Probability;
-        double  ph = 1. / ( 1LU << Codes [i].Bits );
-
-        ProbabilityS += ps;
-        Shannon      -= ps * log (ps) / log (2.);
-        Power        += Codes [i].Power * ps;
-        ProbabilityH += ph;
-        Huffman      -= ps * log (ph) / log (2.);
-    }
-    fprintf ( fp_c, "    //\n" );
-    fprintf ( fp_c, "    // Probability = %9.5f%% (Huffman), %9.5f%% (Shannon)\n", (double)(100 * ProbabilityH), (double)(100 * ProbabilityS) );
-    fprintf ( fp_c, "    // Huffman     = %9.5f bit/sample\n", (double)(Huffman/coupling)  );
-    fprintf ( fp_c, "    // Shannon     = %9.5f bit/sample\n", (double)(Shannon/coupling)  );
-    fprintf ( fp_c, "    // Huffman Loss= %9.5f bit/sample\n", (double)((Huffman-Shannon)/coupling)  );
-    fprintf ( fp_c, "    // Effective V = %9.5f\n",            sqrt (Power/coupling)  );
-    fprintf ( fp_c, "    //\n" );
-
-    fprintf ( stderr, "Huffman %9.5f  ", (double)(Huffman/coupling)  );
-    fprintf ( stderr, "Shannon %9.5f  ", (double)(Shannon/coupling)  );
-    fprintf ( stderr, "Loss %10.3f  ",   (double)(1000*(Huffman-Shannon)/coupling)  );
-    fprintf ( stderr, "Eff %9.5f  ",     (double)(sqrt (Power/coupling))  );
-
-    Code = 0;
-    for ( i = 0; i < maxcodes; i++ ) {
-        Codes [i].CodeWord = Code;
-        Code              += 0x80000000 >> (Codes [i].Bits - 1);
-    }
-
-    qsort ( Codes, maxcodes, sizeof(*Codes), cmpfn_3 );
-
-    for ( i = 0; i < maxcodes; i++ ) {
-        fprintf ( fp_c, "    { 0x%08lX, %2u },\t// Code %3u, %2u bits, %8.5f%%\n", Codes[i].CodeWord, Codes [i].Bits, Codes [i].CodeNumber, Codes [i].Bits, (double)(100 * Codes [i].Probability) );
-        fprintf ( fp_html, "    <tr> <td align=\"right\"> %3d&nbsp;</td> <td align=\"right\"> <tt><b> %08lX&nbsp;</b></tt> </td> <td align=\"right\"> %2u&nbsp;</td> <td align=\"right\"> %5.2f%%&nbsp;</td> <td><font color=\"#DDDDDD\">&nbsp;<tt>%s</tt>&nbsp;</font></td> </tr>\n",
-                  Codes [i].CodeNumber, Codes[i].CodeWord, Codes [i].Bits, (double)(100 * Codes [i].Probability), Graph (Codes[i].CodeWord, Codes [i].Bits) );
-    }
-}
-
-
-void
-generate_type1 ( const char* basename, int min, int max, double deviation, double exponent, double offset, int coupling, int maxcodes )
-{
-    long double    table [513];
-    char           FileName [128];
-    int            i;
-
-    sprintf ( FileName, BASE "%s.html", basename );
-    fp_html = fopen ( FileName, "wb" );
-
-    memset ( table, 0, sizeof table );
-    for ( i = min; i <= max; i++ ) {
-        long double  tmp = i ? pow (fabs ((i+offset)/deviation), exponent) : 0.;
-        table [i + 256] = tmp <= 200. ? exp (-tmp) : 0.;
-        fprintf ( stderr, "%5.2f ", (double)(99.99*table [i + 256]) );
-    }
-    fprintf ( stderr, "\n");
-    fprintf (fp_c, "const HuffmanCode_t  %s [%3u] = {\n", basename, maxcodes );
-    fprintf (stderr, "%-10.10s: ", basename );
-
-    fprintf (fp_html,
-        "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n"
-        "<html>\n"
-        "<head>\n"
-        "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"
-        "    <meta name=\"Author\" content=\"Frank Klemm\">\n"
-        "    <title>Huffman Code table: %s</title>\n"
-        "</head>\n"
-        "<body text=\"#FFFFFF\" bgcolor=\"#254E31\" link=\"#33CCFF\" vlink=\"#33CCFF\" alink=\"#FF0000\" background=\"../img/back-2.gif\">\n"
-        "\n"
-        "<br>\n", basename );
-
-    fprintf (fp_html,
-        "<font size=\"+1\" color=\"#FFD486\"><b>Huffman Code table: &nbsp; %s</b></font><br>\n"
-        "\n"
-        "<p><p>Member of <a href=\"%s.html\">%s</a>\n"
-        "\n"
-        "<p>\n"
-        "\n"
-        "<hr align=\"left\" width=\"512\"> <!------------------------------------------------------------->\n"
-        "\n", basename, ReturnLink, MemberOf );
-
-    fprintf (fp_html, "<p><table border=\"3\" bgcolor=\"20442B\">\n" );
-
-    fprintf (fp_html, "    <tr> <td> &nbsp; Code &nbsp; </td> <td> &nbsp; Huffman code &nbsp; </td> <td> &nbsp; Bits &nbsp; </td> <td> &nbsp; Probability &nbsp; </td> <td> &nbsp; Encoded bits &nbsp; </td> </tr>\n" );
-    fprintf (fp_html, "    <tr> </tr>\n" );
-
-
-    compute_type1 ( table+256, min, max, coupling, maxcodes );
-
-    fprintf (fp_html, "</table>" );
-
-    fprintf (fp_html,
-        "<p>\n"
-        "\n"
-        "<hr align=\"left\" width=\"512\"> <!------------------------------------------------------------->\n"
-        "\n"
-        "<a href=\"mailto:pfk@uni-jena.de\"><img alt=\"[eMail]\" SRC=\"../img/E-Mail.gif\" BORDER=0 height=60 width=55 align=CENTER></a>&nbsp;<a href=\"mailto:pfk@uni-jena.de\">Frank.Klemm@uni-jena.de</a>\n"
-        "\n"
-        "</body>\n"
-        "</html>\n" );
-
-    fprintf (stderr, "\n" );
-    fprintf (fp_c, "};\n\n" );
-    fflush (fp_c);
-
-    fclose (fp_html);
-}
-
-
-int
-main ( void )
-{
-    fp_c = fopen ( BASE "huffman_codes.c", "wb" );
-
-    MemberOf   = "Quantized Subband Samples";
-    ReturnLink = "subbandsample";
-
-    fprintf ( fp_c, "\n#include \"huffman_codes.h\"\n\n\n" );
-
-    generate_type1 ( "table_0X",  -1,  +1, 0.5600, 2.0, 0.0, 9, 163 );
-    generate_type1 ( "table_03",  -1,  +1, 0.6024, 2.0, 0.0, 6,  73 );
-    generate_type1 ( "table_04",  -1,  +1, 0.7650, 2.0, 0.0, 4,  81 );
-    generate_type1 ( "table_05",  -1,  +1, 0.9200, 1.5, 0.0, 3,  27 );
-    generate_type1 ( "table_06",  -2,  +2, 1.0000, 2.0, 0.0, 3, 125 );
-    generate_type1 ( "table_07",  -2,  +2, 1.0000, 1.5, 0.0, 2,  25 );
-    generate_type1 ( "table_08",  -3,  +3, 1.8700, 2.9, 0.0, 2,  49 );
-    generate_type1 ( "table_09",  -4,  +4, 2.6100, 3.0, 0.0, 2,  81 );
-    generate_type1 ( "table_10",  -5,  +5, 3.8000, 3.0, 0.0, 2, 121 );
-    generate_type1 ( "table_01", -16, +15, 5.2000, 3.0, 0.5, 1,  32 );
-    generate_type1 ( "table_02", -16, +15, 6.4000, 2.0, 0.5, 1,  32 );
-    generate_type1 ( "table_11",  -6,  +6, 2.6700, 2.8, 0.0, 1,  13 );
-
-    MemberOf   = "Allocation";
-    ReturnLink = "allocation";
-    generate_type1 ( "table_20", -16, +16, 1.4800, 1.0, 0.0, 1,  33 );
-
-    fprintf (fp_c, "/* end of huffman_codes.c */\n" );
-    fclose (fp_c);
-
-    return 0;
-}
Index: penc/trunk/huffman.vcproj
===================================================================
--- /mppenc/trunk/huffman.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="huffman"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/huffman.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/huffman.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/huffman.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/huffman.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/huffman.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/huffman.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/huffman.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/huffman.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="huffman.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/huffsv46.c
===================================================================
--- /mppenc/trunk/huffsv46.c	(revision 96)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppdec.h"
-
-static Huffman_t   Entropie_1    [ 3];
-static Huffman_t   Entropie_2    [ 5];
-static Huffman_t   Entropie_3    [ 7];
-static Huffman_t   Entropie_4    [ 9];
-static Huffman_t   Entropie_5    [15];
-static Huffman_t   Entropie_6    [31];
-static Huffman_t   Entropie_7    [63];
-Huffman_t          SCFI_Bundle   [ 8];
-Huffman_t          DSCF_Entropie [13];
-static Huffman_t   Region_A      [16];
-static Huffman_t   Region_B      [ 8];
-static Huffman_t   Region_C      [ 4];
-
-const Huffman_t*  Entropie      [18] = {
-    NULL      , Entropie_1, Entropie_2, Entropie_3, Entropie_4, Entropie_5,
-    Entropie_6, Entropie_7, NULL      , NULL      , NULL      , NULL      ,
-    NULL      , NULL      , NULL      , NULL      , NULL      , NULL      ,
-};
-
-const Huffman_t*  Region        [32] = {
-    Region_A, Region_A, Region_A, Region_A, Region_A, Region_A, Region_A, Region_A,
-    Region_A, Region_A, Region_A, Region_B, Region_B, Region_B, Region_B, Region_B,
-    Region_B, Region_B, Region_B, Region_B, Region_B, Region_B, Region_B, Region_C,
-    Region_C, Region_C, Region_C, Region_C, Region_C, Region_C, Region_C, Region_C
-};
-
-static const HuffSrc_t   SCFI_Bundle_src [8] = {
-    { 11, 6 }, { 7, 5 }, { 6, 5 }, { 1, 2 }, { 4, 5 }, { 0, 3 }, { 10, 6 }, { 1, 1 },
-};
-
-static const HuffSrc_t   Region_A_src [16] = {
-    {   2, 3 }, {   1, 1 }, {   0,  2 }, {  15,  5 }, {   29,  6 }, {   13,  5 }, {   12,  5 }, {   57,  7 },
-    { 113, 8 }, { 225, 9 }, { 449, 10 }, { 897, 11 }, { 1793, 12 }, { 3585, 13 }, { 7169, 14 }, { 7168, 14 },
-};
-
-static const HuffSrc_t   Region_B_src [ 8] = {
-    { 1, 2 }, { 1, 1 }, { 1, 3 }, { 1, 4 }, { 1, 5 }, { 1, 6 }, { 1, 7 }, { 0, 7 },
-};
-
-static const HuffSrc_t   Region_C_src [ 4] = {
-    { 1, 1 }, { 1, 2 }, { 1, 3 }, { 0, 3 },
-};
-
-static const HuffSrc_t   DSCF_Entropie_src [13] = {
-    { 20, 6 }, { 11, 5 }, {  4, 4 }, { 24, 5 }, { 11, 4 }, {  4, 3 }, { 0, 2 },
-    {  7, 3 }, {  3, 3 }, { 13, 4 }, { 10, 4 }, { 25, 5 }, { 21, 6 },
-};
-
-static const HuffSrc_t   Entropie_1_src [3] = {
-    { 1, 2 }, { 1, 1 }, { 0, 2 },
-};
-
-static const HuffSrc_t   Entropie_2_src [5] = {
-    { 4, 3 }, { 0, 2 }, { 3, 2 }, { 1, 2 }, { 5, 3 },
-};
-
-static const HuffSrc_t   Entropie_3_src [7] = {
-    { 17, 5 }, { 5, 3 }, { 1, 2 }, { 3, 2 }, { 0, 2 }, { 9, 4 }, { 16, 5 },
-};
-
-static const HuffSrc_t   Entropie_4_src [9] = {
-    { 5, 4 }, { 14, 4 }, { 3, 3 }, { 5, 3 }, { 0, 2 }, { 6, 3 }, { 4, 3 }, { 15, 4 }, { 4, 4 },
-};
-
-static const HuffSrc_t   Entropie_5_src [15] = {
-    { 57, 6 }, { 23, 5 }, { 29, 5 }, {  3, 4 }, { 13, 4 }, { 15, 4 }, {  2, 3 }, { 4, 3 },
-    {  3, 3 }, {  0, 3 }, { 12, 4 }, { 10, 4 }, {  2, 4 }, { 22, 5 }, { 56, 6 },
-};
-
-static const HuffSrc_t   Entropie_6_src [31] = {
-    {  8, 7 }, { 88, 7 }, { 40, 6 }, {  5, 6 }, { 45, 6 }, { 56, 6 }, {  9, 5 }, { 23, 5 },
-    { 24, 5 }, { 27, 5 }, { 29, 5 }, { 31, 5 }, {  3, 4 }, {  2, 4 }, {  7, 4 }, {  9, 4 },
-    {  8, 4 }, {  5, 4 }, {  6, 4 }, {  0, 4 }, { 30, 5 }, { 26, 5 }, { 25, 5 }, { 21, 5 },
-    {  3, 5 }, { 57, 6 }, { 41, 6 }, { 17, 6 }, { 16, 6 }, { 89, 7 }, {  9, 7 },
-};
-
-static const HuffSrc_t   Entropie_7_src [63] = {
-    {  17, 8 }, { 151, 8 }, { 212, 8 }, {   9, 7 }, {  80, 7 }, {  10, 7 }, { 11, 7 }, { 63, 7 },
-    {  89, 7 }, {  97, 7 }, { 107, 7 }, { 126, 7 }, {  18, 6 }, {  36, 6 }, { 38, 6 }, { 42, 6 },
-    {  43, 6 }, {  45, 6 }, {  51, 6 }, {  50, 6 }, {  56, 6 }, {  57, 6 }, { 60, 6 }, { 61, 6 },
-    {   6, 5 }, {   0, 5 }, {   8, 5 }, {   7, 5 }, {  14, 5 }, {  10, 5 }, { 17, 5 }, { 11, 5 },
-    {  16, 5 }, {   5, 5 }, {  13, 5 }, {   4, 5 }, {  12, 5 }, {   1, 5 }, {  3, 5 }, { 62, 6 },
-    {  59, 6 }, {  55, 6 }, {  54, 6 }, {  49, 6 }, {  52, 6 }, {  47, 6 }, { 46, 6 }, { 41, 6 },
-    {  39, 6 }, {  30, 6 }, {  19, 6 }, { 117, 7 }, { 116, 7 }, {  96, 7 }, { 88, 7 }, { 74, 7 },
-    {  62, 7 }, { 254, 8 }, {  81, 7 }, { 255, 8 }, { 213, 8 }, { 150, 8 }, { 16, 8 },
-};
-
-
-#define MAKE(d,s)    Make_HuffTable   ( (d), (s), sizeof(s)/sizeof(*(s)) )
-#define SORT(x,o)    Resort_HuffTable ( (x), sizeof(x)/sizeof(*(x)), -(Int)(o) )
-#define LOOKUP(x,q)  Make_LookupTable ( (q), sizeof(q), (x), sizeof(x)/sizeof(*(x)) )
-
-
-static void
-Init_Huffman_Encoder_SV4_6 ( void )
-{
-    MAKE ( SCFI_Bundle  , SCFI_Bundle_src   );  // SCFI-Bundle
-    MAKE ( Region_A     , Region_A_src      );  // Region A (Subbands  0...10)
-    MAKE ( Region_B     , Region_B_src      );  // Region B (Subbands 11...22)
-    MAKE ( Region_C     , Region_C_src      );  // Region C (Subbands 23...31)
-    MAKE ( DSCF_Entropie, DSCF_Entropie_src );  // DSCF
-    MAKE ( Entropie_1   , Entropie_1_src    );  // first Quantizer
-    MAKE ( Entropie_2   , Entropie_2_src    );  // second Quantizer
-    MAKE ( Entropie_3   , Entropie_3_src    );  // third Quantizer
-    MAKE ( Entropie_4   , Entropie_4_src    );  // fourth Quantizer
-    MAKE ( Entropie_5   , Entropie_5_src    );  // fifth Quantizer
-    MAKE ( Entropie_6   , Entropie_6_src    );  // sixth Quantizer
-    MAKE ( Entropie_7   , Entropie_7_src    );  // seventh Quantizer
-}
-
-
-void
-Init_Huffman_Decoder_SV4_6 ( void )
-{
-    Init_Huffman_Encoder_SV4_6 ();
-
-    SORT ( Entropie_1   , Dc[1] );
-    SORT ( Entropie_2   , Dc[2] );
-    SORT ( Entropie_3   , Dc[3] );
-    SORT ( Entropie_4   , Dc[4] );
-    SORT ( Entropie_5   , Dc[5] );
-    SORT ( Entropie_6   , Dc[6] );
-    SORT ( Entropie_7   , Dc[7] );
-    SORT ( SCFI_Bundle  ,    0  );
-    SORT ( DSCF_Entropie,    6  );
-    SORT ( Region_A     ,    0  );
-    SORT ( Region_B     ,    0  );
-    SORT ( Region_C     ,    0  );
-}
-
-/* end of huffsv46.c */
Index: penc/trunk/huffsv7.c
===================================================================
--- /mppenc/trunk/huffsv7.c	(revision 96)
+++ 	(revision )
@@ -1,444 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppdec.h"
-
-Huffman_t   HuffHdr    [10];            // 9 bit
-Huffman_t   HuffSCFI   [ 4];            // 3 bit
-Huffman_t   HuffDSCF   [16];            // 6 bit
-Huffman_t   HuffQ1 [2] [ 3*3*3];        // 6+ 9 bit
-Huffman_t   HuffQ2 [2] [ 5*5];          // 7+10 bit
-Huffman_t   HuffQ3 [2] [ 7];            // 4+ 5 bit
-Huffman_t   HuffQ4 [2] [ 9];            // 4+ 5 bit
-Huffman_t   HuffQ5 [2] [15];            // 6+ 8 bit
-Huffman_t   HuffQ6 [2] [31];            // 7+13 bit
-Huffman_t   HuffQ7 [2] [63];            // 8+14 bit
-                                        // 4608 Bytes
-Uint8_t     LUT1_0  [1<< 6];
-Uint8_t     LUT1_1  [1<< 9];            //  576 Bytes
-Uint8_t     LUT2_0  [1<< 7];
-Uint8_t     LUT2_1  [1<<10];            // 1152 Bytes
-Uint8_t     LUT3_0  [1<< 4];
-Uint8_t     LUT3_1  [1<< 5];            //   48 Bytes
-Uint8_t     LUT4_0  [1<< 4];
-Uint8_t     LUT4_1  [1<< 5];            //   48 Bytes
-Uint8_t     LUT5_0  [1<< 6];
-Uint8_t     LUT5_1  [1<< 8];            //  320 Bytes
-Uint8_t     LUT6_0  [1<< 7];
-Uint8_t     LUT6_1  [1<< 7];            //  256 Bytes
-Uint8_t     LUT7_0  [1<< 8];
-Uint8_t     LUT7_1  [1<< 8];            //  512 Bytes
-Uint8_t     LUTDSCF [1<< 6];            //   64 Bytes = 2976 Bytes
-
-const Huffman_t* HuffQ [2] [8] = {
-    { NULL, HuffQ1[0], HuffQ2[0], HuffQ3[0], HuffQ4[0], HuffQ5[0], HuffQ6[0], HuffQ7[0] },
-    { NULL, HuffQ1[1], HuffQ2[1], HuffQ3[1], HuffQ4[1], HuffQ5[1], HuffQ6[1], HuffQ7[1] }
-};
-
-#ifdef USE_SV8
-Huffman_t   HuffN3 [2] [ 7*7];          // 8+ 9 bit
-Huffman_t   HuffN8 [2][127];            //13+12 bit
-
-const Huffman_t* HuffN [2] [9] = {
-    { NULL, HuffQ1[0], HuffQ2[0], HuffN3[0], HuffQ4[0], HuffQ5[0], HuffQ6[0], HuffQ7[0], HuffN8[0] },
-    { NULL, HuffQ1[1], HuffQ2[1], HuffN3[1], HuffQ4[1], HuffQ5[1], HuffQ6[1], HuffQ7[1], HuffN8[1] }
-};
-#endif
-
-static const HuffSrc_t   HuffSCFI_src [4] = {
-    { 2, 3 }, { 1, 1 }, { 3, 3 }, { 0, 2 }
-};
-
-static const HuffSrc_t   HuffDSCF_src [16] = {
-    { 32, 6 }, {  4, 5 }, { 17, 5 }, { 30, 5 }, { 13, 4 }, {  0, 3 }, {  3, 3 }, {  9, 4 },
-    {  5, 3 }, {  2, 3 }, { 14, 4 }, {  3, 4 }, { 31, 5 }, {  5, 5 }, { 33, 6 }, { 12, 4 }
-};
-
-static const HuffSrc_t   HuffHdr_src [10] = {
-    {  92, 8 }, {  47, 7 }, {  10, 5 }, {   4, 4 }, {   0, 2 },
-    {   1, 1 }, {   3, 3 }, {  22, 6 }, { 187, 9 }, { 186, 9 }
-};
-
-static const HuffSrc_t   HuffQ1_src [2] [3*3*3] = { {
-    { 54, 6 }, {  9, 5 }, { 32, 6 }, {  5, 5 }, { 10, 4 }, {  7, 5 }, { 52, 6 }, {  0, 5 }, { 35, 6 },
-    { 10, 5 }, {  6, 4 }, {  4, 5 }, { 11, 4 }, {  7, 3 }, { 12, 4 }, {  3, 5 }, {  7, 4 }, { 11, 5 },
-    { 34, 6 }, {  1, 5 }, { 53, 6 }, {  6, 5 }, {  9, 4 }, {  2, 5 }, { 33, 6 }, {  8, 5 }, { 55, 6 }
-}, {
-    { 103, 8 }, {  62, 7 }, { 225, 9 }, {  55, 7 }, {   3, 4 }, {  52, 7 }, { 101, 8 }, {  60, 7 }, { 227, 9 },
-    {  24, 6 }, {   0, 4 }, {  61, 7 }, {   4, 4 }, {   1, 1 }, {   5, 4 }, {  63, 7 }, {   1, 4 }, {  59, 7 },
-    { 226, 9 }, {  57, 7 }, { 100, 8 }, {  53, 7 }, {   2, 4 }, {  54, 7 }, { 224, 9 }, {  58, 7 }, { 102, 8 }
-} };
-
-static const HuffSrc_t   HuffQ2_src [2] [5*5] = { {
-    {  89,  7 }, {  47,  6 }, { 15, 5 }, {   0, 5 }, {  91,  7 },
-    {   4,  5 }, {   6,  4 }, { 13, 4 }, {   4, 4 }, {   5,  5 },
-    {  20,  5 }, {  12,  4 }, {  4, 3 }, {  15, 4 }, {  14,  5 },
-    {   3,  5 }, {   3,  4 }, { 14, 4 }, {   5, 4 }, {   1,  5 },
-    {  90,  7 }, {   2,  5 }, { 21, 5 }, {  46, 6 }, {  88,  7 }
-}, {
-    { 921, 10 }, { 113,  7 }, { 51, 6 }, { 231, 8 }, { 922, 10 },
-    { 104,  7 }, {  30,  5 }, {  0, 3 }, {  29, 5 }, { 105,  7 },
-    {  50,  6 }, {   1,  3 }, {  2, 2 }, {   3, 3 }, {  49,  6 },
-    { 107,  7 }, {  27,  5 }, {  2, 3 }, {  31, 5 }, { 112,  7 },
-    { 920, 10 }, { 106,  7 }, { 48, 6 }, { 114, 7 }, { 923, 10 }
-} };
-
-#ifdef USE_SV8
-static const HuffSrc_t   HuffN3_src [2] [7*7] = { {
-    {  78, 7 }, {  20, 6 }, {  36, 6 }, {  51, 6 }, {  21, 6 }, { 101, 7 }, { 255, 8 },
-    {  37, 6 }, {   0, 5 }, {  62, 6 }, {   7, 5 }, {  60, 6 }, {  49, 6 }, { 100, 7 },
-    {  30, 6 }, {  53, 6 }, {   8, 5 }, {  14, 5 }, {   5, 5 }, {  54, 6 }, {  26, 6 },
-    {  43, 6 }, {   1, 5 }, {  20, 5 }, {  14, 4 }, {  22, 5 }, {   9, 5 }, {  46, 6 },
-    {  47, 6 }, {  61, 6 }, {  17, 5 }, {  16, 5 }, {  11, 5 }, {   4, 5 }, {  38, 6 },
-    {   6, 6 }, {  52, 6 }, {   6, 5 }, {  12, 5 }, {   2, 5 }, {  55, 6 }, {  27, 6 },
-    { 254, 8 }, { 126, 7 }, {  31, 6 }, {  48, 6 }, {  42, 6 }, {   7, 6 }, {  79, 7 }
-}, {
-    {  65, 9 }, { 161, 8 }, { 109, 7 }, {  11, 6 }, { 116, 7 }, { 160, 8 }, {  71, 9 },
-    {  34, 8 }, {  97, 7 }, {  56, 6 }, {   8, 5 }, {  55, 6 }, {  85, 7 }, { 166, 8 },
-    {  84, 7 }, {  52, 6 }, {   3, 4 }, {  11, 4 }, {   5, 4 }, {  59, 6 }, {  86, 7 },
-    {  10, 6 }, {  13, 5 }, {   9, 4 }, {   0, 3 }, {   8, 4 }, {  12, 5 }, {   9, 6 },
-    {  98, 7 }, {  51, 6 }, {  31, 5 }, {   7, 4 }, {  30, 5 }, {  53, 6 }, {  99, 7 },
-    { 162, 8 }, { 108, 7 }, {  50, 6 }, {   9, 5 }, {  57, 6 }, {  82, 7 }, { 163, 8 },
-    {  64, 9 }, { 167, 8 }, {  87, 7 }, { 117, 7 }, {  96, 7 }, {  33, 8 }, {  70, 9 }
-} };
-#endif
-
-static const HuffSrc_t   HuffQ3_src [2] [ 7] = { {
-    { 12, 4 }, { 4, 3 }, { 0, 2 }, { 1, 2 }, { 7, 3 }, { 5, 3 }, { 13, 4 }
-}, {
-    {  4, 5 }, { 3, 4 }, { 2, 2 }, { 3, 2 }, { 1, 2 }, { 0, 3 }, {  5, 5 }
-} };
-
-static const HuffSrc_t   HuffQ4_src [2] [ 9] = { {
-    { 5, 4 }, {  0, 3 }, { 4, 3 }, { 6, 3 }, { 7, 3 }, { 5, 3 }, {  3, 3 }, { 1, 3 }, { 4, 4 }
-}, {
-    { 9, 5 }, { 12, 4 }, { 3, 3 }, { 0, 2 }, { 2, 2 }, { 7, 3 }, { 13, 4 }, { 5, 4 }, { 8, 5 }
-} };
-
-static const HuffSrc_t   HuffQ5_src [2] [15] = { {
-    {  57, 6 }, { 23, 5 }, {  8, 4 }, { 10, 4 }, { 13, 4 }, {   0, 3 }, {   2, 3 }, { 3, 3 },
-    {   1, 3 }, { 15, 4 }, { 12, 4 }, {  9, 4 }, { 29, 5 }, {  22, 5 }, {  56, 6 }
-}, {
-    { 229, 8 }, { 56, 6 }, {  7, 5 }, {  2, 4 }, {  0, 3 }, {   3, 3 }, {   5, 3 }, { 6, 3 },
-    {   4, 3 }, {  2, 3 }, { 15, 4 }, { 29, 5 }, {  6, 5 }, { 115, 7 }, { 228, 8 },
-} };
-
-static const HuffSrc_t   HuffQ6_src [2] [31] = { {
-    {   65,  7 }, {    6,  6 }, {  44,  6 }, {  45, 6 }, {   59,  6 }, {   13,  5 }, {   17,  5 }, { 19, 5 },
-    {   23,  5 }, {   21,  5 }, {  26,  5 }, {  30, 5 }, {    0,  4 }, {    2,  4 }, {    5,  4 }, {  7, 4 },
-    {    3,  4 }, {    4,  4 }, {  31,  5 }, {  28, 5 }, {   25,  5 }, {   27,  5 }, {   24,  5 }, { 20, 5 },
-    {   18,  5 }, {   12,  5 }, {   2,  5 }, {  58, 6 }, {   33,  6 }, {    7,  6 }, {   64,  7 },
-}, {
-    { 6472, 13 }, { 6474, 13 }, { 808, 10 }, { 405, 9 }, {  203,  8 }, {  102,  7 }, {   49,  6 }, {  9, 5 },
-    {   15,  5 }, {   31,  5 }, {   2,  4 }, {   6, 4 }, {    8,  4 }, {   11,  4 }, {   13,  4 }, {  0, 3 },
-    {   14,  4 }, {   10,  4 }, {   9,  4 }, {   5, 4 }, {    3,  4 }, {   30,  5 }, {   14,  5 }, {  8, 5 },
-    {   48,  6 }, {  103,  7 }, { 201,  8 }, { 200, 8 }, { 1619, 11 }, { 6473, 13 }, { 6475, 13 },
-} };
-
-static const HuffSrc_t   HuffQ7_src [2] [63] = { {
-    { 103, 8 },    // 0.3338   01100111
-    { 153, 8 },    // 0.3766   10011001
-    { 181, 8 },    // 0.4715   10110101
-    { 233, 8 },    // 0.5528   11101001
-    {  64, 7 },    // 0.6677    1000000
-    {  65, 7 },    // 0.7041    1000001
-    {  77, 7 },    // 0.7733    1001101
-    {  81, 7 },    // 0.8296    1010001
-    {  91, 7 },    // 0.9295    1011011
-    { 113, 7 },    // 1.0814    1110001
-    { 112, 7 },    // 1.0807    1110000
-    {  24, 6 },    // 1.2748     011000
-    {  29, 6 },    // 1.3390     011101
-    {  35, 6 },    // 1.4224     100011
-    {  37, 6 },    // 1.5201     100101
-    {  41, 6 },    // 1.6642     101001
-    {  44, 6 },    // 1.7292     101100
-    {  46, 6 },    // 1.8647     101110
-    {  51, 6 },    // 2.0473     110011
-    {  49, 6 },    // 2.0152     110001
-    {  54, 6 },    // 2.1315     110110
-    {  55, 6 },    // 2.1358     110111
-    {  57, 6 },    // 2.1700     111001
-    {  60, 6 },    // 2.2449     111100
-    {   0, 5 },    // 2.3063      00000
-    {   2, 5 },    // 2.3854      00010
-    {  10, 5 },    // 2.5481      01010
-    {   5, 5 },    // 2.4867      00101
-    {   9, 5 },    // 2.5352      01001
-    {   6, 5 },    // 2.5074      00110
-    {  13, 5 },    // 2.5745      01101
-    {   7, 5 },    // 2.5195      00111
-    {  11, 5 },    // 2.5502      01011
-    {  15, 5 },    // 2.6251      01111
-    {   8, 5 },    // 2.5260      01000
-    {   4, 5 },    // 2.4418      00100
-    {   3, 5 },    // 2.3983      00011
-    {   1, 5 },    // 2.3697      00001
-    {  63, 6 },    // 2.3041     111111
-    {  62, 6 },    // 2.2656     111110
-    {  61, 6 },    // 2.2549     111101
-    {  53, 6 },    // 2.1151     110101
-    {  59, 6 },    // 2.2042     111011
-    {  52, 6 },    // 2.0837     110100
-    {  48, 6 },    // 1.9446     110000
-    {  47, 6 },    // 1.9189     101111
-    {  43, 6 },    // 1.7177     101011
-    {  42, 6 },    // 1.7035     101010
-    {  39, 6 },    // 1.5287     100111
-    {  36, 6 },    // 1.4559     100100
-    {  33, 6 },    // 1.4117     100001
-    {  28, 6 },    // 1.2776     011100
-    { 117, 7 },    // 1.1107    1110101
-    { 101, 7 },    // 1.0636    1100101
-    { 100, 7 },    // 0.9751    1100100
-    {  80, 7 },    // 0.8132    1010000
-    {  69, 7 },    // 0.7091    1000101
-    {  68, 7 },    // 0.7084    1000100
-    {  50, 7 },    // 0.6277    0110010
-    { 232, 8 },    // 0.5386   11101000
-    { 180, 8 },    // 0.4408   10110100
-    { 152, 8 },    // 0.3759   10011000
-    { 102, 8 },    // 0.3160   01100110
-}, {
-    { 14244, 14 },    // 0.0059   11011110100100
-    { 14253, 14 },    // 0.0098   11011110101101
-    { 14246, 14 },    // 0.0078   11011110100110
-    { 14254, 14 },    // 0.0111   11011110101110
-    {  3562, 12 },    // 0.0320     110111101010
-    {   752, 10 },    // 0.0920       1011110000
-    {   753, 10 },    // 0.1057       1011110001
-    {   160,  9 },    // 0.1403        010100000
-    {   162,  9 },    // 0.1579        010100010
-    {   444,  9 },    // 0.2486        110111100
-    {   122,  8 },    // 0.3772         01111010
-    {   223,  8 },    // 0.5710         11011111
-    {    60,  7 },    // 0.6858          0111100
-    {    73,  7 },    // 0.8033          1001001
-    {   110,  7 },    // 0.9827          1101110
-    {    14,  6 },    // 1.2601           001110
-    {    24,  6 },    // 1.3194           011000
-    {    25,  6 },    // 1.3938           011001
-    {    34,  6 },    // 1.5693           100010
-    {    37,  6 },    // 1.7846           100101
-    {    54,  6 },    // 2.0078           110110
-    {     3,  5 },    // 2.2975            00011
-    {     9,  5 },    // 2.5631            01001
-    {    11,  5 },    // 2.7021            01011
-    {    16,  5 },    // 3.1465            10000
-    {    19,  5 },    // 3.4244            10011
-    {    21,  5 },    // 3.5921            10101
-    {    24,  5 },    // 3.7938            11000
-    {    26,  5 },    // 3.9595            11010
-    {    29,  5 },    // 4.1546            11101
-    {    31,  5 },    // 4.2623            11111
-    {     2,  4 },    // 4.5180             0010
-    {     0,  4 },    // 4.3151             0000
-    {    30,  5 },    // 4.2538            11110
-    {    28,  5 },    // 4.1422            11100
-    {    25,  5 },    // 3.9145            11001
-    {    22,  5 },    // 3.6691            10110
-    {    20,  5 },    // 3.4955            10100
-    {    14,  5 },    // 2.9155            01110
-    {    13,  5 },    // 2.7921            01101
-    {     8,  5 },    // 2.5553            01000
-    {     6,  5 },    // 2.3093            00110
-    {     2,  5 },    // 2.1200            00010
-    {    46,  6 },    // 1.8134           101110
-    {    35,  6 },    // 1.5824           100011
-    {    31,  6 },    // 1.4701           011111
-    {    21,  6 },    // 1.3187           010101
-    {    15,  6 },    // 1.2776           001111
-    {    95,  7 },    // 0.9664          1011111
-    {    72,  7 },    // 0.7922          1001000
-    {    41,  7 },    // 0.6838          0101001
-    {   189,  8 },    // 0.5024         10111101
-    {   123,  8 },    // 0.3830         01111011
-    {   377,  9 },    // 0.2232        101111001
-    {   161,  9 },    // 0.1566        010100001
-    {   891, 10 },    // 0.1383       1101111011
-    {   327, 10 },    // 0.0900       0101000111
-    {   326, 10 },    // 0.0790       0101000110
-    {  3560, 12 },    // 0.0254     110111101000
-    { 14255, 14 },    // 0.0117   11011110101111
-    { 14247, 14 },    // 0.0085   11011110100111
-    { 14252, 14 },    // 0.0085   11011110101100
-    { 14245, 14 },    // 0.0065   11011110100101
-} };
-
-#ifdef USE_SV8
-static const HuffSrc_t   HuffN8_src [2] [127] = { {
-    { 2426, 13 }, { 4943, 13 }, {  787, 12 }, { 2470, 12 }, { 7270, 13 }, { 1764, 12 },
-    { 3632, 12 }, { 3633, 12 }, { 2486, 12 }, {  395, 11 }, {  607, 11 }, { 1242, 11 },
-    {  108, 10 }, {  300, 10 }, {  199, 10 }, {  440, 10 }, {  442, 10 }, {  616, 10 },
-    {  909, 10 }, {  897, 10 }, {  178,  9 }, {  309,  9 }, {  311,  9 }, {  451,  9 },
-    {  449,  9 }, {   26,  8 }, {   74,  8 }, {   94,  8 }, {  122,  8 }, {  136,  8 },
-    {   12,  7 }, {   29,  7 }, {   28,  7 }, {   36,  7 }, {   39,  7 }, {   46,  7 },
-    {   60,  7 }, {   69,  7 }, {   76,  7 }, {   92,  7 }, {  126,  7 }, {   11,  6 },
-    {   15,  6 }, {   10,  6 }, {   16,  6 }, {   21,  6 }, {   25,  6 }, {   28,  6 },
-    {   32,  6 }, {   31,  6 }, {   37,  6 }, {   47,  6 }, {   43,  6 }, {   35,  6 },
-    {   45,  6 }, {   48,  6 }, {   52,  6 }, {   53,  6 }, {   54,  6 }, {   62,  6 },
-    {   59,  6 }, {    0,  5 }, {   61,  6 }, {   51,  6 }, {    2,  5 }, {    1,  5 },
-    {   60,  6 }, {   57,  6 }, {   58,  6 }, {   55,  6 }, {   50,  6 }, {   49,  6 },
-    {   42,  6 }, {   40,  6 }, {   44,  6 }, {   41,  6 }, {   39,  6 }, {   33,  6 },
-    {   29,  6 }, {   26,  6 }, {   24,  6 }, {   20,  6 }, {   17,  6 }, {   13,  6 },
-    {    8,  6 }, {    9,  6 }, {  127,  7 }, {   93,  7 }, {   73,  7 }, {   72,  7 },
-    {   54,  7 }, {   38,  7 }, {   45,  7 }, {   14,  7 }, {   25,  7 }, {   15,  7 },
-    {  226,  8 }, {  137,  8 }, {  111,  8 }, {   95,  8 }, {   88,  8 }, {   48,  8 },
-    {  455,  9 }, {  450,  9 }, {  246,  9 }, {  247,  9 }, {  179,  9 }, {   55,  9 },
-    {  896, 10 }, {  620, 10 }, {  443, 10 }, {  302, 10 }, {  301, 10 }, {  198, 10 },
-    {  109, 10 }, { 1234, 11 }, {  883, 11 }, {  392, 11 }, {  394, 11 }, { 3634, 12 },
-    { 2487, 12 }, {  786, 12 }, { 1765, 12 }, { 1212, 12 }, { 7271, 13 }, { 2427, 13 },
-    { 4942, 13 }
-}, {
-    { 3728, 12 }, { 4005, 12 }, {  264, 11 }, { 4004, 12 }, { 4044, 12 }, { 4045, 12 },
-    { 4046, 12 }, { 1424, 11 }, {  449, 11 }, {  448, 11 }, {  139, 10 }, {  231, 10 },
-    {  133, 10 }, {  719, 10 }, {  641, 10 }, {  676, 10 }, {  225, 10 }, {  677, 10 },
-    {  620, 10 }, {   72,  9 }, {   23,  9 }, {   67,  9 }, {   75,  9 }, {  113,  9 },
-    {  311,  9 }, {   68,  9 }, {  316,  9 }, {  467,  9 }, {   10,  8 }, {  468,  9 },
-    {   35,  8 }, {   27,  8 }, {  358,  9 }, {   32,  8 }, {   26,  8 }, {  501,  9 },
-    {   44,  8 }, {   45,  8 }, {  142,  8 }, {  173,  8 }, {  161,  8 }, {  188,  8 },
-    {  189,  8 }, {  190,  8 }, {  191,  8 }, {  254,  8 }, {  251,  8 }, {  255,  8 },
-    {   19,  7 }, {   26,  7 }, {   70,  7 }, {   76,  7 }, {   87,  7 }, {   85,  7 },
-    {  124,  7 }, {    7,  6 }, {   15,  6 }, {   41,  6 }, {   46,  6 }, {    2,  5 },
-    {   16,  5 }, {   28,  5 }, {   12,  4 }, {    1,  2 }, {   13,  4 }, {   30,  5 },
-    {   18,  5 }, {    0,  5 }, {   45,  6 }, {   34,  6 }, {   12,  6 }, {    3,  6 },
-    {  118,  7 }, {   88,  7 }, {   81,  7 }, {   29,  7 }, {   78,  7 }, {   23,  7 },
-    {   27,  7 }, {  253,  8 }, {   12,  7 }, {  232,  8 }, {  235,  8 }, {  159,  8 },
-    {  238,  8 }, {  172,  8 }, {  168,  8 }, {  143,  8 }, {  154,  8 }, {   40,  8 },
-    {    8,  8 }, {  478,  9 }, {    9,  8 }, {  479,  9 }, {  469,  9 }, {   42,  8 },
-    {   43,  8 }, {  504,  9 }, {  357,  9 }, {  321,  9 }, {  339,  9 }, {  317,  9 },
-    {  114,  9 }, {   82,  9 }, {   83,  9 }, {   73,  9 }, {   74,  9 }, { 1000, 10 },
-    {  933, 10 }, {  621, 10 }, {  718, 10 }, { 2003, 11 }, {  713, 10 }, { 2020, 11 },
-    {  230, 10 }, { 1865, 11 }, {   44, 10 }, {  138, 10 }, { 1280, 11 }, { 2021, 11 },
-    { 3729, 12 }, { 4047, 12 }, {   90, 11 }, {  265, 11 }, { 1281, 11 }, { 1425, 11 },
-    {   91, 11 }
-} };
-#endif
-
-#define MAKE(d,s)     Make_HuffTable   ( (d), (s), sizeof(s)/sizeof(*(s)) )
-#define SORT(x,o)     Resort_HuffTable ( (x), sizeof(x)/sizeof(*(x)), -(Int)(o) )
-#define LOOKUP(x,q)   Make_LookupTable ( (q), sizeof(q), (x), sizeof(x)/sizeof(*(x)) )
-
-
-void
-Init_Huffman_Encoder_SV7 ( void )
-{
-    // Splitting of the 36 Samples
-    MAKE ( HuffSCFI, HuffSCFI_src );
-
-    // Differential Scalefactors
-    MAKE ( HuffDSCF, HuffDSCF_src );
-
-    // resolution, differential quantizer indizes
-    MAKE ( HuffHdr, HuffHdr_src );
-
-    // 3-step quantizer, 3 bundled samples
-    MAKE ( HuffQ1[0], HuffQ1_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ1[1], HuffQ1_src[1] );          // more shaped, book 1
-
-    // 5-step quantizer, 2 bundled samples
-    MAKE ( HuffQ2[0], HuffQ2_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ2[1], HuffQ2_src[1] );          // more shaped, book 1
-
-    // 7-step quantizer, single samples
-    MAKE ( HuffQ3[0], HuffQ3_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ3[1], HuffQ3_src[1] );          // more shaped, book 1
-
-#ifdef USE_SV8
-    // 7-step quantizer, 2 bundled samples
-    MAKE ( HuffN3[0], HuffN3_src[0] );          // less shaped, book 0
-    MAKE ( HuffN3[1], HuffN3_src[1] );          // more shaped, book 1
-#endif
-
-    // 9-step quantizer, single samples
-    MAKE ( HuffQ4[0], HuffQ4_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ4[1], HuffQ4_src[1] );          // more shaped, book 1
-
-    // 15-step quantizer, single samples
-    MAKE ( HuffQ5[0], HuffQ5_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ5[1], HuffQ5_src[1] );          // more shaped, book 1
-
-    // 31-step quantizer, single samples
-    MAKE ( HuffQ6[0], HuffQ6_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ6[1], HuffQ6_src[1] );          // more shaped, book 1
-
-    // 63-step quantizer, single samples
-    MAKE ( HuffQ7[0], HuffQ7_src[0] );          // less shaped, book 0
-    MAKE ( HuffQ7[1], HuffQ7_src[1] );          // more shaped, book 1
-
-#ifdef USE_SV8
-    // 127-step quantizer, single samples
-    MAKE ( HuffN8[0], HuffN8_src[0] );          // book 0
-    MAKE ( HuffN8[1], HuffN8_src[1] );          // book 1
-#endif
-}
-
-#ifndef MPP_ENCODER
-
-void
-Init_Huffman_Decoder_SV7 ( void )
-{
-    Init_Huffman_Encoder_SV7 ();
-
-    SORT ( HuffHdr  ,    5  );
-    SORT ( HuffSCFI ,    0  );
-    SORT ( HuffDSCF ,    7  );
-    SORT ( HuffQ1[0],    0  );
-    SORT ( HuffQ1[1],    0  );
-    SORT ( HuffQ2[0],    0  );
-    SORT ( HuffQ2[1],    0  );
-#ifdef USE_SV8
-    SORT ( HuffN3[0],    0  );
-    SORT ( HuffN3[1],    0  );
-#endif
-    SORT ( HuffQ3[0], Dc[3] );
-    SORT ( HuffQ3[1], Dc[3] );
-    SORT ( HuffQ4[0], Dc[4] );
-    SORT ( HuffQ4[1], Dc[4] );
-    SORT ( HuffQ5[0], Dc[5] );
-    SORT ( HuffQ5[1], Dc[5] );
-    SORT ( HuffQ6[0], Dc[6] );
-    SORT ( HuffQ6[1], Dc[6] );
-    SORT ( HuffQ7[0], Dc[7] );
-    SORT ( HuffQ7[1], Dc[7] );
-#ifdef USE_SV8
-    SORT ( HuffN8[0], Dc[8] );
-    SORT ( HuffN8[1], Dc[8] );
-#endif
-
-    LOOKUP ( HuffQ1[0], LUT1_0  );
-    LOOKUP ( HuffQ1[1], LUT1_1  );
-    LOOKUP ( HuffQ2[0], LUT2_0  );
-    LOOKUP ( HuffQ2[1], LUT2_1  );
-    LOOKUP ( HuffQ3[0], LUT3_0  );
-    LOOKUP ( HuffQ3[1], LUT3_1  );
-    LOOKUP ( HuffQ4[0], LUT4_0  );
-    LOOKUP ( HuffQ4[1], LUT4_1  );
-    LOOKUP ( HuffQ5[0], LUT5_0  );
-    LOOKUP ( HuffQ5[1], LUT5_1  );
-    LOOKUP ( HuffQ6[0], LUT6_0  );
-    LOOKUP ( HuffQ6[1], LUT6_1  );
-    LOOKUP ( HuffQ7[0], LUT7_0  );
-    LOOKUP ( HuffQ7[1], LUT7_1  );
-    LOOKUP ( HuffDSCF , LUTDSCF );
-}
-
-#endif
-
-/* end of huffsv7.c */
Index: penc/trunk/id3tag.c
===================================================================
--- /mppenc/trunk/id3tag.c	(revision 96)
+++ 	(revision )
@@ -1,244 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string.h>
-#include "mppdec.h"
-
-/*
- *  List of known Genres. 256 genres are possible with version 1/1.1 tags,
- *  but not yet used.
- */
-
-static const char*  GenreList [] = {
-    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
-    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
-    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
-    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
-    "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
-    "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
-    "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
-    "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
-    "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
-    "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
-    "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
-    "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
-    "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
-    "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion",
-    "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
-    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
-    "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
-    "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
-    "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
-    "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
-    "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
-    "Dance Hall", "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
-    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", "Christian Gangsta",
-    "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
-    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
-    "SynthPop"
-};
-
-
-/*
- *  Copies src to dst. Copying is stopped at `\0' char is detected or if
- *  len chars are copied.
- *  Trailing blanks are removed and the string is `\0` terminated.
- */
-
-static void
-memcpy_crop ( char* dst, const char* src, size_t len )
-{
-    size_t  i;
-
-    for ( i = 0; i < len; i++ )
-        if  ( src[i] != '\0' )
-            dst[i] = src[i];
-        else
-            break;
-
-    // dst[i] points behind the string contents
-
-    while ( i > 0  &&  dst [i-1] == ' ' )
-        i--;
-    dst [i] = '\0';
-}
-
-
-/*
- *  Evaluate ID version 1/1.1 tags of a file given by 'fp' and fills out Tag
- *  information in 'tip'. Tag information also contains the effective file
- *  length (without the tags if tags are present). Return 1 if there is
- *  usable information inside the file. Note that there's also a possible case
- *  where the file contains empty tags, the file size is truncated by the
- *  128 bytes but the function returns 0.
- *
- *  If there's no tags, all strings containing '\0', the Genre pointer is
- *  NULL and GenreNo and TrackNo are -1.
- */
-
-Int
-Read_ID3V1_Tags ( FILE_T fp, TagInfo_t* tip )
-{
-    Uint8_t  tmp [128];
-    OFF_T    file_pos;
-
-    memset ( tip, 0, sizeof(*tip) );
-    tip->GenreNo = -1;
-    tip->TrackNo = -1;
-
-    if ( -1 == (file_pos = FILEPOS (fp)) )
-        return 0;
-    if ( -1 == SEEK ( fp, -128L, SEEK_END ) )
-        return 0;
-
-    tip->FileSize = FILEPOS (fp);
-    if ( 128 != READ ( fp, tmp, 128 ) )
-        return 0;
-    SEEK ( fp, file_pos, SEEK_SET );
-
-    if ( 0 != memcmp ( tmp, "TAG", 3 ) ) {
-        tip->FileSize += 128;
-        return 0;
-    }
-
-    if ( !tmp[3]  &&  !tmp[33]  &&  !tmp[63]  &&  !tmp[93]  &&  !tmp[97] )
-        return 0;
-
-    memcpy_crop  ( tip->Title  , tmp +  3, 30 );
-    memcpy_crop  ( tip->Artist , tmp + 33, 30 );
-    memcpy_crop  ( tip->Album  , tmp + 63, 30 );
-    memcpy_crop  ( tip->Year   , tmp + 93,  4 );
-    memcpy_crop  ( tip->Comment, tmp + 97, 30 );
-
-    strcpy ( tip->Genre, tmp[127] < sizeof(GenreList)/sizeof(*GenreList)  ?
-                         GenreList [tip->GenreNo = tmp[127]]  :  "???" );
-
-    // Index 0 may be true if file is very short
-    if ( tmp[125] == 0  &&  (tmp[126] != 0  ||  tip->FileSize < 66000 ) )
-        sprintf ( tip->Track, "[%02d]", tip->TrackNo = tmp[126] );
-    else
-        strcpy ( tip->Track, "    " );
-
-    return 1;
-}
-
-
-struct APETagFooterStruct {
-    Uint8_t   ID       [8];    // should equal 'APETAGEX'
-    Uint8_t   Version  [4];    // currently 1000 (version 1.000)
-    Uint8_t   Length   [4];    // the complete size of the tag, including this footer
-    Uint8_t   TagCount [4];    // the number of fields in the tag
-    Uint8_t   Flags    [4];    // the tag flags (none currently defined)
-    Uint8_t   Reserved [8];    // reserved for later use
-};
-
-
-static Uint32_t
-Read_LE_Uint32 ( const Uint8_t* p )
-{
-    return ((Uint32_t)p[0] <<  0) |
-           ((Uint32_t)p[1] <<  8) |
-           ((Uint32_t)p[2] << 16) |
-           ((Uint32_t)p[3] << 24);
-}
-
-
-#define TAG_ANALYZE(item,elem)                      \
-    if ( 0 == memcmp (p, #item, sizeof #item ) ) {  \
-        p += sizeof #item;                          \
-        memcpy ( tip->elem, p, len );               \
-        p += len;                                   \
-    } else
-
-
-Int
-Read_APE_Tags ( FILE_T fp, TagInfo_t* tip )
-{
-    OFF_T                      file_pos;
-    Uint32_t                   len;
-    Uint32_t                   flags;
-    unsigned char              buff [8192];
-    unsigned char*             p;
-    unsigned char*             end;
-    struct APETagFooterStruct  T;
-    Uint32_t                   TagLen;
-    Uint32_t                   TagCount;
-    Uint32_t                   tmp;
-
-    memset ( tip, 0, sizeof(*tip) );
-    tip->GenreNo = -1;
-    tip->TrackNo = -1;
-
-    if ( -1 == (file_pos = FILEPOS (fp)) )
-        goto notag;
-    if ( -1 == SEEK ( fp, 0L, SEEK_END ) )
-        goto notag;
-    tip->FileSize = FILEPOS (fp);
-    if ( -1 == SEEK ( fp, -(long)sizeof T, SEEK_END ) )
-        goto notag;
-    if ( sizeof(T) != READ ( fp, &T, sizeof T ) )
-        goto notag;
-    if ( memcmp ( T.ID, "APETAGEX", sizeof(T.ID) ) != 0 )
-        goto notag;
-    tmp = Read_LE_Uint32 (T.Version);
-    if (  tmp != 1000  &&  tmp != 2000 )
-        goto notag;
-    TagLen = Read_LE_Uint32 (T.Length);
-    if ( TagLen <= sizeof T )
-        goto notag;
-    if ( -1 == SEEK ( fp, -(long)TagLen, SEEK_END ) )
-        goto notag;
-    tip->FileSize = FILEPOS (fp);
-    memset ( buff, 0, sizeof(buff) );
-    if ( TagLen - sizeof T != READ ( fp, buff, TagLen - sizeof T ) )
-        goto notag;
-    SEEK ( fp, file_pos, SEEK_SET );
-
-    TagCount = Read_LE_Uint32 (T.TagCount);
-    end = buff + TagLen - sizeof T;
-    for ( p = buff; p < end  &&  TagCount--; ) {
-        len   = Read_LE_Uint32 ( p ); p += 4;
-        flags = Read_LE_Uint32 ( p ); p += 4;
-        TAG_ANALYZE ( Title  , Title   )
-        TAG_ANALYZE ( Album  , Album   )
-        TAG_ANALYZE ( Artist , Artist  )
-        TAG_ANALYZE ( Album  , Album   )
-        TAG_ANALYZE ( Comment, Comment )
-        TAG_ANALYZE ( Track  , Track   )
-        TAG_ANALYZE ( Year   , Year    )
-        TAG_ANALYZE ( Genre  , Genre   )
-        {
-            p += strlen(p) + 1 + len;
-        }
-    }
-
-    if ( tip->Track[0] != '\0' )
-        sprintf ( tip->Track, "[%02d]", tip->TrackNo = atoi (tip->Track) );
-    else
-        strcpy ( tip->Track, "    " );
-
-    /* genre is not yet entirely decoded */
-    return 1;
-
-notag:
-    SEEK ( fp, file_pos, SEEK_SET );
-    return 0;
-}
-
-/* end of id3tag.c */
Index: penc/trunk/install
===================================================================
--- /mppenc/trunk/install	(revision 96)
+++ 	(revision )
@@ -1,101 +1,0 @@
-How to compile the MPEGplus decoder?
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-First step on all Operating Systems and all compilers:
-
-    - Edit mpp.h and select features
-    - Install NASM if you want to use enhanced assembler routines on 32 bit
-      Intel CPUs
-    - If you are using a Pentium Classic (P54) or Pentium MMX (P55),
-      setting %USE_FXCH in synthasm.nas increase performance by 5...10%. 
-      For other CPUs it decreases performance.
-
-
-MS-DOS:
-    Turbo-C:
-        Command line:
-            maketcc.bat
-        Turbo-C IDE:
-            Open Project "mpp.prj" and compile it
-
-    Zortech-C:
-        Command line:
-            makeztc.bat
-
-    DJGCC:
-        Command line:
-
-    WATCOM C/C++:
-
-Windows:
-
-    Microsoft C/C++:
-        NasmW.exe should be installed in "C:\Program Files\Nasm\NasmW.exe"
-        Command line:
-            Compile Project "config.mak"
-            run config.exe
-            Compile Project "mppdec.mak"
-
-        Microsoft Developer Studio:
-            open workspace mpp.dsw
-            select project config.dsp
-            compile it and execute it (config.exe)
-            select project mpp.dsp
-            compile release version.
-
-    Intel C/C++
-        NasmW.exe should be installed in "C:\Program Files\Nasm\NasmW.exe"
-        Command line:
-            Compile Project "config.mak"
-            run config.exe
-            Compile Project "mppdec.mak"
-
-        Microsoft Developer Studio:
-            open workspace mpp.dsw
-            select project config.dsp
-            compile it and execute it (config.exe)
-            select project mpp.dsp
-            compile release version.
-
-    Cygnus C/C++
-        NasmW.exe should be installed in the %PATH% as nasm.exe
-        See Linux GNU gcc
-
-Linux:
-    GNU gcc:
-
-        make
-        make install
-
-
-Sun (Solaris 2.7):
-    make -f Makefile.sun
-    make -f Makefile.sun install
-
-    Notes:
-
-    librt.a is needed for option USE_REALTIME on Solaris. If your system
-    is lacking librt.a you are unable to build a static executable with
-    realtime-support. Although you can still perfectly use the dynamic
-    executable.
-
-    Volume, Balance and Audio-Port (Line-Out, Speaker or Headphone) can be
-    adjusted with Sun's gaintool.
-
-
-Other Unices:
-    make -f Makefile.nol
-    make -f Makefile.nol install
-
-
-Note:
-    You can safely ignore all warnings during compiling config.c
-
-
------------------------------------------------------------------------------
-
-Report any problem to:
-        <pfk@schnecke.offl.uni-jena.de>
-
-Report any problem on Sun workstations to:
-        <patrick.piecha@micronas.com>
Index: penc/trunk/keyboard.c
===================================================================
--- /mppenc/trunk/keyboard.c	(revision 96)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- *  Keyboard input functions
- *
- *  (C) Frank Klemm 2002. All rights reserved.
- *
- *  Principles:
- *
- *  History:
- *    ca. 1998    created
- *    2002
- *
- *  Global functions:
- *    -
- *
- *  TODO:
- *    -
- */
-
-#include "mppenc.h"
-
-#if defined _WIN32  ||  defined __TURBOC__
-
-# include <conio.h>
-
-int
-WaitKey ( void )
-{
-    return getch ();
-}
-
-int
-CheckKeyKeep ( void )
-{
-    int  ch;
-
-    if ( !kbhit () )
-        return -1;
-
-    ch = getch ();
-    ungetch (ch);
-    return ch;
-}
-
-int
-CheckKey ( void )
-{
-    if ( !kbhit () )
-        return -1;
-
-    return getch ();
-}
-
-#else
-
-# ifdef USE_TERMIOS
-#  include <termios.h>
-
-static struct termios  stored_settings;
-
-static void
-echo_on ( void )
-{
-    tcsetattr ( 0, TCSANOW, &stored_settings );
-}
-
-static void
-echo_off ( void )
-{
-    struct termios  new_settings;
-
-    tcgetattr ( 0, &stored_settings );
-    new_settings = stored_settings;
-
-    new_settings.c_lflag     &= ~ECHO;
-    new_settings.c_lflag     &= ~ICANON;        // Disable canonical mode, and set buffer size to 1 byte
-    new_settings.c_cc[VTIME]  = 0;
-    new_settings.c_cc[VMIN]   = 1;
-
-    tcsetattr ( 0, TCSANOW, &new_settings );
-}
-
-# else
-#  define echo_off()  (void)0
-#  define echo_on()   (void)0
-# endif
-
-int
-WaitKey ( void )
-{
-    unsigned char  buff [1];
-    int            ret;
-
-    echo_off ();
-    ret = read ( 0, buff, 1 );
-    echo_on ();
-    return ret == 1  ?  buff[0]  :  -1;
-}
-
-int
-CheckKeyKeep ( void )
-{
-    struct timeval  tv = { 0, 0 };      // Do not wait at all, not even a microsecond
-    fd_set          read_fd;
-
-    FD_ZERO ( &read_fd );               // Must be done first to initialize read_fd
-    FD_SET ( 0, &read_fd );             // Makes select() ask if input is ready;  0 is file descriptor for stdin
-
-    if ( -1 == select ( 1,              // number of the largest fd to check + 1
-                        &read_fd,
-                        NULL,           // No writes
-                        NULL,           // No exceptions
-                        &tv ) )
-        return -1;                      // an error occured
-
-    return FD_ISSET (0, &read_fd)  ?  0xFF  :  -1;   // read_fd now holds a bit map of files that are readable. We test the entry for the standard input (file 0).
-}
-
-int
-CheckKey ( void )
-{
-    if ( CheckKeyKeep () < 0 )
-        return -1;
-    return WaitKey ();
-}
-
-#endif
-
-/* end of keyboard.c */
Index: penc/trunk/list.c
===================================================================
--- /mppenc/trunk/list.c	(revision 96)
+++ 	(revision )
@@ -1,352 +1,0 @@
-/* list, wp, wav_korr, replaygain */
-/* RKAU + APE */
-
-#include <stdio.h>
-#include "mppdec.h"
-
-int  html = 0;
-
-
-const char*
-color ( int bitrate )
-{
-    if ( bitrate <   8000 )
-        return "<font color=\"#1111FF\">";
-    if ( bitrate <  72000 )
-        return "<font color=\"#33CCFF\">";
-    if ( bitrate <= 320000 )
-        return "";
-    if ( bitrate < 1400000 )
-        return "<font color=\"#FFD468\">";
-    return "<font color=\"#FF1100\">";
-}
-
-
-const char*
-colorend ( int bitrate )
-{
-    if ( bitrate <  72000  ||  bitrate > 320000 )
-        return "</font>";
-    return "";
-}
-
-
-void
-report ( const char*  name,
-         Int64_t      orglen,
-         Int64_t      packlen,
-         long double  duration,
-         int          bits,
-         int          chan,
-         double       freq )
-{
-    static Int64_t      orgtotlen   = 0;
-    static Int64_t      packtotlen  = 0;
-    static long double  totduration = 0.;
-    static unsigned int filecnt = 0;
-    Int64_t             ms;
-    double              tmp;
-    const char*         html2;
-    char                files [128];
-
-    if ( name == NULL ) {
-        name = files;
-        sprintf ( files, "--- %u files ---", filecnt), orglen = orgtotlen, packlen = packtotlen, duration = totduration;
-    }
-    else {
-        orgtotlen += orglen, packtotlen += packlen, totduration += duration;
-    }
-
-    ms = floor ( 1000 * duration + 0.5 );
-
-    if ( html ) printf ("  <tr> <td align=\"right\">" );
-
-    // Report of original length and compressed length in MByte (works up to 10^15 Byte)
-    html2 = html ? "</td> <td align=\"right\">" : " ";
-
-    if ( orglen < 99999999500  &&  packlen < 99999999500 )
-        printf ("%5u.%03u%s%5u.%03u", (int)(orglen/1000000), (int)(orglen/1000%1000), html2, (int)(packlen/1000000), (int)(packlen/1000%1000) );
-    else if ( orglen < 999999995000  &&  packlen < 999999995000 )
-        printf ("%6u.%02u%s%6u.%02u", (int)(orglen/1000000), (int)(orglen/10000%100), html2, (int)(packlen/1000000), (int)(packlen/10000%100) );
-    else if ( orglen < 9999999950000  &&  packlen < 9999999950000 )
-        printf ("%7u.%01u%s%7u.%01u", (int)(orglen/1000000), (int)(orglen/100000%10), html2, (int)(packlen/1000000), (int)(packlen/100000%10) );
-    else
-        printf ("%9u%s%9u", (int)(orglen/1000000), html2, (int)(packlen/1000000) );
-
-    if ( html ) printf ("</td> <td align=\"right\">" );
-
-    // Compression ratio (if ratio < 10)
-    if ( packlen > 0 ) {
-        tmp = (double) orglen / packlen;
-        if ( fabs (tmp - 1.) < 0.0005 )
-            printf ("  1.0  ");
-        else
-            printf ( tmp < 9.9995  ?  "%7.3f"  :  "       ", tmp );
-    }
-    else {
-        printf ("       ");
-    }
-
-
-    if ( html ) printf ("</td> <td align=\"right\">%s", color (packlen * 8 / duration) );
-
-    // Bitrate (kbps) (works up to 100 Mbps)
-    if ( duration > 0 ) {
-        tmp = packlen * 0.008 / duration;
-        printf ( tmp < 99.95  ?  tmp < 9.995  ?  "  %4.2f"  :  "  %4.1f"  :  " %5.0f", tmp );
-    }
-    else {
-        printf ("      ");
-    }
-
-    if ( html ) printf ("%s</font></td> <td align=\"right\">", colorend (packlen * 8 / duration) );
-
-    // Duration (works up to
-    if      ( ms <  600000000 )
-        printf (" %4u:%02u.%03u  ", (int)(ms/60000), (int)(ms/1000%60), (int)(ms%1000) );
-    else if ( ms < 6000000000 )
-        printf (" %5u:%02u.%02u  ", (int)(ms/60000), (int)(ms/1000%60), (int)(ms%1000/10) );
-    else if ( ms < 60000000000 )
-        printf (" %6u:%02u.%01u  ", (int)(ms/60000), (int)(ms/1000%60), (int)(ms%1000/100) );
-    else
-        printf (" %8u:%02u  ", (int)(ms/60000), (int)(ms/1000%60) );
-
-    if ( html ) printf ("</td> <td align=\"right\"><tt>" );
-
-    // technical parameters
-    if ( chan > 1  &&  bits > 0  )
-        printf ("(%ux%2u", chan, bits );
-    else if ( chan == 1  &&  bits > 0  )
-        printf ("(  %2u", bits );
-    else
-        printf ("     ");
-
-    // scanning frequency
-    if ( freq <= 0 )
-        printf ("%c           ", chan>0  && bits > 0  ?  ')'  :  ' ' );
-    else if ( freq / 1000 == (int)(freq/1000) )
-        printf ("%5.0f kHz)  ", freq/1000. );
-    else if ( freq / 100 == (int)(freq/100) )
-        printf ("%5.1f kHz)  ", freq/1000. );
-    else
-        printf ("%6.0f Hz)  ", freq );
-
-    if ( html ) printf ("</tt></td> <td align=\"left\">" );
-
-    // Name
-    printf ("%s", name );
-
-    if ( html ) printf ("</td> </tr>" );
-
-    printf ("\n" );
-    fflush (stdout);
-    filecnt ++;
-}
-
-
-#define EXT(x)  (0 == strcasecmp (ext+1, #x))
-
-
-static int
-analyse ( const char* name )
-{
-    const char*    ext = strrchr ( name, '.');
-    FILE*          fp;
-    unsigned char  buff [44];
-    unsigned long  freq;
-    unsigned long  len;             // length of the file on the disk
-    unsigned long  pcmlen;
-    unsigned int   channels;
-    unsigned int   bits;
-
-    pcmlen = -1;
-
-    if ( ext == NULL ) {
-        goto noext;
-
-    }
-    else if ( EXT(wav) ) { wave:
-        fp = fopen ( name, "rb" );
-    }
-    else if ( EXT(raw)  ||  EXT(cdr)  ||  EXT(pcm) ) {
-        fp = fopen ( name, "rb" );
-        channels = 2;
-        bits     = 16;
-        freq     = 44100;
-        goto skip;
-    }
-    else if ( EXT(pac)  ||  EXT(lpac)  ||  EXT(lpa) ) { lpac:
-        fp = pipeopen ( "lpac -x -o #", name );
-    }
-    else if ( EXT(fla)  ||  EXT(flac) ) { flac:
-        fp = pipeopen ( "flac -d -s -c - < #", name );
-    }
-    else if ( EXT(rka)  ||  EXT(rkau) ) { rkau:
-        fp = pipeopen ( "rkau # -", name );
-    }
-    else if ( EXT(sz) ) {
-        fp = pipeopen ( "szip -d < #", name );
-    }
-    else if ( EXT(sz2) ) { szip2:
-        fp = pipeopen ( "szip2 -d < #", name );
-        if ( fp == NULL )
-            fp = pipeopen ( "szip -d < #", name );
-    }
-    else if ( EXT(ofr) ) { optimfrog:
-        fp = pipeopen ( "optimfrog d # -", name );
-    }
-    else if ( EXT(ape)  ||  EXT(mac) ) { ape:
-        fp = pipeopen ( "mac # - -d", name );
-    }
-    else if ( EXT(la) ) {
-        fp = pipeopen ( "la -console #", name );
-    }
-    else if ( EXT(shn)  ||  EXT(shorten) ) { shorten:
-        fp = pipeopen ( "shorten -x # -", name );           // test if it's okay !!!!
-        if ( fp == NULL )
-            fp = pipeopen ( "shortn32 -x # -", name );
-    }
-    else if ( EXT(mp3)  ||  EXT(mp1)  ||  EXT(mp2)  ||  EXT(mpt)  ||  EXT(mp3pro) ) {
-        fp = pipeopen ( "madplay --output=wave:/dev/fd/1 # 2> /dev/null", name );
-    }
-    else if ( EXT(mpc)  ||  EXT(mp+)  ||  EXT(mpp) ) {
-        fp = pipeopen ( "mppdec --silent --scale 0 # -", name );
-    }
-    else if ( EXT(ogg) ) {
-        fp = pipeopen ( "ogg123 -q -d wav -f /dev/fd/1 #", name );
-        pcmlen = -2;
-    }
-    else if ( EXT(mod) ) {
-        fp = pipeopen ( "xmp -b16 -c -f44100 --stereo -o- #", name );
-        channels = 2;
-        bits     = 16;
-        freq     = 44100;
-        goto skip;
-    }
-    else if ( EXT(ac3) ) {
-        fp = pipeopen ( "ac3dec #", name );
-    }
-    else if ( EXT(aac) ) {
-        fp = pipeopen ( "faad -w # 2> /dev/null", name );
-        pcmlen = -2;
-    }
-    else {
-        char buff [512];
-noext:
-        fp = fopen ( name, "rb" );
-        if ( fp == NULL )
-            return 0;
-        memset ( buff, 0, sizeof buff );
-        fread ( buff, 1, sizeof buff, fp );
-        fclose (fp);
-        if ( 0 == memcmp (buff, "MAC ", 4)  &&  0 == memcmp (buff+40, "RIFF", 4) ) goto ape;
-        if ( 0 == memcmp (buff, "fLaC", 4)                                       ) goto flac;
-        if ( 0 == memcmp (buff, "*"   , 1)  &&  0 == memcmp (buff+ 1, "RIFF", 4) ) goto optimfrog;
-        if ( 0 == memcmp (buff, "LPAC", 4)  &&  0 == memcmp (buff+14, "RIFF", 4) ) goto lpac;
-        if ( 0 == memcmp (buff, "RKA7", 4)                                       ) goto rkau;
-        if ( 0 == memcmp (buff, "ajkg", 4)                                       ) goto shorten;
-        if ( 0 == memcmp (buff, "SZ\012\004", 4)                                 ) goto szip2;
-        if ( 0 == memcmp (buff, "RIFF", 4)  &&  0 == memcmp (buff+44, "wvpk", 4) ) goto wavepack;
-        if ( 0 == memcmp (buff, "RIFF", 4)                                       ) goto wave;
-
-        wavepack:
-        fp = NULL;
-    }
-
-    if ( fp == NULL )
-        return 0;
-
-    if ( sizeof(buff) != fread ( buff, 1, sizeof(buff), fp ) ) {
-        PCLOSE (fp);
-        return 0;
-    }
-    if ( pcmlen != -2 )
-        pcmlen   = buff[40]+(buff[41]<<8)+(buff[42]<<16)+(buff[43]<<24);
-
-    freq     = buff[24]+(buff[25]<<8)+(buff[26]<<16)+(buff[27]<<24);
-    bits     = buff[34] + (buff[35]<<8);
-    channels = buff[22] + (buff[23]<<8);
-
-skip:
-    if ( (unsigned long)pcmlen >= 0x7FFFFFFF  ||  pcmlen == 0 ) {
-        int   tmp;
-        char  buff [4096];
-
-        pcmlen = 0;
-        while ( (tmp = fread (buff, 1, sizeof(buff), fp)) > 0 )
-            pcmlen += tmp;
-    }
-    PCLOSE (fp);
-
-    if (memcmp (buff, "RIFF", 4) != 0 )
-        return 0;
-
-    fp = fopen ( name, "rb" );
-    if ( fp == NULL )
-        return 0;
-    fseek ( fp, 0l, SEEK_END );
-    len = ftell (fp);
-    fclose (fp);
-
-    if ( freq > 0  &&  bits > 0  &&  channels > 0 ) {
-        report ( name, pcmlen+44, len, pcmlen/channels/((bits+7)/8)/(double)freq, bits, channels, freq );
-        return 1;
-    }
-    return 0;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    static const char*  extentions [] = {
-        ".mpc", ".mpp", ".mp+", ".mp1", ".mp2", ".mp3", ".mpg", ".mpeg", ".lqt", ".aac",
-        ".wav", ".raw", ".cdr", ".lpac", ".lpa", ".pac", ".fla", ".flac",
-        ".rka", ".rkau", ".sz", ".sz2", ".ofr", ".mac", ".ape", ".shn", ".ogg",
-        ".mid", ".ac3", ".vqf", ".dts", ".sdds", ".mpv", ".mp3pro", ".wv", ".mod",
-        ".la",
-        NULL
-    };
-
-    if ( argv[1] != NULL  &&  0 == strcmp (argv[1], "--html") )
-        html++, argv++, argc--;
-
-    if ( !html ) {
-        printf ( " PCM size File size  Ratio  kbps    Duration  Param Frequency  Name\n");
-    }
-    else {
-        printf ( "<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">\n"
-                 "<html>\n"
-                 "<head>\n"
-                 "    <title>File List</title>\n"
-                 "</head>\n\n"
-                 "<body text=\"#FFFFFF\" bgcolor=\"#254E31\" link=\"#33CCFF\" vlink=\"#33CCFF\" alink=\"#FF0000\" background=\"img/back-2.gif\">\n\n" );
-
-        printf ( "<table border=\"1\" bgcolor=\"20442B\">\n" );
-        printf ( "  <tr> <td>PCM size</td><td>File size</td><td>Ratio</td><td>kbps</td><td>Duration</td><td>Param&nbsp;Frequency</td><td>Name</td> </tr>\n");
-        printf ( "  <tr></tr>\n" );
-    }
-    fflush (stdout);
-
-#if   defined _OS2
-    _wildcard ( &argc, &argv );
-#elif defined USE_ARGV
-    mysetargv ( &argc, &argv, extentions );
-#endif
-
-    while ( *++argv )
-        analyse (*argv);
-
-    if ( html )
-        printf ( "  <tr></tr>\n" );
-
-    report ( NULL, 0, 0, 0., 0, 0, 0 );
-
-    if (html) {
-        printf ( "</table>\n\n</body>\n</html>\n" );
-    }
-
-    return 0;
-}
-
-/* end of list.c */
Index: penc/trunk/list.dsp
===================================================================
--- /mppenc/trunk/list.dsp	(revision 96)
+++ 	(revision )
@@ -1,114 +1,0 @@
-# Microsoft Developer Studio Project File - Name="list" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=list - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "list.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "list.mak" CFG="list - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "list - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "list - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "list - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "list___Win32_Release"
-# PROP BASE Intermediate_Dir "list___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "list - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "list___Win32_Debug"
-# PROP BASE Intermediate_Dir "list___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  setargv.obj /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "list - Win32 Release"
-# Name "list - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\_setargv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\list.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\pipeopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/list.vcproj
===================================================================
--- /mppenc/trunk/list.vcproj	(revision 96)
+++ 	(revision )
@@ -1,222 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="list"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;MPP_ENCODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/list.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj"
-				OutputFile=".\Debug/list.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/list.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/list.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/list.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj"
-				OutputFile=".\Release/list.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/list.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/list.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="_setargv.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="list.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="pipeopen.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/list_korr.c
===================================================================
--- /mppenc/trunk/list_korr.c	(revision 96)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
-   nasm -f elf wav_korr_asm.asm; gcc -O2 -s -o wav_korr wav_korr.c wav_korr_asm.o -lm
-     or:
-   gcc -DNONASM -O2 -s -o wav_korr wav_korr.c -lm
-*/
-
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <memory.h>
-
-typedef signed short stereo [2];
-typedef signed short mono;
-typedef struct {
-    unsigned long long  n;
-    long double         x;
-    long double         x2;
-    long double         y;
-    long double         y2;
-    long double         xy;
-} korr_t;
-
-#ifdef NONASM
-
-void analyze_stereo ( const stereo* p, size_t len, korr_t* k )
-{
-    long double  _x = 0, _x2 = 0, _y = 0, _y2 = 0, _xy = 0;
-    double       t1;
-    double       t2;
-
-    k -> n  += len;
-
-    for ( ; len--; p++ ) {
-        _x  += (t1 = (*p)[0]); _x2 += t1 * t1;
-        _y  += (t2 = (*p)[1]); _y2 += t2 * t2;
-                               _xy += t1 * t2;
-    }
-
-    k -> x  += _x ;
-    k -> x2 += _x2;
-    k -> y  += _y ;
-    k -> y2 += _y2;
-    k -> xy += _xy;
-}
-
-void analyze_dstereo ( const stereo* p, size_t len, korr_t* k )
-{
-    static double l0 = 0;
-    static double l1 = 0;
-    long double   _x = 0, _x2 = 0, _y = 0, _y2 = 0, _xy = 0;
-    double        t1;
-    double        t2;
-
-    k -> n  += len;
-
-    for ( ; len--; p++ ) {
-        _x  += (t1 = (*p)[0] - l0);  _x2 += t1 * t1;
-        _y  += (t2 = (*p)[1] - l1);  _y2 += t2 * t2;
-                                     _xy += t1 * t2;
-        l0   = (*p)[0];
-        l1   = (*p)[1];
-    }
-
-    k -> x  += _x ;
-    k -> x2 += _x2;
-    k -> y  += _y ;
-    k -> y2 += _y2;
-    k -> xy += _xy;
-}
-
-
-void analyze_mono   ( const mono* p, size_t len, korr_t* k )
-{
-    long double   _x = 0, _x2 = 0;
-    double        t1;
-
-    k -> n  += len;
-
-    for ( ; len--; p++ ) {
-        _x  += (t1 = (*p)); _x2 += t1 * t1;
-    }
-
-    k -> x  += _x ;
-    k -> x2 += _x2;
-    k -> y  += _x ;
-    k -> y2 += _x2;
-    k -> xy += _x2;
-}
-
-void analyze_dmono   ( const mono* p, size_t len, korr_t* k )
-{
-    static double l0 = 0;
-    long double   _x = 0, _x2 = 0;
-    double        t1;
-
-    k -> n  += len;
-
-    for ( ; len--; p++ ) {
-        _x  += (t1 = (*p) - l0); _x2 += t1 * t1;
-        l0   = *p;
-    }
-
-    k -> x  += _x ;
-    k -> x2 += _x2;
-    k -> y  += _x ;
-    k -> y2 += _x2;
-    k -> xy += _x2;
-}
-
-#else
-
-extern void __analyze_stereo ( const stereo* p, size_t len, korr_t* dst );
-extern void __analyze_mono   ( const mono*   p, size_t len, korr_t* dst );
-
-#define analyze_stereo(ptr,len,k)       __analyze_stereo ( ptr, len, k )
-#define analyze_mono(ptr,len,k)         __analyze_mono   ( ptr, len, k )
-
-#endif
-
-
-void report_init ( void )
-{
-    printf ( " x[AC]     y[AC]     r         type        x[DC]     y[DC]   sy/sx  File\n");
-}
-
-int sgn ( long double x )
-{
-    if ( x > 0 ) return +1;
-    if ( x < 0 ) return -1;
-    return 0;
-}
-
-
-void report ( int channels, korr_t* k, int supress_DC_report )
-{
-    long double  scale = sqrt ( 1.e5 / (1<<29) ); // Sine Full Scale is +10 dB, 7327 = 100%
-    long double  r;
-    long double  sx;
-    long double  sy;
-    long double  x;
-    long double  y;
-    long double  b;
-
-    // printf ("n=%Lu (7036596)\nx=%Lf (-1136345)\ny=%Lf (-783749)\nxy=%Lf (103252784558988)\nx²=%Lf (182857029624921)\ny²=%Lf (201045032621475)\n\n",k.n,k.x,k.y,k.xy,k.x2,k.y2);
-
-    r  = (k->x2*k->n - k->x*k->x) * (k->y2*k->n - k->y*k->y);
-    r  = r  > 0.l  ?  (k->xy*k->n - k->x*k->y) / sqrt (r)  :  1.l;
-    sx = k->n > 1  ?  sqrt ( (k->x2 - k->x*k->x/k->n) / (k->n - 1) )  :  0.l;
-    sy = k->n > 1  ?  sqrt ( (k->y2 - k->y*k->y/k->n) / (k->n - 1) )  :  0.l;
-    x  = k->n > 0  ?  k->x/k->n  :  0.l;
-    y  = k->n > 0  ?  k->y/k->n  :  0.l;
-
-    b  = sx != 0   ?  sy/sx * sgn(r)  :  0.l;
-
-    printf ( "%7.3Lf%%%9.3Lf%%%9.3Lf%%   ",
-             sx * scale, sy * scale, 100. * r );
-    if ( supress_DC_report )
-        printf ( "                  " );
-    else
-        printf ( "%7.3Lf%%%9.3Lf%%%", x * scale, y * scale );
-    printf ( "  %6.3Lf\n", b );
-    fflush ( stdout );
-}
-
-
-void readfile ( const char* name, int fd )
-{
-    unsigned short  header [22];
-    stereo          s [1152];
-    mono            m [1152];
-    size_t          samples;
-    korr_t          k0;
-    korr_t          k1;
-    korr_t          kd;
-
-
-    memset ( &k0, 0, sizeof(k0) );
-    memset ( &k1, 0, sizeof(k1) );
-
-    read ( fd, header, sizeof(header) );
-
-    switch ( header[11] ) {
-    case 1:
-        printf ("\n%s\n", name);
-        while  ( ( samples = read (fd, m, sizeof(m)) ) > 0 ) {
-            analyze_mono    ( m, samples / sizeof (*m), &k0 );
-            analyze_dmono   ( m, samples / sizeof (*m), &k1 );
-        }
-        report ( header[11], &k0, 0 );
-        report ( header[11], &k1, 1 );
-        break;
-
-    case 2:
-        printf ("\n%s\n", name);
-        while  ( ( samples = read (fd, s, sizeof(s)) ) > 0 ) {
-            analyze_stereo  ( s, samples / sizeof (*s), &k0 );
-            analyze_dstereo ( s, samples / sizeof (*s), &k1 );
-            memset ( &kd, 0, sizeof(kd) );
-            analyze_dstereo ( s, samples / sizeof (*s), &kd );
-        }
-        report ( header[11], &k0, 0 );
-        report ( header[11], &k1, 1 );
-        break;
-
-    default:
-        fprintf ( stderr, "%u Channels not supported: %s\n", header[11], name );
-        break;
-    }
-}
-
-int main ( int argc, char** argv )
-{
-    char*  name;
-    int    fd;
-
-    report_init ();
-
-    if (argc < 2)
-        readfile ( "<stdin>", 0 );
-    else
-        while ( (name = *++argv) != NULL ) {
-            if ( (fd = open ( name, O_RDONLY )) >= 0 ) {
-                readfile ( name, fd );
-                close ( fd );
-            } else {
-                fprintf ( stderr, "Can't open: %s\n", name );
-            }
-        }
-
-    return 0;
-}
Index: penc/trunk/list_korr_asm.nas
===================================================================
--- /mppenc/trunk/list_korr_asm.nas	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-        BITS 32
-
-        SECTION .text
-;
-; void __analyze_stereo ( const stereo* p, size_t len, korr_t* result );
-;
-; esp+12        result
-; esp+ 8        len
-; esp+ 4        p
-; esp+ 0        return address
-;
-        GLOBAL  __analyze_stereo:function
-__analyze_stereo
-        mov     eax,  [esp+12]
-        mov     ecx,  [esp+ 8]
-        mov     edx,  [esp+ 4]
-        add     dword [eax+0],ecx
-        adc     dword [eax+4],byte 0
-        fldz
-        fldz
-        fldz
-        fldz
-        fldz                            ; Sxy Sy² Sy  Sx² Sx
-lbl:
-        fild    word [edx+0]            ; x   Sxy Sy² Sy  Sx² Sx
-        fld     st0                     ; x   x   Sxy Sy² Sy  Sx² Sx
-        fmul    st0,st0                 ; x²  x   Sxy Sy² Sy  Sx² Sx
-        faddp   st5,st0                 ; x   Sxy Sy² Sy  Sx² Sx
-        fadd    st5,st0
-        fild    word [edx+2]            ; y   x   Sxy Sy² Sy  Sx² Sx
-        fadd    st4,st0
-        add     edx,byte 4
-        fmul    st1,st0                 ; y   xy  Sxy Sy² Sy  Sx² Sx
-        fmul    st0,st0                 ; y²  xy  Sxy Sy² Sy  Sx² Sx
-        faddp   st3,st0                 ; xy  Sxy Sy² Sy  Sx² Sx
-        faddp   st1,st0                 ; Sxy Sy² Sy  Sx² Sx
-        dec     ecx
-        jnz     lbl
-
-        fld     tword [eax+56]
-        faddp   st1,st0
-        fstp    tword [eax+56]          ; xy
-        fld     tword [eax+44]
-        faddp   st1,st0
-        fstp    tword [eax+44]          ; y²
-        fld     tword [eax+32]
-        faddp   st1,st0
-        fstp    tword [eax+32]          ; y
-        fld     tword [eax+20]
-        faddp   st1,st0
-        fstp    tword [eax+20]          ; x²
-        fld     tword [eax+ 8]
-        faddp   st1,st0
-        fstp    tword [eax+ 8]          ; x
-        ret
-;
-
-;
-; void __analyze_mono ( const mono* p, size_t len, korr_t* result );
-;
-; esp+12        result
-; esp+ 8        len
-; esp+ 4        p
-; esp+ 0        return address
-;
-        GLOBAL  __analyze_mono:function
-__analyze_mono
-        mov     eax,  [esp+12]
-        mov     ecx,  [esp+ 8]
-        mov     edx,  [esp+ 4]
-        add     dword [eax+0],ecx
-        adc     dword [eax+4],byte 0
-        fldz
-        fldz                            ; Sx² Sx
-lbl2:
-        fild    word [edx+0]            ; x   Sx² Sx
-        add     edx,byte 2
-        fadd    st2,st0                 ; x   Sx² Sx
-        fmul    st0,st0                 ; x²  Sx² Sx
-        faddp   st1,st0                 ; Sx² Sx
-        dec     ecx
-        jnz     lbl2
-
-        fld     tword [eax+56]
-        fadd    st0,st1
-        fstp    tword [eax+56]          ; xy
-        fld     tword [eax+44]
-        fadd    st0,st1
-        fstp    tword [eax+44]          ; y²
-        fld     tword [eax+32]
-        fadd    st0,st2
-        fstp    tword [eax+32]          ; y
-        fld     tword [eax+20]
-        faddp   st1,st0
-        fstp    tword [eax+20]          ; x²
-        fld     tword [eax+ 8]
-        faddp   st1,st0
-        fstp    tword [eax+ 8]          ; x
-        ret
-;
Index: penc/trunk/lpc.c-new
===================================================================
--- /mppenc/trunk/lpc.c-new	(revision 96)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/******************************************************************************
-*                                                                             *
-*       Copyright (C) 1992-1995 Tony Robinson                                 *
-*                                                                             *
-*       See the file LICENSE for conditions on distribution and usage         *
-*                                                                             *
-******************************************************************************/
-
-/*
- * $Id: lpc.c-new,v 1.1 2004/03/17 22:17:54 robux4 Exp $
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../include/shorten.h"
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#define log2(x)                         ( log (x) * (1./M_LN2) )
-#define E_BITS_PER_COEF         ( 2 + LPCQUANT )                // watch out, these are all 0 .. order inclusive arrays
-
-
-int                                                             // best prediction order model
-wav2lpc ( slong*  buf,                  // Samples
-                  int     nbuf,                 // Number of samples
-                  slong   offset,               //
-                  int*    qlpc,                 // quantized prediction coefficients
-                  int     nlpc,                 // max. prediction order
-                  int     version,              // some strange version information
-          float*  psigbit,              // expected number of bits per original signal sample
-          float*  presbit )             // expected number of bits per residual signal sample
-{
-        static double*  fbuf  = NULL;
-        static int      nflpc = 0;
-        static int      nfbuf = 0;
-        int             i;
-        int             j;
-        int             bestnbit;
-        int             bestnlpc;
-        double          e;
-        double          bestesize;
-        double          ci;
-        double          esize;
-        double          acf [MAX_LPC_ORDER + 1];
-        double          ref [MAX_LPC_ORDER + 1];
-        double          lpc [MAX_LPC_ORDER + 1];
-        double          tmp [MAX_LPC_ORDER + 1];
-        double          escale = 0.5 * M_LN2 * M_LN2 / nbuf;
-        double          sum;
-
-        if ( nlpc >= nbuf )                                                             // if necessary, limit the LPC order to the number of samples available
-                nlpc = nbuf - 1;
-
-        if ( nlpc > nflpc  ||  nbuf > nfbuf ) {                 // grab some space for a 'zero mean' buffer of floats if needed
-                if ( fbuf != NULL )
-                        free ( fbuf - nflpc );
-                fbuf  = nlpc + ((double*) pmalloc ( (nlpc+nbuf) * sizeof (*fbuf) ));
-                nfbuf = nbuf;
-                nflpc = nlpc;
-        }
-
-        e = 0.;
-        for ( j = 0; j < nbuf; j++ ) {                                  // zero mean signal and compute energy
-                sum = fbuf [j] -= offset;
-                e  += sum * sum;
-        }
-
-        esize     = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
-        *psigbit  = esize;                                                              // return the expected number of bits per original signal sample
-
-        acf [0]   = e;                                                                  // store the best values so far (the zeroth order predictor)
-        bestnlpc  = 0;
-        bestnbit  = (int) floor (nbuf * esize);
-        bestesize = esize;
-
-        // check all linear predictors up to and including length nlpc if version is 2 or greater, just check two more than bestnlpc
-        // AJR:  8 May 1996: the code used to read "version < 12", it should read "bestnlpc + 2" but
-        //       changed to "bestnlpc + 3" to be more conservative (and more in line with old behaviour
-
-        for ( i = 1; i <= nlpc  &&  e > 0.  &&  (version < 2  ||  i <= bestnlpc + 3); i++ ) {
-
-                sum = 0.;
-                for ( j = i; j < nbuf; j++ )                                                                                    // compute the jth autocorrelation coefficient
-                        sum += fbuf [j] * fbuf [j-i];
-                acf [i] = sum;
-
-                ci = 0.;                                                                                                                                // compute the reflection and LP coeffients for order j predictor
-                for ( j = 1; j < i; j++ )
-                        ci += lpc [j] * acf [i-j];
-                lpc [i] = ref [i] = ci = (acf [i] - ci) / e;
-                for ( j = 1; j < i; j++ )
-                        tmp [j] = lpc [j] - ci * lpc [i-j];
-                for ( j = 1; j < i; j++ )
-                        lpc [j] = tmp [j];
-
-                e    *= 1 - ci*ci;                                                                                                              // compute the new energy in the prediction residual
-                esize = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
-
-                if ( nbuf * esize + i * E_BITS_PER_COEF < bestnbit ) {                                  // store this model if it is the best so far
-                        bestnlpc  = i;                                                                                                          // store best model order
-                        bestnbit  = (int) floor ( nbuf * esize + i * E_BITS_PER_COEF );
-                        bestesize = esize;
-
-                        for ( j = 0; j < bestnlpc; j++ )                                                                        // store the quantised LP coefficients
-                                qlpc [j] = (int) floor ( lpc [j+1] * (1 << LPCQUANT) + 0.5 );
-                }
-        }
-
-        *presbit = bestesize;                                           // return the expected number of bits per residual signal sample
-        return bestnlpc;                                                        // return the best model order
-}
Index: penc/trunk/minimax.h
===================================================================
--- /mppenc/trunk/minimax.h	(revision 96)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef MPP_MINIMAX_H
-#define MPP_MINIMAX_H
-
-#if   defined __GNUC__  &&  defined __cplusplus
-
-# define maxi(A,B)  ( (A) >? (B) )
-# define mini(A,B)  ( (A) <? (B) )
-# define maxd(A,B)  ( (A) >? (B) )
-# define mind(A,B)  ( (A) <? (B) )
-# define maxf(A,B)  ( (A) >? (B) )
-# define minf(A,B)  ( (A) <? (B) )
-
-# define absi(A)    abs   (A)
-# define absf(A)    fabsf (A)
-# define absd(A)    fabs  (A)
-
-#elif defined __GNUC__
-
-# define maxi(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
-# define mini(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
-# define maxd(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
-# define mind(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
-# define maxf(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
-# define minf(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
-
-# define absi(A)    abs   (A)
-# define absf(A)    fabsf (A)
-# define absd(A)    fabs  (A)
-
-#else
-
-# define maxi(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
-# define mini(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
-# define maxd(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
-# define mind(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
-# define maxf(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
-# define minf(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
-
-# define absi(A)    ( (A) >= 0    ?  (A)  : -(A) )
-# define absf(A)    ( (A) >= 0.f  ?  (A)  : -(A) )
-# define absd(A)    ( (A) >= 0.   ?  (A)  : -(A) )
-
-#endif /* GNUC && C++ */
-
-#endif /* MPP_MINIMAX_H */
Index: penc/trunk/mmm.bat
===================================================================
--- /mppenc/trunk/mmm.bat	(revision 96)
+++ 	(revision )
@@ -1,7 +1,0 @@
-@echo off
-echo.
-echo.
-Release\mppdec 1.mpc nul
-echo.
-Release\mppdec 1.mpc 2.wav
-.\wavcmp 2.wav 9.wav
Index: penc/trunk/mpc-darwin.diff
===================================================================
--- /mppenc/trunk/mpc-darwin.diff	(revision 96)
+++ 	(revision )
@@ -1,43 +1,0 @@
- 
- //// Macros typical for special conformances
-@@ -67,7 +69,7 @@
- # include <time.h>
- # include <sys/types.h>
- # include <sys/stat.h>
--#elif defined __unix__  ||  defined __linux__
-+#elif defined __unix__  ||  defined __linux__ || defined __APPLE__
- # include <fcntl.h>
- # include <unistd.h>
- # include <sys/time.h>
-@@ -100,6 +102,16 @@
- #if defined __TURBOC__
- # undef USE_OSS_AUDIO
- # undef USE_ESD_AUDIO
-@@ -439,14 +451,14 @@
- # endif
- #endif /* !S_ISDIR */
- 
--#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __TURBOC__  ||  defined _WIN32
-+#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __TURBOC__  ||  defined _WIN32 || defined __APPLE__
- # define ISATTY(fd)             isatty (fd)
- #else
- # define ISATTY(fd)             0
- #endif
- 
- // Path separator
--#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__
-+#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__ || defined __APPLE__
- # define PATH_SEP               '/'
- # define DRIVE_SEP              '\0'
- # define EXE_EXT                ""
-diff -NauX ../diffignore ../mppdec-1.1/wave_out.c ./wave_out.c
---- ../mppdec-1.1/wave_out.c	Fri Apr  4 15:23:12 2003
-+++ ./wave_out.c	Fri Apr  4 12:02:32 2003
-@@ -742,6 +742,7 @@
-     int                  aif;
- 
-     (void) dummyFile;
-+    output_endianess = machine_endianess;
- 
-     if ( esd_rate == 0 ) {
-         if ( (esd = esd_open_sound (NULL)) >= 0 ) {
Index: penc/trunk/mpp.dsw
===================================================================
--- /mppenc/trunk/mpp.dsw	(revision 96)
+++ 	(revision )
@@ -1,245 +1,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Remove.tab"=.\Remove.tab.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "clipboard"=.\clipboard.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "clipstat"=.\clipstat.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "codepage"=.\codepage.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "config"=.\config.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "huffman"=.\huffman.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "list"=.\list.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mppdec"=.\mppdec.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mppenc"=.\mppenc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mppsplit"=.\mppsplit.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "name"=.\name.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pns"=.\pns.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pulse"=.\pulse.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "replaygain"=.\replaygain.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "seekspeed"=.\seekspeed.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "streamserver"=.\streamserver.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "tagger"=.\tagger.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "tonality"=.\tonality.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "wp"=.\wp.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
Index: penc/trunk/mpp.h
===================================================================
--- /mppenc/trunk/mpp.h	(revision 96)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/******************************************************
- *                                                    *
- *            Source Compile configuration            *
- *                                                    *
- ******************************************************/
-
-
-#if !defined(__APPLE__)
-// use optimized assembler routines for Pentium III/K6-2/Athlon (only 32 bit OS, Intel x86 and no MAKE_xxBITS)
-// you need the NASM assembler on your system, the program becomes a little bit larger and decoding
-// on AMD K6-2 (x3), AMD K6-III (x3), AMD Duron (x1.7), AMD Athlon (x1.7), Pentium III (x2) and Pentium 4 (x1.8) becomes faster
-#define USE_ASM
-
-// Open Sound System support (only Unix with OSS support)
-// If your Operating System supports the Open Sound System, you can output to /dev/dsp* and
-// instead of writing a file the program plays the file via this sound device.
-// on some systems you also must link the libossaudio library, so maybe you also must edit the Makefile
-#define USE_OSS_AUDIO
-
-// Enlightenment Sound Daemon support (only Unix with ESD support)
-// If your Operating System supports the Enlightenment Sound Daemon you can output to /dev/esd and
-// instead of writing a file the program plays the file via this sound device.
-// you also must link the libesd library, so maybe you also must edit the Makefile
-//#define USE_ESD_AUDIO
-
-#endif
-
-// native Sun Onboard-Audio support (only SunOS)
-// If you have a Sun Workstation with Onboard-Audio, you can output to /dev/audio and
-// instead of writing a file the program plays the file via this sound device.
-// Some machines lacking librt.a so you are unable to link a static executable with realtime-support.
-// Although you can still perfectly use the dynamic executable.
-//#define USE_SUN_AUDIO
-
-// Sound support for SGI Irix
-// If you have a SGI Workstation running IRIX, you can output to /dev/audio and
-// instead of writing a file the program plays the file via this sound device.
-//#define USE_IRIX_AUDIO
-
-// Audio support for Windows (WAVE OUT) (only Windows)
-// If you have a Windows based system and if you also want to play files directly instead of only writing audio files,
-// then define the next item
-#define USE_WIN_AUDIO
-
-// Buffersize for Windows Audio in 4.5 KByte units
-// Only needed for Windows+USE_WIN_AUDIO
-// Good values are 8...32 for fast machines and 128...512 for slow machines
-// large values decrease average performance a little bit, increase memory
-// consumption (1 Block = 4.5 KByte), but increase buffering, so it takes a
-// longer time to get a dropout. Note that I don't have a 486/80...133, so
-// I don't know anything about their performance.
-// (Attention: 512 = additional 2.3 MByte of memory)
-#define MAX_WAVEBLOCKS    40
-
-// increase priority if destination is an audio device
-// this increases the priority of the decoder when playing the file directly to a sound card to reduce/prevent
-// dropouts during the playback due to CPU time shortage
-#define USE_NICE
-
-// use realtime scheduling if destination is an audio device
-// This sets the program to real time priority when playing the file directly to a sound card.
-// Now it should be really difficult to get dropouts (file IO and other realtime programs are the remaining weak points)
-#define USE_REALTIME
-
-// use ANSI-Escape sequences to structure output
-#define USE_ANSI_ESCAPE
-
-// Use termios for reading values from keyboard without echo and ENTER
-#define USE_TERMIOS
-
-// if none of the next three macros MAKE_xxBIT is defined,
-// normal non-dithered and non-shaped 16 bit PCM output is generated
-
-// create 16 bit Output
-// output is 16 bit wide, you can also dither and noise shape
-//#define MAKE_16BIT
-
-// create 24 bit Output
-// output is 24 bit wide instead of 16 bit wide, you can also dither and noise shape
-//#define MAKE_24BIT
-
-// create 32 bit Output
-// output is 32 bit wide instead of 16 bit wide, you can also dither and noise shape
-//#define MAKE_32BIT
-
-// Select subset of function used for file I/O:
-//   1: ANSI via file pointer (FILE*)
-//   2: POSIX via file handle (int or HANDLE)
-//   3: POSIX like lowest level function of Turbo/Borland C
-//   4: WinAMP 3: running inside WinAMP
-// Try to use '2', if this doesn't work, try '1'. '3' is for Borland compilers.
-#ifndef FILEIO
-# if   defined MPP_ENCODER
-#  define FILEIO      1             // mppenc still uses buffered ANSI-I/O
-# elif defined MPP_DECODER
-#  define FILEIO      2
-# else
-#   error Neigher MPP_DECODER nor MPP_ENCODER is defined. Abort.
-# endif
-#endif
-
-// the POSIX function read() can return less bytes than requested not only at the end of the file.
-// if this happens, the following macro must be defined:
-#define HAVE_INCOMPLETE_READ
-
-// use a shorter Huffman_t  representation, may be faster
-// use for performance tuning
-#define USE_HUFF_PACK
-
-// use shorter representation for SCF_Index[][] and Res[], may be faster
-// use for performance tuning
-#define USE_ARRAY_PACK
-
-// use the System 5 timer for profiling
-// otherwise a special piece of code for Turbo-C is used or the Timestamp Counter on Intel IA32/gcc systems.
-// Both is highly non-portable. This solution is more portable (you only need a SYS 5 compatible system,
-// but also much much more inaccurate.
-//#define USE_SYSV_TIMER
-
-// do a memory shift every n subband samples, otherwise only increment pointer (6, 12, 18 and 36 are good values)
-// use for performance tuning
-#define VIRT_SHIFT    18
-
-// selects InputBuff size, size is 4 * 2^IBUFLOG2 bytes (11...14 are good values)
-// use for performance tuning
-// can also be used to eliminate disk performance issue while tuning the program
-// (set to a value, so the test cases are fully read before decoding
-#define IBUFLOG2      14
-
-// Dump contents of MPEGplus files (only for development), 0x00 no dump
-// Bit 0: maxband, Bit 1: msbits, Bit 2: allocation/resolution, Bit 3: SCF
-// Bit 4: Subsamples, Bit 5: Datenrate, Bit 6: Bitusage der Sektionen
-//#define DUMPSELECT    0xFF
-
-// 16 bit and 32 bit accesses must be aligned, otherwise a bus error occures.
-// try this if you get bus errors
-//#define MUST_ALIGNED
-
-// Experimental: use http/ftp streaming
-#define USE_HTTP
-
-// _use setargv module
-#define USE_ARGV
-
-
-// Use IPv4 and IPv6
-//#define USE_IPv4_6
-// Use only IPv6
-//#define USE_IPv6
-
-// compile StreamVersion 8 decoding (always disable, no usabiltity)
-// do not edit
-//#define USE_SV8
-
-// disables assert()
-// assert() is for development only and decreases speed and increases the size of the program
-#ifndef NDEBUG
-# define NDEBUG
-#endif
-
-// Some other tracing (only for development)
-// do not edit
-//#define DEBUG
-
-// Some tracings of popen()
-// do not edit
-//#define DEBUG2
-
-// activate simple profiler
-//#define PROFILE
-
-// make debug output in tags.c stfu
-#define STFU
-
-/* end of mpp.h */
Index: penc/trunk/mpp.sln
===================================================================
--- /mppenc/trunk/mpp.sln	(revision 96)
+++ 	(revision )
@@ -1,185 +1,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Remove.tab", "Remove.tab.vcproj", "{82E5E7C7-5B12-468E-9B26-0E908424F48D}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "ape", "ape\Source\mac.dsp", "{8BA31963-BF9D-4DDD-BAFB-56CA3CE32615}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clipboard", "clipboard.vcproj", "{2E9C3213-F034-4779-955D-B2145631DBE3}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clipstat", "clipstat.vcproj", "{4820B013-A83A-4114-9F42-C6487A6C0A15}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "codepage", "codepage.vcproj", "{6C38893E-26E6-453A-9670-C071160504F6}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "config.vcproj", "{CAED069E-64E0-4713-BC2E-DEFFA994DB2B}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "huffman", "huffman.vcproj", "{C58B5912-27C3-4B8F-B468-827C9CE83510}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "in_mpc", "winamp\in_mpc.dsp", "{2032F666-EA09-4E51-8FCD-757FC983E277}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "list", "list.vcproj", "{6B8B6B82-7165-4565-B8CA-804DEC297E57}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mppdec", "mppdec.vcproj", "{8579438D-C1B0-46E1-BC7F-EF98641E8E0D}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mppenc", "mppenc.vcproj", "{84F7FF0B-3105-4860-97CC-D3CD6B307496}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mppsplit", "mppsplit.vcproj", "{8C82164E-8365-43E0-8479-861F61D4866D}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "name", "name.vcproj", "{CE86999E-6BDA-4D61-8A51-0D117B553F39}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pns", "pns.vcproj", "{4335D2F8-0555-4A8A-89D5-519A7E97DDAF}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pulse", "pulse.vcproj", "{5A1C93B8-91E3-49B6-975A-2DAD0B18D4A3}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replaygain", "replaygain.vcproj", "{9A212394-02F5-420B-AFE4-81239AF881A2}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "seekspeed", "seekspeed.vcproj", "{D3300F87-AEED-4F66-B23B-F6EA8AD3E17A}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{059D6162-CD51-11D0-AE1F-00A0C90FFFC3}") = "shorten", "shorten-3.4\shorten.dsp", "{014C9B8E-AC38-4BCF-970C-5A2FB9F212D9}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "streamserver", "streamserver.vcproj", "{078863D1-11CA-4E25-B207-77E7949EA83F}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tagger", "tagger.vcproj", "{EDFCC693-F562-4180-BE51-B22A917A26B7}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tonality", "tonality.vcproj", "{9E232A7C-755D-4BEC-B542-9F0DDC629AE7}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wp", "wp.vcproj", "{6DEF3BDF-44AA-454F-B445-457CA52B7B80}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmms", "xmms\xmms.vcproj", "{9C5E451F-A9C1-49FA-99B3-BE3EF6E87038}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
-EndProject
-Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{82E5E7C7-5B12-468E-9B26-0E908424F48D}.Debug.ActiveCfg = Debug|Win32
-		{82E5E7C7-5B12-468E-9B26-0E908424F48D}.Debug.Build.0 = Debug|Win32
-		{82E5E7C7-5B12-468E-9B26-0E908424F48D}.Release.ActiveCfg = Release|Win32
-		{82E5E7C7-5B12-468E-9B26-0E908424F48D}.Release.Build.0 = Release|Win32
-		{2E9C3213-F034-4779-955D-B2145631DBE3}.Debug.ActiveCfg = Debug|Win32
-		{2E9C3213-F034-4779-955D-B2145631DBE3}.Debug.Build.0 = Debug|Win32
-		{2E9C3213-F034-4779-955D-B2145631DBE3}.Release.ActiveCfg = Release|Win32
-		{2E9C3213-F034-4779-955D-B2145631DBE3}.Release.Build.0 = Release|Win32
-		{4820B013-A83A-4114-9F42-C6487A6C0A15}.Debug.ActiveCfg = Debug|Win32
-		{4820B013-A83A-4114-9F42-C6487A6C0A15}.Debug.Build.0 = Debug|Win32
-		{4820B013-A83A-4114-9F42-C6487A6C0A15}.Release.ActiveCfg = Release|Win32
-		{4820B013-A83A-4114-9F42-C6487A6C0A15}.Release.Build.0 = Release|Win32
-		{6C38893E-26E6-453A-9670-C071160504F6}.Debug.ActiveCfg = Debug|Win32
-		{6C38893E-26E6-453A-9670-C071160504F6}.Debug.Build.0 = Debug|Win32
-		{6C38893E-26E6-453A-9670-C071160504F6}.Release.ActiveCfg = Release|Win32
-		{6C38893E-26E6-453A-9670-C071160504F6}.Release.Build.0 = Release|Win32
-		{CAED069E-64E0-4713-BC2E-DEFFA994DB2B}.Debug.ActiveCfg = Debug|Win32
-		{CAED069E-64E0-4713-BC2E-DEFFA994DB2B}.Debug.Build.0 = Debug|Win32
-		{CAED069E-64E0-4713-BC2E-DEFFA994DB2B}.Release.ActiveCfg = Release|Win32
-		{CAED069E-64E0-4713-BC2E-DEFFA994DB2B}.Release.Build.0 = Release|Win32
-		{C58B5912-27C3-4B8F-B468-827C9CE83510}.Debug.ActiveCfg = Debug|Win32
-		{C58B5912-27C3-4B8F-B468-827C9CE83510}.Debug.Build.0 = Debug|Win32
-		{C58B5912-27C3-4B8F-B468-827C9CE83510}.Release.ActiveCfg = Release|Win32
-		{C58B5912-27C3-4B8F-B468-827C9CE83510}.Release.Build.0 = Release|Win32
-		{6B8B6B82-7165-4565-B8CA-804DEC297E57}.Debug.ActiveCfg = Debug|Win32
-		{6B8B6B82-7165-4565-B8CA-804DEC297E57}.Debug.Build.0 = Debug|Win32
-		{6B8B6B82-7165-4565-B8CA-804DEC297E57}.Release.ActiveCfg = Release|Win32
-		{6B8B6B82-7165-4565-B8CA-804DEC297E57}.Release.Build.0 = Release|Win32
-		{8579438D-C1B0-46E1-BC7F-EF98641E8E0D}.Debug.ActiveCfg = Debug|Win32
-		{8579438D-C1B0-46E1-BC7F-EF98641E8E0D}.Debug.Build.0 = Debug|Win32
-		{8579438D-C1B0-46E1-BC7F-EF98641E8E0D}.Release.ActiveCfg = Release|Win32
-		{8579438D-C1B0-46E1-BC7F-EF98641E8E0D}.Release.Build.0 = Release|Win32
-		{84F7FF0B-3105-4860-97CC-D3CD6B307496}.Debug.ActiveCfg = Debug|Win32
-		{84F7FF0B-3105-4860-97CC-D3CD6B307496}.Debug.Build.0 = Debug|Win32
-		{84F7FF0B-3105-4860-97CC-D3CD6B307496}.Release.ActiveCfg = Release|Win32
-		{84F7FF0B-3105-4860-97CC-D3CD6B307496}.Release.Build.0 = Release|Win32
-		{8C82164E-8365-43E0-8479-861F61D4866D}.Debug.ActiveCfg = Debug|Win32
-		{8C82164E-8365-43E0-8479-861F61D4866D}.Debug.Build.0 = Debug|Win32
-		{8C82164E-8365-43E0-8479-861F61D4866D}.Release.ActiveCfg = Release|Win32
-		{8C82164E-8365-43E0-8479-861F61D4866D}.Release.Build.0 = Release|Win32
-		{CE86999E-6BDA-4D61-8A51-0D117B553F39}.Debug.ActiveCfg = Debug|Win32
-		{CE86999E-6BDA-4D61-8A51-0D117B553F39}.Debug.Build.0 = Debug|Win32
-		{CE86999E-6BDA-4D61-8A51-0D117B553F39}.Release.ActiveCfg = Release|Win32
-		{CE86999E-6BDA-4D61-8A51-0D117B553F39}.Release.Build.0 = Release|Win32
-		{4335D2F8-0555-4A8A-89D5-519A7E97DDAF}.Debug.ActiveCfg = Debug|Win32
-		{4335D2F8-0555-4A8A-89D5-519A7E97DDAF}.Debug.Build.0 = Debug|Win32
-		{4335D2F8-0555-4A8A-89D5-519A7E97DDAF}.Release.ActiveCfg = Release|Win32
-		{4335D2F8-0555-4A8A-89D5-519A7E97DDAF}.Release.Build.0 = Release|Win32
-		{5A1C93B8-91E3-49B6-975A-2DAD0B18D4A3}.Debug.ActiveCfg = Debug|Win32
-		{5A1C93B8-91E3-49B6-975A-2DAD0B18D4A3}.Debug.Build.0 = Debug|Win32
-		{5A1C93B8-91E3-49B6-975A-2DAD0B18D4A3}.Release.ActiveCfg = Release|Win32
-		{5A1C93B8-91E3-49B6-975A-2DAD0B18D4A3}.Release.Build.0 = Release|Win32
-		{9A212394-02F5-420B-AFE4-81239AF881A2}.Debug.ActiveCfg = Debug|Win32
-		{9A212394-02F5-420B-AFE4-81239AF881A2}.Debug.Build.0 = Debug|Win32
-		{9A212394-02F5-420B-AFE4-81239AF881A2}.Release.ActiveCfg = Release|Win32
-		{9A212394-02F5-420B-AFE4-81239AF881A2}.Release.Build.0 = Release|Win32
-		{D3300F87-AEED-4F66-B23B-F6EA8AD3E17A}.Debug.ActiveCfg = Debug|Win32
-		{D3300F87-AEED-4F66-B23B-F6EA8AD3E17A}.Debug.Build.0 = Debug|Win32
-		{D3300F87-AEED-4F66-B23B-F6EA8AD3E17A}.Release.ActiveCfg = Release|Win32
-		{D3300F87-AEED-4F66-B23B-F6EA8AD3E17A}.Release.Build.0 = Release|Win32
-		{078863D1-11CA-4E25-B207-77E7949EA83F}.Debug.ActiveCfg = Debug|Win32
-		{078863D1-11CA-4E25-B207-77E7949EA83F}.Debug.Build.0 = Debug|Win32
-		{078863D1-11CA-4E25-B207-77E7949EA83F}.Release.ActiveCfg = Release|Win32
-		{078863D1-11CA-4E25-B207-77E7949EA83F}.Release.Build.0 = Release|Win32
-		{EDFCC693-F562-4180-BE51-B22A917A26B7}.Debug.ActiveCfg = Debug|Win32
-		{EDFCC693-F562-4180-BE51-B22A917A26B7}.Debug.Build.0 = Debug|Win32
-		{EDFCC693-F562-4180-BE51-B22A917A26B7}.Release.ActiveCfg = Release|Win32
-		{EDFCC693-F562-4180-BE51-B22A917A26B7}.Release.Build.0 = Release|Win32
-		{9E232A7C-755D-4BEC-B542-9F0DDC629AE7}.Debug.ActiveCfg = Debug|Win32
-		{9E232A7C-755D-4BEC-B542-9F0DDC629AE7}.Debug.Build.0 = Debug|Win32
-		{9E232A7C-755D-4BEC-B542-9F0DDC629AE7}.Release.ActiveCfg = Release|Win32
-		{9E232A7C-755D-4BEC-B542-9F0DDC629AE7}.Release.Build.0 = Release|Win32
-		{6DEF3BDF-44AA-454F-B445-457CA52B7B80}.Debug.ActiveCfg = Debug|Win32
-		{6DEF3BDF-44AA-454F-B445-457CA52B7B80}.Debug.Build.0 = Debug|Win32
-		{6DEF3BDF-44AA-454F-B445-457CA52B7B80}.Release.ActiveCfg = Release|Win32
-		{6DEF3BDF-44AA-454F-B445-457CA52B7B80}.Release.Build.0 = Release|Win32
-		{9C5E451F-A9C1-49FA-99B3-BE3EF6E87038}.Debug.ActiveCfg = Debug|Win32
-		{9C5E451F-A9C1-49FA-99B3-BE3EF6E87038}.Debug.Build.0 = Debug|Win32
-		{9C5E451F-A9C1-49FA-99B3-BE3EF6E87038}.Release.ActiveCfg = Release|Win32
-		{9C5E451F-A9C1-49FA-99B3-BE3EF6E87038}.Release.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal
Index: penc/trunk/mppdec.c
===================================================================
--- /mppenc/trunk/mppdec.c	(revision 96)
+++ 	(revision )
@@ -1,1417 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-//
-// Still to do:
-//
-//   * documentation (need a reader to find difficult to understand comments or unclear code
-//   * removal of the huge amount of global variables
-//   * multithreading support
-//   * fast forward using skip information instead of decoding
-//   * Makefile dependencies are broken
-//   * lame --alt-preset xxx - outputfile.mp3          (mit xxx = 80, 103, 132)
-
-
-#include <time.h>
-#include <string.h>
-#include <errno.h>
-#include "mppdec.h"
-
-
-// global variables (ugly, not killed yet)
-
-Quant_t           Q             [32];       // quantized matrixed subband samples
-
-FloatArray        Y_L           [36];       // scaled dematrixed subband samples
-FloatArray        Y_R           [36];
-
-Float             V_L           [1024 + 64*(VIRT_SHIFT-1)];     // 1st stage of the subband synthesizer
-Float             V_R           [1024 + 64*(VIRT_SHIFT-1)];
-
-CPair_t           SCF_Index [3] [32];       // scale factors for transforming Q -> Y
-CPair_t           Res           [32];       // sample resolution for decoding Bitstream -> Q
-
-CPair_t           SCFI          [32];       // grouping of SCF, needed for SCF decoding
-Bool_t            MS_Band       [32];       // dematrixing information for transforming Q -> Y
-
-static Int        V_L_offset;
-static Int        V_R_offset;
-
-Bool_t            MS_used            =  0;  // 0: all is LR coded, 1: MS or LR coding per subband
-Bool_t            IS_used            =  0;  // is IS used (if yes, a fixed number of subbands is IS coded)
-static Float      Scale              =  1.; // user defined scale factor
-static Bool_t     ClipPrev           =  0;  // if set, clipping is prevented if needed information is available
-static int        ReplayGainType     =  0;  // 0: no additional gain, 1: CD based gain correction, 2: title based gain correction
-
-Bool_t            TrueGaplessPresent =  0;  // is true gapless used?
-Int               LastValidSamples   =  0;  // number of valid samples within last frame
-unsigned int      SampleFreq         =  44100;
-static const Uint16_t
-                  sftable [4] = { 44100, 48000, 37800, 32000 };
-
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-static int        Bits               = SAMPLE_SIZE;
-static int        NoiseShapeType     =  0;
-static Float      Dither             = -1;  // Dithering if not Noise shaping
-#endif
-
-static Uint       StreamVersion;
-static Uint       Blockgroesse;
-static Ulong      InputBuffRead;
-#ifdef USE_ASM
-static SyntheseFilter16_t
-                  Synthese_Filter_16;
-#endif
-const char        About        []    = "MPC Decoder  " MAX_SV "  " MPPDEC_VERSION "  " BUILD "   " COPYRIGHT;
-const char        CompileFlags []    = COMPILER_FLAGS;
-const char        Date         []    = __DATE__ " " __TIME__;
-
-Bool_t            output_endianess   = LITTLE;
-
-
-static void
-usage ( void )
-{
-    stderr_printf (
-        "\n"
-        "\x1B[1m\rusage:\n"
-        "\x1B[0m\r  "PROG_NAME" [--options] <Input_File> <Output_File>\n"
-        "  "PROG_NAME" [--options] <List_of_Input_Files> <Output_File>\n"
-        "  "PROG_NAME" [--options] <List_of_Input_Files> <Output_Directory>\n"
-        "\n"
-        "\x1B[1m\roptions:\n"
-        "\x1B[0m\r  --start x   start decoding at x sec (x>0) or at |x|%% of the file (x<0)\n"
-        "  --dur x     decode a sequence of x sec duration (dflt: 100%%)\n"
-        "  --prev      activate clipping prevention (gain=0,2:title based; 1,3:album based)\n"
-        "  --noprev    deactivate clipping prevention (dflt)\n"
-        "  --scale x   additional scale signal by x (dflt: 1)\n"
-        "  --gain x    replay gain control (0,1:off (dflt), 2:title, 3:album)\n"
-        "  --silent    no messages to the terminal\n"
-        "  --wav       write Microsoft's WAVE file (dflt)\n"
-        "  --aiff      write Apple's AIFF file\n"
-        "  --raw       write RAW file in native byte order\n"
-        "  --raw-le    write RAW file in little endian byte order\n"
-        "  --raw-be    write RAW file in big endian byte order\n"
-        "  --random    random play order (don't use options after this one)\n"
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-        "  --bits x    output with x bits (dflt: " STR(SAMPLE_SIZE) ")\n"
-        "  --dither x  dithering factor (dflt: auto, useful 0.00...1.00)\n"
-        "  --shape x   set shaping type (0:off (dflt), 1:light, 2:medium, 3:heavy)\n"
-#endif
-        "\n"
-        "\x1B[1m\rspecial files:\n"
-        "\x1B[0m\r  -           standard input or standard output\n"
-        "  /dev/null   device null, the trash can\n"
-#ifdef USE_OSS_AUDIO
-        "  /dev/dsp*   use Open Sound System (OSS)" SAMPLE_SIZE_STRING "\n"
-#endif
-#ifdef USE_ESD_AUDIO
-        "  /dev/esd    use Enlightenment Sound Daemon (EsounD)" SAMPLE_SIZE_STRING "\n"
-#endif
-#ifdef USE_SUN_AUDIO
-        "  /dev/audio  use Sun Onboard-Audio" SAMPLE_SIZE_STRING "\n"
-#endif
-#ifdef USE_IRIX_AUDIO
-        "  /dev/audio  use SGI IRIX Onboard-Audio" SAMPLE_SIZE_STRING "\n"
-#endif
-#ifdef USE_WIN_AUDIO
-        "  /dev/audio  use Windows WAVEOUT Audio" SAMPLE_SIZE_STRING "\n"
-#endif
-#ifdef USE_HTTP
-        "  protocol://[username[:password]@]servername[:port]/directories/file\n"
-        "              file addressed via URL; username, password and port are optional,\n"
-        "              protocol can be ftp, http, rtp. servername can be DNS, IP4 or IP6\n"
-        // other interesting protocols are file:// und https://
-#endif
-        "\n"
-        "\x1B[1m\rexamples:\n"
-        "\x1B[0m\r  "PROG_NAME" Overtune.mpc Overtune.wav\n"
-#if PATH_SEP == '/'
-        "  "PROG_NAME" \"/Archive/Rossini/Wilhelm Tell -- [01] Overtune.mpc\" Overtune.wav\n"
-        "  "PROG_NAME" \"/Archive/Rossini/*.mpc\" - | wavplay -\n"
-
-        "  "PROG_NAME" --start -50%% --duration -5%% *.mpc - | wavplay -\n"
-        "  "PROG_NAME" --prev *.mp+ .  &&  cdrecord -v -dao dev=sony -audio *.wav\n"
-#else
-        "  cd \\Archive\\Rossini; "PROG_NAME" \"Wilhelm Tell -- [01] Overtune.mpc\" Overtune.wav\n"
-        "  cd \\Archive\\Rossini; "PROG_NAME" *.mpc - | wavplay -\n"
-
-        "  "PROG_NAME" --start -50%% --duration -5%% *.mpc - | wavplay -\n"
-        "  "PROG_NAME" --prev *.mp+ . ; cdrecord -v -dao dev=sony -audio *.wav\n"
-#endif
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-        "  "PROG_NAME" --bits " STR(SAMPLE_SIZE) " --shape 2 *.mpc .\n"
-#endif
-#ifdef USE_OSS_AUDIO
-        "  "PROG_NAME" */*.mpc /dev/dsp ; "PROG_NAME" */*.mpc /dev/dsp1\n"
-#endif
-#ifdef USE_SUN_AUDIO
-        "  "PROG_NAME" */*.mpc /dev/audio\n"
-#endif
-#ifdef USE_IRIX_AUDIO
-        "  "PROG_NAME" */*.mpc /dev/audio\n"
-#endif
-#ifdef USE_WIN_AUDIO
-        "  "PROG_NAME" *.mpc /dev/audio\n"
-#endif
-#ifdef USE_HTTP
-        "  "PROG_NAME" http://www.uni-jena.de/~pfk/mpp/audio/Maire_10bit_48kHz_Dithered.mpc\n"
-#endif
-#ifdef USE_ARGV
-# if PATH_SEP == '/'
-        "  "PROG_NAME" --gain 2 --prev --random /Archive/Audio/  /dev/audio\n"
-# else
-        "  "PROG_NAME" --gain 2 --prev --random C:\\AUDIO\\ D:\\AUDIO\\  /dev/audio\n"
-# endif
-#endif
-        "  "PROG_NAME" playlist.m3u  /dev/audio\n"
-        "\n"
-        "For further information see the file \"MANUAL.TXT\".\n" );
-}
-
-
-static const char*
-ProfileName ( Uint profile )        // profile is 0...15, where 1, 5...15 is used
-{
-    static const char   na    [] = "n.a.";
-    static const char*  Names [] = {
-        na, "Unstable/Experimental", na, na,
-        na, "below 'Telephone'", "below 'Telephone'", "'Telephone'",
-        "'Thumb'", "'Radio'", "'Standard'", "'Xtreme'",
-        "'Insane'", "'BrainDead'", "above 'BrainDead'", "above 'BrainDead'"
-    };
-
-    return profile >= sizeof(Names)/sizeof(*Names)  ?  na  :  Names [profile];
-}
-
-
-/*
- *  Print out the time to stderr with a precision of 10 ms always using
- *  12 characters. Time is represented by the sample count. An additional
- *  prefix character (normally ' ' or '-') is prepended before the first
- *  digit.
- */
-
-static const char*
-Print_Time ( Ulong samples, char sgn )
-{
-    static char  ret [16];
-    Ulong        csec = (Ulong)(samples/(SampleFreq/100.));
-    Uint         hour = (Uint) (csec/360000L);
-    Uint         min  = (Uint) (csec/6000 % 60);
-    Uint         sec  = (Uint) (csec/100  % 60);
-
-    if      ( hour > 9 )
-        sprintf ( ret,  "%c%2u:%02u", sgn, hour, min );
-    else if ( hour > 0 )
-        sprintf ( ret, " %c%1u:%02u", sgn, hour, min );
-    else if ( min  > 9 )
-        sprintf ( ret,    "   %c%2u", sgn,       min );
-    else
-        sprintf ( ret,   "    %c%1u", sgn,       min );
-
-    sprintf ( ret+6,   ":%02u.%02u", sec, (Uint)(csec % 100) );
-    return ret;
-}
-
-
-static double
-TestForGap ( Int2xSample_t* p, int valid )       // Rough estimation of bug error effect, too late starts can't be detected anytime
-{
-    double  sum1 = 2000;
-    double  sum2 = 2000;
-    double  tmp1;
-    double  tmp2;
-    double  ret;
-    int     i;
-
-    for ( i = 0; i < valid; i++ ) {
-        tmp1  = (double) p[i][0]*p[i][0] + (double) p[i][1]*p[i][1];
-        tmp1  = sqrt ( sqrt (tmp1) );
-        tmp2  = 1. + exp ( (i-240.) / 30. );
-
-        sum1 += tmp1;
-        sum2 += tmp1 / tmp2;
-    }
-    // fprintf ( stderr, "\n\n******** %4u: %.0f %.0f\n", valid, sum1, sum2 );
-    ret = sum1 / sum2 - 0.99999999;
-    ret = log (100 * ret);
-
-    return ret;
-}
-
-
-static Uint32_t
-Decode ( FILE_T OutputFile, FILE_T InputFile, Uint32_t TotalFrames, Uint32_t Start, Uint32_t Duration )
-{
-    Int2xSample_t  Stream [BLK_SIZE];
-    Ulong          StartBitPos;
-    size_t         valid;
-    size_t         ring;
-    Uint32_t       FrameNo;
-    Uint32_t       ret         = 0;
-    Uint32_t       CurrBlkSize = 0;
-    time_t         T           = time (NULL);
-
-    ENTER(3);
-
-    // decode frame by frame, note some differences in decoding the last frame (TotalFrames-1)
-    memset ( Stream, 0, sizeof(Stream) );
-    for ( FrameNo = 0; FrameNo < TotalFrames  &&  Duration > 0; FrameNo++ ) {
-        ring = InputCnt;
-
-        REP ((printf ("\nFrame %lu\n", (Ulong)FrameNo), fflush (stdout)));
-
-        // read skip information (designed for rewind/fast forward, but here used for checking purpose)
-        if ( FrameNo % Blockgroesse == 0 )
-            CurrBlkSize = Bitstream_read (20);
-        StartBitPos = BitsRead ();
-
-        // decode bitstream (see decode.c)
-        switch ( StreamVersion ) {
-        case 0x04:
-        case 0x05:
-        case 0x06:  Read_Bitstream_SV6 (); break;
-        case 0x17:
-        case 0x07:  Read_Bitstream_SV7 (); break;
-#ifdef USE_SV8
-        case 8:  Read_Bitstream_SV8 (); break;
-#endif
-        default: assert (0);
-        }
-
-        REP (printf ("Frame end\n"));
-
-        // check skip information against value determined by decoding (buggy for CBR)
-        if ( (FrameNo+1) % Blockgroesse == 0  &&  BitsRead () - StartBitPos != CurrBlkSize )
-            if ( FrameNo != TotalFrames-1  ||  StreamVersion > 5 ) {
-                if ( BitsRead() < InputBuffRead * (Ulong)(CHAR_BIT * sizeof(*InputBuff)) )
-                    stderr_printf ("\n\n"PROG_NAME": broken frame %lu/%lu (decoded size=%lu, size in stream=%lu)\n\n", (Ulong)FrameNo, (Ulong)TotalFrames, (Ulong)(BitsRead () - StartBitPos), (Ulong)CurrBlkSize );
-                else
-                    stderr_printf ("\n\n"PROG_NAME": unexpected end of file after frame %lu/%lu\n\n", (Ulong)FrameNo, (Ulong)TotalFrames );
-                LEAVE(3);
-                return ret;
-            }
-
-        // reload data if more than 50% of the buffer is decoded
-        if ( (ring ^ InputCnt) & IBUFSIZE2 )
-            InputBuffRead += Read_LittleEndians ( InputFile, InputBuff + (ring & IBUFSIZE2), IBUFSIZE2 );
-
-        // Subband synthesizer
-        if ( Start <= BLK_SIZE ) {
-            if ( Scale != 0. ) {
-                if (IS_used) {
-                    Requantize_MidSideStereo   ( Min_Band-1, MS_Band );
-                    Requantize_IntensityStereo ( Min_Band,  Max_Band );
-                } else {
-                    Requantize_MidSideStereo   ( Max_Band,   MS_Band );
-                }
-                Synthese_Filter ( (Int2xSample_t*)&Stream[0][0], &V_L_offset, V_L, Y_L, 0 );
-                Synthese_Filter ( (Int2xSample_t*)&Stream[0][1], &V_R_offset, V_R, Y_R, 1 );
-            }
-
-            // write PCM data to destination (except the data in the last frame, this is done behind the for loop
-            if ( FrameNo < TotalFrames-1 ) {
-                valid     = BLK_SIZE - Start;
-                if ( valid > Duration )
-                    valid = Duration;
-                ret      += Write_PCM ( OutputFile, Stream + Start, valid );
-                Duration -= valid;
-                Start     = 0;
-            }
-        } else {
-            Start -= BLK_SIZE;
-        }
-
-        // output report if a real time second is over sinse the last report
-        if ( (Int)(time (NULL) - T) >= 0 ) {
-            T += 1;
-            stderr_printf ("\r%s/", Print_Time ( Start  ?  Start  :  ret, (char)(Start ? '-' : ' ') ) );
-            stderr_printf ("%s %s (%4.1f%%)", Print_Time ( TotalFrames * BLK_SIZE, ' ') + 1, Start  ?  "jumping"  :  "decoded", 100.* FrameNo / TotalFrames );
-        }
-    }
-
-    // write PCM data to destination for the last frame
-    if ( Duration > 0 ) {
-        // reconstruct exact size for SV6 and higher (for SV4...5 this is unknown)
-        switch ( StreamVersion ) {
-        default:
-            assert (0);
-        case 0x04:
-        case 0x05:
-            valid = 0;
-            break;
-        case 0x06:
-        case 0x07:
-        case 0x17:
-#ifdef USE_SV8
-        case 0x08:
-#endif
-            valid = (Int) Bitstream_read (11);
-            if (valid == 0) valid = BLK_SIZE;               // Old encoder writes a 0 instead of a 1152, Bugfix
-            valid += DECODER_DELAY - Start;
-            if ( valid > Duration ) valid = Duration;
-
-            if ( Start + valid > BLK_SIZE ) {
-                // write out data for the last frame
-                if ( Start < BLK_SIZE ) {
-                    ret   += Write_PCM ( OutputFile, Stream + Start, BLK_SIZE - Start );
-                    valid -= BLK_SIZE - Start;
-                    Start  = 0;
-                } else {
-                    Start -= BLK_SIZE;
-                }
-
-                if ( ! TrueGaplessPresent ) {
-                    // due to the subband synthesizer latency there may up to 481 data samples still in the pipeline, synthesize it (this comment is wrong!)
-                    // is it better to clear or to leave the next two statements (???)
-                    memset ( Y_L, 0, sizeof Y_L );
-                    memset ( Y_R, 0, sizeof Y_R );
-                } else {
-                    // new feature for true gapless encoding/decoding delivers the true
-                    // quantized values needed for gapless playback!!
-                    CurrBlkSize = Bitstream_read (20);
-                    StartBitPos = BitsRead ();
-                    Read_Bitstream_SV7 ();
-
-                    // check skip information against value determined by decoding (buggy for CBR)
-                    if ( BitsRead () - StartBitPos != CurrBlkSize ) {
-                        if ( BitsRead() < InputBuffRead * (Ulong)(CHAR_BIT * sizeof(*InputBuff)) )
-                            stderr_printf ("\n\n"PROG_NAME": broken frame %lu/%lu (decoded size=%lu, size in stream=%lu)\n\n", (Ulong)FrameNo, (Ulong)TotalFrames, (Ulong)(BitsRead () - StartBitPos), (Ulong)CurrBlkSize );
-                        else
-                            stderr_printf ("\n\n"PROG_NAME": unexpected end of file after frame %lu/%lu\n\n", (Ulong)FrameNo, (Ulong)TotalFrames );
-                        LEAVE(3);
-                        return ret;
-                    }
-
-                    if ( Scale != 0. ) {
-                        if (IS_used) {
-                            Requantize_MidSideStereo   ( Min_Band-1, MS_Band );
-                            Requantize_IntensityStereo ( Min_Band,  Max_Band );
-                        } else {
-                            Requantize_MidSideStereo   ( Max_Band,   MS_Band );
-                        }
-                    }
-                }
-                Synthese_Filter ( (Int2xSample_t*)&Stream[0][0], &V_L_offset, V_L, Y_L, 0 );
-                Synthese_Filter ( (Int2xSample_t*)&Stream[0][1], &V_R_offset, V_R, Y_R, 1 );
-            }
-            break;
-        }
-        // write PCM data to destination from the "very last" frame
-        ret += Write_PCM ( OutputFile, Stream + Start, valid );
-    }
-
-    // time report
-    stderr_printf ("\r%s", Print_Time ( ret, (char)' ' ) );
-
-    LEAVE(3);
-    return ret;
-}
-
-
-//   0: No ID3v2 tag
-//  >0: ID2v2 tag with this length
-
-static Int32_t
-JumpID3v2 ( void )
-{
-    Int32_t   ret = 10;
-
-    if ( (Bitstream_read (32) & 0xFFFFFF) != 0x334449L )
-        return 0;
-
-    if ( Bitstream_read (1) )
-        return 0;
-    ret += Bitstream_read (7) << 14;
-    if ( Bitstream_read (1) )
-        return 0;
-    ret += Bitstream_read (7) << 21;
-    Bitstream_read (1);
-    if ( Bitstream_read (1) )
-        ret += 10;
-    Bitstream_read (14);
-    Bitstream_read (16);
-    if ( Bitstream_read (1) )
-        return 0;
-    ret += Bitstream_read (7) <<  0;
-    if ( Bitstream_read (1) )
-        return 0;
-    ret += Bitstream_read (7) <<  7;
-
-    return ret;
-}
-
-const char*
-EncoderName ( int encoderno )
-{
-    static char Name [32];
-
-    if ( encoderno <= 0 )
-        Name [0] = '\0';
-    else if ( encoderno % 10 == 0 )
-        sprintf ( Name, " (Release %u.%u)", encoderno/100, encoderno/10%10 );
-    else if ( (encoderno & 1) == 0 )
-        sprintf ( Name, " (Beta %u.%02u)", encoderno/100, encoderno%100 );
-    else
-        sprintf ( Name, " (--Alpha-- %u.%02u)", encoderno/100, encoderno%100 );
-    return Name;
-}
-
-
-/**************************** Decode a file *****************************/
-static Ulong
-DecodeFile ( FILE_T OutputFile, FILE_T InputFile, Double Start, Double Duration )
-{
-    Int        MaxBandDesired = 0;
-    Uint32_t   TotalFrames    = 0;
-    Ulong      DecodedSamples = 0;
-    Uint       Profile        = (Uint)-1;
-    Double     AverageBitrate;
-    TagInfo_t  taginfo;
-    clock_t    T;
-    Int32_t    ID3v2;
-    Uint16_t   PeakTitle = 0;
-    Uint16_t   PeakAlbum = 0;
-    Uint16_t   Peak;
-    Uint16_t   tmp;
-    Int16_t    GainTitle = 0;
-    Int16_t    GainAlbum = 0;
-    Int16_t    Gain;
-    int        Encoder;
-    Bool_t     SecurePeakTitle = 0;
-    Float      ReplayGain;       // 0...1...+oo
-    Float      ClipCorr;         // 0...1
-
-    ENTER(2);
-
-    // Fill the bitstream buffer for the first time
-resume:
-    Bitstream_init ();
-    InputBuffRead = Read_LittleEndians ( InputFile, InputBuff, IBUFSIZE );
-
-    // Test the first 4 bytes ("MP+": SV7+, "ID3": ID3V2, other: may be SV4...6)
-    switch ( Bitstream_preview(32) ) {
-    case (Uint32_t)0x01334449L:                                         /* ID3 V2.1...2.4 */
-    case (Uint32_t)0x02334449L:
-    case (Uint32_t)0x03334449L:
-    case (Uint32_t)0x04334449L:
-        stderr_printf ("\n"PROG_NAME": Stream was corrupted by an ID3 Version 2 tagger\n\n" );
-        ID3v2 = JumpID3v2 ();
-        if ( SEEK ( InputFile, ID3v2, SEEK_SET ) < 0 ) {
-            stderr_printf ( "\n\nSorry, recovering fails.\n\a" );
-            return 0;
-        }
-        sleep (1);
-        stderr_printf ("\b\b\b\b, ignore %lu words and %u bits ...\n\a", (unsigned long)ID3v2 >> 2, (int)(ID3v2&3) << 3 );
-        goto resume;
-
-    case (Uint32_t)0x072B504DL:                                         /* MP+ SV7 */
-    case (Uint32_t)0x172B504DL:                                         /* MP+ SV7.1 */
-#ifdef USE_SV8
-    case (Uint32_t)0x082B504DL:                                         /* MP+ SV8 */
-#endif
-        StreamVersion  = (Int) Bitstream_read (8);
-        if ( (Uint)StreamVersion < 7 ) {
-            stderr_printf ("\n"PROG_NAME": StreamVersion 7+ like header with SV0...6\n" );
-            return 0;
-        }
-        (void) Bitstream_read (24);
-        break;
-
-
-    case (Uint32_t)0x2043414DL:                                         /* MAC  */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "Monkey's Audio" );
-        return 0;
-
-    case (Uint32_t)0x7961722E:                                         /* Real Audio */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "Real Audio" );
-        return 0;
-
-    case (Uint32_t)0x46464952L:                                         /* WAV  */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "Microsoft WAVE" );
-        return 0;
-
-    case (Uint32_t)0x43614C66L:                                         /* FLAC */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "FLAC" );
-        return 0;
-
-    case (Uint32_t)0x4341504CL:                                         /* LPAC */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "LPAC" );
-        return 0;
-
-    case (Uint32_t)0x37414B52L:                                         /* RKAU */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "RKAU" );
-        return 0;
-
-    case (Uint32_t)0x676B6A61L:                                         /* Shorten */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "Shorten" );
-        return 0;
-
-    case (Uint32_t)0x040A5A53L:                                         /* SZIP 1.12 */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "szip" );
-        return 0;
-
-    case (Uint32_t)0x5367674FL:                                         /* OggS */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "Ogg Stream" );
-        return 0;
-
-    case (Uint32_t)0x46494441L:                                         /* AAC-ADIF */
-        stderr_printf ("\n"PROG_NAME": Input File is a %s file\n", "AAC Audio Data Interchange Format" );
-        return 0;
-
-    default:
-        StreamVersion = (Uint32_t) Bitstream_preview(32);
-        if ( ( StreamVersion & 0x00FFFFFF ) == (Uint32_t)0x002B504DL ) {
-            StreamVersion >>= 24;
-            if ( StreamVersion >= 0x72 ) {
-                stderr_printf ( "\n"PROG_NAME": Input File seems to be a MPC file StreamVersion %u.%u\nVisit http://www.uni-jena.de/~pfk/mpc/ and update your software.\n\n", StreamVersion & 15, StreamVersion >> 4 );
-                return 0;
-            }
-        }
-
-        StreamVersion = (Int)(Bitstream_preview(21) & 0x3FF);
-        if ( StreamVersion < 4  ||  StreamVersion > 6 ) {
-            stderr_printf ("\n"PROG_NAME": Input File is not a MPC file, neither SV 4...6 nor SV 7 (SV %u)\n", StreamVersion );
-            return 0;
-        }
-        break;
-    }
-
-
-    // decode the header for SV4...6 or SV7 or SV8
-    switch ( StreamVersion ) {
-    case 0x04:
-    case 0x05:
-    case 0x06:
-        Bitrate        = (Int) Bitstream_read (9);
-        IS_used        = (Int) Bitstream_read (1);
-        MS_used        = (Int) Bitstream_read (1);
-        StreamVersion  = (Int) Bitstream_read(10);
-        MaxBandDesired = (Int) Bitstream_read (5);
-        Blockgroesse   = (Int) Bitstream_read (6);
-        TotalFrames    = Bitstream_read (StreamVersion < 5  ?  16  :  32);
-        SampleFreq     = 44100;
-        Encoder        = -1;
-
-        if ( StreamVersion >= 4  &&  StreamVersion <= 6 )
-            break;
-
-    default:  // it should be impossible to execute the following code
-        stderr_printf ("\n"PROG_NAME": Internal error\n" );
-        stderr_printf ("\n"PROG_NAME": Not a MPC file, neither SV 4...6 nor SV 7 (SV %u.%u)\n", StreamVersion & 15, StreamVersion >> 4 );
-        return 0;
-
-    case 0x07:
-    case 0x17:
-#ifdef USE_SV8
-    case 0x08:
-#endif
-        Bitrate        = 0;
-        Blockgroesse   = 1;
-        TotalFrames    = Bitstream_read (32);
-        IS_used        = (Int) Bitstream_read (1);
-        MS_used        = (Int) Bitstream_read (1);
-        MaxBandDesired = (Int) Bitstream_read (6);
-
-        // reading the profile
-        Profile = (Int) Bitstream_read (4);
-        (void) Bitstream_read ( 2);
-        SampleFreq = sftable [ Bitstream_read ( 2) ];
-
-        // reading peak and gain values from the file (or use useful values if they are absent)
-        PeakTitle = (Uint16_t)(1.18 * (Uint32_t)Bitstream_read (16));
-        GainTitle = Bitstream_read (16);
-        tmp       = Bitstream_read (16);
-        if ( SecurePeakTitle = (tmp != 0) )
-            PeakTitle = tmp;
-        GainAlbum = Bitstream_read (16);
-        PeakAlbum = Bitstream_read (16);
-        if ( PeakAlbum == 0 )
-            PeakAlbum = PeakTitle;
-
-        // reading true gapless
-        TrueGaplessPresent = Bitstream_read ( 1);
-        LastValidSamples   = Bitstream_read (11);
-        (void) Bitstream_read (20);
-
-        // reserved bytes for future use
-        Encoder = Bitstream_read ( 8);
-        break;
-    }
-
-
-    // check for ID3V1(.1) tags or APE tags, output information if available
-    if ( Read_ID3V1_Tags ( InputFile, &taginfo )  ||  Read_APE_Tags ( InputFile, &taginfo ) ) {
-        stderr_printf ("\n         %s: %s  ", taginfo.Artist, taginfo.Album );
-        stderr_printf ( taginfo.Genre[0] != '?'  ||  taginfo.Year[0] != '\0'  ?  "  (" : "" );
-        stderr_printf ( taginfo.Genre[0] == '?'  ?  "%0.0s"  : "%s", taginfo.Genre );
-        stderr_printf ( taginfo.Genre[0] != '?'  &&  taginfo.Year[0]  ?  ", "  :  "" );
-        stderr_printf ( "%s", taginfo.Year );
-        stderr_printf ( taginfo.Genre[0] != '?'  ||  taginfo.Year[0] != '\0'  ?  ")\n" : "\n" );
-        stderr_printf ("    %s %s", taginfo.Track, taginfo.Title );
-        stderr_printf ( taginfo.Comment[0] != '\0'  ?  "  (%s)\n"  :  "%s\n", taginfo.Comment );
-    }
-
-    // calculate bitrate for informational purpose
-    if ( Bitrate == 0 ) {
-        AverageBitrate = ( SampleFreq / 1000. / BLK_SIZE * 8 ) * taginfo.FileSize / TotalFrames  ;
-    } else {
-        AverageBitrate = Bitrate;
-    }
-    stderr_printf ("\n");
-    if ( AverageBitrate > 0. )
-        stderr_printf ("%7.1f kbps,", AverageBitrate );
-
-    // Output total time, Streamversion, Profile
-    stderr_printf ("%s, SV %u.%u, Profile %s%s", Print_Time (TotalFrames * BLK_SIZE, ' ') + 1, StreamVersion & 15, StreamVersion >> 4, ProfileName(Profile), EncoderName(Encoder) );
-
-    // Choose the select type of Peak and Gain values
-    switch ( ReplayGainType ) {
-    case  0: // no replay gain, use title peak for clipping prevention
-        Gain = 0;
-        Peak = PeakTitle;
-        break;
-    case  1: // no replay gain, use album peak for clipping prevention
-        Gain = 0;
-        Peak = PeakAlbum;
-        break;
-    default: // title replay gain
-        Gain = GainTitle;
-        Peak = PeakTitle;
-        break;
-    case  3: // album replay gain
-        Gain = GainAlbum;
-        Peak = PeakAlbum;
-        break;
-    }
-
-    // calculate the multiplier from the original integer peak and gain data
-    ReplayGain = (Float) exp ( (M_LN10/2000.) * (Int16_t)Gain );
-    ClipCorr   = (Float) (32767. / ( (Uint32_t)Peak + 1 ));             // avoid divide by 0
-
-    // Perform or not perform clipping prevention, this is the question here 
-    if ( ClipPrev ) {
-        stderr_printf (", ClipDamp " );
-        if        ( Peak == 0 ) {
-            stderr_printf ("1 ???" );
-            ClipCorr = 1.f;
-        } else if ( ReplayGain * fabs(Scale) > ClipCorr ) {
-            stderr_printf (".%04d%s", (int)(1.e4 * ClipCorr / (ReplayGain * Scale) + 0.5), SecurePeakTitle  ?  ""  :  "?" );
-            ClipCorr = ClipCorr / (ReplayGain * Scale);
-        } else {
-            stderr_printf ("1%s", SecurePeakTitle  ?  ""  :  "?" );
-            ClipCorr = 1.f;
-        }
-    }
-    else {
-        ClipCorr = 1.f;
-    }
-
-    // report replay gain if != 1.
-    if ( ReplayGain != 1. )
-        stderr_printf (", Gain %.4f", ReplayGain );
-    stderr_printf ("\n\n");
-
-    // init subband structure (MaxBandDesired, StreamVersion, bitrate) and Scale factors
-    Init_QuantTab ( MaxBandDesired, IS_used, ClipCorr * ReplayGain * Scale, StreamVersion );
-
-    // calculate Start and Duration if they are given in percent as negative values
-    if ( Start    < 0. )
-        Start    *= TotalFrames * -(0.01 * BLK_SIZE / SampleFreq);
-    if ( Duration < 0. )
-        Duration *= TotalFrames * -(0.01 * BLK_SIZE / SampleFreq);
-
-
-    // reset arrays to avoid HF noise if recent MaxBand > current MaxBand
-    memset ( Y_L, 0, sizeof(Y_L) );
-    memset ( Y_R, 0, sizeof(Y_R) );
-    memset ( Q  , 0, sizeof(Q  ) );
-    memset ( V_L, 0, sizeof(V_L) );
-    memset ( V_R, 0, sizeof(V_R) );
-    V_L_offset = V_R_offset = 0;
-
-    // decoding kernel with time measurement
-    T = clock ();
-    DecodedSamples  = Decode ( OutputFile, InputFile, TotalFrames,
-                               (Uint32_t) (Start * (double)SampleFreq + 0.5) + DECODER_DELAY,
-                               Duration <= 0.  ||  Duration > 0xFFFFFFFFL/SampleFreq  ?  (Uint32_t)0xFFFFFFFFL  :  (Uint32_t)(Duration * (double)SampleFreq + 0.5)
-                             );
-    T = clock () - T;
-#ifdef __TURBOC__       // wraps around at midnight
-    if ( (Long)T < 0 ) {
-        T += (time_t) (86400. * CLOCKS_PER_SEC);
-    }
-#endif
-
-    // output at the end of a decoded title
-    (void) stderr_printf (" (runtime: %.2f s  speed: %.2fx)\n", (Double) (T * (1. / CLOCKS_PER_SEC )),
-                     T  ?  (Double) ((CLOCKS_PER_SEC/(Float)SampleFreq) * DecodedSamples / T)  :  (Double)0. );
-
-    LEAVE(2);
-
-    return DecodedSamples;
-}
-
-
-/*
-*   LAME and numerous decoders only append a '.wav' to make it harder to overwrite the binary source
- *  It will probably be changed if i can think of a better mechanism
- */
-
-// Create a useful output name for automatic output file mode (destination is only a directory name)
-// The destination directory and the file name is merged together with the new file extensions.
-// This gives file names as directory/filename.mpc.wav which can be distinguished from the
-// original .wav file. This is the way most programs do it (including "Lame").
-
-static char*
-Create_Extention ( const char* Path, const char* Name, const char* Extention )
-{
-    static char  ret [PATHLEN_MAX + 3];
-    char*        p = strrchr ( Name, PATH_SEP );
-
-    if ( p != NULL )
-        Name = p + 1;
-    if ( strlen(Path) + strlen(Name) + strlen(Extention) > sizeof(ret) - 3 ) {
-        stderr_printf (PROG_NAME":\tTarget buffer for new file name too short,\n\tincrease PATHLEN_MAX and recompile\n\a" );
-        exit (4);
-    }
-    sprintf ( ret, "%s%c%s.%s", Path, PATH_SEP, Name, Extention );
-    return ret;
-}
-
-// It should refuse to output WAV-content into existing '.mp?'-files,
-// in this case the file shouldn't be the output file,
-// but an (additional) input file, and all should be written to <stdout>.
-// This is non-orthogonal and dirty, but it should prevent quite some data loss.
-//
-// Maybe it should only overwrite files if it's stated by '--forceoverwrite',
-// got to think about that some more.
-
-static Int
-Unintended_OutputFile ( const char* Name )
-{
-    FILE_T  fp;
-    char    buff [4];
-
-#ifdef USE_HTTP
-    if ( 0 == strncasecmp (Name, "http://", 7)  ||  0 == strncasecmp (Name, "ftp://", 6) )
-        return 1;
-#endif
-    if ( (fp = OPEN ( Name )) == INVALID_FILEDESC )
-        return 0;
-    READ ( fp, buff, 4 );
-    CLOSE (fp);
-    if ( memcmp (buff, "MP+\007", 4) == 0 )
-        return 1;
-    if ( strlen (Name) <= 4 )
-        return 0;
-    Name += strlen (Name) - 4;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'M'  &&  (Name[2] & 0xDF) == 'P' )
-        return 1;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'M'  &&  Name[2] == '3'  &&  (Name[3] & 0xDF) == 'U' )
-        return 1;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'P'  &&  Name[2] == 'A'  &&  (Name[3] & 0xDF) == 'C' )
-        return 1;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'A'  &&  Name[2] == 'P'  &&  (Name[3] & 0xDF) == 'E' )
-        return 1;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'O'  &&  Name[2] == 'F'  &&  (Name[3] & 0xDF) == 'R' )
-        return 1;
-    if ( Name[0] == '.'  &&  (Name[1] & 0xDF) == 'R'  &&  Name[2] == 'K'  &&  (Name[3] & 0xDF) == 'A' )
-        return 1;
-    if ( Name[3] == PATH_SEP )
-        return 1;
-    return 0;
-}
-
-
-enum NameMode_t  {
-    automode,
-    nullmode,
-    filemode, filemode_noinit,
-    pipemode, pipemode_noinit,
-    dspmode , dspmode_noinit ,
-    esdmode , esdmode_noinit ,
-    sunmode , sunmode_noinit ,
-    winmode , winmode_noinit ,
-    irixmode, irixmode_noinit,
-};
-
-/**************************** main interpreter loop ******************/
-
-
-static void
-randomize ( const char** argv )
-{
-    int          argc;
-    int          i;
-    int          j;
-    const char*  tmp;
-
-    for ( argc = 0; argv[argc] != NULL; argc++ )
-        ;
-    srand ( time (NULL) );
-    for ( i = 0; i < argc; i++ ) {
-        j       = rand() % argc;
-        tmp     = argv[i];
-        argv[i] = argv[j];
-        argv[j] = tmp;
-    }
-}
-
-
-static int
-hexdigit ( const char s )
-{
-    if ( (unsigned char)(s-'0') < 10u )
-        return s-'0';
-    if ( (unsigned char)(s-'A') <  6u )
-        return s-'A'+10;
-    return -1;
-}
-
-
-static void
-decode_html ( FILE_T fp, const char* src )
-{
-    char  ch;
-
-    if ( GetStderrSilent () )
-        return;
-
-    for ( ; src[0] != '\0' ; src++) {
-        if      ( src[0] == '_' )
-            WRITE (fp, " ", 1 );
-        else if ( src[0] != '%'  ||  hexdigit(src[1]) < 0  ||  hexdigit(src[2]) < 0 ) {
-            WRITE ( fp, src, 1);
-        }
-        else {
-            ch = hexdigit(src[1]) * 16 + hexdigit(src[2]), src += 2;
-            WRITE ( fp, &ch, 1 );
-        }
-    }
-}
-
-
-static void
-Analyze_fs ( const char* filename )
-{
-    FILE_T         f = OPEN (filename);
-    unsigned char  buff [28];
-    int            bytes;
-
-    SampleFreq = 44100;
-
-    if ( f == INVALID_FILEDESC )
-        return;
-
-    bytes = READ ( f, buff, sizeof buff );
-    CLOSE (f);
-
-    if ( sizeof buff != bytes )
-        return;
-
-    if ( buff[0] != 'M' || buff[1] != 'P' || buff[2] != '+' )
-        return;
-
-    SampleFreq = sftable [ buff[10] & 3 ];
-}
-
-
-static int
-mainloop ( int argc, char** argv )
-{
-    enum NameMode_t  OutputMode;
-    FILE_T           InputFile;
-    FILE_T           OutputFile;
-    const char*      OutputName;
-    const char*      OutputDir;
-    const char*      OutputComment  = "";
-    Double           Start          = 0.;   // Starting time when > 0
-    Double           Duration       = 0.;   // length to decode when > 0
-    Ulong            DecodedSamples = 0;
-#ifdef USE_ESD_AUDIO
-    int              ESDFileHandle;
-#endif
-    HeaderWriter_t   HeaderWriter  = Write_WAVE_Header;
-    const char*      OutputFileExt = "wav";
-    const char*      arg;
-
-    // take care of the output file (need to rethink this)
-    OutputName = argv [argc-1];
-    if      ( 0 == strcmp (OutputName, "-")  ||  0 == strcmp (OutputName, "/dev/stdout") ) {
-        if ( argc > 2  ||  ISATTY (FILENO(STDIN)) )
-            argv [argc-1]  = NULL;
-  pipe: if ( ISATTY (FILENO (STDOUT)) ) {
-            argc++;
-#if   defined USE_OSS_AUDIO
-            OutputName = "/dev/audio";
-            goto ossjump;
-#elif defined USE_ESD_AUDIO
-            goto esdjump;
-#elif defined USE_SUN_AUDIO
-            OutputName = "/dev/audio";
-            goto sunjump;
-#elif defined USE_IRIX_AUDIO
-            OutputName = "/dev/audio";
-            goto irixjump;
-#elif defined USE_WIN_AUDIO
-            OutputName = "/dev/audio";
-            goto winjump;
-#endif
-        }
-        OutputMode = pipemode_noinit;
-        OutputName = "/dev/stdout";
-    }
-    else if ( 0 == strcmp (OutputName, "/dev/null") ) {
-        OutputMode = nullmode;
-        OutputFile = NULL_FD;
-        OutputComment = " (Null Device)";
-        argv [argc-1]  = NULL;
-    }
-#ifdef USE_SUN_AUDIO
-    else if ( 0 == strcmp (OutputName, "/dev/audio") ) { sunjump:
-        OutputMode       = sunmode_noinit;
-        argv [argc-1]  = NULL;
-    }
-#endif /* USE_SUN_AUDIO */
-#ifdef USE_IRIX_AUDIO
-    else if ( 0 == strcmp (OutputName, "/dev/audio") ) { irixjump:
-        OutputMode       = irixmode_noinit;
-        argv [argc-1]  = NULL;
-    }
-#endif /* USE_IRIX_AUDIO */
-#ifdef USE_ESD_AUDIO
-    else if ( 0 == strcmp (OutputName, "/dev/esd") ) { esdjump:
-        OutputMode = esdmode_noinit;
-        output_endianess = ENDIAN == HAVE_LITTLE_ENDIAN  ?  LITTLE  :  BIG;
-        argv [argc-1]  = NULL;
-    }
-#endif /* USE_ESD_AUDIO */
-#ifdef USE_OSS_AUDIO
-    else if ( 0 == strncmp (OutputName, "/dev/", 5) ) { ossjump:
-        OutputMode = dspmode_noinit;
-        argv [argc-1]  = NULL;
-    }
-#endif /* USE_OSS_AUDIO */
-#ifdef USE_WIN_AUDIO
-    else if ( 0 == strcmp (OutputName, "/dev/audio") ) { winjump:
-        OutputMode = winmode_noinit;
-        argv [argc-1]  = NULL;
-    }
-#endif /* USE_WIN_AUDIO */
-    else if ( Unintended_OutputFile (OutputName) ) {
-        goto pipe;
-    }
-    else {
-        OutputMode = filemode_noinit;
-        if ( (OutputFile = CREATE ( OutputName )) != INVALID_FILEDESC ) {
-            UNBUFFER ( OutputFile );
-            argv [argc-1]  = NULL;
-        }
-        else if ( isdir ( OutputName ) ) {
-            OutputMode = automode;
-            OutputFile = INVALID_FILEDESC;
-            OutputDir  = OutputName;
-            argv [argc-1]  = NULL;
-        }
-        else {
-            stderr_printf ("\n"PROG_NAME": Can't create output file '%s': %s\n", OutputName, strerror(errno) );
-            return 3;
-        }
-    }
-
-
-    while ( *++argv != NULL ) {
-
-        // decode options
-        if ( argv[0][0] == '-'  &&  argv[0][1] == '-' ) {
-            arg = argv[0] + 2;
-
-            if ( 0 == strncmp (arg, "random", 3) ) {
-                randomize ( argv + 1 );
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "start", 2)  ||  0 == strncmp (arg, "skip", 2) ) {     // Start
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "start" );
-                    return 1;
-                } else {
-                    if ( 0 == strncmp (*argv, "mid", 1) )
-                        Start = -50.f;      // 50%, negative values are percentages
-                    else
-                        Start = atof (*argv);
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "duration", 2) ) {  // Duration
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "duration" );
-                    return 1;
-                } else {
-                    Duration = atof (*argv);
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "scale", 2) ) {     // Level scaling
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "scale" );
-                    return 1;
-                } else {
-                    Scale = (Float) atof (*argv);
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "noprev", 3)  ||  0 == strncmp (arg, "noclip", 3) ) {    // Clipping prevention disabled
-                ClipPrev = 0;
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "prev"  , 1)  ||  0 == strncmp (arg, "clip"  , 1) ) {    // Clipping prevention enabled
-                ClipPrev = 1;
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "gain", 1) ) {      // Disable replay gain
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "gain" );
-                    return 1;
-                } else {
-                    ReplayGainType = atoi (*argv);
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "silent", 2)  ||  0 == strncmp (arg, "quiet", 1) ) {    // Disable display
-                SetStderrSilent (1);
-                continue;
-            }
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-            else if ( 0 == strncmp (arg, "bits", 1) ) {      // Output bits
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "bits" );
-                    return 1;
-                } else {
-                    Init_Dither ( Bits = atoi (*argv), NoiseShapeType, Dither );
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "dither", 2) ) {    // Output bits
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "dither" );
-                    return 1;
-                } else {
-                    Init_Dither ( Bits, NoiseShapeType, Dither = (Float)atof (*argv) );
-                    continue;
-                }
-            }
-            else if ( 0 == strncmp (arg, "shape", 2) ) {     // Noise shaping type
-                if ( *++argv == NULL ) {
-                    stderr_printf ("\n"PROG_NAME": --%s x?\n\n", "shape" );
-                    return 1;
-                } else {
-                    Init_Dither ( Bits, NoiseShapeType = atoi(*argv), Dither );
-                    continue;
-                }
-            }
-#endif
-            else if ( 0 == strncmp (arg, "wav", 1) ) {       // Microsoft's WAVE
-                HeaderWriter     = Write_WAVE_Header;
-                output_endianess = LITTLE;
-                OutputFileExt    = "wav";
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "aiff", 1) ) {      // Apple's AIFF
-                HeaderWriter     = Write_AIFF_Header;
-                output_endianess = BIG;
-                OutputFileExt    = "aiff";
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "raw-le", 5) ) {    // Raw PCM, little endian
-                HeaderWriter     = Write_Raw_Header;
-                output_endianess = LITTLE;
-                OutputFileExt    = "pcm.le";
-                continue;
-            }
-            else if ( 0 == strncmp (arg, "raw-be", 5) ) {    // Raw PCM big endian
-                HeaderWriter     = Write_Raw_Header;
-                output_endianess = BIG;
-                OutputFileExt    = "pcm.be";
-                continue;
-            }
-            else if ( 0 == strcmp (arg, "raw") ) {           // Raw PCM native endian
-                HeaderWriter     = Write_Raw_Header;
-                output_endianess = ENDIAN == HAVE_LITTLE_ENDIAN  ?  LITTLE  :  BIG;
-                OutputFileExt    = "pcm";
-                continue;
-            }
-        }
-
-        // open input-file
-        if ( 0 == strcmp (*argv, "-")  ||  0 == strcmp (*argv, "/dev/stdin") ) {
-            InputFile = SETBINARY_IN (STDIN);
-            if ( ISATTY (FILENO(InputFile)) ) {
-                stderr_printf ("\n"PROG_NAME": Can't decode data from a terminal\n" );
-                return 2;
-            }
-            TitleBar ("<stdin>");
-            Analyze_fs ("");
-            stderr_printf ("\ndecoding of <stdin>\n");
-        } else {
-            if ( (InputFile = OPEN (*argv)) == INVALID_FILEDESC ) {
-#if defined USE_HTTP
-                if ( (InputFile = FDOPEN ( http_open (*argv), "rb" )) == INVALID_FILEDESC ) {
-#endif
-
-                    stderr_printf ("\n"PROG_NAME": Can't open input file '%s': %s\n", *argv, strerror(errno) );
-                    return 1;
-#if defined USE_HTTP
-                }
-#endif
-            }
-            stderr_printf ("\ndecoding of file '");
-            decode_html ( STDERR, *argv);
-            TitleBar (*argv);
-            Analyze_fs (*argv);
-            if ( SampleFreq != 44100 )
-                stderr_printf ("' (%g kHz)\n", 1.e-3*SampleFreq );
-            else
-                stderr_printf ("'\n");
-        }
-        UNBUFFER ( InputFile );
-
-        // open output-file or continue to use it
-        switch ( OutputMode ) {
-        case automode:
-            OutputName = Create_Extention ( OutputDir, *argv, OutputFileExt );
-            if ( (OutputFile = CREATE ( OutputName )) == INVALID_FILEDESC ) {
-                stderr_printf ("\n"PROG_NAME": Can't create output file '%s': %s\n", OutputName, strerror(errno) );
-                return 3;
-            }
-            DecodedSamples = 0;
-            goto filemode2;
-        case filemode_noinit:
-            OutputMode = filemode;
-        filemode2:
-            UNBUFFER ( OutputFile );
-            HeaderWriter ( OutputFile, SampleFreq, SAMPLE_SIZE, 2, 0xFFFFFFFFL );
-        case filemode:
-            stderr_printf ("         to file '%s'" SAMPLE_SIZE_STRING "\n", OutputName );
-            break;
-        case pipemode_noinit:
-            OutputMode = pipemode;
-            OutputFile = SETBINARY_OUT (STDOUT);
-            UNBUFFER ( OutputFile );
-
-#if defined USE_OSS_AUDIO
-            if ( 0 == Set_DSP_OSS_Params ( OutputFile, SampleFreq, SAMPLE_SIZE, 2 ) )
-                OutputComment = " (Open Sound System)";
-            else
-#elif defined USE_SUN_AUDIO
-            if ( 0 == Set_DSP_Sun_Params ( OutputFile, SampleFreq, SAMPLE_SIZE, 2 ) )
-                OutputComment = " (Sun Onboard-Audio)";
-            else
-#endif
-
-            HeaderWriter ( OutputFile, SampleFreq, SAMPLE_SIZE, 2, 0xFFFFFFFFL );
-        case pipemode:
-            stderr_printf ("         to <stdout>%s" SAMPLE_SIZE_STRING "\n", OutputComment );
-            break;
-        case sunmode_noinit:
-#ifdef USE_SUN_AUDIO
-            output_endianess = BIG;
-            if ( (OutputFile = CREATE ( OutputName )) == INVALID_FILEDESC ) {
-                stderr_printf ("\n"PROG_NAME": Can't access device %s: %s\n", OutputName, strerror(errno) );
-                return 3;
-            }
-            UNBUFFER ( OutputFile );
-            if ( 0 == Set_DSP_Sun_Params ( OutputFile, SampleFreq, SAMPLE_SIZE, 2 ) )
-                OutputComment = " (Sun Onboard-Audio)";
-#endif
-            OutputMode = sunmode;
-            goto init_done;
-        case dspmode_noinit:
-#ifdef USE_OSS_AUDIO
-            output_endianess = ENDIAN == HAVE_LITTLE_ENDIAN  ?  LITTLE  :  BIG;
-            if ( (OutputFile = CREATE ( OutputName )) == INVALID_FILEDESC ) {
-                stderr_printf ("\n"PROG_NAME": Can't access device %s: %s\n", OutputName, strerror(errno) );
-                return 3;
-            }
-            UNBUFFER ( OutputFile );
-            if ( 0 == Set_DSP_OSS_Params ( OutputFile, SampleFreq, SAMPLE_SIZE, 2 ) )
-                OutputComment = " (Open Sound System)";
-            OutputMode = dspmode;
-#endif
-            goto init_done;
-        case esdmode_noinit:
-#ifdef USE_ESD_AUDIO
-            output_endianess = ENDIAN == HAVE_LITTLE_ENDIAN  ?  LITTLE  :  BIG;
-            OutputComment = (ESDFileHandle = Set_ESD_Params ( INVALID_FILEDESC, SampleFreq, SAMPLE_SIZE, 2 )) < 0  ?  ""  :  " (Enlightenment Sound Daemon)";
-            if ( (OutputFile = FDOPEN ( ESDFileHandle, "wb" )) == INVALID_FILEDESC ) {
-                stderr_printf ("\n"PROG_NAME": Can't access %s: %s\n", OutputName, strerror(errno) );
-                return 3;
-            }
-            UNBUFFER ( OutputFile );
-            OutputMode = esdmode;
-#endif
-            goto init_done;
-        case winmode_noinit:
-#ifdef USE_WIN_AUDIO
-            output_endianess = ENDIAN == HAVE_LITTLE_ENDIAN  ?  LITTLE  :  BIG;
-            if ( Set_WIN_Params ( INVALID_FILEDESC, SampleFreq, SAMPLE_SIZE, 2 ) < 0 ) {
-                stderr_printf ("\n"PROG_NAME": Can't access %s: %s\n", "WAVE OUT", strerror(errno) );
-                return 3;
-            }
-            OutputFile = WINAUDIO_FD;
-            OutputComment = " (Windows WAVEOUT Audio)";
-            OutputMode = winmode;
-#endif
-            goto init_done;
-        case irixmode_noinit:
-#ifdef USE_IRIX_AUDIO
-            output_endianess = BIG;
-            if ( Set_IRIX_Params ( INVALID_FILEDESC, SampleFreq, SAMPLE_SIZE, 2 ) < 0 ) {
-                stderr_printf ("\n"PROG_NAME": Can't access %s: %s\n", "SGI Irix Audio", strerror(errno) );
-                return 3;
-            }
-            OutputFile = IRIXAUDIO_FD;
-            OutputComment = " (SGI IRIX Audio)";
-            OutputMode = irixmode;
-#endif
-            goto init_done;
-
-        case sunmode:
-        case dspmode:
-        case esdmode:
-        case winmode:
-        case irixmode:
-        case nullmode:
-init_done:  stderr_printf ("         to device %s%s" SAMPLE_SIZE_STRING "\n", OutputName, OutputComment );
-            break;
-        }
-
-        // Decode
-        DecodedSamples += DecodeFile ( OutputFile, InputFile, Start, Duration );
-
-        // close output-file if necessary (inner loop)
-        switch ( OutputMode ) {
-        case automode:
-            if ( SEEK (OutputFile, 0L, SEEK_SET) != -1 )
-                HeaderWriter ( OutputFile, SampleFreq, SAMPLE_SIZE, 2, DecodedSamples );
-            CLOSE ( OutputFile );
-            break;
-        case filemode:
-        case pipemode:
-        case pipemode_noinit:
-        case filemode_noinit:
-        case dspmode:
-        case esdmode:
-        case sunmode:
-        case winmode:
-        case nullmode:
-        case irixmode:
-            break;
-        }
-
-    }
-
-    // close output-file if necessary (final)
-    switch ( OutputMode ) {
-    case pipemode:
-    case filemode:
-        if ( SEEK (OutputFile, 0L, SEEK_SET) != -1 ) {
-            HeaderWriter ( OutputFile, SampleFreq, SAMPLE_SIZE, 2, DecodedSamples );
-        }
-        // fall through
-    case pipemode_noinit:
-    case filemode_noinit:
-    case dspmode:
-    case esdmode:
-        CLOSE ( OutputFile );
-        break;
-    case sunmode:
-    case automode:
-    case nullmode:
-        break;
-    case winmode:
-#ifdef USE_WIN_AUDIO
-        WIN_Audio_close ();
-#endif
-        break;
-    case irixmode:
-#ifdef USE_IRIX_AUDIO
-        IRIX_Audio_close ();
-#endif
-        break;
-    }
-
-    TitleBar ("");
-    return 0;
-}
-
-
-/************ The main() function *****************************/
-int Cdecl
-main ( int argc, char** argv )
-{
-    static const char*  extentions [] = { ".mpc", ".mpp", ".mp+", NULL };
-    int                 ret;
-
-#if (defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO)  &&  (defined USE_REALTIME  ||  defined USE_NICE)
-    DisableSUID ();
-#endif
-
-#if   defined _OS2
-    _wildcard ( &argc, &argv );
-#elif defined USE_ARGV
-    mysetargv ( &argc, &argv, extentions );
-#endif
-
-    START();
-    ENTER(1);
-
-    // Welcome message
-    if ( argc < 2  ||  (0 != strcmp (argv[1], "--silent")  &&  0 != strcmp (argv[1], "--quiet")) )
-        (void) stderr_printf ("\r\x1B[1m\r%s\n\x1B[0m\r     \r", About );
-
-    // no arguments or call for help
-    if ( argc < 2  ||  0==strcmp (argv[1],"-h")  ||  0==strcmp (argv[1],"-?")  ||  0==strcmp (argv[1],"--help") ) {
-        usage ();
-        return 1;
-    }
-
-    // initialize tables which must be initialized once and only once
-    Init_Huffman_Decoder_SV4_6 ();
-    Init_Huffman_Decoder_SV7   ();
-
-#ifdef USE_ASM
-    Synthese_Filter_16 = Get_Synthese_Filter ();
-#endif
-
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-    Init_Dither ( Bits, NoiseShapeType, Dither );       // initialize dither parameter with standard settings
-#endif
-
-    ret = mainloop ( argc, argv );                      // analyze command line and do the requested work
-
-    OverdriveReport ();                                 // output a report if clipping was necessary
-
-    LEAVE(1);
-    REPORT();
-    return ret;
-}
-
-/* end of mppdec.c */
Index: penc/trunk/mppdec.dsp
===================================================================
--- /mppenc/trunk/mppdec.dsp	(revision 96)
+++ 	(revision )
@@ -1,245 +1,0 @@
-# Microsoft Developer Studio Project File - Name="mppdec" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=mppdec - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "mppdec.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "mppdec.mak" CFG="mppdec - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "mppdec - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "mppdec - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "mppdec - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /Gr /Zp4 /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG MPP_DECODER"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ws2_32.lib setargv.obj /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "mppdec - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /G6 /Zp16 /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409 /d "_DEBUG MPP_DECODER"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# SUBTRACT LINK32 /profile
-
-!ENDIF 
-
-# Begin Target
-
-# Name "mppdec - Win32 Release"
-# Name "mppdec - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\_setargv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\cpu_feat.nas
-
-!IF  "$(CFG)" == "mppdec - Win32 Release"
-
-# Begin Custom Build - Assembling $(InputPath)
-InputPath=.\cpu_feat.nas
-InputName=cpu_feat
-
-"Release/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	"C:/PROGRAM FILES/NASM/NASMW" -f win32 -o Release/$(InputName).obj $(InputPath)
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "mppdec - Win32 Debug"
-
-# Begin Custom Build - Assembling $(InputPath)
-InputPath=.\cpu_feat.nas
-InputName=cpu_feat
-
-"Debug/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	"NASMW" -f win32 -o Debug/$(InputName).obj $(InputPath)
-
-# End Custom Build
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\decode.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\http.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\huffsv7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\huffsv46.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\id3tag.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mppdec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\profile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\requant.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\synth.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\synthasm.nas
-
-!IF  "$(CFG)" == "mppdec - Win32 Release"
-
-# Begin Custom Build - Assembling $(InputPath)
-InputPath=.\synthasm.nas
-InputName=synthasm
-
-"Release/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	"C:/PROGRAM FILES/NASM/NASMW" -d WIN32 -f win32 -o Release/$(InputName).obj $(InputPath) -l $(InputName).lst
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "mppdec - Win32 Debug"
-
-# Begin Custom Build - Assembling $(InputPath)
-InputPath=.\synthasm.nas
-InputName=synthasm
-
-"Debug/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	"NASMW" -d WIN32 -f win32 -o Debug/$(InputName).obj $(InputPath)
-
-# End Custom Build
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\synthtab.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tools.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\wave_out.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Makefile
-# End Source File
-# Begin Source File
-
-SOURCE=.\mpp.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mppdec.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\profile.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\SV7.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\tools.inc
-# End Source File
-# Begin Source File
-
-SOURCE=.\version
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/mppdec.h
===================================================================
--- /mppenc/trunk/mppdec.h	(revision 96)
+++ 	(revision )
@@ -1,1172 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-//// Macros typical for Compilers:
-//
-//  __TURBOC__          Turbo-C, Borland-C
-//  __BORLANDC__        Borland-C
-//  __ZTC__             Zortech-C
-//  _MSC_VER            Microsoft-C
-//  __EMX__             Eberhard Mattes EMX (GNU based)
-//  __GNUC__            GNU C based compiler (also Cygwin)
-//  __CYGWIN__          Cygnus Windows C-Compiler (GNU based)
-//  __APPLE_CC__        Apple GCC (GNU based)
-
-
-//// Macros typical for Operating Systems
-//
-//  __linux__           Linux
-//  __bsdi__            BSDi
-//  __FreeBSD__         FreeBSD
-//  __NetBSD__          NetBSD
-//  __OpenBSD__         OpenBSD
-//  __unix__            Unix ????????
-//  _WIN16              16 bit-Windows
-//  _WIN32              32 bit-Windows (WIN32 is wrong, not defined by not MSC) (also __GNUC__ + _WIN32 is possible)
-//  _HPUX_SOURCE        HP-UX
-//  __BEOS__            BeOS
-//  __APPLE__           Apple Mac OS X (only when using Apple GCC)
-//  ???????             MS-DOS and relatives
-
-
-//// Macros typical for special conformances
-//                      System 5 Release 4 (SVr4)
-//                      System 5 ID     (SVID)
-//                      POSIX 1.0
-//                      POSIX 1.0b
-//                      X/OPEN
-//                      BSD 4.3
-//                      BSD 4.4
-//                      ANSI
-
-
-// Macros to manipulate Sockets + Files in one, in (+0x4000)
-// output times TIME/TIME_T/DTIME
-
-#ifndef MPPDEC_MPPDEC_H
-#define MPPDEC_MPPDEC_H
-
-//// optimization/feature defines //////////////////////////////////
-#ifndef NOT_INCLUDE_CONFIG_H
-# include "config.h"
-#endif
-#include "./mpp.h"
-
-
-//// portable system includes //////////////////////////////////////
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include <math.h>
-
-
-//// system dependent system includes //////////////////////////////
-// low level I/O, where are prototypes and constants?
-#if   defined _WIN32  ||  defined __TURBOC__  ||  defined __ZTC__  ||  defined _MSC_VER
-# include <io.h>
-# include <fcntl.h>
-# include <time.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-#elif defined __unix__  ||  defined __linux__  ||  defined __APPLE__
-# include <fcntl.h>
-# include <unistd.h>
-# include <sys/time.h>
-# include <sys/ioctl.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-#else
-// .... add Includes for new Operating System here (with prefix: #elif defined)
-# include <fcntl.h>
-# include <unistd.h>
-# include <sys/ioctl.h>
-# include <sys/stat.h>
-#endif
-
-
-#if   defined __linux__
-#  include <fpu_control.h>
-#elif defined __FreeBSD__
-# include <machine/floatingpoint.h>
-#elif defined _MSC_VER
-# include <float.h>
-#endif
-
-
-#if defined _WIN32
-# undef USE_OSS_AUDIO
-# undef USE_ESD_AUDIO
-# undef USE_SUN_AUDIO
-#else
-# undef USE_WIN_AUDIO
-#endif
-
-#if defined __APPLE__
-# undef USE_OSS_AUDIO
-# undef USE_SUN_AUDIO
-# undef USE_WIN_AUDIO
-# undef USE_NICE
-# undef USE_REALTIME
-# undef USE_ASM
-# undef USE_ESD_AUDIO
-# define NO_DEV_AUDIO
-# undef ENDIAN
-# define ENDIAN HAVE_BIG_ENDIAN
-#endif
-
-#if defined __TURBOC__
-# undef USE_OSS_AUDIO
-# undef USE_ESD_AUDIO
-# undef USE_SUN_AUDIO
-# undef USE_NICE
-# undef USE_REALTIME
-#endif
-
-#if defined USE_DIET  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-# undef USE_ESD_AUDIO
-#endif
-
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-# undef USE_ASM
-#endif
-
-#if INT_MAX < 2147483647L
-# undef USE_ASM
-#endif
-
-// sound card
-#if defined USE_OSS_AUDIO
-# include <sys/ioctl.h>
-# include <sys/time.h>
-# if   defined __linux__        // the standard is that this file is stored somewhere on the hard disk
-#  include <linux/soundcard.h>
-# elif defined __bsdi__
-#  include <sys/soundcard.h>
-# elif defined __FreeBSD__
-#  include <machine/soundcard.h>
-# elif defined __NetBSD__  ||  defined __OpenBSD__
-#  include <soundcard.h>
-# elif defined __APPLE__  &&  defined __MACH__
-#  include <pleasepatchheretherightpathofsoundcard.hforMacOSX/soundcard.h>
-# else
-#  include <pleasepatchheretherightpathof/soundcard.h>
-# endif
-#endif /* USE_OSS_AUDIO */
-
-#if defined USE_ESD_AUDIO
-# include <esd.h>
-#endif
-
-#if defined USE_SUN_AUDIO
-# include <sys/audioio.h>
-#endif
-
-#ifdef MPP_ENCODER
-# undef USE_HTTP
-#endif
-
-#ifdef USE_HTTP
-# ifdef _WIN32
-#  include <winsock2.h>
-# else
-#  include <sys/socket.h>
-# endif
-#endif
-
-#if   defined USE_WIN_AUDIO
-# include <windows.h>
-# define WINAUDIO_FD            ((FILE_T)-128)
-#elif defined USE_IRIX_AUDIO
-# define IRIXAUDIO_FD           ((FILE_T)-127)
-#endif
-#define  NULL_FD                ((FILE_T)-126)
-
-#if defined USE_NICE  &&  !defined _WIN32
-# include <sys/resource.h>
-#endif
-
-// scheduler stuff
-#if defined USE_REALTIME  &&  !defined _WIN32
-# include <sched.h>
-#endif
-
-#ifndef O_BINARY
-# ifdef _O_BINARY
-#  define O_BINARY              _O_BINARY
-# else
-#  define O_BINARY              0
-# endif
-#endif
-
-#if defined _WIN32  ||  defined __TURBOC__
-# define strncasecmp(__s1,__s2,__n) strnicmp ((__s1), (__s2), (__n))
-# define strcasecmp(__s1,__s2)      stricmp  ((__s1), (__s2))
-# define MKDIR(__dir,__attr)        mkdir ((__dir))
-#else
-# define MKDIR(__dir,__attr)        mkdir ((__dir), (__attr))
-#endif
-
-#if defined _WIN32
-# include <direct.h>
-# define snprintf                   _snprintf
-# define getcwd(__buff,__len)       _getcwd ((__buff), (__len))
-# define sleep(__sec)               Sleep ((__sec) * 1000)
-#endif
-
-#if defined _WIN32
-# define TIME_T                     long
-# define TIME(__x)                  time ( &(__x) )
-# define DTIME(__x,__y)             ( (double)(__y) - (__x) )
-#else
-# define TIME_T                     struct timeval
-# define TIME(__x)                  gettimeofday ( &(__x), NULL )
-# define DTIME(__x,__y)             ( ((double)(__y).tv_sec - (__x).tv_sec) + 1.e-6 * ((double)(__y).tv_usec - (__x).tv_usec) )
-#endif
-
-#if   defined __GNUC__
-# define inline                 __inline__
-# define restrict
-#elif defined _WIN32
-# define inline                 __inline
-# define restrict
-#else
-# define inline
-# define restrict
-#endif
-
-
-//// Binary/Low-Level-IO ///////////////////////////////////////////
-//
-// All file I/O is basicly handled via an ANSI file pointer (type: FILE*) in
-// FILEIO-Mode 1 and via a POSIX file descriptor (type: int) in
-// FILEIO-Mode 2 and 3.
-//
-// Some operations are only available via the POSIX interface (fcntl, setmode,
-// ...) so we need a function to get the file descriptor from a file pointer.
-// In FILEIO-Mode 2 and 3 this is a dummy function because we are always working
-// with these file descriptors.
-//
-
-#if  FILEIO == 1
-# if   defined __BORLANDC__  ||  defined _WIN32
-#  define FILENO(__fp)          _fileno ((__fp))
-# elif defined __CYGWIN__  ||  defined __TURBOC__  ||  defined __unix__  ||  defined __EMX__  ||  defined _MSC_VER
-#  define FILENO(__fp)          fileno  ((__fp))
-# else
-#  define FILENO(__fp)          fileno  ((__fp))
-# endif
-#else
-#  define FILENO(__fd)          (__fd)
-#endif
-
-
-//
-// If we have access to a file via file name, we can open the file with an
-// additional "b" or a O_BINARY within the (f)open function to get a
-// transparent untranslated data stream which is necessary for audio bitstream
-// data and also for PCM data. If we are working with
-// stdin/stdout/FILENO_STDIN/FILENO_STDOUT we can't open the file with these
-// attributes, because the files are already open. So we need a non
-// standardized sequence to switch to this mode (not necessary for Unix).
-// Mostly the sequence is the same for incoming and outgoing streams, but only
-// mostly so we need one for IN and one for OUT.
-// Macros are called with the file pointer and you get back the untransalted file
-// pointer which can be equal or different from the original.
-//
-
-#if   defined __EMX__
-# define SETBINARY_IN(__fp)     (_fsetmode ( (__fp), "b" ), (__fp))
-# define SETBINARY_OUT(__fp)    (_fsetmode ( (__fp), "b" ), (__fp))
-#elif defined __TURBOC__ || defined __BORLANDC__
-# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
-# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
-#elif defined __CYGWIN__
-# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)), _O_BINARY ), (__fp))
-# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)), _O_BINARY ), (__fp))
-#elif defined _WIN32
-# define SETBINARY_IN(__fp)     (_setmode  ( FILENO ((__fp)), _O_BINARY ), (__fp))
-# define SETBINARY_OUT(__fp)    (_setmode  ( FILENO ((__fp)), _O_BINARY ), (__fp))
-#elif defined _MSC_VER
-# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
-# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
-#elif defined __unix__
-# define SETBINARY_IN(__fp)     (__fp)
-# define SETBINARY_OUT(__fp)    (__fp)
-#elif 0
-# define SETBINARY_IN(__fp)     (freopen   ( NULL, "rb", (__fp) ), (__fp))
-# define SETBINARY_OUT(__fp)    (freopen   ( NULL, "wb", (__fp) ), (__fp))
-#else
-# define SETBINARY_IN(__fp)     (__fp)
-# define SETBINARY_OUT(__fp)    (__fp)
-#endif
-
-// file I/O using ANSI buffered file I/O via file pointer FILE* (fopen, fread, fwrite, fclose)
-#if  FILEIO == 1
-# define OFF_T                  signed long
-# define FILE_T                 FILE*
-# define OPEN(name)             fopen  (name, "rb" )
-# define OPENRW(name)           fopen  (name, "r+b")
-# define CREATE(name)           fopen  (name, "wb" )
-# define INVALID_FILEDESC       NULL
-# define CLOSE(fp)              fclose (fp)                  // CLOSE   returns -1 on error, otherwise 0
-# define READ(fp,ptr,len)       fread  (ptr, 1, len, fp)     // READ    returns -1 or 0 on error/EOF, otherwise > 0
-# define READ1(fp,ptr)          fread  (ptr, 1, 1, fp)       // READ    returns -1 or 0 on error/EOF, otherwise > 0
-# define WRITE(fp,ptr,len)      fwrite (ptr, 1, len, fp)     // WRITE   returns -1 or 0 on error/EOF, otherwise > 0
-# define SEEK(fp,offs,lbl)      fseek  (fp, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
-# define FILEPOS(fp)            ftell  (fp)                  // FILEPOS returns -1 on error, otherwise >= 0
-# define STDIN                  stdin
-# define STDOUT                 stdout
-# define STDERR                 stderr
-# define FDOPEN(fd,mode)        fdopen (fd, mode)
-# define UNBUFFER(fp)           setvbuf(fp, NULL, _IONBF, 0 )
-# define FLUSH(fp)              fflush (fp)
-#endif /* FILEIO==1 */
-
-// file I/O using POSIX unbuffered file I/O via file descriptors (open, read, write, close)
-#if  FILEIO == 2
-# ifdef WIN32
-#  define OFF_T                 _off_t
-# else
-#  define OFF_T                 off_t
-# endif
-# define FILE_T                 int
-# define OPEN(name)             open  (name, O_RDONLY|O_BINARY)
-# define OPENRW(name)           open  (name, O_RDWR  |O_BINARY)
-# define CREATE(name)           open  (name, O_WRONLY|O_BINARY|O_TRUNC|O_CREAT, 0644)
-# define INVALID_FILEDESC       (-1)
-# define CLOSE(fd)              close (fd)                   // CLOSE   returns -1 on error, otherwise 0
-# if defined HAVE_INCOMPLETE_READ
-#  define READ(fd,ptr,len)      complete_read (fd, ptr, len) // READ    returns -1 or 0 on error/EOF, otherwise > 0
-# else
-#  define READ(fd,ptr,len)      (size_t)read   (fd, ptr, len)// READ    returns -1 or 0 on error/EOF, otherwise > 0
-# endif
-# define READ1(fd,ptr)          (size_t)read   (fd, ptr, 1)  // READ    returns -1 or 0 on error/EOF, otherwise > 0
-# define WRITE(fd,ptr,len)      (size_t)write  (fd, ptr, len)// WRITE   returns -1 or 0 on error/EOF, otherwise > 0
-# define SEEK(fd,offs,lbl)      lseek  (fd, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
-# define FILEPOS(fd)            lseek  (fd, 0L, SEEK_CUR)    // FILEPOS returns -1 on error, otherwise >= 0
-# define STDIN                  0
-# define STDOUT                 1
-# define STDERR                 2
-# define FDOPEN(fd,mode)        (fd)
-# define UNBUFFER(fd)           (void)(fd)
-# define FLUSH(fd)              (void)(fd)
-#endif /* FILEIO==2 */
-
-// file I/O using Turbo-C lowest level unbuffered file I/O via file descriptors (_open, _read, _write, _close)
-#if  FILEIO == 3
-# define OFF_T                  signed long
-# define FILE_T                 int
-# define OPEN(name)             _open (name, O_RDONLY)
-# define OPENRW(name)           _open (name, O_RDWR  )
-# define CREATE(name)           _creat(name, 0)
-# define INVALID_FILEDESC       (-1)
-# define CLOSE(fd)              _close (fd)                  // CLOSE   returns -1 on error, otherwise 0
-# define READ(fd,ptr,len)       (size_t)_read  (fd, ptr, len)// READ    returns -1 or 0 on error/EOF, otherwise > 0
-# define READ1(fd,ptr)          (size_t)_read  (fd, ptr, 1)  // READ    returns -1 or 0 on error/EOF, otherwise > 0
-# define WRITE(fd,ptr,len)      (size_t)_write (fd, ptr, len)// WRITE   returns -1 or 0 on error/EOF, otherwise > 0
-# define SEEK(fd,offs,lbl)      lseek  (fd, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
-# define FILEPOS(fd)            lseek  (fd, 0L, SEEK_CUR)    // FILEPOS returns -1 on error, otherwise >= 0
-# define STDIN                  0
-# define STDOUT                 1
-# define STDERR                 2
-# undef  SETBINARY_IN
-# undef  SETBINARY_OUT
-# define SETBINARY_IN(fd)       (fd)
-# define SETBINARY_OUT(fd)      (fd)
-# define FDOPEN(fd,mode)        (fd)
-# define UNBUFFER(fd)           (void)(fd)
-# define FLUSH(fd)              (void)(fd)
-#endif /* FILEIO==3 */
-
-#if FILEIO != 2  &&  defined USE_HTTP
-# error HTTP can only be used by FILEIO==2
-#endif
-
-#if defined _WIN32  ||  defined __BEOS__
-# define WRITE_SOCKET(sock,ptr,len)     send (sock, ptr, len, 0)
-# define READ_SOCKET(sock,ptr,len)      recv (sock, ptr, len, 0)
-#else
-# define WRITE_SOCKET(sock,ptr,len)     write (sock, ptr, len)
-# define READ_SOCKET(sock,ptr,len)      read  (sock, ptr, len)
-#endif
-
-#ifdef _WIN32
-# define POPEN_READ_BINARY_OPEN(cmd)    _popen ((cmd), "rb")
-# define POPEN_WRITE_BINARY_OPEN(cmd)   _popen ((cmd), "wb")
-# define PCLOSE(fp)                     _pclose(fp)
-#else
-# define POPEN_READ_BINARY_OPEN(cmd)    popen ((cmd), "r")
-# define POPEN_WRITE_BINARY_OPEN(cmd)   popen ((cmd), "w")
-# define PCLOSE(fp)                     pclose(fp)
-#endif
-
-#if defined _WIN32
-# define STRUCT_STAT            struct _stat
-# define STAT_CMD(f,s)          _stat (f, s)
-#else
-# define STRUCT_STAT            struct stat
-# define STAT_CMD(f,s)          stat (f, s)
-#endif /* WIN32 */
-
-#ifndef S_ISDIR
-# if   defined S_IFDIR
-#  define S_ISDIR(x)            ((x) &   S_IFDIR)
-# elif defined _S_IFDIR
-#  define S_ISDIR(x)            ((x) &  _S_IFDIR)
-# elif defined __S_IFDIR
-#  define S_ISDIR(x)            ((x) & __S_IFDIR)
-# else
-#  error Cannot find a way to test for a directory
-# endif
-#endif /* !S_ISDIR */
-
-#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __TURBOC__  ||  defined _WIN32  ||  defined __APPLE__
-# define ISATTY(fd)             isatty (fd)
-#else
-# define ISATTY(fd)             0
-#endif
-
-// Path separator
-#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __APPLE__
-# define PATH_SEP               '/'
-# define DRIVE_SEP              '\0'
-# define EXE_EXT                ""
-# define DEV_NULL               "/dev/null"
-# define ENVPATH_SEP            ':'
-#elif defined _WIN32  ||  defined __TURBOC__  ||  defined __ZTC__  ||  defined _MSC_VER
-# define PATH_SEP               '\\'
-# define DRIVE_SEP              ':'
-# define EXE_EXT                ".exe"
-# define DEV_NULL               "\\nul"
-# define ENVPATH_SEP            ';'
-#else
-# define PATH_SEP               '/'         // Amiga: C:/
-# define DRIVE_SEP              ':'
-# define EXE_EXT                ""
-# define DEV_NULL               "nul"
-# define ENVPATH_SEP            ';'
-#endif
-
-// maximum length of file names
-#ifndef PATHLEN_MAX
-# if   defined FILENAME_MAX
-#  define PATHLEN_MAX           FILENAME_MAX
-# elif INT_MAX < 2147483647L
-#  define PATHLEN_MAX            128
-# else
-#  define PATHLEN_MAX           1024
-# endif
-#endif /* !PATHLEN_MAX */
-
-#ifdef _WIN32
-# define TitleBar(text)   SetConsoleTitle (text)
-#else
-# define TitleBar(text)   (void) (text)
-#endif
-
-
-//// constants /////////////////////////////////////////////////////
-#ifdef USE_SV8
-# define MAX_SV          "SV8"
-#else
-# define MAX_SV          "SV7"
-#endif
-
-#ifdef USE_ASM
-# define BUILD           "3DNOW!/SSE"
-#else
-# define BUILD           ""
-#endif
-
-
-#define COPYRIGHT        "(C) 1999-2003 Buschmann/Klemm/Piecha/Wolf"
-
-#define DECODER_DELAY    (512 - 32 + 1)
-#define BLK_SIZE         (36 * 32)
-
-
-//// logging defines, for development only /////////////////////////
-#if defined _WIN32  ||  defined __TURBOC__
-# define LOGPATH         ".\\"
-# define MUSICPATH       "D:\\AUDIO\\"
-#else
-# define LOGPATH         "./"
-# define MUSICPATH       "/Archive/Audio/"
-#endif
-#define _(x)             (void)(fprintf(stderr,"<%d>\n",(x)),fflush(stderr))
-
-#ifdef DEBUG
-# define REP(x)          (void)(x)
-#else
-# define REP(x)
-#endif
-
-
-//// numerical constants ///////////////////////////////////////////
-#define C00              (Float) 0.500000000000000000000000L    // Cxx = 0.5 / cos (xx*M_PI/64)
-#define C01              (Float) 0.500602998235196301334178L
-#define C02              (Float) 0.502419286188155705518560L
-#define C03              (Float) 0.505470959897543659956626L
-#define C04              (Float) 0.509795579104159168925062L
-#define C05              (Float) 0.515447309922624546962323L
-#define C06              (Float) 0.522498614939688880640101L
-#define C07              (Float) 0.531042591089784174473998L
-#define C08              (Float) 0.541196100146196984405269L
-#define C09              (Float) 0.553103896034444527838540L
-#define C10              (Float) 0.566944034816357703685831L
-#define C11              (Float) 0.582934968206133873665654L
-#define C12              (Float) 0.601344886935045280535340L
-#define C13              (Float) 0.622504123035664816182728L
-#define C14              (Float) 0.646821783359990129535794L
-#define C15              (Float) 0.674808341455005746033820L
-#define C16              (Float) 0.707106781186547524436104L
-#define C17              (Float) 0.744536271002298449773679L
-#define C18              (Float) 0.788154623451250224773056L
-#define C19              (Float) 0.839349645415527038721463L
-#define C20              (Float) 0.899976223136415704611808L
-#define C21              (Float) 0.972568237861960693780520L
-#define C22              (Float) 1.060677685990347471323668L
-#define C23              (Float) 1.169439933432884955134476L
-#define C24              (Float) 1.306562964876376527851784L
-#define C25              (Float) 1.484164616314166277319733L
-#define C26              (Float) 1.722447098238333927796261L
-#define C27              (Float) 2.057781009953411550808880L
-#define C28              (Float) 2.562915447741506178719328L
-#define C29              (Float) 3.407608418468718785698107L
-#define C30              (Float) 5.101148618689163857960189L
-#define C31              (Float)10.190008123548056810994678L
-
-#define SS05             (Float) 0.840896415253714543018917L      // 0.5^0.25
-
-
-#ifndef M_PI
-# define M_PI            3.1415926535897932384626433832795029     // 4*atan(1)
-# define M_PIl           3.1415926535897932384626433832795029L
-# define M_LN2           0.6931471805599453094172321214581766     // ln(2)
-# define M_LN2l          0.6931471805599453094172321214581766L
-# define M_LN10          2.3025850929940456840179914546843642     // ln 10 */
-# define M_LN10l         2.3025850929940456840179914546843642L
-#endif
-
-
-//// 'Cdecl' forces the use of standard C/C++ calling convention ///////
-#if   defined _WIN32
-# define Cdecl           __cdecl
-#elif defined __ZTC__
-# define Cdecl           _cdecl
-#elif defined __TURBOC__
-# define Cdecl           cdecl
-#else
-# define Cdecl
-#endif
-
-//// expect handling of GCC ////////////////////////////////////////
-#ifdef __GNUC__
-# if __GNUC__ < 3
-#  define __builtin_expect(cond,exp)  (cond)
-#  ifndef expect
-#    define expect(cond,exp)          __builtin_expect(cond,exp)
-#  endif
-# else
-#  ifndef expect
-#   define expect(cond,exp)           __builtin_expect(cond,exp)
-#  endif
-# endif
-#else
-# define __builtin_expect(cond,exp)   (cond)
-# ifndef expect
-#  define expect(cond,exp)            __builtin_expect(cond,exp)
-# endif
-#endif
-
-#define if0(x)                        if (expect(x,0))
-#define if1(x)                        if (expect(x,1))
-#define while0(x)                     while (expect(x,0))
-#define while1(x)                     while (expect(x,1))
-
-#ifndef __GNUC__
-# define __attribute__(x)
-#else
-# define __attribute__(x)
-#endif
-
-//// Remaining macros //////////////////////////////////////////////
-// selects input buffer size and some constants needed for input buffer handling
-#ifndef IBUFLOG2                 // must be at least 10 (bitrate always <626 kbps) or better 11 ( <1253 kbps)
-# if INT_MAX < 2147483647L
-#  define IBUFLOG2       11      // 8 KByte buffer, possible 11...13 (32 KByte limit)
-# else
-#  define IBUFLOG2       21      // 8 MByte buffer, possible 11...29 ( 2 GByte limit)
-# endif
-#endif
-#define IBUFSIZE         ((size_t)(1LU<<(IBUFLOG2)))
-#define IBUFSIZE2        ((size_t)((IBUFSIZE)/2))
-#define IBUFMASK         ((size_t)((IBUFSIZE)-1))
-
-// save memory space for 16 bit compiler (data + stack < 64 KByte)
-#if INT_MAX < 2147483647L
-# if VIRT_SHIFT     >  6
-#  undef  VIRT_SHIFT
-#  define VIRT_SHIFT   6
-# endif
-# if      IBUFLOG2  > 11
-#  undef  IBUFLOG2
-#  define IBUFLOG2    11
-# endif
-# define USE_HUFF_PACK
-# define USE_ARRAY_PACK
-#endif
-
-// generate a macro which contains information about compile time settings
-#define STR(x)   _STR(x)
-#define _STR(x)  #x
-#ifdef NDEBUG
-# define T1  ""
-#else
-# define T1  "DEBUG "
-#endif
-#if  defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO  ||  defined USE_WIN_AUDIO
-# define T2  "SND "
-#else
-# define T2  ""
-#endif
-#ifdef USE_NICE
-# define T3  "NICE "
-#else
-# define T3  ""
-#endif
-#if defined USE_REALTIME
-# define T4  "RT "
-#else
-# define T4  ""
-#endif
-#ifdef HAVE_IEEE754_FLOAT
-# define T5  "IEEE "
-#else
-# define T5  ""
-#endif
-#define T6  "IO=" STR(FILEIO) " "
-#ifdef USE_HUFF_PACK
-# define T7  "H-PCK "
-#else
-# define T7  ""
-#endif
-#ifdef USE_ARRAY_PACK
-# define T8  "A-PCK "
-#else
-# define T8  ""
-#endif
-#define T9  "SHFT=" STR(VIRT_SHIFT) " "
-#define T10 "IBUF=" STR(IBUFLOG2) " "
-
-#define COMPILER_FLAGS  T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
-
-// align a pointer by maybe incrementing it
-#define ALIGN(ptr,alignment) \
-                    (void*)((((ptrdiff_t)(ptr)) & (-(ptrdiff_t)(alignment))) + (alignment))   // aligns a pointer with alignment, the source array should be at least alignment-1 Bytes longer than the needed length
-
-
-//// Simple types //////////////////////////////////////////////////
-
-#if   CHAR_BIT == 8  &&  SCHAR_MAX == 127L
-typedef unsigned char       Uint8_t;    // guaranteed  8 bit unsigned integer type with range 0...255
-typedef signed   char       Int8_t;     // guaranteed  8 bit signed   integer type with range -128...127
-#else
-# error No  8 bit int type found. Tested: char
-#endif
-
-#if   SHRT_MAX == 32767L
-typedef unsigned short int  Uint16_t;   // guaranteed 16 bit unsigned integer type with range 0...65535
-typedef signed   short int  Int16_t;    // guaranteed 16 bit signed   integer type with range -32768...32767
-#else
-# error No 16 bit int type found. Tested: short
-#endif
-
-#if   INT_MAX == 2147483647L
-typedef unsigned int        Uint32_t;   // guaranteed 32 bit unsigned integer type with range 0...4294967295
-typedef signed   int        Int32_t;    // guaranteed 32 bit signed   integer type with range -2147483648...2147483647
-#elif LONG_MAX == 2147483647L
-typedef unsigned long int   Uint32_t;   // guaranteed 32 bit unsigned integer type with range 0...4294967295
-typedef signed   long int   Int32_t;    // guaranteed 32 bit signed   integer type with range -2147483648...2147483647
-#else
-# error No 32 bit int type found. Tested: int, long
-#endif
-
-#if    defined __C99__                 // C9x has a type which is exact 64 bit
-typedef int64_t             Int64_t;
-typedef uint64_t            Uint64_t;
-typedef intmax_t            IntMax_t;
-typedef uintmax_t           UintMax_t;
-# define IntMax_MIN        -9223372036854775808
-# define IntMax_MAX         9223372036854775807
-# define UintMax_MAX       18446744073709551615
-# define UintMAX_FP(x)      (long double)(x)
-#elif  defined __GNUC__                // GCC uses long long as 64 bit
-typedef signed   long long  Int64_t;
-typedef unsigned long long  Uint64_t;
-typedef signed   long long  IntMax_t;
-typedef unsigned long long  UintMax_t;
-# define IntMax_MIN        -9223372036854775808LL
-# define IntMax_MAX         9223372036854775807LL
-# define UintMax_MAX       18446744073709551615LLU
-# define UintMAX_FP(x)      (long double)(x)
-#elif defined _MSC_VER
-typedef signed   __int64    Int64_t;
-typedef unsigned __int64    Uint64_t;
-typedef signed   __int64    IntMax_t;
-typedef unsigned __int64    UintMax_t;
-# define IntMax_MIN        -9223372036854775808I64
-# define IntMax_MAX         9223372036854775807I64
-# define UintMax_MAX       18446744073709551615UI64
-# define UintMAX_FP(x)      (long double)(IntMax_t)(x)
-#elif defined LLONG_MAX               // long long (when existing) is normally 64 bit
-typedef signed   long long  Int64_t;
-typedef unsigned long long  Uint64_t;
-typedef signed   long long  IntMax_t;
-typedef unsigned long long  UintMax_t;
-# define IntMax_MIN        -9223372036854775808LL
-# define IntMax_MAX         9223372036854775807LL
-# define UintMax_MAX       18446744073709551615LLU
-# define UintMAX_FP(x)      (long double)(x)
-#elif  LONG_MAX > 0xFFFFFFFFLU         // long is longer than 33 bit, assume 64 bit
-typedef signed   long       Int64_t;
-typedef unsigned long       Uint64_t;
-typedef signed   long       IntMax_t;
-typedef unsigned long       UintMax_t;
-# define IntMax_MIN        -9223372036854775808L
-# define IntMax_MAX         9223372036854775807L
-# define UintMax_MAX       18446744073709551615LU
-# define UintMAX_FP(x)      (long double)(x)
-#elif  defined _WIN32                  // Microsoft and Intel call it __int64
-typedef signed   __int64    Int64_t;
-typedef unsigned __int64    Uint64_t;
-typedef signed   __int64    IntMax_t;
-typedef unsigned __int64    UintMax_t;
-# define IntMax_MIN        -9223372036854775808I64
-# define IntMax_MAX         9223372036854775807I64
-# define UintMax_MAX       18446744073709551615UI64
-# define UintMAX_FP(x)      (long double)(IntMax_t)(x)
-#else
-# define NO_INT64_T                    // no type mapped to 64 bit integer
-typedef signed   long       IntMax_t;
-typedef unsigned long       UintMax_t;
-# define IntMax_MIN        -2147483648L
-# define IntMax_MAX         2147483647L
-# define UintMax_MAX        4294967295LU
-# define UintMAX_FP(x)      (long double)(x)
-#endif
-
-
-#if defined _WIN32  &&  !defined __GNUC__  &&  !defined __C99__
-typedef signed long         ssize_t;
-#endif
-
-#ifdef USE_ARRAY_PACK
-typedef signed char         Bool_t;     // ==0: false, !=0: true
-#else
-typedef signed int          Bool_t;     // ==0: false, !=0: true
-#endif
-typedef Uint32_t            Ibuf_t;     // type for input buffer, currently this type must be 32 bit
-typedef signed   char       Schar;      // at least -127...+127
-typedef unsigned char       Uchar;      // at least 0...255
-typedef signed   short int  Short;      // at least -32767...+32767, memory economic type
-typedef unsigned short int  Ushort;     // at least 0...65535, memory economic type
-typedef signed   int        Int;        // at least -32767...+32767, fast type
-typedef unsigned int        Uint;       // at least 0...65535, fast type
-typedef signed   long int   Long;       // at least -2147483647...+2147483647, but more is better
-typedef unsigned long int   Ulong;      // at least 0...4294967295, but more is better
-//                          size_t;     // size of memory objects
-//                          ptrdiff_t;  // pointer differences, may be larger than size_t
-typedef float               Float32_t;  // guaranteed 32 bit floating point type
-typedef double              Float64_t;  // guaranteed 64 bit floating point type
-typedef float               Float;      // fastest floating point type, memory economic (used for all PCM calculations)
-#define SIZEOF_Float  4                 // size of the type 'Float' in sizeof units
-typedef double              Double;     // floating point with extended precision (more than 32 bit mantissa)
-typedef long double         Ldouble;    // most exact floating point format
-typedef Int16_t             Int2x16_t [2];
-typedef Int32_t             Int2x32_t [2];
-
-#if   defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-# ifdef NO_INT64_T
-#   error No 64 bit int type found, needed for HQ 16...32 bit output
-# endif
-typedef Int2x32_t           Int2xSample_t;
-# if defined MAKE_32BIT
-#  define SAMPLE_SIZE        32
-#  define PROG_NAME          "mppdec32"
-#  define SAMPLE_SIZE_STRING " (32 bit HQ)"
-#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x32bit ( fd, p, b )
-#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
-                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
-#  undef  USE_ESD_AUDIO
-# elif defined MAKE_24BIT
-#  define SAMPLE_SIZE        24
-#  define PROG_NAME          "mppdec24"
-#  define SAMPLE_SIZE_STRING " (24 bit HQ)"
-#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x24bit ( fd, p, b )
-#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
-                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
-#  undef  USE_ESD_AUDIO
-# elif defined MAKE_16BIT
-#  define SAMPLE_SIZE        16
-#  define PROG_NAME          "mppdec16"
-#  define SAMPLE_SIZE_STRING " (16 bit HQ)"
-#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x16bit ( fd, p, b )
-#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
-                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
-# endif
-#else
-typedef Int2x16_t           Int2xSample_t;
-# define SAMPLE_SIZE        16
-# define PROG_NAME          "mppdec"
-# define SAMPLE_SIZE_STRING ""
-# define Write_PCM(fd,p,b)  Write_PCM_2x16bit ( fd, p, b )
-# ifdef USE_ASM
-#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
-                            Synthese_Filter_16 ( Stream, offset, Vi, Yi )
-# else
-#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
-                            Synthese_Filter_16_C ( Stream, offset, Vi, Yi )
-# endif /* USE_ASM */
-#endif
-
-
-//// More complex types ////////////////////////////////////////////
-typedef struct {
-    Int    L [36];
-    Int    R [36];
-} Quant_t ;
-
-typedef struct {
-    Uint   L;
-    Uint   R;
-} UPair_t ;
-
-typedef struct {
-    Int    L;
-    Int    R;
-} Pair_t ;
-
-typedef struct {
-#ifdef USE_ARRAY_PACK
-    Schar  L;
-    Schar  R;
-#else
-    Int    L;
-    Int    R;
-#endif
-} CPair_t ;
-
-typedef Float     FloatArray [32];
-typedef UPair_t   UPairArray [32];
-typedef Pair_t    PairArray  [32];
-typedef CPair_t   CPairArray [32];
-typedef Float     SCFTriple   [3];
-typedef struct {
-#ifndef MPP_ENCODER
-    Uint32_t      Code;         // >=32 bit
-# ifdef USE_HUFF_PACK
-    Schar         Value;        // >= 7 bit
-    Uchar         Length;       // >= 4 bit
-# else
-    Int           Value;
-    Uint          Length;
-# endif
-#else
-# ifdef USE_HUFF_PACK
-    Uint8_t       Length;      // >=  4 bit
-    Uint8_t       ___;
-    Uint16_t      Code;        // >= 14 bit
-# else
-    Uint          Code;
-    Uint          Length;
-# endif
-#endif
-} Huffman_t ;
-
-typedef struct {
-    Uint          Code   : 16;  // >= 14 bit
-    Uint          Length :  8;  // >=  4 bit
-} HuffSrc_t ;
-
-typedef struct {
-    OFF_T         FileSize;
-    Int           GenreNo;
-    Int           TrackNo;
-    char          Genre   [128];
-    char          Year    [ 20];
-    char          Track   [  8];
-    char          Title   [256];
-    char          Artist  [256];
-    char          Album   [256];
-    char          Comment [512];
-} TagInfo_t ;
-
-typedef void  (*SyntheseFilter16_t) ( Int2x16_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi );
-typedef void  (*SyntheseFilter32_t) ( Int2x32_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi, int ch );
-typedef Int   (*HeaderWriter_t)     ( FILE_T outputFile, Ldouble  SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
-
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-typedef struct {
-    const Float*  FilterCoeff;
-    Uint64_t      Mask;
-    Float64_t     Add;
-    Float         Dither;
-    Uint32_t      Overdrives;
-    Int64_t       MaxLevel;
-    Bool_t        NoShaping;
-    Float         ErrorHistory     [2] [16];       // max. 2 channels, 16th order Noise shaping
-    Float         DitherHistory    [2] [16];
-    Int32_t       LastRandomNumber [2];
-} dither_t;
-#else
-typedef struct {
-    Uint32_t      Overdrives;
-    Int32_t       MaxLevel;
-} dither_t;
-#endif
-
-
-//// Variables /////////////////////////////////////////////////////
-
-// decode.c
-extern Ibuf_t             InputBuff [IBUFSIZE]; // read buffer for the MP+ data stream
-extern size_t             InputCnt;             // current offset in this buffer
-
-// huffsv7.c
-extern Huffman_t          HuffHdr    [10];
-extern Huffman_t          HuffSCFI   [ 4];
-extern Huffman_t          HuffDSCF   [16];
-extern Huffman_t          HuffQ1 [2] [ 3*3*3];
-extern Huffman_t          HuffQ2 [2] [ 5*5];
-extern Huffman_t          HuffQ3 [2] [ 7];
-extern Huffman_t          HuffN3 [2] [ 7*7];
-extern Huffman_t          HuffQ4 [2] [ 9];
-extern Huffman_t          HuffQ5 [2] [15];
-extern Huffman_t          HuffQ6 [2] [31];
-extern Huffman_t          HuffQ7 [2] [63];
-extern Huffman_t          HuffN8 [2][127];
-extern const Huffman_t*   HuffQ  [2] [ 8];
-extern const Huffman_t*   HuffN  [2] [ 9];
-extern Uint8_t            LUT1_0  [1<< 6];
-extern Uint8_t            LUT1_1  [1<< 9];
-extern Uint8_t            LUT2_0  [1<< 7];
-extern Uint8_t            LUT2_1  [1<<10];
-extern Uint8_t            LUT3_0  [1<< 4];
-extern Uint8_t            LUT3_1  [1<< 5];
-extern Uint8_t            LUT4_0  [1<< 4];
-extern Uint8_t            LUT4_1  [1<< 5];
-extern Uint8_t            LUT5_0  [1<< 6];
-extern Uint8_t            LUT5_1  [1<< 8];
-extern Uint8_t            LUT6_0  [1<< 7];
-extern Uint8_t            LUT6_1  [1<< 7];
-extern Uint8_t            LUT7_0  [1<< 8];
-extern Uint8_t            LUT7_1  [1<< 8];
-extern Uint8_t            LUTDSCF [1<< 6];
-
-// huffsv46.c
-extern const Huffman_t*   Entropie      [18];
-extern const Huffman_t*   Region        [32];
-extern Huffman_t          SCFI_Bundle   [ 8];
-extern Huffman_t          DSCF_Entropie [13];
-
-// mppdec.c
-extern Float              Y_L      [36] [32];
-extern Float              Y_R      [36] [32];
-extern CPair_t            SCF_Index [3] [32];      // Scalefactor
-extern CPair_t            Res           [32];      // resolution steps of the subbands
-extern Quant_t            Q             [32];      // quantized samples
-extern CPair_t            SCFI          [32];      // transfer order of the SCF
-extern Bool_t             MS_Band       [32];      // subband-wise flag for M/S-signal guidance
-extern Bool_t             MS_used;                 // global flag for M/S-signal guidance
-extern Bool_t             IS_used;
-
-#define LITTLE                  0
-#define BIG                     1
-extern Bool_t                   output_endianess;
-#if   ENDIAN == HAVE_LITTLE_ENDIAN
-# define machine_endianess      LITTLE
-#elif ENDIAN == HAVE_BIG_ENDIAN
-# define machine_endianess      BIG
-#endif
-
-// requant.c
-extern Float              __SCF    [6 + 128];       // tabulated Scalefactors from -6 to +127
-#define SCF             ( __SCF + 6 )
-extern Int8_t             Q_bit         [32];       // number of bits to save the resolution (SV6)
-extern Int8_t             Q_res         [32] [16];  // Index -> resolution (SV6)
-extern Uint               Bitrate;
-extern Int                Min_Band;
-extern Int                Max_Band;
-extern Float              __Cc          [1 + 18];
-extern const Uint         __Dc          [1 + 18];
-#define Cc              ( __Cc + 1 )
-#define Dc              ( __Dc + 1 )
-
-// synthtab.c
-extern const Float        Cos64         [32];
-extern const Float        Di_opt        [32] [16];
-
-// stderr.c
-
-
-//// procedures/functions //////////////////////////////////////////
-// cpu_feat.c
-Bool_t Cdecl  Has_MMX                 ( void );
-Bool_t Cdecl  Has_SIMD                ( void );
-Bool_t Cdecl  Has_SIMD2               ( void );
-Bool_t Cdecl  Has_3DNow               ( void );
-
-// decode.c
-void       Bitstream_init             ( void );
-Ulong      BitsRead                   ( void );
-Uint32_t   Bitstream_read             ( Int  bits );
-Uint32_t   Bitstream_peek             ( Uint pos, Int bits );
-void       Bitstream_skip             ( Uint bits );
-Uint32_t   Bitstream_preview          ( Int  bits );  // same as above, but data doesn't get receipted yet
-void       Read_Bitstream_SV6         ( void );
-void       Read_Bitstream_SV7         ( void );
-void       Read_Bitstream_SV8         ( void );
-
-// http.c
-int        http_open                  ( const char* URL );
-
-// huffsv7.c
-void       Init_Huffman_Decoder_SV7   ( void );
-void       Init_Huffman_Encoder_SV7   ( void );
-
-// huffsv46.c
-void       Init_Huffman_Decoder_SV4_6 ( void );
-
-// id3tag.c
-Int        Read_ID3V1_Tags            ( FILE_T fp, TagInfo_t* tip );
-Int        Read_APE_Tags              ( FILE_T fp, TagInfo_t* tip );
-
-// requant.c
-void       Init_QuantTab              ( Int maximum_Band, Bool_t used_IS, Double amplification, Uint StreamVersion );
-
-// synth.c
-Uint32_t   random_int                 ( void );
-
-void Cdecl Calculate_New_V_i387       ( const Float* Sample, Float* V );
-void Cdecl Calculate_New_V_3DNow      ( const Float* Sample, Float* V );
-void Cdecl New_V_Helper2              ( Float* A, const Float* Sample );
-void Cdecl New_V_Helper3              ( Float* A, const Float* Sample );
-void Cdecl New_V_Helper4              ( Float* V );
-
-void Cdecl VectorMult_i387            ( void* buff, const Float* V );
-void Cdecl VectorMult_3DNow           ( void* buff, const Float* V );
-void Cdecl VectorMult_SIMD            ( void* buff, const Float* V );
-
-void       Synthese_Filter_16_C       ( Int2x16_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi );
-void       Synthese_Filter_32_C       ( Int2x32_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi, Uint channel );
-
-void Cdecl Reset_FPU                  ( void );
-void Cdecl Reset_FPU_3DNow            ( void );
-void Cdecl memcpy_dn_MMX              ( void* dst, const void* src, size_t words64byte  );
-void Cdecl memcpy_dn_SIMD             ( void* dst, const void* src, size_t words128byte );
-
-void       Init_Dither                ( Int bits, int shapingtype, Double dither );
-void       OverdriveReport            ( void );
-SyntheseFilter16_t
-           Get_Synthese_Filter        ( void );
-
-// tools.c
-size_t     Read_LittleEndians         ( FILE_T fp, Uint32_t* dst, size_t words32bit );
-void       Requantize_MidSideStereo   ( Int Stop_Band, const Bool_t* used_MS );
-void       Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band );
-void       Resort_HuffTable           ( Huffman_t* const Table, const size_t elements, Int offset );
-void       Make_HuffTable             ( Huffman_t* dst, const HuffSrc_t* src, size_t len );
-void       Make_LookupTable           ( Uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements );
-size_t     complete_read              ( int fd, void* dest, size_t bytes );
-int        isdir                      ( const char* Name );
-void       Init_FPU                   ( void );
-
-// wave_out.c
-Int        Write_WAVE_Header          ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
-Int        Write_AIFF_Header          ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
-Int        Write_Raw_Header           ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
-Int        Set_DSP_OSS_Params         ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-Int        Set_DSP_Sun_Params         ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-Int        Set_ESD_Params             ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-Int        Set_WIN_Params             ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-Int        Set_IRIX_Params            ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-size_t     Write_PCM_2x16bit          ( FILE_T outputFile, Int2x16_t* data, size_t len );
-size_t     Write_PCM_HQ_2x16bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
-size_t     Write_PCM_HQ_2x24bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
-size_t     Write_PCM_HQ_2x32bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
-int        WIN_Play_Samples           ( const void* buff, size_t len );
-int        IRIX_Play_Samples          ( const void* buff, size_t len );
-int        WIN_Audio_close            ( void );
-int        IRIX_Audio_close           ( void );
-void       DisableSUID                ( void );
-void       EnableSUID                 ( void );
-
-// pipeopen.c
-FILE*      pipeopen                   ( const char* command, const char* filename );
-
-// stderr.c
-void       SetStderrSilent            ( Bool_t state );
-Bool_t     GetStderrSilent            ( void );
-int Cdecl  stderr_printf              ( const char* format, ... );
-
-// _setargv.c
-long       treewalk                   ( const char* start, const char** mask, int (*fn)(const char* filename, void* aux), void* aux );
-void       mysetargv                  ( int* argc, char*** argv, const char** extentions );
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-
-# define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
-# define ReadBE32(dst,psrc)                           \
-       ((Uint8_t*)&(dst))[0] = ((Uint8_t*)(psrc))[3], \
-       ((Uint8_t*)&(dst))[1] = ((Uint8_t*)(psrc))[2], \
-       ((Uint8_t*)&(dst))[2] = ((Uint8_t*)(psrc))[1], \
-       ((Uint8_t*)&(dst))[3] = ((Uint8_t*)(psrc))[0]
-
-
-#elif defined __i386__           /* 486+ */
-
-#  define ReadBE32(dst,psrc)      __asm__ ( "bswap %0" : "=r" (dst) : "0" (*(Uint32_t*)(psrc)) )
-#  define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
-
-# else
-
-#  define ReadBE32(dst,psrc)                          \
-       ((Uint8_t*)&(dst))[0] = ((Uint8_t*)(psrc))[3], \
-       ((Uint8_t*)&(dst))[1] = ((Uint8_t*)(psrc))[2], \
-       ((Uint8_t*)&(dst))[2] = ((Uint8_t*)(psrc))[1], \
-       ((Uint8_t*)&(dst))[3] = ((Uint8_t*)(psrc))[0]
-#  define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
-
-# endif
-
-//// Profiler include //////////////////////////////////////////////
-#include "profile.h"
-
-#ifdef _MSC_VER
-#pragma warning ( disable : 4244 )
-#endif
-
-#endif /* MPPDEC_MPPDEC_H */
-
-/* end of mppdec.h */
Index: penc/trunk/mppdec.vcproj
===================================================================
--- /mppenc/trunk/mppdec.vcproj	(revision 96)
+++ 	(revision )
@@ -1,485 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="mppdec"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				OptimizeForProcessor="2"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				StructMemberAlignment="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/mppdec.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				BrowseInformation="1"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib winmm.lib setargv.obj"
-				OutputFile=".\Debug/mppdec.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/mppdec.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/mppdec.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG MPP_DECODER"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				OptimizeForProcessor="2"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				StructMemberAlignment="3"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/mppdec.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CallingConvention="1"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib ws2_32.lib setargv.obj"
-				OutputFile=".\Release/mppdec.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/mppdec.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/mppdec.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG MPP_DECODER"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="_setargv.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="cpu_feat.nas">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Assembling $(InputPath)"
-						CommandLine="NASMW -f win32 -o Debug/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot;
-"
-						Outputs="Debug/$(InputName).obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Assembling $(InputPath)"
-						CommandLine="&quot;NASMW&quot; -f win32 -o Release/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot;
-"
-						Outputs="Release/$(InputName).obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="decode.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="http.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="huffsv46.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="huffsv7.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="id3tag.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="mppdec.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="profile.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="requant.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="synth.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="synthasm.nas">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Assembling $(InputPath)"
-						CommandLine="NASMW -d WIN32 -f win32 -o Debug/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot;
-"
-						Outputs="Debug/$(InputName).obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						Description="Assembling $(InputPath)"
-						CommandLine="&quot;NASMW&quot; -d WIN32 -f win32 -o Release/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot; -l &quot;$(InputName)&quot;.lst
-"
-						Outputs="Release/$(InputName).obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="synthtab.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tools.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="wave_out.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						BrowseInformation="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath="config.h">
-			</File>
-			<File
-				RelativePath="Makefile">
-			</File>
-			<File
-				RelativePath="mpp.h">
-			</File>
-			<File
-				RelativePath="mppdec.h">
-			</File>
-			<File
-				RelativePath="profile.h">
-			</File>
-			<File
-				RelativePath="tools.inc">
-			</File>
-			<File
-				RelativePath="version">
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/mppenc.c
===================================================================
--- /mppenc/trunk/mppenc.c	(revision 96)
+++ 	(revision )
@@ -1,1967 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/* overflow of subband-samples */
-
-#include <memory.h>
-#include <time.h>
-#include <errno.h>
-#include "mppenc.h"
-
-/* G L O B A L  V A R I A B L E S */
-float         SNR_comp_L [32];
-float         SNR_comp_R [32];             // SNR-compensation after SCF-combination and ANS-gain
-float         Power_L    [32] [3];
-float         Power_R    [32] [3];
-float         PNS = 0.;
-int           Max_Band;                    // maximum bandwidth
-
-/* MS-Coding */
-unsigned int  MS_Channelmode;              // global flag for enhanced functionality
-float         SampleFreq      =  0.;
-float         Bandwidth       =  0.;
-int           PredictionBands =  0;
-int           CombPenalities  = -1;
-extern float  KBD1            =  2;
-extern float  KBD2            = -1.;
-int           DisplayUpdateTime = 1;
-int           APE_Version     = 2000;
-int           LowDelay        = 0;
-Bool_t        EnableTags      = 1;
-
-#define MODE_OVERWRITE          0
-#define MODE_NEVER_OVERWRITE    1
-#define MODE_ASK_FOR_OVERWRITE  2
-
-/* other general global variables */
-unsigned int  DelInput        = 0;      // deleting the input file after encoding
-unsigned int  WriteMode       = MODE_ASK_FOR_OVERWRITE;      // overwriting a possibly existing MPC file
-int           MainQual;                 // Profiles
-unsigned int  verbose         = 0;      // more information during output
-unsigned int  NoUnicode       = 1;      // console is unicode or not (tag translation)
-UintMax_t     SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
-unsigned int  Overflows       = 0;      // number of internal (filterbank) clippings
-float         MaxOverFlow     = 0.f;    // maximum overflow
-float         ScalingFactorl  = 1.f;    // Scaling the input signal
-float         ScalingFactorr  = 1.f;    // Scaling the input signal
-float         FadeShape       = 1.f;    // Shape of the fade
-float         FadeInTime      = 0.f;    // Duration of FadeIn in secs
-float         FadeOutTime     = 0.f;    // Duration of FadeOut in secs
-float         SkipTime        = 0.f;    // Skip the beginning of the file (sec)
-double        Duration        = 1.e+99; // Maximum encoded audio length
-Bool_t        FrontendPresent = 0;      // Flag for frontend-detection
-Bool_t        XLevel          = 1;      // Encode extreme levels with relative SCFs
-const char    About []        = "MPC Encoder  " MPPENC_VERSION "  " MPPENC_BUILD "   (C) 1999-2005 Buschmann/Klemm/Piecha/MDT";
-
-
-#if defined _WIN32  ||  defined __TURBOC__
-# include <conio.h>
-#else
-
-# ifdef USE_TERMIOS
-#  include <termios.h>
-
-static struct termios  stored_settings;
-
-static void
-echo_on ( void )
-{
-    tcsetattr ( 0, TCSANOW, &stored_settings );
-}
-
-static void
-echo_off ( void )
-{
-    struct termios  new_settings;
-
-    tcgetattr ( 0, &stored_settings );
-    new_settings = stored_settings;
-
-    new_settings.c_lflag     &= ~ECHO;
-    new_settings.c_lflag     &= ~ICANON;        /* Disable canonical mode, and set buffer size to 1 byte */
-    new_settings.c_cc[VTIME]  = 0;
-    new_settings.c_cc[VMIN]   = 1;
-
-    tcsetattr ( 0, TCSANOW, &new_settings );
-}
-
-# else
-#  define echo_off()  (void)0
-#  define echo_on()   (void)0
-# endif
-
-static int
-getch ( void )
-{
-    unsigned char  buff [1];
-    int            ret;
-
-    echo_off ();
-    ret = READ1 ( STDIN, buff );
-    echo_on ();
-    return ret == 1  ?  buff[0]  :  -1;
-}
-
-#endif
-
-
-static int
-waitkey ( void )
-{
-    int  c;
-
-    fflush (stdout);
-    while ( (c = getch() ) <= ' ' )
-        ;
-    return c;
-}
-
-
-
-
-static void
-longhelp ( void )
-{
-    stderr_printf (
-             "\n"
-             "\033[1m\rusage:\033[0m\n"
-             "  mppenc [--options] <Input_File>\n"
-             "  mppenc [--options] <Input_File> <Output_File>\n"
-             "  mppenc [--options] <List_of_Input_Files> <Output_File>        (not yet supp.)\n"
-             "  mppenc [--options] <List_of_Input_Files> <Output_Directory>   (not yet supp.)\n"
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rInput_File must be:\033[0m\n"
-             "  -                for stdin (only RIFF WAVE files)\n"
-             "  /dev/audio       for soundcard (OSS only at the moment), 44.1 kHz\n"
-             "  *.wav            RIFF WAVE file\n"
-             "  *.raw/cdr        Raw PCM, 2 channels, 16 bit, 44.1 kHz, little endian\n"
-             "  *.pac/lpac       LPAC file                (needs LPAC 1.36+ for Windows)\n"
-             "  *.fla/flac       FLAC file                (needs FLAC 1.03+ for Windows)\n"
-             "  *.ape            Monkey's Audio APE file  (needs MAC 3.96b2...7)\n"
-             "  *.rka/rkau       RK Audio file            (offical binaries do not work)\n"
-             "  *.sz             SZIP file\n"
-             "  *.shn            Shorten file             (needs Shorten 3.4+ for Windows)\n"
-             "  *.ofr            OptimFROG file\n"
-             "\n"
-             "Currently only 32, 37.8, 44.1 and 48 kHz, 1...8 channels, 8...32 bit linear PCM\n"
-             "is supported. When using one of the lossless compressed formats, a proper binary\n"
-             "must be installed within the system's search path.\n"
-             "\n"
-             "\033[1m\rOutput_File must be (otherwise file name is generated from Input_File):\033[0m\n"
-             "  *.mpc            Musepack file name \n"
-             "  *.mp+/mpp        old extentions known as MPEGplus\n"
-             "  -                for stdout\n"
-             "  /dev/null        for trash can\n"
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rProfile Options (Quality Presets):\033[0m\n"
-             "  --telephone      lowest quality,       (typ.  32... 48 kbps)\n"
-             "  --thumb          low quality/internet, (typ.  58... 86 kbps)\n"
-             "  --radio          medium (MP3) quality, (typ. 112...152 kbps)\n"
-             "  --standard       high quality (dflt),  (typ. 142...184 kbps)\n"
-             "  --xtreme         extreme high quality, (typ. 168...212 kbps)\n"
-             "  --insane         extreme high quality, (typ. 232...268 kbps)\n"
-             "  --braindead      extreme high quality, (typ. 232...278 kbps)\n"
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rFile/Message handling:\033[0m\n"
-             "  --silent         do not write any message to the console\n"
-             "  --verbose        increase verbosity (dflt: off)\n"
-             "  --longhelp       print this help text\n"
-             "  --stderr fn      append messages to file 'fn'\n"
-             "  --neveroverwrite never overwrite existing destination file\n"
-             "  --interactive    ask before overwrite existing destination file (dflt)\n"
-             "  --overwrite      overwrite existing destination file\n"
-             "  --deleteinput    delete input file after encoding (dflt: off)\n"
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rTagging (uses APE 2.0 tags):\033[0m\n"
-             "  --tag key=value  Add tag \"key\" with \"value\" as contents\n"
-             "  --tagfile key=f  dto., take value from a file 'f'\n"
-             "  --tagfile key    dto., take value from console\n"
-             "  --artist 'value' shortcut for --tag 'Artist=value'\n"
-             "  --album 'value'  shortcut for --tag 'Album=value'\n"
-             "                   other possible keys are: debutalbum, publisher, conductor,\n"
-             "                   title, subtitle, track, comment, composer, copyright,\n"
-             "                   publicationright, filename, recordlocation, recorddate,\n"
-             "                   ean/upc, year, releasedate, genre, media, index, isrc,\n"
-             "                   abstract, bibliography, introplay, media, language, ...\n"
-             "  --unicode        unicode input from console\n"
-             "  --notags         disable tags\n"
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rAudio processing:\033[0m\n" );
-    stderr_printf (
-             "  --skip x         skip the first x seconds  (dflt: %3.1f)\n",   SkipTime );
-    stderr_printf (
-             "  --dur x          stop encoding after at most x seconds of encoded audio\n" );
-    stderr_printf (
-             "  --fade x         fadein+out in seconds\n" );
-    stderr_printf (
-             "  --fadein x       fadein  in seconds (dflt: %3.1f)\n",                   FadeInTime );
-    stderr_printf (
-             "  --fadeout x      fadeout in seconds (dflt: %3.1f)\n",                   FadeOutTime );
-    stderr_printf (
-             "  --fadeshape x    fade shape (dflt: %3.1f),\n"
-             "                   see http://www.uni-jena.de/~pfk/mpc/img/fade.png\n",   FadeShape );
-    stderr_printf (
-             "  --scale x        scale input signal by x (dflt: %7.5f)\n",              ScalingFactorl );
-    stderr_printf (
-             "  --scale x,y      scale input signal, separate for each channel\n" );
-
-    stderr_printf (
-             "\033[1m\rExpert settings:\033[0m\n" );
-    stderr_printf (
-             "==Masking thresholds======\n" );
-    stderr_printf (
-             "  --quality x      set Quality to x (dflt: 5)\n" );
-    stderr_printf (
-             "  --nmt x          set NMT value to x dB (dflt: %4.1f)\n", NMT );
-    stderr_printf (
-             "  --tmn x          set TMN value to x dB (dflt: %4.1f)\n", TMN );
-    stderr_printf (
-             "  --pns x          set PNS value to x dB (dflt: %4.1f)\n", PNS );
-    stderr_printf (
-             "==ATH/Bandwidth settings==\n" );
-    stderr_printf (
-             "  --bw x           maximum bandwidth in Hz (dflt: %4.1f kHz)\n", (Max_Band+1)*(SampleFreq/32000.) );
-    stderr_printf (
-             "  --minSMR x       minimum SMR of x dB over encoded bandwidth (dflt: %2.1f)\n",  minSMR );
-    stderr_printf (
-             "  --ltq xyy        x=0: ISO threshold in quiet (not recommended)\n"
-             "                   x=1: more sensitive threshold in quiet (Buschmann)\n"
-             "                   x=2: even more sensitive threshold in quiet (Filburt)\n"
-             "                   x=3: Klemm\n"
-             "                   x=4: Buschmann-Klemm Mix\n"
-             "                   x=5: minimum of Klemm and Buschmann (dflt)\n"
-             "                   y=00...99: HF roll-off (00:+30 dB, 99:-30 dB @20 kHz\n" );
-    stderr_printf (
-             "  --ltq_gain x     add offset of x dB to chosen ltq (dflt: %+4.1f)\n",       Ltq_offset   );
-    stderr_printf (
-             "  --ltq_max x      maximum level for ltq (dflt: %4.1f dB)\n",                Ltq_max      );
-    stderr_printf (
-             "  --ltq_var x      adaptive threshold in quiet: 0: off, >0: on (dflt: %g)\n",varLtq       );
-    stderr_printf (
-             "  --tmpMask x      exploit postmasking: 0: off, 1: on (dflt: %i)\n",         tmpMask_used );
-    stderr_printf (
-             "==Stuff settings==========\n" );
-    stderr_printf (
-             "  --ms x           Mid/Side Stereo, 0: off, 1: reduced, 2: on, 3: decoupled,\n"
-             "                   10: enhanced 1.5/3 dB, 11: 2/6 dB, 12: 2.5/9 dB,\n"
-             "                   13: 3/12 dB, 15: 3/oo dB (dflt: %i)\n",                        MS_Channelmode );
-    stderr_printf (
-             "  --ans x          Adaptive Noise Shaping Order: 0: off, 1...6: on (dflt: %i)\n", NS_Order );
-    stderr_printf (
-             "  --cvd x          ClearVoiceDetection, 0: off, 1: on, 2: dual (dflt: %i)\n",     CVD_used );
-    stderr_printf (
-             "  --shortthr x     short FFT threshold (dflt: %4.1f)\n",                          ShortThr );
-    stderr_printf (
-             "  --transdet x     slewrate for transient detection (dflt: %3.1f)\n",             TransDetect );
-    stderr_printf (
-             "  --minval x       calculation of MinVal (1:Buschmann, 2,3:Klemm)\n" );
-    stderr_printf (
-             "  --noxlevel       use old filterbank clipping solving strategy\n" );
-    stderr_printf (
-             "\n" );
-
-    stderr_printf (
-             "\033[1m\rExamples:\033[0m\n"
-             "  mppenc inputfile.wav\n"
-             "  mppenc inputfile.wav outputfile.mpc\n"
-             "  mppenc --xtreme inputfile.pac outputfile.mpc\n"
-             "  mppenc --silent --radio --pns 0.25 inputfile.pac outputfile.mpc\n"
-             "  mppenc --nmt 12 --tmn 28 inputfile.pac outputfile.mpc\n"
-             "\n"
-             "For further information see the file 'MANUAL.TXT'.\n" );
-}
-
-
-static void
-shorthelp ( void )
-{
-    stderr_printf (
-             "\n"
-             "\033[1m\rusage:\033[0m\n"
-             "  mppenc [--options] <Input_File>\n"
-             "  mppenc [--options] <Input_File> <Output_File>\n"
-             "\n"
-
-             "\033[1m\rStandard options:\033[0m\n"
-             "  --silent       do not write any message to the console (dflt: off)\n"
-             "  --deleteinput  delete input file after encoding        (dflt: off)\n"
-             "  --overwrite    overwrite existing destination file     (dflt: off)\n"
-             "  --fade sec     fade in and out with 'sec' duration     (dflt: 0.0)\n"
-             "\n"
-
-             "\033[1m\rProfile Options (Quality Presets):\033[0m\n"
-             "  --thumb        low quality/internet, (typ.  58... 86 kbps)\n"
-             "  --radio        medium (MP3) quality, (typ. 112...152 kbps)\n"
-             "  --standard     high quality (dflt),  (typ. 142...184 kbps)\n"
-             "  --xtreme       extreme high quality, (typ. 168...212 kbps)\n"
-             "\n"
-
-             "\033[1m\rExamples:\033[0m\n"
-             "  mppenc inputfile.wav\n"
-             "  mppenc inputfile.wav outputfile.mpc\n"
-             "  mppenc --xtreme inputfile.pac outputfile.mpc\n"
-             "  mppenc --silent --radio inputfile.pac outputfile.mpc\n"
-             "\n"
-             "For further information see the file 'MANUAL.TXT' or use option --longhelp.\n" );
-}
-
-
-/*
- *  Wishes for fading:
- *
- *            _____________________
- *           /|                   |\
- *         /  |                   |  \
- *        /   |                   |   \
- *  ____/     |                   |     \______________
- *  |  |      |                   |      |  |
- *  |t1|  t2  |                   |  t4  |t5|
- *  |                 t3                    |
- *     |<-------------- M P C ------------->|
- *  |<-------------------- W A V E ------------------>|
- *
- *   t1: StartTime   (Standard: 0, positive: from beginning of file, negative: from end of file)
- *   t2: FadeInTime  (Standard: 0, positive: Fadetime)
- *   t3: EndTime     (Standard: 0, non-positive: from end of file, positive: from beginning of file)
- *   t4: FadeOutTime (Standard: 0, positive: Fadetime)
- *   t5: PostGapTime (Standard: 0, positive: additional silence)
- *
- * The beginning of phase t4 can also be triggered by the signal SIGINT.
- * With SIGTERM, the current frame is fully decoded and then terminated.
- *
- * Another question is if you can't put t1 before the zero, same with t3 and t5
- * (track-spanning cutting).
- */
-
-#include "fastmath.h"
-
-
-float  bump_exp   = 1.f;
-float  bump_start = 0.040790618517f;
-
-
-static void
-setbump ( double e )
-{
-    bump_exp   = e;
-    bump_start = 1 - sqrt (1 - 1 / (1 - log(1.e-5) / e));
-}
-
-
-static double
-bump ( double x )
-{
-    x = bump_start + x * (1. - bump_start);
-    if ( x <= 0.) return 0.;
-    if ( x >= 1.) return 1.;
-    x *= (2. - x);
-    x  = (x - 1.) / x;
-    return exp (x * bump_exp);
-}
-
-
-static void
-Fading_In ( PCMDataTyp* data, unsigned int N, const float fs )
-{
-    float  inv_fs = 1.f / fs;
-    float  fadein_pos;
-    float  scale;
-    int    n;
-    int    idx;
-
-    ENTER(2);
-    for ( n = 0; n < BLOCK; n++, N++ ) {
-        idx           = n + CENTER;
-        fadein_pos    = N * inv_fs;
-        scale         = fadein_pos / FadeInTime;
-        scale         = bump (scale);
-        data->L[idx] *= scale;
-        data->R[idx] *= scale;
-        data->M[idx] *= scale;
-        data->S[idx] *= scale;
-    }
-    LEAVE(2);
-}
-
-
-static void
-Fading_Out ( PCMDataTyp* data, unsigned int N, const float fs )
-{
-    float  inv_fs = 1.f / fs;
-    float  fadeout_pos;
-    float  scale;
-    int    n;
-    int    idx;
-
-    ENTER(3);
-    for ( n = 0; n < BLOCK; n++, N++ ) {
-        idx           = n + CENTER;
-        fadeout_pos   = UintMAX_FP(SamplesInWAVE - N) * inv_fs;
-        scale         = fadeout_pos / FadeOutTime;
-        scale         = bump (scale);
-        data->L[idx] *= scale;
-        data->R[idx] *= scale;
-        data->M[idx] *= scale;
-        data->S[idx] *= scale;
-    }
-    LEAVE(3);
-}
-
-
-static const unsigned char  Penalty [256] = {
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-      0,  2,  5,  9, 15, 23, 36, 54, 79,116,169,246,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-
-#define P(new,old)  Penalty [128 + (old) - (new)]
-
-static void
-SCF_Extraktion ( const int MaxBand, SubbandFloatTyp* x )
-{
-    int    Band;
-    int    n;
-    int    d01;
-    int    d12;
-    int    d02;
-    int    warnL;
-    int    warnR;
-    int*   scfL;
-    int*   scfR;
-    int    comp_L [3];
-    int    comp_R [3];
-    float  tmp_L  [3];
-    float  tmp_R  [3];
-    float  facL;
-    float  facR;
-    float  L;
-    float  R;
-    float  SL;
-    float  SR;
-
-    ENTER(4);
-
-    for ( Band = 0; Band <= MaxBand; Band++ ) {         // Suche nach Maxima
-        L  = FABS (x[Band].L[ 0]);
-        R  = FABS (x[Band].R[ 0]);
-        SL = x[Band].L[ 0] * x[Band].L[ 0];
-        SR = x[Band].R[ 0] * x[Band].R[ 0];
-        for ( n = 1; n < 12; n++ ) {
-            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
-            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
-            SL += x[Band].L[n] * x[Band].L[n];
-            SR += x[Band].R[n] * x[Band].R[n];
-        }
-        Power_L [Band][0] = SL;
-        Power_R [Band][0] = SR;
-        tmp_L [0] = L;
-        tmp_R [0] = R;
-
-        L  = FABS (x[Band].L[12]);
-        R  = FABS (x[Band].R[12]);
-        SL = x[Band].L[12] * x[Band].L[12];
-        SR = x[Band].R[12] * x[Band].R[12];
-        for ( n = 13; n < 24; n++ ) {
-            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
-            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
-            SL += x[Band].L[n] * x[Band].L[n];
-            SR += x[Band].R[n] * x[Band].R[n];
-        }
-        Power_L [Band][1] = SL;
-        Power_R [Band][1] = SR;
-        tmp_L [1] = L;
-        tmp_R [1] = R;
-
-        L  = FABS (x[Band].L[24]);
-        R  = FABS (x[Band].R[24]);
-        SL = x[Band].L[24] * x[Band].L[24];
-        SR = x[Band].R[24] * x[Band].R[24];
-        for ( n = 25; n < 36; n++ ) {
-            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
-            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
-            SL += x[Band].L[n] * x[Band].L[n];
-            SR += x[Band].R[n] * x[Band].R[n];
-        }
-        Power_L [Band][2] = SL;
-        Power_R [Band][2] = SR;
-        tmp_L [2] = L;
-        tmp_R [2] = R;
-
-        // calculation of the scalefactor-indexes
-        // -12.6f*log10(x)+57.8945021823f = -10*log10(x/32767)*1.26+1
-        // normalize maximum of +/- 32767 to prevent quantizer overflow
-        // It can stand a maximum of +/- 32768 ...
-
-        // Where is scf{R,L} [0...2] initialized ???
-        scfL = SCF_Index_L [Band];
-        scfR = SCF_Index_R [Band];
-        if (tmp_L [0] > 0.) scfL [0] = IFLOORF (-12.6f * LOG10 (tmp_L [0]) + 57.8945021823f );
-        if (tmp_L [1] > 0.) scfL [1] = IFLOORF (-12.6f * LOG10 (tmp_L [1]) + 57.8945021823f );
-        if (tmp_L [2] > 0.) scfL [2] = IFLOORF (-12.6f * LOG10 (tmp_L [2]) + 57.8945021823f );
-        if (tmp_R [0] > 0.) scfR [0] = IFLOORF (-12.6f * LOG10 (tmp_R [0]) + 57.8945021823f );
-        if (tmp_R [1] > 0.) scfR [1] = IFLOORF (-12.6f * LOG10 (tmp_R [1]) + 57.8945021823f );
-        if (tmp_R [2] > 0.) scfR [2] = IFLOORF (-12.6f * LOG10 (tmp_R [2]) + 57.8945021823f );
-
-        // restriction to SCF_Index = 0...63, make note of the internal overflow
-        warnL = warnR = 0;
-        if (scfL[0] & ~63) { if (scfL[0] < 0) { if (XLevel==0) scfL[0] = 0, warnL = 1; } else scfL[0] = 63; }
-        if (scfL[1] & ~63) { if (scfL[1] < 0) { if (XLevel==0) scfL[1] = 0, warnL = 1; } else scfL[1] = 63; }
-        if (scfL[2] & ~63) { if (scfL[2] < 0) { if (XLevel==0) scfL[2] = 0, warnL = 1; } else scfL[2] = 63; }
-        if (scfR[0] & ~63) { if (scfR[0] < 0) { if (XLevel==0) scfR[0] = 0, warnR = 1; } else scfR[0] = 63; }
-        if (scfR[1] & ~63) { if (scfR[1] < 0) { if (XLevel==0) scfR[1] = 0, warnR = 1; } else scfR[1] = 63; }
-        if (scfR[2] & ~63) { if (scfR[2] < 0) { if (XLevel==0) scfR[2] = 0, warnR = 1; } else scfR[2] = 63; }
-
-        // save old values for compensation calculation
-        comp_L[0] = scfL[0]; comp_L[1] = scfL[1]; comp_L[2] = scfL[2];
-        comp_R[0] = scfR[0]; comp_R[1] = scfR[1]; comp_R[2] = scfR[2];
-
-        // determination and replacement of scalefactors of minor differences with the smaller one???
-        // a smaller one is quantized more roughly, i.e. the noise gets amplified???
-
-        if ( CombPenalities >= 0 ) {
-            if      ( P(scfL[0],scfL[1]) + P(scfL[0],scfL[2]) <= CombPenalities ) scfL[2] = scfL[1] = scfL[0];
-            else if ( P(scfL[1],scfL[0]) + P(scfL[1],scfL[2]) <= CombPenalities ) scfL[0] = scfL[2] = scfL[1];
-            else if ( P(scfL[2],scfL[0]) + P(scfL[2],scfL[1]) <= CombPenalities ) scfL[0] = scfL[1] = scfL[2];
-            else if ( P(scfL[0],scfL[1])                      <= CombPenalities ) scfL[1] = scfL[0];
-            else if ( P(scfL[1],scfL[0])                      <= CombPenalities ) scfL[0] = scfL[1];
-            else if ( P(scfL[1],scfL[2])                      <= CombPenalities ) scfL[2] = scfL[1];
-            else if ( P(scfL[2],scfL[1])                      <= CombPenalities ) scfL[1] = scfL[2];
-
-            if      ( P(scfR[0],scfR[1]) + P(scfR[0],scfR[2]) <= CombPenalities ) scfR[2] = scfR[1] = scfR[0];
-            else if ( P(scfR[1],scfR[0]) + P(scfR[1],scfR[2]) <= CombPenalities ) scfR[0] = scfR[2] = scfR[1];
-            else if ( P(scfR[2],scfR[0]) + P(scfR[2],scfR[1]) <= CombPenalities ) scfR[0] = scfR[1] = scfR[2];
-            else if ( P(scfR[0],scfR[1])                      <= CombPenalities ) scfR[1] = scfR[0];
-            else if ( P(scfR[1],scfR[0])                      <= CombPenalities ) scfR[0] = scfR[1];
-            else if ( P(scfR[1],scfR[2])                      <= CombPenalities ) scfR[2] = scfR[1];
-            else if ( P(scfR[2],scfR[1])                      <= CombPenalities ) scfR[1] = scfR[2];
-        }
-        else {
-
-            d12  = scfL [2] - scfL [1];
-            d01  = scfL [1] - scfL [0];
-            d02  = scfL [2] - scfL [0];
-
-            if      ( 0 < d12  &&  d12 < 5 ) scfL [2] = scfL [1];
-            else if (-3 < d12  &&  d12 < 0 ) scfL [1] = scfL [2];
-            else if ( 0 < d01  &&  d01 < 5 ) scfL [1] = scfL [0];
-            else if (-3 < d01  &&  d01 < 0 ) scfL [0] = scfL [1];
-            else if ( 0 < d02  &&  d02 < 4 ) scfL [2] = scfL [0];
-            else if (-2 < d02  &&  d02 < 0 ) scfL [0] = scfL [2];
-
-            d12  = scfR [2] - scfR [1];
-            d01  = scfR [1] - scfR [0];
-            d02  = scfR [2] - scfR [0];
-
-            if      ( 0 < d12  &&  d12 < 5 ) scfR [2] = scfR [1];
-            else if (-3 < d12  &&  d12 < 0 ) scfR [1] = scfR [2];
-            else if ( 0 < d01  &&  d01 < 5 ) scfR [1] = scfR [0];
-            else if (-3 < d01  &&  d01 < 0 ) scfR [0] = scfR [1];
-            else if ( 0 < d02  &&  d02 < 4 ) scfR [2] = scfR [0];
-            else if (-2 < d02  &&  d02 < 0 ) scfR [0] = scfR [2];
-        }
-
-        // calculate SNR-compensation
-        tmp_L [0]         = invSCF [comp_L[0] - scfL[0]];
-        tmp_L [1]         = invSCF [comp_L[1] - scfL[1]];
-        tmp_L [2]         = invSCF [comp_L[2] - scfL[2]];
-        tmp_R [0]         = invSCF [comp_R[0] - scfR[0]];
-        tmp_R [1]         = invSCF [comp_R[1] - scfR[1]];
-        tmp_R [2]         = invSCF [comp_R[2] - scfR[2]];
-        SNR_comp_L [Band] = (tmp_L[0]*tmp_L[0] + tmp_L[1]*tmp_L[1] + tmp_L[2]*tmp_L[2]) * 0.3333333333f;
-        SNR_comp_R [Band] = (tmp_R[0]*tmp_R[0] + tmp_R[1]*tmp_R[1] + tmp_R[2]*tmp_R[2]) * 0.3333333333f;
-
-        // normalize the subband samples
-        facL = invSCF[scfL[0]];
-        facR = invSCF[scfR[0]];
-        for ( n = 0; n < 12; n++ ) {
-            x[Band].L[n] *= facL;
-            x[Band].R[n] *= facR;
-        }
-        facL = invSCF[scfL[1]];
-        facR = invSCF[scfR[1]];
-        for ( n = 12; n < 24; n++ ) {
-            x[Band].L[n] *= facL;
-            x[Band].R[n] *= facR;
-        }
-        facL = invSCF[scfL[2]];
-        facR = invSCF[scfR[2]];
-        for ( n = 24; n < 36; n++ ) {
-            x[Band].L[n] *= facL;
-            x[Band].R[n] *= facR;
-        }
-
-        // limit to +/-32767 if internal clipping
-        if ( warnL )
-            for ( n = 0; n < 36; n++ ) {
-                if      (x[Band].L[n] > +32767.f) {
-                    Overflows++;
-                    MaxOverFlow = maxf (MaxOverFlow,  x[Band].L[n]);
-                    x[Band].L[n] = 32767.f;
-                }
-                else if (x[Band].L[n] < -32767.f) {
-                    Overflows++;
-                    MaxOverFlow = maxf (MaxOverFlow, -x[Band].L[n]);
-                    x[Band].L[n] = -32767.f;
-                }
-            }
-        if ( warnR )
-            for ( n = 0; n < 36; n++ ) {
-                if      (x[Band].R[n] > +32767.f) {
-                    Overflows++;
-                    MaxOverFlow = maxf (MaxOverFlow,  x[Band].R[n]);
-                    x[Band].R[n] = 32767.f;
-                }
-                else if (x[Band].R[n] < -32767.f) {
-                    Overflows++;
-                    MaxOverFlow = maxf (MaxOverFlow, -x[Band].R[n]);
-                    x[Band].R[n] = -32767.f;
-                }
-            }
-    }
-
-    LEAVE(4);
-    return;
-}
-
-
-static void
-Quantisierung ( const int               MaxBand,
-                const int*              resL,
-                const int*              resR,
-                const SubbandFloatTyp*  subx,
-                SubbandQuantTyp*        subq )
-{
-    static float  errorL [32] [36 + MAX_NS_ORDER];
-    static float  errorR [32] [36 + MAX_NS_ORDER];
-    int           Band;
-
-    ENTER(5);
-
-    // quantize Subband- and Subframe-samples
-    for ( Band = 0; Band <= MaxBand; Band++, resL++, resR++ ) {
-
-        if ( *resL > 0 ) {
-            if ( NS_Order_L [Band] > 0 ) {
-                QuantizeSubbandWithNoiseShaping ( subq[Band].L, subx[Band].L, *resL, errorL [Band], FIR_L [Band] );
-                memcpy ( errorL [Band], errorL[Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
-            } else {
-                QuantizeSubband                 ( subq[Band].L, subx[Band].L, *resL, errorL [Band] );
-                memcpy ( errorL [Band], errorL[Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
-            }
-        } else {
-        }
-
-        if ( *resR > 0 ) {
-            if ( NS_Order_R [Band] > 0 ) {
-                QuantizeSubbandWithNoiseShaping ( subq[Band].R, subx[Band].R, *resR, errorR [Band], FIR_R [Band] );
-                memcpy ( errorR [Band], errorR [Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
-            } else {
-                QuantizeSubband                 ( subq[Band].R, subx[Band].R, *resR, errorL [Band] );
-                memcpy ( errorR [Band], errorR [Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
-            }
-        } else {
-        }
-    }
-
-    LEAVE(5);
-    return;
-}
-
-
-static int
-PNS_SCF ( int* scf, float S0, float S1, float S2 )
-{
-//    printf ("%7.1f %7.1f %7.1f  ", sqrt(S0/12), sqrt(S1/12), sqrt(S2/12) );
-
-#if 1
-    if ( S0 < 0.5 * S1  ||  S1 < 0.5 * S2  ||  S0 < 0.5 * S2 )
-        return 0;
-
-    if ( S1 < 0.25 * S0  ||  S2 < 0.25 * S1  ||  S2 < 0.25 * S0 )
-        return 0;
-#endif
-
-
-    if ( S0 >= 0.8 * S1 ) {
-        if ( S0 >= 0.8 * S2  &&  S1 > 0.8 * S2 )
-            S0 = S1 = S2 = 0.33333333333f * (S0 + S1 + S2);
-        else
-            S0 = S1 = 0.5f * (S0 + S1);
-    }
-    else {
-        if ( S1 >= 0.8 * S2 )
-            S1 = S2 = 0.5f * (S1 + S2);
-    }
-
-    scf [0] = scf [1] = scf [2] = 63;
-    S0 = sqrt (S0/12 * 4/1.2005080577484075047860806747022);
-    S1 = sqrt (S1/12 * 4/1.2005080577484075047860806747022);
-    S2 = sqrt (S2/12 * 4/1.2005080577484075047860806747022);
-    if (S0 > 0.) scf [0] = IFLOORF (-12.6f * LOG10 (S0) + 57.8945021823f );
-    if (S1 > 0.) scf [1] = IFLOORF (-12.6f * LOG10 (S1) + 57.8945021823f );
-    if (S2 > 0.) scf [2] = IFLOORF (-12.6f * LOG10 (S2) + 57.8945021823f );
-
-    if ( scf[0] & ~63 ) scf[0] = scf[0] > 63 ? 63 : 0;
-    if ( scf[1] & ~63 ) scf[1] = scf[1] > 63 ? 63 : 0;
-    if ( scf[2] & ~63 ) scf[2] = scf[2] > 63 ? 63 : 0;
-
-    return 1;
-}
-
-
-static void
-Allocate ( const int MaxBand, int* res, float* x, int* scf, const float* comp, const float* smr, const SCFTriple* Pow, const int* Transient )
-{
-    int    Band;
-    int    k;
-    float  tmpMNR;      // to adjust the scalefactors
-    float  save [36];   // to adjust the scalefactors
-    float  MNR;         // Mask-to-Noise ratio
-
-    ENTER(6);
-
-    for ( Band = 0; Band <= MaxBand; Band++, res++, comp++, smr++, scf += 3, x += 72 ) {
-        // printf ( "%2u: %u\n", Band, Transient[Band] );
-
-        // Find out needed quantization resolution Res to fulfill the calculated MNR
-        // This is done by exactly measuring the quantization residuals against the signal itself
-        // Starting with Res=1  Res in increased until MNR becomes less than 1.
-        if ( Band > 0  &&  res[-1] < 3  &&  *smr >= 1. &&  *smr < Band * PNS  &&
-             PNS_SCF ( scf, Pow [Band][0], Pow [Band][1], Pow [Band][2] ) ) {
-            *res = -1;
-        } else {
-            for ( MNR = *smr * 1.; MNR > 1.  &&  *res != 15; )
-                MNR = *smr * (Transient[Band] ? ISNR_Schaetzer_Trans : ISNR_Schaetzer) ( x, *comp, ++*res );
-        }
-
-        // Fine adapt SCF's (MNR > 0 prevents adaption of zero samples, which is nonsense)
-        // only apply to Huffman-coded samples (otherwise no savings in bitrate)
-        if ( *res > 0  &&  *res <= LAST_HUFFMAN  &&  MNR < 1.  &&  MNR > 0.  &&  !Transient[Band] ) {
-            while ( scf[0] > 0  &&  scf[1] > 0  &&  scf[2] > 0 ) {
-
-                --scf[2]; --scf[1]; --scf[0];                   // adapt scalefactors and samples
-                memcpy ( save, x, sizeof save );
-                for (k = 0; k < 36; k++ )
-                    x[k] *= SCFfac;
-
-                tmpMNR = *smr * (Transient[Band] ? ISNR_Schaetzer_Trans : ISNR_Schaetzer) ( x, *comp, *res );// recalculate MNR
-
-                // FK: if ( tmpMNR > MNR  &&  tmpMNR <= 1 ) {          // check for MNR
-                if ( tmpMNR <= 1 ) {                            // check for MNR
-                    MNR = tmpMNR;
-                }
-                else {
-                    ++scf[0]; ++scf[1]; ++scf[2];               // restore scalefactors and samples
-                    memcpy ( x, save, sizeof save );
-                    break;
-                }
-            }
-        }
-
-    }
-    LEAVE(6);
-    return;
-}
-
-
-
-
-typedef struct {
-    float            ShortThr;
-    unsigned char    MinValChoice;
-    unsigned int     EarModelFlag;
-    signed char      Ltq_offset;
-    float            TMN;
-    float            NMT;
-    signed char      minSMR;
-    signed char      Ltq_max;
-    unsigned short   BandWidth;
-    unsigned char    tmpMask_used;
-    unsigned char    CVD_used;
-    float            varLtq;
-    unsigned char    MS_Channelmode;
-    unsigned char    CombPenalities;
-    unsigned char    NS_Order;
-    float            PNS;
-    float            TransDetect;
-} Profile_Setting_t;
-
-
-#define PROFILE_PRE2_TELEPHONE   5      // --quality  0
-#define PROFILE_PRE_TELEPHONE    6      // --quality  1
-#define PROFILE_TELEPHONE        7      // --quality  2
-#define PROFILE_THUMB            8      // --quality  3
-#define PROFILE_RADIO            9      // --quality  4
-#define PROFILE_STANDARD        10      // --quality  5
-#define PROFILE_XTREME          11      // --quality  6
-#define PROFILE_INSANE          12      // --quality  7
-#define PROFILE_BRAINDEAD       13      // --quality  8
-#define PROFILE_POST_BRAINDEAD  14      // --quality  9
-#define PROFILE_POST2_BRAINDEAD 15      // --quality 10
-
-
-static const Profile_Setting_t  Profiles [16] = {
-    { 0 },
-    { 0 },
-    { 0 },
-    { 0 },
-    { 0 },
-/*    Short   MinVal  EarModel  Ltq_                min   Ltq_  Band-  tmpMask  CVD_  varLtq    MS   Comb   NS_        Trans */
-/*    Thr     Choice  Flag      offset  TMN   NMT   SMR   max   Width  _used    used         channel Penal used  PNS    Det  */
-    { 1.e9f,  1,      300,       30,    3.0, -1.0,    0,  106,   4820,   1,      1,    1.,      3,     24,  6,   1.09f, 200 },  // 0: pre-Telephone
-    { 1.e9f,  1,      300,       24,    6.0,  0.5,    0,  100,   7570,   1,      1,    1.,      3,     20,  6,   0.77f, 180 },  // 1: pre-Telephone
-    { 1.e9f,  1,      400,       18,    9.0,  2.0,    0,   94,  10300,   1,      1,    1.,      4,     18,  6,   0.55f, 160 },  // 2: Telephone
-    { 50.0f,  2,      430,       12,   12.0,  3.5,    0,   88,  13090,   1,      1,    1.,      5,     15,  6,   0.39f, 140 },  // 3: Thumb
-    { 15.0f,  2,      440,        6,   15.0,  5.0,    0,   82,  15800,   1,      1,    1.,      6,     10,  6,   0.27f, 120 },  // 4: Radio
-    {  5.0f,  2,      550,        0,   18.0,  6.5,    1,   76,  19980,   1,      2,    1.,     11,      9,  6,   0.00f, 100 },  // 5: Standard
-    {  4.0f,  2,      560,       -6,   21.0,  8.0,    2,   70,  22000,   1,      2,    1.,     12,      7,  6,   0.00f,  80 },  // 6: Xtreme
-    {  3.0f,  2,      570,      -12,   24.0,  9.5,    3,   64,  24000,   1,      2,    2.,     13,      5,  6,   0.00f,  60 },  // 7: Insane
-    {  2.8f,  2,      580,      -18,   27.0, 11.0,    4,   58,  26000,   1,      2,    4.,     13,      4,  6,   0.00f,  40 },  // 8: BrainDead
-    {  2.6f,  2,      590,      -24,   30.0, 12.5,    5,   52,  28000,   1,      2,    8.,     13,      4,  6,   0.00f,  20 },  // 9: post-BrainDead
-    {  2.4f,  2,      599,      -30,   33.0, 14.0,    6,   46,  30000,   1,      2,   16.,     15,      2,  6,   0.00f,  10 },  //10: post-BrainDead
-};
-
-
-static int
-TestProfileParams ( void )
-{   //                                       0    1    2    3    4   5   6  7 8 9  10  11  12  13 14  15
-    static signed char  TMNStereoAdj [] = { -6, -18, -15, -18, -12, -9, -6, 0,0,0, +1, +1, +1, +1, 0, +1 };  // Penalties for TMN
-    static signed char  NMTStereoAdj [] = { -3, -18, -15, -15,  -9, -6, -3, 0,0,0,  0, +1, +1, +1, 0, +1 };  // Penalties for NMT
-    int                 i;
-
-    MainQual = PROFILE_PRE2_TELEPHONE;
-
-    for ( i = PROFILE_PRE2_TELEPHONE; i <= PROFILE_POST2_BRAINDEAD; i++ ) {
-        if ( ShortThr     > Profiles [i].ShortThr     ) continue;
-        if ( MinValChoice < Profiles [i].MinValChoice ) continue;
-        if ( EarModelFlag < Profiles [i].EarModelFlag ) continue;
-        if ( Ltq_offset   > Profiles [i].Ltq_offset   ) continue;
-        if ( Ltq_max      > Profiles [i].Ltq_max      ) continue;                     // offset should normally be considered here
-        if ( TMN + TMNStereoAdj [MS_Channelmode] <
-             Profiles [i].TMN + TMNStereoAdj [Profiles [i].MS_Channelmode] )
-                                                        continue;
-        if ( NMT + NMTStereoAdj [MS_Channelmode] <
-             Profiles [i].NMT + NMTStereoAdj [Profiles [i].MS_Channelmode] )
-                                                        continue;
-        if ( minSMR       < Profiles [i].minSMR       ) continue;
-        if ( Bandwidth    < Profiles [i].BandWidth    ) continue;
-        if ( tmpMask_used < Profiles [i].tmpMask_used ) continue;
-        if ( CVD_used     < Profiles [i].CVD_used     ) continue;
-     // if ( varLtq       > Profiles [i].varLtq       ) continue;
-     // if ( NS_Order     < Profiles [i].NS_Order     ) continue;
-        if ( PNS          > Profiles [i].PNS          ) continue;
-        MainQual = i;
-    }
-    return MainQual;
-}
-
-
-static void
-SetQualityParams ( float qual )
-{
-    int    i;
-    float  mix;
-
-    if      ( qual <  0. ) {
-        qual =  0.;
-    }
-    if      ( qual > 10. ) {
-        qual = 10.;
-#ifdef _WIN32
-        stderr_printf ( "\nmppenc: Can't open MACDll.dll, quality set to 10.0\n" );
-#else
-        stderr_printf ( "\nmppenc: Can't open libMAC.so, quality set to 10.0\n" );
-#endif
-    }
-
-    i   = (int) qual + PROFILE_PRE2_TELEPHONE;
-    mix = qual - (int) qual;
-
-    MainQual       = i;
-    ShortThr       = Profiles [i].ShortThr   * (1-mix) + Profiles [i+1].ShortThr   * mix;
-    MinValChoice   = Profiles [i].MinValChoice  ;
-    EarModelFlag   = Profiles [i].EarModelFlag  ;
-    Ltq_offset     = Profiles [i].Ltq_offset * (1-mix) + Profiles [i+1].Ltq_offset * mix;
-    varLtq         = Profiles [i].varLtq     * (1-mix) + Profiles [i+1].varLtq     * mix;
-    Ltq_max        = Profiles [i].Ltq_max    * (1-mix) + Profiles [i+1].Ltq_max    * mix;
-    TMN            = Profiles [i].TMN        * (1-mix) + Profiles [i+1].TMN        * mix;
-    NMT            = Profiles [i].NMT        * (1-mix) + Profiles [i+1].NMT        * mix;
-    minSMR         = Profiles [i].minSMR        ;
-    Bandwidth      = Profiles [i].BandWidth  * (1-mix) + Profiles [i+1].BandWidth  * mix;
-    tmpMask_used   = Profiles [i].tmpMask_used  ;
-    CVD_used       = Profiles [i].CVD_used      ;
-    MS_Channelmode = Profiles [i].MS_Channelmode;
-    CombPenalities = Profiles [i].CombPenalities;
-    NS_Order       = Profiles [i].NS_Order      ;
-    PNS            = Profiles [i].PNS        * (1-mix) + Profiles [i+1].PNS        * mix;
-    TransDetect    = Profiles [i].TransDetect* (1-mix) + Profiles [i+1].TransDetect* mix;
-}
-
-
-/* Planned: return the evaluated options, without InputFile and OutputFile, argc implicit instead of explicit */
-
-static int
-EvalParameters ( int argc, char** argv, char** InputFile, char** OutputFile, int onlyfilenames )
-{
-    int          k;
-    size_t       len;
-    static char  output [2048];
-    static char  errmsg [] = "\n\033[33;41;1mERROR\033[0m: Missing argument for option '--%s'\n\n";
-    FILE*        fp;
-    char*        p;
-    char         buff [32768];
-
-    /********************************* In / Out Files *********************************/
-    *InputFile  = argv [argc-1];
-    *OutputFile = NULL;
-
-    // search for output file
-    if ( argc >= 3 ) {
-        len = strlen (argv[argc-1]);
-
-        if ( strcmp (argv[argc-1], "/dev/null") == 0  ||
-             strcmp (argv[argc-1], "-")         == 0  ||
-             (len >= 4  &&  (0 == strcasecmp (argv [argc-1] + len - 4, ".MPC")  ||
-                             0 == strcasecmp (argv [argc-1] + len - 4, ".MPP")  ||
-                             0 == strcasecmp (argv [argc-1] + len - 4, ".MP+"))) ) {
-            *OutputFile = argv[argc-1];
-            *InputFile  = argv[argc-2];
-            argc -= 2;
-        }
-    }
-
-    // if no Output-File is stated, set OutFile to InFile.mpc
-    if ( *OutputFile == NULL  ) {
-        strcpy ( *OutputFile = output, *InputFile );
-        len = strlen ( output );
-        if ( len > 4  &&  output[len-4] == '.' )
-            len -= 4;
-        strcpy (output+len, ".mpc");
-        argc -= 1;
-    }
-
-    if ( onlyfilenames )
-        return 0;
-
-    /********************************* In / Out Files *********************************/
-
-
-    // search for options
-    for ( k = 1; k < argc; k++ ) {
-
-        const char*  arg = argv [k];
-
-        if ( arg[0] != '-'  ||  arg[1] != '-' )
-            continue;
-        arg += 2;
-
-        if      ( 0 == strcmp ( arg, "verbose" ) ) {                                     // verbose
-            verbose++;
-        }
-        else if ( 0 == strcmp ( arg, "telephone" ) ) {                                   // MainQual
-            SetQualityParams (2.0);
-        }
-        else if ( 0 == strcmp ( arg, "thumb" ) ) {                                       // MainQual
-            SetQualityParams (3.0);
-        }
-        else if ( 0 == strcmp ( arg, "radio"   ) ) {
-            SetQualityParams (4.0);
-        }
-        else if ( 0 == strcmp ( arg, "standard")  ||  0 == strcmp ( arg, "normal") ) {
-            SetQualityParams (5.0);
-        }
-        else if ( 0 == strcmp ( arg, "xtreme")  ||  0 == strcmp ( arg, "extreme") ) {
-            SetQualityParams (6.0);
-        }
-        else if ( 0 == strcmp ( arg, "insane") ) {
-            SetQualityParams (7.0);
-        }
-        else if ( 0 == strcmp ( arg, "braindead") ) {
-            SetQualityParams (8.0);
-        }
-        else if ( 0 == strcmp ( arg, "quality") ) {                                      // Quality
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            SetQualityParams (atof (argv[k]) );
-        }
-        else if ( 0 == strcmp ( arg, "neveroverwrite") ) {                              // NeverOverWrite
-            WriteMode = MODE_NEVER_OVERWRITE;
-        }
-        else if ( 0 == strcmp ( arg, "forcewrite")  ||  0 == strcmp ( arg, "overwrite") ) { // ForceWrite
-            WriteMode = MODE_OVERWRITE;
-        }
-        else if ( 0 == strcmp ( arg, "interactive")  ) {                                // Interactive
-            WriteMode = MODE_ASK_FOR_OVERWRITE;
-        }
-        else if ( 0 == strcmp ( arg, "delinput")  ||  0 == strcmp ( arg, "delete")  ||  0 == strcmp ( arg, "deleteinput" ) ) {                                    // DelInput
-            DelInput = 0xAFFEDEAD;
-        }
-        else if ( 0 == strcmp ( arg, "scale") ) {                                       // ScalingFactor
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            ScalingFactorl = ScalingFactorr = (float) atof (argv[k]);
-            if (strchr (argv[k], ','))
-                ScalingFactorr = (float) atof (strchr (argv[k], ',') + 1);
-            if ( ScalingFactorl == 0.97f  ||  ScalingFactorl == 0.98f ) stderr_printf ("--scale 0.97 or --scale 0.98 is nearly useless to prevent clipping. Use replaygain tool\nto determine EXACT attenuation to avoid clipping. Factor can be between 0.696 and 1.000.\nSee \"http://www.uni-jena.de/~pfk/mpp/clipexample.html\".\n\n" );
-        }
-        else if ( 0 == strcmp ( arg, "kbd") ) {                                       // ScalingFactor
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            if ( 2 != sscanf ( argv[k], "%f,%f", &KBD1, &KBD2 ))
-                { stderr_printf ( "%s: missing two arguments", arg ); return -1; }
-            Init_FFT ();
-        }
-        else if ( 0 == strcmp ( arg, "fadein") ) {                                      // FadeInTime
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            FadeInTime = (float) atof (argv[k]);
-            if ( FadeInTime < 0.f ) FadeInTime = 0.f;
-        }
-        else if ( 0 == strcmp ( arg, "fadeout") ) {                                     // FadeOutTime
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            FadeOutTime = (float) atof (argv[k]);
-            if ( FadeOutTime < 0.f ) FadeOutTime = 0.f;
-        }
-        else if ( 0 == strcmp ( arg, "fade") ) {                                        // FadeInTime + FadeOutTime
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            FadeOutTime = (float) atof (argv[k]);
-            if ( FadeOutTime < 0.f ) FadeOutTime = 0.f;
-            FadeInTime = FadeOutTime;
-        }
-        else if ( 0 == strcmp ( arg, "fadeshape") ) {                                   // FadeOutTime
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            FadeShape = (float) atof (argv[k]);
-            if ( FadeShape < 0.001f  ||  FadeShape > 1000.f ) FadeShape = 1.f;
-            setbump ( FadeShape );
-        }
-        else if ( 0 == strcmp ( arg, "skip")  ||  0 == strcmp ( arg, "start") ) {       // SkipTime
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            SkipTime = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "dur")  ||  0 == strcmp ( arg, "duration") ) {     // maximum Duration
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            Duration = atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "ans") ) {                                         // AdaptiveNoiseShaping
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            NS_Order = atoi (argv[k]);
-            NS_Order = mini ( NS_Order, MAX_NS_ORDER );
-        }
-        else if ( 0 == strcmp ( arg, "predict") ) {                                     // AdaptiveNoiseShaping
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            PredictionBands = atoi (argv[k]);
-            PredictionBands = mini ( PredictionBands, 32 );
-        }
-        else if ( 0 == strcmp ( arg, "ltq_var")  ||  0 == strcmp ( arg, "ath_var") ) {  // ltq_var
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            varLtq = atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "pns") ) {                                         // pns
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            PNS = atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "minval") ) {                                      // MinValChoice
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            MinValChoice = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "transdet") ) {                                    // TransDetect
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            TransDetect = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "shortthr") ) {                                    // ShortThr
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            ShortThr = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "noxlevel") ) {                                      // Xlevel
-            XLevel = 0;
-        }
-        else if ( 0 == strcmp ( arg, "xlevel") ) {                                      // Xlevel
-            stderr_printf ( "\nXlevel coding now enabled by default, --xlevel ignored.\n" );
-        }
-        else if ( 0 == strcmp ( arg, "nmt") ) {                                         // NMT
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
-            NMT = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "tmn") ) {                                         // TMN
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
-            TMN = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "cvd") ) {                                         // ClearVoiceDetection
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            CVD_used = atoi (argv[k]);
-            if ( CVD_used == 0 )
-                stderr_printf ( "\nDisabling CVD always reduces quality!\a\n" );
-        }
-        else if ( 0 == strcmp ( arg, "ms") ) {                                          // Mid/Side Stereo
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            MS_Channelmode = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "minSMR") ) {                                      // minimum SMR
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            if ( minSMR > (float) atof (argv[k]) )
-                stderr_printf ( "This option usage may reduces quality!\a\n" );
-            minSMR = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "tmpMask") ) {                                     // temporal post-masking
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            tmpMask_used = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "ltq_max")  ||  0 == strcmp ( arg, "ath_max") ) {  // Maximum for threshold in quiet
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
-            Ltq_max = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "ltq_gain")  ||  0 == strcmp ( arg, "ath_gain") ) {// Offset for threshold in quiet
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            Ltq_offset = (float) atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "silent")  ||  0 == strcmp ( arg, "quiet") ) {
-            SetStderrSilent (1);
-        }
-        else if ( 0 == strcmp ( arg, "stderr") ) {                                      // Offset for threshold in quiet
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            freopen ( argv[k], "a", stderr );
-        }
-        else if ( 0 == strcmp ( arg, "ltq")  ||  0 == strcmp ( arg, "ath") ) {          // threshold in quiet
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            EarModelFlag = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "noco") ) {
-            NoiseInjectionComp ();
-        }
-        else if ( 0 == strcmp ( arg, "newcomb") ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            CombPenalities = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "ape1") ) {                                     // Mark APE as APE 1.000
-            APE_Version = 1000;
-        }
-        else if ( 0 == strcmp ( arg, "ape2") ) {                                     // Mark APE as APE 2.000
-            APE_Version = 2000;
-        }
-        else if ( 0 == strcmp ( arg, "unicode") ) {                                  // no tag conversion
-            NoUnicode = 0;
-        }
-        else if ( 0 == strcmp ( arg, "notags") ) {
-            EnableTags = 0;
-        }
-        else if ( 0 == strcmp ( arg, "lowdelay") ) {
-            LowDelay = 1;
-        }
-        else if ( 0 == strcmp ( arg, "bw")  ||  0 == strcmp ( arg, "lowpass") ) {       // bandwidth
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            Bandwidth = atof (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "displayupdatetime") ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            DisplayUpdateTime = atoi (argv[k]);
-        }
-        else if ( 0 == strcmp ( arg, "artist" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Artist", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "album" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Album", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "debutalbum" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Debut Album", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "publisher" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Publisher", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "conductor" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Conductor", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "title" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Title", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "subtitle" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Subtitle", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "track" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Track", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "comment" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Comment", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "composer" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Composer", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "copyright" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Copyright", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "publicationright" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Publicationright", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "filename" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "File", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "recordlocation" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Record Location", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "recorddate" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Record Date", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "ean/upc" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "EAN/UPC", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "year" )  ||  0 == strcmp ( arg, "releasedate") ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Year", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "genre" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Genre", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "media" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Media", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "index" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Index", 0, p, strlen(p), NoUnicode*3, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "isrc" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "ISRC", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "abstract" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Abstract", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "bibliography" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Bibliography", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "introplay" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Introplay", 0, p, strlen(p), NoUnicode*3, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "media" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = argv[k];
-            addtag ( "Media", 0, p, strlen(p), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "tag" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = strchr ( argv[k], '=' );
-            if ( p == NULL )
-                addtag ( argv[k], strlen(argv[k]), "", 0, NoUnicode, 0 );
-            else
-                addtag ( argv[k], p-argv[k], p+1, strlen(p+1), NoUnicode, 0 );
-        }
-        else if ( 0 == strcmp ( arg, "tagfile" ) ) {
-            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
-            p = strchr ( argv[k], '=' );
-            if ( p == NULL ) {
-                stderr_printf (" Enter value for tag key '%s': ", argv[k] );
-                fgets ( buff, sizeof buff, stdin );
-                len = strlen (buff);
-                while ( len > 0  &&  (buff [len-1] == '\r'  ||  buff [len-1] == '\n') )
-                    len--;
-                addtag ( arg, strlen(arg), buff, len, NoUnicode*6, 0 );
-            }
-            else {
-                fp = fopen ( p+1, "rb" );
-                if ( fp == NULL ) {
-                    fprintf ( stderr, "Can't open file '%s'.\n", p+1 );
-                }
-                else {
-                    addtag ( argv[k], p-argv[k], buff, fread (buff,1,sizeof buff,fp), NoUnicode*2, 3 );
-                    fclose (fp);
-                }
-            }
-        }
-        else {
-            char c;
-            stderr_printf ( "\n\033[33;41;1mERROR\033[0m: unknown option '--%s' !\n", arg );
-
-            stderr_printf ( "\nNevertheless continue with encoding (Y/n)? \a" );
-            c = waitkey ();
-            if ( c != 'Y' && c != 'y' ) {
-                stderr_printf ( "\n\n*** Abort ***\n" );
-                return -1;
-            }
-            stderr_printf ( "\n" );
-        }
-    }
-
-    TestProfileParams ();
-    return 0;
-}
-
-
-static void
-ShowParameters ( char* inDatei, char* outDatei )
-{
-    static const char        unk      []       = "???";
-    static const char*       EarModel []       = { "ISO (bad!!!)", "Busch", "Filburt", "Klemm", "Klemm/Busch mix", "min(Klemm,Busch)" };
-    static const char        th       [ 7] [4] = { "no", "1st", "2nd", "3rd", "4th", "5th", "6th" };
-    static const char        able     [ 3] [9] = { "Disabled", "Enabled", "Dual" };
-    static const char*       stereo   [16]     = {
-        "Simple uncoupled Stereo",
-        "Mid/Side Stereo + Intensity Stereo 2 bit",
-        "Mid/Side Stereo + Intensity Stereo 4 bit",
-        "Mid/Side Stereo, destroyed imaging (unusable)",
-        "Mid/Side Stereo, much reduced imaging",
-        "Mid/Side Stereo, reduced imaging (-3 dB)",
-        "Mid/Side Stereo when superior",
-        unk, unk, unk,
-        "Mid/Side Stereo when superior + enhanced (1.5/3 dB)",
-        "Mid/Side Stereo when superior + enhanced (2/6 dB)",
-        "Mid/Side Stereo when superior + enhanced (2.5/9 dB)",
-        "Mid/Side Stereo when superior + enhanced (3/12 dB)",
-        unk,
-        "Mid/Side Stereo when superior + enhanced (3/oo dB)"
-    };
-    static const char* const Profiles [16]     = {
-        "n.a", "Unstable/Experimental", unk, unk, unk, "below Telephone", "below Telephone", "Telephone",
-        "Thumb", "Radio", "Standard", "Xtreme", "Insane", "BrainDead", "above BrainDead", "above BrainDead"
-    };
-
-    stderr_printf ( "\n"
-                    " encoding file '%s'\n"
-                    "       to file '%s'\n"
-                    "\n"
-                    " SV %u.%u%s, Profile '%s'\n",
-                    inDatei, outDatei, 7, PNS > 0 ? 1 : 0, XLevel ? " + XLevel coding" : "", Profiles [MainQual] );
-
-    if ( verbose > 0 ) {
-        stderr_printf ( "\n" );
-        if ( FadeInTime != 0.  ||  FadeOutTime != 0.  ||  verbose > 1 )
-            stderr_printf ( " PCM fader                : fade-in: %.2f s, fade-out: %.2f s, shape: %g\n", FadeInTime, FadeOutTime, FadeShape );
-        if ( ScalingFactorr != 1.  ||  ScalingFactorl != 1.  ||  verbose > 1 )
-            stderr_printf ( " Scaling input by         : left %.5f, right: %.5f\n", ScalingFactorl, ScalingFactorr );
-        stderr_printf ( " Maximum encoded bandwidth: %4.1f kHz\n", (Max_Band+1) * (SampleFreq/32./2000.) );
-        stderr_printf ( " Adaptive Noise Shaping   : max. %s order\n", th [NS_Order] );
-        stderr_printf ( " Clear Voice Detection    : %s\n", able [CVD_used] );
-        stderr_printf ( " Mid/Side Stereo          : %s\n", stereo [MS_Channelmode] );
-        stderr_printf ( " Threshold of Hearing     : Model %3u: %s, Max ATH: %2.0f dB, Offset: %+1.0f dB, +Offset@20 kHz:%3.0f dB\n",
-                        EarModelFlag,
-                        EarModelFlag/100 < sizeof(EarModel)/sizeof(*EarModel) ? EarModel [EarModelFlag/100] : unk,
-                        Ltq_max,
-                        Ltq_offset,
-                        -0.6 * (int) (EarModelFlag % 100 - 50) );
-        if ( NMT !=  6.5 || verbose > 1 )
-            stderr_printf ( " Noise masks Tone Ratio   : %4.1f dB\n", NMT );
-        if ( TMN != 18.0 || verbose > 1 )
-            stderr_printf ( " Tone masks Noise Ratio   : %4.1f dB\n", TMN );
-        if ( PNS > 0 )
-            stderr_printf ( " PNS Threshold            : %4.2f\n", PNS );
-        if ( !tmpMask_used )
-            stderr_printf ( " No exploitation of temporal post masking\n" );
-        else if ( verbose > 1 )
-            stderr_printf ( " Exploitation of temporal post masking\n" );
-        if ( minSMR > 0. )
-            stderr_printf ( " Minimum Signal-to-Mask   : %4.1f dB\n", minSMR );
-        else if ( verbose > 1 )
-            stderr_printf ( " No minimum SMR (psycho model controlled filtering)\n" );
-        if ( DelInput == 0xAFFEDEAD )
-            stderr_printf ( " Deleting input file after (successful) encoding\n" );
-        else if ( verbose > 1 )
-            stderr_printf ( " No deleting of input file after encoding\n" );
-    }
-    stderr_printf ( "\n" );
-}
-
-
-/*
- *  Print out the time to stderr with a precision of 10 ms always using
- *  12 characters. Time is represented by the sample count. An additional
- *  prefix character (normally ' ' or '-') is prepended before the first
- *  digit.
- */
-
-static const char*
-PrintTime ( UintMax_t samples, int sign )
-{
-    static char  ret [32];
-    Ulong        tmp  = (Ulong) ( UintMAX_FP(samples) * 100. / SampleFreq );
-    Uint         hour = (Uint)  ( tmp / 360000     );
-    Uint         min  = (Uint)  ( tmp / 6000 %  60 );
-    Uint         sec  = (Uint)  ( tmp / 100  %  60 );
-    Uint         csec = (Uint)  ( tmp        % 100 );
-
-
-    if ( UintMAX_FP(samples) >= SampleFreq * 360000. )
-        return "            ";
-    else if ( hour > 9 )
-        sprintf ( ret,  "%c%2u:%02u", sign, hour, min );
-    else if ( hour > 0 )
-        sprintf ( ret, " %c%1u:%02u", sign, hour, min );
-    else if ( min  > 9 )
-        sprintf ( ret,    "   %c%2u", sign,       min );
-    else
-        sprintf ( ret,   "    %c%1u", sign,       min );
-
-    sprintf ( ret + 6,   ":%02u.%02u", sec, csec );
-    return ret;
-}
-
-
-static void
-ShowProgress ( UintMax_t  samples,
-               UintMax_t  total_samples,
-               UintMax_t  databits )
-{
-    static clock_t  start;
-    clock_t         curr;
-    float           percent;
-    float           kbps;
-    float           speed;
-    float           total_estim;
-
-    if ( samples == 0 ) {
-        if ( DisplayUpdateTime >= 0 ) {
-            stderr_printf ("    %%|avg.bitrate| speed|play time (proc/tot)| CPU time (proc/tot)| ETA\n"
-                            "  -.-    -.- kbps  -.--x     -:--.-    -:--.-     -:--.-    -:--.-     -:--.-\r" );
-        }
-        start = clock ();
-        return;
-    }
-    curr    = clock ();
-    if ( curr == start )
-        return;
-
-    percent     = 100.f    * UintMAX_FP(samples) / UintMAX_FP(total_samples);
-    kbps        =   1.e-3f * UintMAX_FP(databits) * SampleFreq / UintMAX_FP(samples);
-    speed       =   1.f    * UintMAX_FP(samples) * (CLOCKS_PER_SEC / SampleFreq) / (unsigned long)(curr - start) ;
-    total_estim =   1.f    * UintMAX_FP(total_samples) / UintMAX_FP(samples) * (unsigned long)(curr - start);
-
-    // progress percent
-    if ( total_samples < IntMax_MAX )
-        stderr_printf ("\r%5.1f ", percent );
-    else
-        stderr_printf ("\r      " );
-
-    // average data rate
-    stderr_printf ( "%6.1f kbps ", kbps );
-
-    // encoder speed
-    stderr_printf ( "%5.2fx ", speed );
-
-    // 2x duration in WAVE file time (encoded/total)
-    stderr_printf ("%10.10s" , PrintTime ( samples      , (char)' ')+1 );
-    stderr_printf ("%10.10s ", PrintTime ( total_samples, (char)' ')+1 );
-
-    // 2x coding time (encoded/total)
-    stderr_printf ("%10.10s" , PrintTime ( (curr - start) * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1 );
-    stderr_printf ("%10.10s ", PrintTime ( total_estim    * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1 );
-
-    // ETA
-    stderr_printf ( "%10.10s\r", samples < total_samples  ?  PrintTime ((total_estim - curr + start) * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1  :  "" );
-    fflush ( stderr );
-
-    if ( WIN32_MESSAGES  &&  FrontendPresent )
-        SendProgressMessage ( kbps, speed, percent );
-}
-
-
-static int
-myfeof ( FILE* fp )
-{
-    int  ch;
-
-    if ( fp != (FILE*)-1 )
-        return feof (fp);
-
-    ch = CheckKeyKeep ();
-    if ( ch == 'q'  ||  ch == 'Q' )
-        return 1;
-    return 0;
-}
-
-static void fill_float(float * buffer,float val,unsigned count)
-{
-	unsigned n;
-	for(n=0;n<count;n++) buffer[n] = val;
-}
-
-
-static int
-mainloop ( int argc, char** argv )
-{
-    SMRTyp           SMR;                       // contains SMRs for the given frame
-    PCMDataTyp       Main;                      // contains PCM data for 1600 samples
-    SubbandFloatTyp  X [32];                    // Subbandsamples as float()
-    SubbandQuantTyp  Q [32];                    // Subband samples after quantization
-    wave_t           Wave;                      // contains WAV-files arguments
-    UintMax_t        AllSamplesRead   =    0;   // overall read Samples per channel
-    unsigned int     CurrentRead      =    0;   // current read Samples per channel
-    unsigned int     N;                         // counter for processed frames
-    unsigned int     LastValidSamples =    0;   // number of valid samples for the last frame
-    unsigned int     LastValidFrame   =    0;   // overall number of frames
-    char*            InputName        = NULL;   // Name of WAVE file
-    char*            OutputName       = NULL;   // Name of bitstream file
-    FILE*            OutputFile       = NULL;   // Filepointer to output file
-    int              Silence          =    0;
-    int              OldSilence       =    0;
-    time_t           T;
-    UintMax_t        OldBufferedBits;
-    BitstreamPos     bitstreampos;
-    int              TransientL [PART_SHORT];   // Flag of transient detection
-    int              TransientR [PART_SHORT];   // Flag of transient detection
-    int              Transient  [32];           // Flag of transient detection
-
-
-    ENTER(2);
-
-    // initialize PCM-data
-    memset ( &Main, 0, sizeof Main );
-
-    // open WAV file
-    if ( EvalParameters ( argc, argv, &InputName, &OutputName, 1 ) < 0 )
-        return 1;
-    if ( Open_WAV_Header ( &Wave, InputName ) < 0 ) {
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: Unable to read or decode: '%s'\n", InputName );
-        return 1;
-    }
-    TitleBar ( InputName );
-    CopyTags ( InputName );
-
-    // read WAV-Header
-    if ( 0 != Read_WAV_Header (&Wave) ) {
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: Invalid file header, not a WAVE file '%s'\n", InputName );
-        return 1;
-    }
-
-    SampleFreq    = Wave.SampleFreq;
-    SamplesInWAVE = Wave.PCMSamples;
-
-    if ( Wave.SampleFreq != 44100.  &&  Wave.SampleFreq != 48000.  &&  Wave.SampleFreq != 37800.  &&  Wave.SampleFreq != 32000. ) {
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: Sampling frequency of %g kHz is not supported!\n\n", (double)(Wave.SampleFreq * 1.e-3) );
-        return 1;
-    }
-
-    if ( Wave.BitsPerSample < 8  ||  Wave.BitsPerSample > 32 ) {
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: %i bits per sample are not supported!\n\n", Wave.BitsPerSample );
-        return 1;
-    }
-
-    switch ( Wave.Channels ) {
-    case  0:
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: 0 channels file, this is nonsense\n\n" );
-        return 1;
-    case  1: case  2:
-        break;
-    case  3: case  4: case  5: case  6: case  7: case  8:
-        stderr_printf ( "WARNING: %i channel(s) file, only first 2 channels are encoded.\n\n", Wave.Channels );
-        break;
-    default:
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: %i channel(s) file, not supported\n\n", Wave.Channels );
-        return 1;
-    }
-
-    SetQualityParams (5.0);
-
-    if ( EvalParameters ( argc, argv, &InputName, &OutputName, 0 ) < 0 )
-        return 1;
-
-    if ( UintMAX_FP(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
-        SamplesInWAVE = Wave.SampleFreq * (SkipTime + Duration);
-    }
-
-    Init_Psychoakustiktabellen ();              // must be done AFTER decoding command line parameters
-
-    // check fade-length
-    if ( FadeInTime + FadeOutTime > UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq ) {
-        stderr_printf ( "WARNING: Duration of fade in + out exceeds file length!\n");
-        FadeInTime = FadeOutTime = 0.5 * UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq;
-    }
-
-    /* open bitstream file */
-    if      ( 0 == strcmp ( OutputName, "/dev/null") ) {
-        OutputFile = fopen (DEV_NULL, "wb");
-    }
-    else if ( 0 == strcmp ( OutputName, "-")  ||  0 == strcmp ( OutputName, "/dev/stdout") ) {
-        OutputFile = SETBINARY_OUT (stdout);
-    }
-    else
-        switch ( WriteMode ) {
-        default:
-            stderr_printf ( "\033[33;41;1mERROR\033[0m: Invalid Write mode, internal error\n" );
-            return 1;
-        case MODE_NEVER_OVERWRITE:
-            OutputFile = fopen ( OutputName, "rb" );
-            if ( OutputFile != NULL ) {
-                fclose ( OutputFile );
-                stderr_printf ( "\033[33;41;1mERROR\033[0m: Output file '%s' already exists\n", OutputName );
-                return 1;
-            }
-            OutputFile = fopen ( OutputName, "wb" );
-            break;
-        case MODE_OVERWRITE:
-            OutputFile = fopen ( OutputName, "wb" );
-            break;
-        case MODE_ASK_FOR_OVERWRITE:
-            OutputFile = fopen ( OutputName, "rb" );
-            if ( OutputFile != NULL ) {
-                char c;
-                fclose ( OutputFile );
-                stderr_printf ( "\nmppenc: Output file '%s' already exists, overwrite (Y/n)? ", OutputName );
-                c = waitkey ();
-                if ( c != 'Y'  &&  c != 'y' ) {
-                    stderr_printf ( "No!!!\n\n*** Canceled overwrite ***\n" );
-                    return 1;
-                }
-                                stderr_printf ( " YES\n" );
-            }
-            OutputFile = fopen ( OutputName, "wb" );
-            break;
-        }
-
-    if ( OutputFile == NULL ) {
-        stderr_printf ( "\033[33;41;1mERROR\033[0m: Could not create output file '%s'\n", OutputName );
-        return 1;
-    }
-
-#ifndef IO_BUFFERING
-    setvbuf ( OutputFile, NULL, _IONBF, 0 );
-#endif
-
-    ShowParameters ( InputName, OutputName );
-    if ( WIN32_MESSAGES  &&  FrontendPresent )
-        SendModeMessage (MainQual);
-
-    if ( SkipTime > 0. ) {
-        unsigned long  SkipSamples = SampleFreq * SkipTime;
-        ssize_t        read;
-
-        while ( SkipSamples > 0 ) {
-            read          = Read_WAV_Samples ( &Wave, mini(BLOCK, SkipSamples), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
-            if ( read <= 0 )
-                break;
-            SkipSamples   -= read;
-            SamplesInWAVE -= read;
-        }
-    }
-
-    BufferedBits     = 0;
-    LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
-    LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
-    WriteHeader_SV7 ( Max_Band, MainQual, MS_Channelmode > 0, LastValidFrame, LastValidSamples, PNS > 0 ? 0x17 : 0x07, SampleFreq );
-
-    // initialize timer
-    ShowProgress ( 0, SamplesInWAVE, BufferedBits );
-    T            = time ( NULL );
-
-    // read samples
-    CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
-    AllSamplesRead += CurrentRead;
-
-	if (CurrentRead > 0)
-	{
-		fill_float( Main.L, Main.L[CENTER], CENTER );
-		fill_float( Main.R, Main.R[CENTER], CENTER );
-		fill_float( Main.M, Main.M[CENTER], CENTER );
-		fill_float( Main.S, Main.S[CENTER], CENTER );
-	}
-
-	Analyse_Init ( Main.L[CENTER], Main.R[CENTER], X, Max_Band );
-
-    // adapt SamplesInWAVE to the real number of contained samples
-    if ( myfeof (Wave.fp) ) {
-        stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
-                        UintMAX_FP(AllSamplesRead) / SampleFreq, UintMAX_FP(SamplesInWAVE) / SampleFreq );
-        SamplesInWAVE = AllSamplesRead;
-
-        // in the case of a broken wav-header, recalculate the overall frames
-        // and the valid samples for the last frame
-        LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
-        LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
-        // fprintf ( stderr, "\nKorrupt WAV file in Frame %d: NEU!: Frames: %u, last valid: %u\n", -1, LastValidFrame, LastValidSamples );
-    }
-
-    for ( N = 0; (UintMax_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
-
-        // setting residual data-fields to zero
-        if ( CurrentRead < BLOCK  &&  N > 0 ) {
-            fill_float( Main.L + (CENTER + CurrentRead), Main.L[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
-            fill_float( Main.R + (CENTER + CurrentRead), Main.R[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
-            fill_float( Main.M + (CENTER + CurrentRead), Main.M[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
-            fill_float( Main.S + (CENTER + CurrentRead), Main.S[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
-        }
-
-        /*********************************************************************************/
-        /*                                Fade In and Fade Out                                */
-        /*********************************************************************************/
-        if ( FadeInTime  > 0. )
-            if ( FadeInTime  > UintMAX_FP(BLOCK         + (UintMax_t)N*BLOCK) / Wave.SampleFreq )
-                Fading_In  ( &Main, N*BLOCK, Wave.SampleFreq );
-        if ( FadeOutTime > 0. )
-            if ( FadeOutTime > UintMAX_FP(SamplesInWAVE - (UintMax_t)N*BLOCK) / Wave.SampleFreq )
-                Fading_Out ( &Main, N*BLOCK, Wave.SampleFreq );
-
-        /********************************************************************/
-        /*                         Encoder-Core                             */
-        /********************************************************************/
-        // you only get null samples at the output of the filterbank when the last frame contains zeroes
-
-        memset ( Res_L, 0, sizeof Res_L );
-        memset ( Res_R, 0, sizeof Res_R );
-
-        if ( !Silence  ||  !OldSilence ) {
-            Analyse_Filter ( &Main, X, Max_Band );                      // Analysis-Filterbank (Main -> X)
-            SMR = Psychoakustisches_Modell ( Max_Band*0+31, &Main, TransientL, TransientR );    // Psychoacoustics return SMRs for input data 'Main'
-            if ( minSMR > 0 )
-                RaiseSMR ( Max_Band, &SMR );                            // Minimum-operation on SBRs (full bandwidth)
-            if ( MS_Channelmode > 0 )
-                MS_LR_Entscheidung ( Max_Band, MS_Flag, &SMR, X );      // Selection of M/S- or L/R-Coding
-            SCF_Extraktion ( Max_Band, X );                             // Extraction of the scalefactors and normalization of the subband samples
-            TransientenCalc ( Transient, TransientL, TransientR );
-            if ( NS_Order > 0 ) {
-                NS_Analyse ( Max_Band, MS_Flag, SMR, Transient );                  // calculate possible ANS-Filter and the expected gain
-            }
-
-            Allocate ( Max_Band, Res_L, X[0].L, SCF_Index_L[0], SNR_comp_L, SMR.L, Power_L, Transient );   // allocate bits for left + right channel
-            Allocate ( Max_Band, Res_R, X[0].R, SCF_Index_R[0], SNR_comp_R, SMR.R, Power_R, Transient );
-
-            Quantisierung ( Max_Band, Res_L, Res_R, X, Q );             // quantize samples
-        }
-
-        if ( Zaehler >= BUFFER_ALMOST_FULL  ||  LowDelay ) {
-            FlushBitstream ( OutputFile, Buffer, Zaehler );
-            Zaehler = 0;
-         }
-
-        OldSilence      = Silence;
-        OldBufferedBits = BufferedBits;
-        GetBitstreamPos    ( &bitstreampos );
-        WriteBits          ( 0, 20 );                                                      // Reserve 20 bits for jump-information
-        WriteBitstream_SV7 ( Max_Band, Q );                                                // write SV7-Bitstream
-        WriteBitsAt        ( (Uint32_t)(BufferedBits - OldBufferedBits - 20), 20, bitstreampos );      // Patch 20 bits for jump-information to the right value
-
-        if ( (Int)(time (NULL) - T) >= 0 ) {                            // output
-            T += labs (DisplayUpdateTime);
-            ShowProgress ( (UintMax_t)(N+1) * BLOCK, SamplesInWAVE, BufferedBits );
-        }
-
-        // for backwards-compatibility with older decoders write the 11 bit for
-        // reconstruction of exact filelength before the very last frame
-
-        memmove ( Main.L, Main.L + BLOCK, CENTER * sizeof(float) );
-        memmove ( Main.R, Main.R + BLOCK, CENTER * sizeof(float) );
-        memmove ( Main.M, Main.M + BLOCK, CENTER * sizeof(float) );
-        memmove ( Main.S, Main.S + BLOCK, CENTER * sizeof(float) );
-
-		if ( AllSamplesRead + BLOCK > SamplesInWAVE )
-		{
-			int n = 0;
-		}
-
-        // read samples
-        CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
-        AllSamplesRead += CurrentRead;
-
-        // adapt SamplesInWAV to the real number of contained samples
-        if ( myfeof (Wave.fp) ) {
-            stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
-                            UintMAX_FP(AllSamplesRead) / SampleFreq, UintMAX_FP(SamplesInWAVE) / SampleFreq );
-            SamplesInWAVE = AllSamplesRead;
-
-            // in the case of broken wav-header, recalculate the overall frames
-            // and the valid samples for the last frame
-            LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
-            LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
-            // fprintf ( stderr, "\nKorrupt WAV file in Frame %d: NEU!: Frames: %u, last valid: %u\n", N, LastValidFrame, LastValidSamples );
-        }
-
-        if ( N == LastValidFrame - 1 ) {
-            WriteBits ( LastValidSamples, 11 );
-            // fprintf ( stderr, "\nGültige Samples im letzten Frame: %4u   \n", LastValidSamples );
-        }
-        if ( N >= LastValidFrame ) {
-            // fprintf ( stderr, "Zusätzlicher Frame %u (von %u) angehängt.   \n", N, LastValidFrame );
-        }
-
-    }
-    LEAVE(2);
-
-    // write the last incomplete word to buffer, so it's written during the next flush
-    FinishBitstream();
-    ShowProgress ( SamplesInWAVE, SamplesInWAVE, BufferedBits );
-
-    FlushBitstream ( OutputFile, Buffer, Zaehler );
-    Zaehler = 0;
-
-    UpdateHeader ( OutputFile, LastValidFrame, LastValidSamples );
-
-    if(EnableTags)
-        FinalizeTags ( OutputFile, APE_Version );
-    fclose ( OutputFile );
-    fclose ( Wave.fp );
-
-    if ( DelInput == 0xAFFEDEAD  &&  remove (InputName) == -1 )         // delete input file if DelInput is active
-        stderr_printf ( "\n\n\033[33;41;1mERROR\033[0m: Could not delete input file '%s'\n", InputName );
-
-    if ( WIN32_MESSAGES  &&  FrontendPresent )
-        SendQuitMessage ();
-
-    stderr_printf ( "\n" );
-    return 0;
-}
-
-
-static void
-OverdriveReport ( void )
-{
-    if ( Overflows > 0 ) {                                                // report internal clippings
-        if ( XLevel == 0 ) {
-            stderr_printf ( "\n"
-                            "\033[1m\rWARNING:\n"
-                            "\033[0m\r  There occured %u internal clippings due to a restriction of StreamVersion 7.\n"
-                            "  Re-encode with '--scale %.3f', or use option '--xlevel', which normally can\n"
-                            "  handle this situation but don't work well with old decoders.\a\n\n",
-                            Overflows, ScalingFactorl * 32767. / MaxOverFlow - 0.0005f );
-        }
-        else {
-            stderr_printf ( "\n"
-                            "\033[1m\rWARNING:\n"
-                            "\033[0m\r  There still occured %u SCF clippings due to a restriction of StreamVersion 7.\n"
-                            "  Use the '--scale' method to avoid additional distortions. Note that this\n"
-                            "  file already has annoying distortions due to slovenly CD mastering.\a\n\n", Overflows );
-        }
-    }
-}
-
-
-/************ The main() function *****************************/
-int Cdecl
-main ( int argc, char** argv )
-{
-    int  ret;
-
-#if (defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO)  &&  (defined USE_REALTIME  ||  defined USE_NICE)
-    // DisableSUID ();
-#endif
-
-#ifdef _OS2
-    _wildcard ( &argc, &argv );
-#endif
-
-    if ( WIN32_MESSAGES ) {
-        FrontendPresent = SearchForFrontend (); // search for presence of Windows Frontend
-        if ( FrontendPresent )
-            SendStartupMessage ( MPPENC_VERSION, 7, MPPENC_BUILD );
-    }
-
-    START();
-    ENTER(1);
-
-    // Welcome message
-    if ( argc < 2  ||  ( 0 != strcmp (argv[1], "--silent")  &&  0 != strcmp (argv[1], "--quiet")) )
-        (void) stderr_printf ("\r\x1B[1m\r%s\n\x1B[0m\r     \r", About );
-
-    // no arguments or call for help
-    if ( argc < 2  ||  0==strcmp (argv[1],"-h")  ||  0==strcmp (argv[1],"-?")  ||  0==strcmp (argv[1],"--help") ) {
-        SetQualityParams (5.0);
-        dup2 ( 1, 2 );
-        shorthelp ();
-        return 1;
-    }
-
-    if ( 0==strcmp (argv[1],"--longhelp")  ||  0==strcmp (argv[1],"-??") ) {
-        SetQualityParams (5.0);
-        dup2 ( 1, 2 );
-        longhelp ();
-        return 1;
-    }
-
-    // initialize tables which must be initialized once and only once
-#ifdef FAST_MATH
-    Init_FastMath ();                           // check if something has to be done for each file !!
-#endif
-    Init_SV7 ();
-    Init_Psychoakustiktabellen ();
-    Init_Skalenfaktoren ();
-    Init_Psychoakustik ();
-    Init_FPU ();
-    Init_ANS ();
-    Klemm    ();
-
-    ret = mainloop ( argc, argv );              // analyze command line and do the requested work
-
-    OverdriveReport ();                         // output a report if clipping was necessary
-
-    LEAVE(1);
-    REPORT();
-#ifdef BUGBUG
-    reppr ();
-#endif
-    return ret;
-}
-
-/* end of mppenc.c */
Index: penc/trunk/mppenc.dsp
===================================================================
--- /mppenc/trunk/mppenc.dsp	(revision 96)
+++ 	(revision )
@@ -1,254 +1,0 @@
-# Microsoft Developer Studio Project File - Name="mppenc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=mppenc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "mppenc.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "mppenc.mak" CFG="mppenc - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "mppenc - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "mppenc - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "mppenc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gr /MT /W3 /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /FD /GM /GL /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG MPP_ENCODER"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj winmm.lib /nologo /subsystem:console /machine:IX86 /LTCG
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF  "$(CFG)" == "mppenc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G5 /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG MPP_ENCODER"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "mppenc - Win32 Release"
-# Name "mppenc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\analy_filter.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ans.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\bitstream.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\cvd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\encode_sv7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fastmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fft4g.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\fft4gasm.nas
-
-!IF  "$(CFG)" == "mppenc - Win32 Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF  "$(CFG)" == "mppenc - Win32 Debug"
-
-# PROP Exclude_From_Build 1
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\fft_routines.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\huffsv7.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\keyboard.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\mppenc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\pipeopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\psy.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\psy_tab.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\quant.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tags.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tools.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\wave_in.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\winmsg.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\fastmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Makefile
-# End Source File
-# Begin Source File
-
-SOURCE=.\minimax.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\mppenc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\predict.h
-# End Source File
-# End Group
-# Begin Group "Design Proposal"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=".\A-frame.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-gedanken.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-num.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-pflichtenheft.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-psycho.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-quant.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-sample.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=".\A-stereo.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=.\website\coupling.txt
-# End Source File
-# Begin Source File
-
-SOURCE=.\website\sv8file.txt
-# End Source File
-# End Group
-# End Target
-# End Project
Index: penc/trunk/mppenc.h
===================================================================
--- /mppenc/trunk/mppenc.h	(revision 96)
+++ 	(revision )
@@ -1,372 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef MPPENC_MPPENC_H
-#define MPPENC_MPPENC_H
-
-#ifdef _WIN32
-# define CVD_FASTLOG
-# define FAST_MATH
-#endif
-
-#include "mppdec.h"
-#include "minimax.h"
-
-//#define IO_BUFFERING                          // activates IO-buffer (default: off)
-
-#define WIN32_MESSAGES      1                   // support Windows-Messaging to Frontend
-
-// analyse_filter.c
-#define X_MEM            1152
-
-// ans.c
-#define MAX_NS_ORDER        6                   // maximum order of the Adaptive Noise Shaping Filter (IIR)
-#define MAX_ANS_BANDS      16
-#define MAX_ANS_LINES    (32 * MAX_ANS_BANDS)   // maximum number of noiseshaped FFT-lines
-///////// 16 * MAX_ANS_BANDS not sufficient? //////////////////
-#define MS2SPAT1             0.5f
-#define MS2SPAT2             0.25f
-#define MS2SPAT3             0.125f
-#define MS2SPAT4             0.0625f
-
-// bitstream.c
-#define BUFFER_ALMOST_FULL  8192
-#define BUFFER_FULL         (BUFFER_ALMOST_FULL + 4352)         // 34490 bit/frame  1320.3 kbps
-
-// cvd.c
-#define MAX_CVD_LINE      300                   // maximum FFT-Index for CVD
-#define CVD_UNPRED          0.040f              // unpredictability (cw) for CVD-detected bins, e33 (04)
-#define MIN_ANALYZED_IDX   12                   // maximum base-frequency = 44100/MIN_ANALYZED_IDX ^^^^^^
-#define MED_ANALYZED_IDX   50                   // maximum base-frequency = 44100/MED_ANALYZED_IDX ^^^^^^
-#define MAX_ANALYZED_IDX  900                   // minimum base-frequency = 44100/MAX_ANALYZED_IDX  (816 for Amnesia)
-
-// mppenc.h
-#define CENTER            448                   // offset for centering current data in Main-array
-#define BLOCK            1152                   // blocksize
-#define ANABUFFER    (BLOCK + CENTER)           // size of PCM-data array for analysis
-
-// psy.c
-#define SHORTFFT_OFFSET   168                   // fft-offset for short FFT's
-#define PREFAC_LONG        10                   // preecho-factor for long partitions
-
-// psy_tab.h
-#define PART_LONG          57                   // number of partitions for long
-#define PART_SHORT     (PART_LONG / 3)          // number of partitions for short
-#define MAX_SPL            20                   // maximum assumed Sound Pressure Level
-
-// quant.h
-#define SCFfac              0.832980664785f     // = SCF[n-1]/SCF[n]
-
-// wave_in.h
-
-
-// fast but maybe more inaccurate, use if you need speed
-#if defined(__GNUC__) && !defined(__APPLE__)
-#  define SIN(x)      sinf ((float)(x))
-#  define COS(x)      cosf ((float)(x))
-#  define ATAN2(x,y)  atan2f ((float)(x), (float)(y))
-#  define SQRT(x)     sqrtf ((float)(x))
-#  define LOG(x)      logf ((float)(x))
-#  define LOG10(x)    log10f ((float)(x))
-#  define POW(x,y)    expf (logf(x) * (y))
-#  define POW10(x)    expf (M_LN10 * (x))
-#  define FLOOR(x)    floorf ((float)(x))
-#  define IFLOOR(x)   (int) floorf ((float)(x))
-#  define FABS(x)     fabsf ((float)(x))
-#else
-# define SIN(x)      (float) sin (x)
-# define COS(x)      (float) cos (x)
-# define ATAN2(x,y)  (float) atan2 (x, y)
-# define SQRT(x)     (float) sqrt (x)
-# define LOG(x)      (float) log (x)
-# define LOG10(x)    (float) log10 (x)
-# define POW(x,y)    (float) pow (x,y)
-# define POW10(x)    (float) pow (10., (x))
-# define FLOOR(x)    (float) floor (x)
-# define IFLOOR(x)   (int)   floor (x)
-# define FABS(x)     (float) fabs (x)
-#endif
-
-#define SQRTF(x)      SQRT (x)
-#ifdef FAST_MATH
-# define TABSTEP      64
-# define COSF(x)      my_cos ((float)(x))
-# define ATAN2F(x,y)  my_atan2 ((float)(x), (float)(y))
-# define IFLOORF(x)   my_ifloor ((float)(x))
-#else
-# undef  TABSTEP
-# define COSF(x)      COS (x)
-# define ATAN2F(x,y)  ATAN2 (x,y)
-# define IFLOORF(x)   IFLOOR (x)
-#endif
-
-typedef struct {
-    float  L [ANABUFFER];
-    float  R [ANABUFFER];
-    float  M [ANABUFFER];
-    float  S [ANABUFFER];
-} PCMDataTyp;
-
-typedef struct {
-    float  L [36];
-    float  R [36];
-} SubbandFloatTyp;
-
-typedef struct {
-    unsigned int  L [36];
-    unsigned int  R [36];
-} SubbandQuantTyp;
-
-typedef struct {
-    float  L [32];
-    float  R [32];
-    float  M [32];
-    float  S [32];
-} SMRTyp;
-
-typedef struct {
-    FILE*         fp;                   // File pointer to read data
-    Ulong         PCMOffset;            // File offset of PCM data
-    long double   SampleFreq;           // Sample frequency in Hz
-    Uint          BitsPerSample;        // used bits per sample, 8*BytesPerSample-7 <= BitsPerSample <= BytesPerSample
-    Uint          BytesPerSample;       // allocated bytes per sample
-    Uint          Channels;             // Number of channels, 1...8
-    UintMax_t     PCMBytes;             // PCM Samples (in 8 bit units)
-    UintMax_t     PCMSamples;           // PCM Samples per Channel
-    Bool_t        raw;                  // raw: headerless format
-} wave_t;
-
-// analy_filter.c
-void   Analyse_Filter(const PCMDataTyp*, SubbandFloatTyp*, const int);
-void   Analyse_Init ( float Left, float Right, SubbandFloatTyp* out, const int MaxBand );
-
-void   Klemm ( void );
-
-// ans.c
-extern unsigned int  NS_Order;                          // global Flag for Noise Shaping
-extern unsigned int  NS_Order_L [32];
-extern unsigned int  NS_Order_R [32];                   // order of the Adaptive Noiseshaping (0: off, 1...5: on)
-extern float         FIR_L     [32] [MAX_NS_ORDER];
-extern float         FIR_R     [32] [MAX_NS_ORDER];     // contains FIR-Filter for NoiseShaping
-extern float         ANSspec_L [MAX_ANS_LINES];
-extern float         ANSspec_R [MAX_ANS_LINES];         // L/R-masking threshold for ANS
-extern float         ANSspec_M [MAX_ANS_LINES];
-extern float         ANSspec_S [MAX_ANS_LINES];         // M/S-masking threshold for ANS
-
-void   Init_ANS   ( void );
-void   NS_Analyse ( const int, const unsigned char* MS, const SMRTyp, const int* Transient );
-
-
-// bitstream.c
-typedef struct {
-    Uint32_t*     ptr;
-    unsigned int  bit;
-} BitstreamPos;
-
-
-extern Uint32_t      Buffer [BUFFER_FULL];      // buffer for bitstream file (128 KB)
-extern Uint32_t      dword;                     // 32 bit-Word for Bitstream-I/O
-extern unsigned int  Zaehler;                   // position counter for processed bitstream word (32 bit)
-extern UintMax_t     BufferedBits;              // counter for the number of written bits in the bitstream
-
-void  FlushBitstream    ( FILE* fp, const Uint32_t* buffer, size_t words32bit );
-void  UpdateHeader      ( FILE* fp, Uint32_t Frames, Uint ValidSamples );
-void  WriteBits         ( const Uint32_t input, const unsigned int bits );
-void  WriteBitsAt       ( const Uint32_t input, const unsigned int bits, const BitstreamPos pos );
-void  GetBitstreamPos   ( BitstreamPos* const pos );
-
-// cvd.c
-int    CVD2048 ( const float*, int* );
-
-
-// fastmath.c
-void   Init_FastMath ( void );
-extern const float  tabatan2   [] [2];
-extern const float  tabcos     [] [2];
-extern const float  tabsqrt_ex [];
-extern const float  tabsqrt_m  [] [2];
-
-
-// fft4g.c
-void   rdft                ( const int, float*, int*, float* );
-void   Generate_FFT_Tables ( const int, int*, float* );
-
-
-// fft_routines.c
-void   Init_FFT      ( void );
-void   PowSpec256    ( const float*, float* );
-void   PowSpec1024   ( const float*, float* );
-void   PowSpec2048   ( const float*, float* );
-void   PolarSpec1024 ( const float*, float*, float* );
-void   Cepstrum2048  ( float* cep, const int );
-
-
-// mppenc.c
-extern float         SNR_comp_L [32];
-extern float         SNR_comp_R [32];   // SNR-compensation after SCF-combination and ANS-gain
-extern unsigned int  MS_Channelmode;    // global flag for enhanced functionality
-extern unsigned int  Overflows;
-extern float         SampleFreq;
-extern float         Bandwidth;
-extern float         KBD1;
-extern float         KBD2;
-
-// psy.c
-extern unsigned int  CVD_used;          // global flag for ClearVoiceDetection (more switches for the psychoacoustic model)
-extern float         varLtq;            // variable threshold in quiet
-extern unsigned int  tmpMask_used;      // global flag for temporal masking
-extern float         ShortThr;          // factor for calculation masking threshold with transients
-extern float         minSMR;            // minimum SMR for all subbands
-
-void   Init_Psychoakustik       ( void );
-SMRTyp Psychoakustisches_Modell ( const int, const PCMDataTyp*, int* TransientL, int* TransientR );
-void   TransientenCalc          ( int* Transient, const int* TransientL, const int* TransientR );
-void   RaiseSMR                 ( const int, SMRTyp* );
-void   MS_LR_Entscheidung       ( const int, unsigned char* MS, SMRTyp*, SubbandFloatTyp* );
-
-
-// psy_tab.c
-extern int          MinValChoice;               // Flag for calculation of MinVal-values
-extern unsigned int EarModelFlag;               // Flag for threshold in quiet
-extern float        Ltq_offset;                 // Offset for threshold in quiet
-extern float        Ltq_max;                    // maximum level for threshold in quiet
-extern float        fftLtq   [512];             // threshold in quiet (FFT)
-extern float        partLtq  [PART_LONG];       // threshold in quiet (Partitions)
-extern float        invLtq   [PART_LONG];       // inverse threshold in quiet (Partitions, long)
-extern float        Loudness [PART_LONG];       // weighting factors for calculation of loudness
-extern float        MinVal   [PART_LONG];       // minimum quality that's adapted to the model, minval for long
-extern float        SPRD     [PART_LONG] [PART_LONG]; // tabulated spreading function
-extern float        TMN;                        // Offset for purely sinusoid components
-extern float        NMT;                        // Offset for purely noisy components
-extern float        TransDetect;                // minimum slewrate for transient detection
-extern float        O_MAX;
-extern float        O_MIN;
-extern float        FAC1;
-extern float        FAC2;     // constants to calculate the used offset
-
-extern const float  Butfly    [7];              // Antialiasing to calculate the subband powers
-extern const float  InvButfly [7];              // Antialiasing to calculate the masking thresholds
-extern const float  iw        [PART_LONG];      // inverse partition-width for long
-extern const float  iw_short  [PART_SHORT];     // inverse partition-width for short
-extern const int    wl        [PART_LONG];      // w_low  for long
-extern const int    wl_short  [PART_SHORT];     // w_low  for short
-extern const int    wh        [PART_LONG];      // w_high for long
-extern const int    wh_short  [PART_SHORT];     // w_high for short
-
-void   Init_Psychoakustiktabellen ( void );
-
-
-// quant.c
-extern float __invSCF [128 + 6];        // tabulated scalefactors (inverted)
-#define invSCF  (__invSCF + 6)
-
-void   Init_Skalenfaktoren             ( void );
-float  ISNR_Schaetzer                  ( const float* samples, const float comp, const int res);
-float  ISNR_Schaetzer_Trans            ( const float* samples, const float comp, const int res);
-void   QuantizeSubband                 ( unsigned int* qu_output, const float* input, const int res, float* errors );
-void   QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, float* errors, const float* FIR );
-
-void   NoiseInjectionComp ( void );
-
-
-// encode_sv7.c
-extern unsigned char  MS_Flag     [32];                  // subband-wise mid/side flag
-extern int            Res_L       [32];
-extern int            Res_R       [32];                  // resolution steps of the subbands
-extern int            SCF_Index_L [32] [3];
-extern int            SCF_Index_R [32] [3];              // Scalefactor-index for Bitstream
-
-void         Init_SV7             ( void );
-void         WriteHeader_SV7      ( const unsigned int, const unsigned int, const unsigned int, const Uint32_t TotalFrames, const unsigned int SamplesRest, const unsigned int StreamVersion, const unsigned int SampleFreq );
-void         WriteBitstream_SV7   ( const int, const SubbandQuantTyp* );
-void         FinishBitstream      ( void );
-
-
-// huffsv7.c
-extern Huffman_t         HuffHdr  [10];         // contains tables for SV7-header
-extern Huffman_t         HuffSCFI [ 4];         // contains tables for SV7-scalefactor select
-extern Huffman_t         HuffDSCF [16];         // contains tables for SV7-scalefactor coding
-extern const Huffman_t*  HuffQ [2] [8];         // points to tables for SV7-sample coding
-
-void    Huffman_SV7_Encoder ( void );
-
-
-// keyboard.c
-int    WaitKey      ( void );
-int    CheckKeyKeep ( void );
-int    CheckKey     ( void );
-
-
-// regress.c
-void    Regression       ( float* const _r, float* const _b, const float* p, const float* q );
-
-
-// tags.c
-void    Init_Tags        ( void );
-int     FinalizeTags     ( FILE* fp, unsigned int Version );
-int     addtag           ( const char* key, size_t keylen, const unsigned char* value, size_t valuelen, int converttoutf8, int flags );
-int     gettag           ( const char* key, char* dst, size_t len );
-int     CopyTags         ( const char* filename );
-
-
-// wave_in.c
-int     Open_WAV_Header  ( wave_t* type, const char* name );
-size_t  Read_WAV_Samples ( wave_t* t, const size_t RequestedSamples, PCMDataTyp* data, const ptrdiff_t offset, const float scalel, const float scaler, int* Silence );
-int     Read_WAV_Header  ( wave_t* type );
-
-
-// winmsg.c
-#ifdef _WIN32
-int    SearchForFrontend   ( void );
-void   SendQuitMessage     ( void );
-void   SendModeMessage     ( const int );
-void   SendStartupMessage  ( const char*, const int, const char* );
-void   SendProgressMessage ( const int, const float, const float );
-#else
-# undef  WIN32_MESSAGES
-# define WIN32_MESSAGES                 0
-# define SearchForFrontend()            (0)
-# define SendQuitMessage()              (void)0
-# define SendModeMessage(x)             (void)0
-# define SendStartupMessage(x,y,s)      (void)0
-# define SendProgressMessage(x,y,z)     (void)0
-#endif /* _WIN32 */
-
-
-#define MPPENC_DENORMAL_FIX_BASE ( 32. * 1024. /* normalized sample value range */ / ( (float) (1 << 24 /* first bit below 32-bit PCM range */ ) ) )
-#define MPPENC_DENORMAL_FIX_LEFT ( MPPENC_DENORMAL_FIX_BASE )
-#define MPPENC_DENORMAL_FIX_RIGHT ( MPPENC_DENORMAL_FIX_BASE * 0.5f )
-
-
-#endif /* MPPENC_MPPENC_H */
-
-#if 0
-# define LAST_HUFFMAN   15
-# define DUMP_HIGHRES
-#endif
-
-#if 0
-# define DUMP_RES15
-#endif
-
-#ifndef LAST_HUFFMAN
-# define LAST_HUFFMAN    7
-#endif
-
-/* end of mppenc.h */
Index: penc/trunk/mppenc.mak
===================================================================
--- /mppenc/trunk/mppenc.mak	(revision 96)
+++ 	(revision )
@@ -1,334 +1,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on mppenc.dsp
-!IF "$(CFG)" == ""
-CFG=mppenc - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to mppenc - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "mppenc - Win32 Release" && "$(CFG)" != "mppenc - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "mppenc.mak" CFG="mppenc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mppenc - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "mppenc - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "mppenc - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\mppenc.exe"
-
-
-CLEAN :
-        -@erase "$(INTDIR)\analy_filter.obj"
-        -@erase "$(INTDIR)\ans.obj"
-        -@erase "$(INTDIR)\bitstream.obj"
-        -@erase "$(INTDIR)\cvd.obj"
-        -@erase "$(INTDIR)\fastmath.obj"
-        -@erase "$(INTDIR)\fft4g.obj"
-        -@erase "$(INTDIR)\fft_routines.obj"
-        -@erase "$(INTDIR)\huffsv7.obj"
-        -@erase "$(INTDIR)\mppenc.obj"
-        -@erase "$(INTDIR)\pipeopen.obj"
-        -@erase "$(INTDIR)\psy.obj"
-        -@erase "$(INTDIR)\psy_tab.obj"
-        -@erase "$(INTDIR)\quant.obj"
-        -@erase "$(INTDIR)\stderr.obj"
-        -@erase "$(INTDIR)\encode_sv7.obj"
-        -@erase "$(INTDIR)\tools.obj"
-        -@erase "$(INTDIR)\vc60.idb"
-        -@erase "$(INTDIR)\wave_in.obj"
-        -@erase "$(INTDIR)\winmsg.obj"
-        -@erase "$(OUTDIR)\mppenc.exe"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /Gr /Zp4 /ML /W3 /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GM /c
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\mppenc.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj winmm.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\mppenc.pdb" /machine:I386 /out:"$(OUTDIR)\mppenc.exe"
-LINK32_OBJS= \
-        "$(INTDIR)\analy_filter.obj" \
-        "$(INTDIR)\ans.obj" \
-        "$(INTDIR)\bitstream.obj" \
-        "$(INTDIR)\cvd.obj" \
-        "$(INTDIR)\fastmath.obj" \
-        "$(INTDIR)\fft4g.obj" \
-        "$(INTDIR)\fft_routines.obj" \
-        "$(INTDIR)\huffsv7.obj" \
-        "$(INTDIR)\mppenc.obj" \
-        "$(INTDIR)\pipeopen.obj" \
-        "$(INTDIR)\psy.obj" \
-        "$(INTDIR)\psy_tab.obj" \
-        "$(INTDIR)\quant.obj" \
-        "$(INTDIR)\stderr.obj" \
-        "$(INTDIR)\encode_sv7.obj" \
-        "$(INTDIR)\tools.obj" \
-        "$(INTDIR)\wave_in.obj" \
-        "$(INTDIR)\winmsg.obj" \
-        "$(INTDIR)\fft4gasm.obj"
-
-"$(OUTDIR)\mppenc.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF  "$(CFG)" == "mppenc - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\mppenc.exe"
-
-
-CLEAN :
-        -@erase "$(INTDIR)\analy_filter.obj"
-        -@erase "$(INTDIR)\ans.obj"
-        -@erase "$(INTDIR)\bitstream.obj"
-        -@erase "$(INTDIR)\cvd.obj"
-        -@erase "$(INTDIR)\fastmath.obj"
-        -@erase "$(INTDIR)\fft4g.obj"
-        -@erase "$(INTDIR)\fft_routines.obj"
-        -@erase "$(INTDIR)\huffsv7.obj"
-        -@erase "$(INTDIR)\mppenc.obj"
-        -@erase "$(INTDIR)\pipeopen.obj"
-        -@erase "$(INTDIR)\psy.obj"
-        -@erase "$(INTDIR)\psy_tab.obj"
-        -@erase "$(INTDIR)\quant.obj"
-        -@erase "$(INTDIR)\stderr.obj"
-        -@erase "$(INTDIR)\encode_sv7.obj"
-        -@erase "$(INTDIR)\tools.obj"
-        -@erase "$(INTDIR)\vc60.idb"
-        -@erase "$(INTDIR)\vc60.pdb"
-        -@erase "$(INTDIR)\wave_in.obj"
-        -@erase "$(INTDIR)\winmsg.obj"
-        -@erase "$(OUTDIR)\mppenc.exe"
-        -@erase "$(OUTDIR)\mppenc.ilk"
-        -@erase "$(OUTDIR)\mppenc.pdb"
-
-"$(OUTDIR)" :
-    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /G5 /MLd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /Fp"$(INTDIR)\mppenc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\mppenc.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj winmm.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\mppenc.pdb" /debug /machine:I386 /out:"$(OUTDIR)\mppenc.exe" /pdbtype:sept
-LINK32_OBJS= \
-        "$(INTDIR)\analy_filter.obj" \
-        "$(INTDIR)\ans.obj" \
-        "$(INTDIR)\bitstream.obj" \
-        "$(INTDIR)\cvd.obj" \
-        "$(INTDIR)\fastmath.obj" \
-        "$(INTDIR)\fft4g.obj" \
-        "$(INTDIR)\fft_routines.obj" \
-        "$(INTDIR)\huffsv7.obj" \
-        "$(INTDIR)\mppenc.obj" \
-        "$(INTDIR)\pipeopen.obj" \
-        "$(INTDIR)\psy.obj" \
-        "$(INTDIR)\psy_tab.obj" \
-        "$(INTDIR)\quant.obj" \
-        "$(INTDIR)\stderr.obj" \
-        "$(INTDIR)\encode_sv7.obj" \
-        "$(INTDIR)\tools.obj" \
-        "$(INTDIR)\wave_in.obj" \
-        "$(INTDIR)\winmsg.obj" \
-        "$(INTDIR)\fft4gasm.obj"
-
-"$(OUTDIR)\mppenc.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
-    $(LINK32) @<<
-  $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
-   $(CPP) @<<
-   $(CPP_PROJ) $<
-<<
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("mppenc.dep")
-!INCLUDE "mppenc.dep"
-!ELSE
-!MESSAGE Warning: cannot find "mppenc.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "mppenc - Win32 Release" || "$(CFG)" == "mppenc - Win32 Debug"
-SOURCE=.\analy_filter.c
-
-"$(INTDIR)\analy_filter.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\ans.c
-
-"$(INTDIR)\ans.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\bitstream.c
-
-"$(INTDIR)\bitstream.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\cvd.c
-
-"$(INTDIR)\cvd.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\fastmath.c
-
-"$(INTDIR)\fastmath.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\fft4g.c
-
-"$(INTDIR)\fft4g.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\fft4gasm.nas
-
-!IF  "$(CFG)" == "mppenc - Win32 Release"
-
-InputPath=.\fft4gasm.nas
-InputName=fft4gasm
-
-"$(INTDIR)\fft4gasm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-        <<tempfile.bat
-        @echo off
-        "C:/PROGRAM FILES/NASM/NASMW" -d WIN32 -f win32 -o Release/$(InputName).obj $(InputPath) -l $(InputName).lst
-<<
-
-
-!ELSEIF  "$(CFG)" == "mppenc - Win32 Debug"
-
-InputPath=.\fft4gasm.nas
-InputName=fft4gasm
-
-"$(INTDIR)\fft4gasm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-        <<tempfile.bat
-        @echo off
-        "C:/PROGRAM FILES/NASM/NASMW" -d WIN32 -f win32 -o Debug/$(InputName).obj $(InputPath)
-<<
-
-
-!ENDIF
-
-SOURCE=.\fft_routines.c
-
-"$(INTDIR)\fft_routines.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\huffsv7.c
-
-"$(INTDIR)\huffsv7.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\mppenc.c
-
-"$(INTDIR)\mppenc.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\pipeopen.c
-
-"$(INTDIR)\pipeopen.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\psy.c
-
-"$(INTDIR)\psy.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\psy_tab.c
-
-"$(INTDIR)\psy_tab.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\quant.c
-
-"$(INTDIR)\quant.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\stderr.c
-
-"$(INTDIR)\stderr.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\encode_sv7.c
-
-"$(INTDIR)\encode_sv7.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\tools.c
-
-"$(INTDIR)\tools.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\wave_in.c
-
-"$(INTDIR)\wave_in.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\winmsg.c
-
-"$(INTDIR)\winmsg.obj" : $(SOURCE) "$(INTDIR)"
-
-
-
-!ENDIF
Index: penc/trunk/mppenc.plg
===================================================================
--- /mppenc/trunk/mppenc.plg	(revision 96)
+++ 	(revision )
@@ -1,16 +1,0 @@
-<html>
-<body>
-<pre>
-<h1>Build Log</h1>
-<h3>
---------------------Configuration: mppenc - Win32 Release--------------------
-</h3>
-<h3>Command Lines</h3>
-
-
-
-<h3>Results</h3>
-mppenc.exe - 0 error(s), 0 warning(s)
-</pre>
-</body>
-</html>
Index: penc/trunk/mppenc.vcproj
===================================================================
--- /mppenc/trunk/mppenc.vcproj	(revision 96)
+++ 	(revision )
@@ -1,556 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="mppenc"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				OptimizeForProcessor="1"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/mppenc.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj winmm.lib"
-				OutputFile=".\Debug/mppenc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/mppenc.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/mppenc.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG MPP_ENCODER"
-				Culture="1031"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalOptions="/GM "
-				Optimization="2"
-				InlineFunctionExpansion="2"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				StructMemberAlignment="3"
-				EnableFunctionLevelLinking="TRUE"
-				PrecompiledHeaderFile=".\Release/mppenc.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CallingConvention="1"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj winmm.lib"
-				OutputFile=".\Release/mppenc.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/mppenc.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/mppenc.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG MPP_ENCODER"
-				Culture="1031"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="">
-			<File
-				RelativePath="analy_filter.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="ans.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="bitstream.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="cvd.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="encode_sv7.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="fastmath.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="fft4g.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="fft4gasm.nas">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						CommandLine="&quot;NASMW.exe&quot; -d WIN32 -f win32 -o Debug/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot;
-"
-						Outputs="Debug/$(InputName).obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCustomBuildTool"
-						CommandLine="&quot;NASMW&quot; -d WIN32 -f win32 -o Release/&quot;$(InputName)&quot;.obj &quot;$(InputPath)&quot; -l &quot;$(InputName)&quot;.lst
-"
-						Outputs="Release/$(InputName).obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="fft_routines.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="huffsv7.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="keyboard.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="mppenc.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="pipeopen.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="psy.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="psy_tab.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="quant.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tags.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tools.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="wave_in.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="winmsg.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="">
-			<File
-				RelativePath="fastmath.h">
-			</File>
-			<File
-				RelativePath="Makefile">
-			</File>
-			<File
-				RelativePath="minimax.h">
-			</File>
-			<File
-				RelativePath="mppenc.h">
-			</File>
-			<File
-				RelativePath="predict.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="Design Proposal"
-			Filter="">
-			<File
-				RelativePath="A-frame.txt">
-			</File>
-			<File
-				RelativePath="A-gedanken.txt">
-			</File>
-			<File
-				RelativePath="A-num.txt">
-			</File>
-			<File
-				RelativePath="A-pflichtenheft.txt">
-			</File>
-			<File
-				RelativePath="A-psycho.txt">
-			</File>
-			<File
-				RelativePath="A-quant.txt">
-			</File>
-			<File
-				RelativePath="A-sample.txt">
-			</File>
-			<File
-				RelativePath="A-stereo.txt">
-			</File>
-			<File
-				RelativePath="website\coupling.txt">
-			</File>
-			<File
-				RelativePath="website\sv8file.txt">
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/mppsplit.dsp
===================================================================
--- /mppenc/trunk/mppsplit.dsp	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# Microsoft Developer Studio Project File - Name="mppsplit" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=mppsplit - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "mppsplit.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "mppsplit.mak" CFG="mppsplit - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "mppsplit - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "mppsplit - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "mppsplit - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "mppsplit___Win32_Release"
-# PROP BASE Intermediate_Dir "mppsplit___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "mppsplit___Win32_Release"
-# PROP Intermediate_Dir "mppsplit___Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "mppsplit - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "mppsplit___Win32_Debug"
-# PROP BASE Intermediate_Dir "mppsplit___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "mppsplit - Win32 Release"
-# Name "mppsplit - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\mppsplit.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/mppsplit.vcproj
===================================================================
--- /mppenc/trunk/mppsplit.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="mppsplit"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/mppsplit.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/mppsplit.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/mppsplit.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/mppsplit.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\mppsplit___Win32_Release"
-			IntermediateDirectory=".\mppsplit___Win32_Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\mppsplit___Win32_Release/mppsplit.pch"
-				AssemblerListingLocation=".\mppsplit___Win32_Release/"
-				ObjectFile=".\mppsplit___Win32_Release/"
-				ProgramDataBaseFileName=".\mppsplit___Win32_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\mppsplit___Win32_Release/mppsplit.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\mppsplit___Win32_Release/mppsplit.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\mppsplit___Win32_Release/mppsplit.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="mppsplit.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/msr.h
===================================================================
--- /mppenc/trunk/msr.h	(revision 96)
+++ 	(revision )
@@ -1,10 +1,0 @@
-/* You only need this if your gcc doesn't have this file */
-
-#define rdmsr(msr,val1,val2)     __asm__ __volatile__ ("rdmsr" : "=a" (val1), "=d" (val2) : "c" (msr))
-#define wrmsr(msr,val1,val2)     __asm__ __volatile__ ("wrmsr" : /* no outputs */ : "c" (msr), "a" (val1), "d" (val2))
-#define rdtsc(low,high)          __asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high))
-#define rdtscl(low)              __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
-#define rdtscll(val)             __asm__ __volatile__ ("rdtsc" : "=A" (val))
-#define rdpmc(counter,low,high)  __asm__ __volatile__ ("rdpmc" : "=a" (low), "=d" (high)  : "c" (counter))
-
-/* end of msr.h */
Index: penc/trunk/name.c
===================================================================
--- /mppenc/trunk/name.c	(revision 96)
+++ 	(revision )
@@ -1,250 +1,0 @@
-#define MPP_ENCODER
-#include "mppdec.h"
-#include <ctype.h>
-
-
-typedef struct {
-    unsigned char  Artist [512];
-    unsigned char  Title  [512];
-    unsigned char  Album  [512];
-    unsigned char  Year   [  5];
-    unsigned int   Number;
-} taginfo_t;
-
-
-static int
-xdigit ( char c )
-{
-    if ( (unsigned int )(c-'0') < 10 )
-        return c-'0';
-    if ( (unsigned int )(c-'A') < 6 )
-        return c-'A'+10;
-    return -1;
-}
-
-
-static void
-percent ( char* p )
-{
-    char* q = p;
-
-    for (; *p; ) {
-        if ( p[0] == '%'  &&  xdigit(p[1]) >= 0  &&  xdigit(p[2]) >= 0 )
-            *q++ = 16*xdigit(p[1]) + xdigit(p[2]), p += 3;
-        else if (p[0] == '_')
-            *q++ = ' ', p++;
-        else
-            *q++ = *p++;
-    }
-    *q = '\0';
-}
-
-
-static char*
-separator ( char* s )
-{
-    while (*s) {
-        if ( s[0] == PATH_SEP ) {
-            s[0] = '\0';
-            return s+1;
-        }
-        if ( (s[0]==' ' || s[0]=='_') && s[1]=='-' && s[2]=='-' && (s[3]==' ' || s[3]=='_') ) {
-            s[0] = '\0';
-            return s+4;
-        }
-        s++;
-    }
-    return NULL;
-}
-
-
-static int
-IsIndexType1 ( const char* s )
-{
-    if ( s[0]=='[' && isdigit(s[1])  && isdigit(s[2]) && s[3]==']' && (s[4]==' ' || s[4]=='_') )
-        return 10*s[1]+s[2]-11*'0';
-    if ( 0 == strcmp (s, "[00]") )
-        return 0;
-    return -1;
-}
-
-
-static int
-IsIndexType2 ( const char* s )
-{
-    if ( isdigit(s[0])  && isdigit(s[1]) && s[2] == '\0' )
-        return 10*s[0]+s[1]-11*'0';
-    return -1;
-}
-
-typedef int (*idxfn) (const char*);
-
-int
-ParseName ( const char* filename, taginfo_t* const T )
-{
-    unsigned char*  Components    [64];
-    idxfn           fn             [2] = { IsIndexType1, IsIndexType2 };
-    int             Ci                 = 0;
-    char            Path [PATHLEN_MAX] = "";
-    char            Name [PATHLEN_MAX];
-    char*           p;
-    int             i;
-    int             j;
-#if DRIVE_SEP != '\0'
-    char            Drive           = '@';
-#endif
-
-
-#if DRIVE_SEP != '\0'
-    // drive specified?
-    if ( isalpha (filename[0])  &&  filename[1] == DRIVE_SEP ) {
-        Drive = filename[0];
-        filename += 2;
-    }
-#endif
-
-    if ( filename[0] != PATH_SEP ) {
-        // no absolute path, so get the current folder for this drive
-        p = Path;
-#if DRIVE_SEP != '\0'
-# if defined _WIN32
-        _getdcwd  ( Drive & 0x1F, Path, sizeof Path );
-# else
-        getcurdir ( Drive & 0x1F, Path );
-# endif
-        if ( isalpha (p[0])  &&  p[1] == DRIVE_SEP )
-            p += 2;
-#else
-        getcwd ( Path, sizeof Path );
-#endif
-        // parse the current folder
-        while ( p != NULL  &&  *p != '\0' ) {
-            Components [Ci++] = p;
-            p = separator ( p );
-        }
-    }
-
-    // parse the filename
-    strcpy ( Name, filename );
-    p = Name;
-    while ( p != NULL  &&  *p != '\0' ) {
-        Components [Ci++] = p;
-        p = separator ( p );
-    }
-
-    // remove ".", ".." and names from file formats
-    for ( i = j = 0; i < Ci; i++ )
-        if      ( 0 == strcmp (Components [i], ""   ) )
-            ;
-        else if ( 0 == strcmp (Components [i], "."  ) )
-            ;
-        else if ( 0 == strcmp (Components [i], "wav") )
-            ;
-        else if ( 0 == strcmp (Components [i], "pac") )
-            ;
-        else if ( 0 == strcmp (Components [i], "mpc") )
-            ;
-        else if ( 0 == strcmp (Components [i], "mpp") )
-            ;
-        else if ( 0 == strcmp (Components [i], "mp+") )
-            ;
-        else if ( 0 == strcmp (Components [i], "mp3") )
-            ;
-        else if ( 0 == strcmp (Components [i], ".." ) )
-            j -= j ? 1 : 0;
-        else
-             Components [j++] = Components [i];
-    Ci = j;
-
-    // remove file extension
-    p = strrchr ( Components [Ci-1], '.');
-    if ( p != NULL )
-        *p = '\0';
-
-    // Merging of (CD 1), (CD 1/7), (CD 1/12) is still missing
-    // Decoding of %XX and "_" is still missing
-
-    T->Year  [0] = '\0';
-    T->Artist[0] = '\0';
-    T->Album [0] = '\0';
-    T->Title [0] = '\0';
-    T->Number    = -1;
-
-    if ( fn[0] ( Components [Ci-1]) >= 0 ) {
-        strcpy ( T->Album , Components [Ci-2] );
-        strcpy ( T->Artist, Components [Ci-3] );
-        strcpy ( T->Title , strlen (Components [Ci-1]) >= 5  ?  Components [Ci-1]+5  :  (unsigned char*)"" );
-        T->Number = fn[0] ( Components [Ci-1]);
-        goto okay;
-    }
-    if ( fn[0] ( Components [Ci-2]) >= 0 ) {
-        strcpy ( T->Album , Components [Ci-3] );
-        strcpy ( T->Artist, Components [Ci-2]+5 );
-        strcpy ( T->Title , Components [Ci-1] );
-        T->Number = fn[0] ( Components [Ci-2]);
-        goto okay;
-    }
-
-
-    if ( fn[1] ( Components [Ci-1]) == 0 ) {
-        strcpy ( T->Album , Components [Ci-2] );
-        strcpy ( T->Artist, Components [Ci-3] );
-        strcpy ( T->Title , ""                );
-        T->Number = 0;
-        goto okay;
-    }
-    if ( fn[1] ( Components [Ci-2]) >= 0 ) {
-        strcpy ( T->Album , Components [Ci-3] );
-        strcpy ( T->Artist, Components [Ci-4] );
-        strcpy ( T->Title , Components [Ci-1] );
-        T->Number = fn[1] ( Components [Ci-2]);
-        goto okay;
-    }
-    if ( fn[1] ( Components [Ci-3]) >= 0 ) {
-        strcpy ( T->Album , Components [Ci-4] );
-        strcpy ( T->Artist, Components [Ci-2] );
-        strcpy ( T->Title , Components [Ci-1] );
-        T->Number = fn[1] ( Components [Ci-3]);
-        goto okay;
-    }
-
-    for ( i = 0; i < Ci; i++)
-        printf ( "'%s' ", Components [i] );
-    printf ( "\n" );
-    return 1;
-
-okay:
-    T->Year[0] = '\0';
-    if ( strlen (T->Album) >= 8 ) {
-        p = T->Album + strlen (T->Album) - 7;
-        if (p[0] == ' ' && p[1]=='(' && p[6]=='1') {
-            i = atoi (p+2);
-            if ( i >= 1900 && i <= 2019 ) {
-                sprintf (T->Year, "%4u", i);
-                p[0] = '\0';
-            }
-        }
-    }
-    percent (T->Album);
-    percent (T->Artist);
-    percent (T->Title);
-    return 0;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    taginfo_t     T;
-    const char*   extentions [] = { ".mpc", ".mp+", ".mpp", ".wav", ".ape", ".pac", NULL };
-
-    mysetargv ( &argc, &argv, extentions );
-
-    while ( *++argv ) {
-        fprintf ( stderr, "%s\n", *argv );
-        ParseName (*argv, &T);
-        printf ( "%-40.40s %-40.40s %4.4s [%02d] %s\n", T.Artist, T.Album, T.Year, T.Number, T.Title );
-    }
-
-    return 0;
-}
Index: penc/trunk/name.dsp
===================================================================
--- /mppenc/trunk/name.dsp	(revision 96)
+++ 	(revision )
@@ -1,112 +1,0 @@
-# Microsoft Developer Studio Project File - Name="name" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=name - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "name.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "name.mak" CFG="name - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "name - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "name - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "name - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "name - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "name - Win32 Release"
-# Name "name - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\_setargv.c
-# ADD CPP /D "MPP_DECODER"
-# End Source File
-# Begin Source File
-
-SOURCE=.\name.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\tools.c
-# ADD CPP /D "MPP_DECODER"
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/name.vcproj
===================================================================
--- /mppenc/trunk/name.vcproj	(revision 96)
+++ 	(revision )
@@ -1,202 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="name"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/name.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/name.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/name.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/name.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/name.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/name.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/name.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/name.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="_setargv.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions="MPP_DECODER"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions="MPP_DECODER"
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="name.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="tools.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions="MPP_DECODER"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions="MPP_DECODER"
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/pipeopen.c
===================================================================
--- /mppenc/trunk/pipeopen.c	(revision 96)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- *  Opens a communication channel to another program using unnamed pipe mechanism and stdin/stdout.
- *
- *  (C) Frank Klemm 2001,02. All rights reserved.
- *
- *  Principles:
- *
- *  History:
- *    2001          created
- *    2002
- *
- *  Global functions:
- *    - pipeopen
- *
- *  TODO:
- *    -
- */
-
-//#define DEBUG2
-
-#include "mppdec.h"
-#include <ctype.h>
-
-
-/*
- *
- */
-
-static int
-EscapeProgramPathName ( const char*  longprogname,
-                        char*        escaped,
-                        size_t       len )
-{
-    int   ret = 0;
-
-#ifdef _WIN32
-    ret = GetShortPathName ( longprogname, escaped, len );
-#else
-    if ( strlen (longprogname) <= len-3 )
-        ret = sprintf ( escaped, "\"%s\"", longprogname );      // Note that this only helps against spaces and some similar things in the file name, not against all strange stuff
-#endif
-
-    if ( ret <= 0  ||  ret >= (int)len ) {
-    }
-
-    return ret;
-}
-
-
-/*
- *
- */
-
-static FILE*
-OpenPipeWhenBinaryExist ( const char*  path,
-                          size_t       pathlen,
-                          const char*  executable_filename,
-                          const char*  command_line )
-{
-    char   filename [4096];
-    char   cmdline  [4096];
-    char*  p  = filename;
-    FILE*  fp;
-
-    for ( ; *path  &&  pathlen--; path++ )
-        if ( *path != '"' )
-            *p++ = *path;
-    *p++ = PATH_SEP;
-    strcpy ( p, executable_filename );
-#ifdef DEBUG2
-    stderr_printf ("Test for file »%s«        \n", filename );
-#endif
-    fp = fopen ( filename, "rb" );
-    if ( fp != NULL ) {
-        fclose ( fp );
-        EscapeProgramPathName ( filename, cmdline, sizeof cmdline );
-        strcat ( cmdline, command_line );
-        fp = POPEN_READ_BINARY_OPEN ( cmdline );
-#ifdef DEBUG2
-        stderr_printf ("Executed »%s«\n", cmdline );
-#endif
-   }
-   return fp;
-}
-
-
-/*
- *
- */
-
-static FILE*
-TracePathList ( const char*  p,
-                const char*  executable_filename,
-                const char*  command_line )
-{
-    const char*  nextsep;
-    FILE*        fp;
-
-    while ( p != NULL   &&  *p != '\0' ) {
-        if ( (nextsep = strchr (p, ENVPATH_SEP)) == NULL ) {
-            fp = OpenPipeWhenBinaryExist ( p, (size_t)         -1, executable_filename, command_line );
-            p  = NULL;
-        }
-        else {
-            fp = OpenPipeWhenBinaryExist ( p, (size_t)(nextsep-p), executable_filename, command_line );
-            p  = nextsep + 1;
-        }
-        if ( fp != NULL )
-            return fp;
-    }
-    return NULL;
-}
-
-
-/*
- *  Executes command line given by »command«.
- *  The command must be found in some predefined paths or in the ${PATH} aka %PATH%
- *  The char »#« in command is replaced by the contents
- *  of »filename«. Special characters are escaped.
- */
-
-FILE*
-pipeopen ( const char* command, const char* filename )
-{
-    static const char  pathlist [] =
-#ifdef _WIN32
-        ".";
-#else
-        "/usr/bin:/usr/local/bin:/opt/mpp:.";
-#endif
-    char          command_line        [4096];           // » -o - bar.pac«
-    char          executable_filename [4096];           // »foo.exe«
-    char*         p;
-    const char*   q;
-    FILE*         fp;
-
-    // does the source file exist and is readble?
-    if ( (fp = fopen (filename, "rb")) == NULL ) {
-        stderr_printf ("file '%s' not found.\n", filename );
-        return NULL;
-    }
-    fclose (fp);
-
-    // extract executable name from the 'command' to executable_filename, append executable extention
-    p = executable_filename;
-    for ( ; *command != ' '  &&  *command != '\0'; command++ )
-        *p++ = *command;
-    strcpy ( p, EXE_EXT );
-
-
-    // Copy 'command' to 'command_line' replacing '#' by filename
-    p = command_line;
-    for ( ; *command != '\0'; command++ ) {
-        if ( *command != '#' ) {
-            *p++ = *command;
-        }
-        else {
-            q = filename;
-            if (*q == '-') {
-                *p++ = '.';
-                *p++ = PATH_SEP;
-            }
-#ifdef _WIN32                           // Windows secure Way to "escape"
-            *p++ = '"';
-            while (*q)
-                *p++ = *q++;
-            *p++ = '"';
-#else                                   // Unix secure Way to \e\s\c\a\p\e
-            while (*q) {
-                if ( !isalnum(*q)  &&  *q != '.'  &&  *q != '-'  &&  *q != '_'  &&  *q != '/' )
-                    *p++ = '\\';
-                *p++ = *q++;
-            }
-#endif
-        }
-    }
-    *p = '\0';
-
-    // Try the several built-in paths to find binary
-    fp = TracePathList ( pathlist       , executable_filename, command_line );
-    if ( fp != NULL )
-        return fp;
-
-    // Try the PATH settings to find binary (Why we must search for the executable in all PATH settings? --> popen itself do not return useful information)
-    fp = TracePathList ( getenv ("PATH"), executable_filename, command_line );
-    if ( fp != NULL )
-        return fp;
-
-#ifdef DEBUG2
-    stderr_printf ("Nothing found to execute.\n" );
-#endif
-    return NULL;
-}
-
-/* end of pipeopen.c */
Index: penc/trunk/pns.c
===================================================================
--- /mppenc/trunk/pns.c	(revision 96)
+++ 	(revision )
@@ -1,201 +1,0 @@
-#include <stdio.h>
-#include <math.h>
-
-float X [18] = {
-    18.000000f,         // 0.
-    11.981016f,
-     8.965634f,
-     7.172353f,
-     5.962646f,
-     5.109376f,
-     4.470957f,
-     3.966050f,
-     3.569583f,
-     3.241481f,
-     2.970905f,
-     2.740498f,
-     2.547215f,
-     2.374246f,
-     2.224069f,
-     2.092965f,
-     1.978325f,
-     1.873230f,         // 1.
-} ;
-
-#define M_PI    3.14159265358979
-
-static const  unsigned char    Parity [256] = {  // parity
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
-};
-
-static unsigned int  __r1 = 1;
-static unsigned int  __r2 = 1;
-
-static void
-set_seed ( unsigned int  seed )
-{
-    __r1 = seed != 0 ? seed : 1;                // 0 is a forbidden value which locks the generator
-    __r2 = 1;                                   // there are several (8389119) forbidden codes. 1 is not one of them
-}
-
-
-unsigned int
-random_int ( void )
-{
-    unsigned int  t1, t2, t3, t4;
-
-    t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
-    t1  &= 0xF5;        t2 >>= 25;              // on CPUs without parity, can be implemented in C and avoid unpredictable
-    t1   = Parity [t1]; t2  &= 0x63;            // jumps and slow rotate through the carry flag operations.
-    t1 <<= 31;          t2   = Parity [t2];
-
-    return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
-}
-
-
-
-int  usePlevel;
-int  MinPNSSubband;
-
-static float  A [36] [36];
-static float  B [1801];
-
-static void
-Init ( void )
-{
-        int     i;
-        int     j;
-        double  w;
-
-        for ( i = 0; i < 36; i += 2 ) {
-                for ( j = 0; j < 36; j++ ) {
-                        w = 2 * M_PI * (i+1) / 36 * j;
-                        A [i+0] [j] = cos (w);
-                        A [i+1] [j] = sin (w);
-                }
-        }
-        for ( i = 0; i <= 1800; i++ )
-                B [i] = 1.0 ;
-        for ( i = 0; i < 18000; i++ ) {
-                j     =
-                B [j] = 0.01
-        }
-}
-
-
-        static double T [4];
-        static short k;
-
-
-static float
-Penalties ( float x, int n )                                            // Value between 1 and 18
-{                                                                                                       //             =>1    =>0
-// Values between 1.0 and 2.0 are noise       -> return 0.0 to 0.1
-// Values between 6.0 und 18.0 are not noise  -> return 0.9 to 1.0
-
-//      static double T [4];
-        //static short k;
-
-
-        T [n+0] += x;
-        T [n+2] += 1;
-
-        if ( k++ )
-                return 0.;
-        printf ( "%8.6f%c", T[n]/T[n+2], n ? '\n' : '\t'  );
-        return B [ (int) (100. * x) ] ;
-}
-
-
-int
-TestForPNSUsage ( int          Subband,
-                                  float        SMR,                                     // 1 = 0 dB, 4 = 6 dB
-                                  const float  Samples[36] )            // Samples are freed of SCF and decolored upon prediction
-{
-        float  x;
-        float  xx;
-        float  tmp;
-        int    i;
-        int    j;
-        float  Result [36];
-        float  Ptime;
-        float  Pfreq;
-        float  Plevel;
-
-        if ( Subband < MinPNSSubband )
-                return 0;
-
-        x = xx = 0. ;
-        for ( i = 0; i < 36; i += 2 ) {
-                tmp = Samples[i] * Samples[i] + Samples[i+1] * Samples[i+1];
-                x  += tmp;
-                xx += tmp * tmp;
-        }
-        if ( x == 0. )
-                return 0;
-
-        Plevel = fabs (x / 18.) - 1. ;
-        Ptime  = Penalties ( 18.*xx / (x*x), 0 );       // possible values between 1 and 18
-
-        return 0;
-        for ( i = 0; i < 36; i++ ) {
-                x = 0. ;
-                for ( j = 0; j < 36; j++ )
-                        x += Samples[j] * A[i][j];
-                Result [i] = x;
-        }
-
-        x = xx = 0. ;
-        for ( i = 0; i < 36; i += 2 ) {
-                tmp = Result[i] * Result[i] + Result[i+1] * Result[i+1];
-                x  += tmp;
-                xx += tmp * tmp;
-        }
-
-        Pfreq  = Penalties ( 18.*xx / (x*x), 1 );       // possible values between 1 and 18
-
-        if ( usePlevel ) {
-                tmp = (1. - Plevel) * Ptime * Pfreq ;
-        }
-        else {
-                tmp = 1. * Ptime * Pfreq ;
-        }
-
-        if ( tmp < 1 - 1. / SMR )
-                return 0;
-
-        return 1;
-}
-
-
-int
-main ( void )
-{
-        int           i;
-        int           j;
-        static float  X [36];
-        int l;
-
-        Init ();
-        for ( l = 2; l <= 36; l+=2 ) {
-                printf ("%2u: ", l );
-                memset ( T, 0, sizeof(T) );
-        for ( i = 0; i < 0x60000; i++ ) {
-                for ( j = 0; j < l; j++ ) {
-                        X [j] = ((double) (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int () + (int) random_int ()) * 1.e-10 ;
-                        //X[j] = j;
-                }
-                TestForPNSUsage ( 0, 1, X );
-        }
-        printf ("\n");
-        }
-
-        return 0 ;
-}
Index: penc/trunk/pns.dsp
===================================================================
--- /mppenc/trunk/pns.dsp	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# Microsoft Developer Studio Project File - Name="pns" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pns - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pns.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pns.mak" CFG="pns - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pns - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pns - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pns - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "pns___Win32_Release"
-# PROP BASE Intermediate_Dir "pns___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "pns___Win32_Release"
-# PROP Intermediate_Dir "pns___Win32_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "pns - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "pns___Win32_Debug"
-# PROP BASE Intermediate_Dir "pns___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "pns___Win32_Debug"
-# PROP Intermediate_Dir "pns___Win32_Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pns - Win32 Release"
-# Name "pns - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pns.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/pns.vcproj
===================================================================
--- /mppenc/trunk/pns.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="pns"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\pns___Win32_Debug"
-			IntermediateDirectory=".\pns___Win32_Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\pns___Win32_Debug/pns.pch"
-				AssemblerListingLocation=".\pns___Win32_Debug/"
-				ObjectFile=".\pns___Win32_Debug/"
-				ProgramDataBaseFileName=".\pns___Win32_Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\pns___Win32_Debug/pns.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\pns___Win32_Debug/pns.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\pns___Win32_Debug/pns.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\pns___Win32_Release"
-			IntermediateDirectory=".\pns___Win32_Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\pns___Win32_Release/pns.pch"
-				AssemblerListingLocation=".\pns___Win32_Release/"
-				ObjectFile=".\pns___Win32_Release/"
-				ProgramDataBaseFileName=".\pns___Win32_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\pns___Win32_Release/pns.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\pns___Win32_Release/pns.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\pns___Win32_Release/pns.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="pns.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/predict.h
===================================================================
--- /mppenc/trunk/predict.h	(revision 96)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-
-#define MAX_LPC_ORDER       35
-#define log2(x)             ( log (x) * (1./M_LN2) )
-#define ORDER_PENALTY       0
-
-
-static int                                     // best prediction order model
-CalculateLPCCoeffs ( Int32_t*  buf,            // Samples
-                     size_t    nbuf,           // Number of samples
-                     Int32_t   offset,         //
-                     double*   lpcout,         // quantized prediction coefficients
-                     int       nlpc,           // max. prediction order
-                     float*    psigbit,        // expected number of bits per original signal sample
-                     float*    presbit )       // expected number of bits per residual signal sample
-{
-    static double*  fbuf  = NULL;
-    static int      nflpc = 0;
-    static int      nfbuf = 0;
-    int             nbit;
-    int             i;
-    int             j;
-    int             bestnbit;
-    int             bestnlpc;
-    double          e;
-    double          bestesize;
-    double          ci;
-    double          esize;
-    double          acf [MAX_LPC_ORDER + 1];
-    double          ref [MAX_LPC_ORDER + 1];
-    double          lpc [MAX_LPC_ORDER + 1];
-    double          tmp [MAX_LPC_ORDER + 1];
-    double          escale = 0.5 * M_LN2 * M_LN2 / nbuf;
-    double          sum;
-
-    if ( nlpc >= nbuf )                         // if necessary, limit the LPC order to the number of samples available
-        nlpc = nbuf - 1;
-
-    if ( nlpc > nflpc  ||  nbuf > nfbuf ) {     // grab some space for a 'zero mean' buffer of floats if needed
-        if ( fbuf != NULL )
-            free ( fbuf - nflpc );
-        fbuf  = nlpc + ((double*) calloc ( nlpc+nbuf, sizeof (*fbuf) ));
-        nfbuf = nbuf;
-        nflpc = nlpc;
-    }
-
-    e = 0.;
-    for ( j = 0; j < nbuf; j++ ) {              // zero mean signal and compute energy
-        sum = fbuf [j] = buf[j] - (double)offset;
-        e  += sum * sum;
-    }
-
-    esize     = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
-    *psigbit  = esize;                          // return the expected number of bits per original signal sample
-
-    acf [0]   = e;                              // store the best values so far (the zeroth order predictor)
-    bestnlpc  = 0;
-    bestnbit  = nbuf * esize;
-    bestesize = esize;
-
-    for ( i = 1; i <= nlpc  &&  e > 0.  &&  i < bestnlpc + 4; i++ ) {   // just check two more than bestnlpc
-
-        sum = 0.;
-        for ( j = i; j < nbuf; j++ )                                    // compute the jth autocorrelation coefficient
-            sum += fbuf [j] * fbuf [j-i];
-        acf [i] = sum;
-
-        ci = 0.;                                                        // compute the reflection and LP coeffients for order j predictor
-        for ( j = 1; j < i; j++ )
-            ci += lpc [j] * acf [i-j];
-        lpc [i] = ref [i] = ci = (acf [i] - ci) / e;
-        for ( j = 1; j < i; j++ )
-            tmp [j] = lpc [j] - ci * lpc [i-j];
-        for ( j = 1; j < i; j++ )
-            lpc [j] = tmp [j];
-
-        e    *= 1 - ci*ci;                                              // compute the new energy in the prediction residual
-        esize = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
-
-        nbit = nbuf * esize + i * ORDER_PENALTY;
-        if ( nbit < bestnbit ) {                                        // store this model if it is the best so far
-            bestnlpc  = i;                                              // store best model order
-            bestnbit  = nbit;
-            bestesize = esize;
-
-            for ( j = 0; j < bestnlpc; j++ )                            // store the quantized LP coefficients
-                lpcout [j] = lpc [j+1];
-        }
-    }
-
-    *presbit = bestesize;                       // return the expected number of bits per residual signal sample
-    return bestnlpc;                            // return the best model order
-}
-
-
-static void
-Pred ( const unsigned int*  new,
-       unsigned int*        old )
-{
-    static Double  DOUBLE [36];
-    Float   org;
-    Float   pred;
-    int     i;
-    int     j;
-    int     sum = 18;
-    int     order;
-    double  oldeff = 0.;
-    double  neweff = 0.;
-
-    for ( i = 0; i < 36; i++ )
-        sum += old [i];
-    sum = (int) floor (sum / 36.);
-
-    order = CalculateLPCCoeffs ( old, 36, sum*0, DOUBLE, 35, &org, &pred );
-
-    printf ("avg: %4u  [%2u]  %.2f  %.2f\n\n", sum, order, org, pred );
-    if ( order < 1 )
-        return;
-
-    for ( i = 0; i < order; i++ )
-        printf ("%f ", DOUBLE[i] );
-    printf ("\n");
-
-    for ( i = 0; i < 36; i++ ) {
-        double  sum = 0.;
-        for ( j = 1; j <= order; j++ ) {
-            sum += (i-j < 0 ? old[i-j+36] : new [i-j]) * DOUBLE [j-1];
-        }
-        printf ("%2u: %6.2f %3d\n", i, sum, new [i] );
-        oldeff += new[i]       * new[i];
-        neweff += (sum-new[i]) * (sum-new[i]);
-    }
-    printf ("%6.2f %6.2f\n", sqrt(oldeff), sqrt(neweff) );
-}
-
-
-void
-Predicate ( int Channel, int Band, unsigned int* x, int* scf )
-{
-    static Int32_t  OLD [2] [32] [36];
-    int    i;
-
-    printf ("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
-    for ( i = 0; i < 36; i++ )
-        printf ("%2d ", OLD [Channel][Band][i] );
-    printf ("\n");
-    for ( i = 0; i < 36; i++ )
-        printf ("%2d ", x[i] );
-    printf ("\n");
-    printf ("%2u-%2u-%2u  ", scf[0], scf[1], scf[2] );
-    Pred ( x, OLD [Channel][Band] );
-    for ( i = 0; i < 36; i++ )
-        OLD [Channel][Band][i] = x[i];
-}
-
-/* end of predict.c */
Index: penc/trunk/profile.c
===================================================================
--- /mppenc/trunk/profile.c	(revision 96)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include "mppdec.h"
-#include "profile.h"
-
-/*
- *  For every architecture you want to profile/checkpoint you need the following items:
- *
- *  uintmax_t:
- *      A type which is used for time calculation, mostly 32 bit or 64 bit,
- *      should be large enough so that no overruns occures during the measurement
- *  STD_TIMER_CLK:
- *      Clock frequency of the used timer in MHz
- *  RDTSC():
- *      A macro reading the current time into a local variable timetemp with the type uintmax_t,
- *      Time is in 1.e-6/STD_TIMER_CLK seconds.
- *
- *  Places:
- *      typedef of uintmax_t:     profile.h
- *      RDTSC():                  profile.h
- *      STD_TIMER_CLK:            profile.c
- *      no-inline functions maybe needed by RDTSC():
- *                                profile.c
- */
-
-#ifdef PROFILE
-
-#ifdef __TURBOC__
-# define STD_TIMER_CLK  1.193181667 /* MHz */
-
-uintmax_t
-readtime ( void )               /* PC onboard timer */
-{
-    asm  XOR   AX, AX
-    asm  MOV   ES, AX
-    asm  OUT   67, AL
-    asm  MOV   DX, ES:[46Ch]
-    asm  IN    AL, 64
-    asm  XCHG  AL, AH
-    asm  IN    AL, 64
-    asm  XCHG  AL, AH
-    asm  NEG   AX
-}
-
-#elif defined USE_SYSV_TIMER
-# define STD_TIMER_CLK    1.0000000 /* MHz */
-
-# include <sys/time.h>
-# include <unistd.h>
-
-uintmax_t
-readtime ( void )               /* System V timer */
-{
-    struct timeval  tv;
-
-    gettimeofday ( &tv, NULL );
-    return tv.tv_sec * (uintmax_t)1000000LU + tv.tv_usec;
-}
-
-#else
-# define STD_TIMER_CLK  233.3333333 /* MHz */
-#endif
-
-
-uintmax_t       timecounter    [256];
-const char*     timename       [256];
-unsigned char   functionstack [1024];
-unsigned char*  functionstack_pointer = functionstack;
-
-
-static void Cdecl
-signal_handler ( int signum )
-{
-    char            name [128];
-    char            file [128];
-    char            no   [ 32];
-    unsigned char*  f;
-
-    (void) stderr_printf ( "\n\nSignal %d detected. Call stack:\n", signum );
-    for ( f = functionstack+1; f <= functionstack_pointer; f++ ) {
-        (void) sscanf        ( timename[*f], "%128[^|]|%128[^|]|%32[0-9]", name, file, no );
-        (void) stderr_printf ( "%-24.24s%12.12s:%s\n", name, file, no );
-    }
-    _exit ( 128+signum );
-}
-
-
-void
-set_signal ( void )
-{
-    signal ( SIGILL , signal_handler );
-    signal ( SIGINT , signal_handler );
-    signal ( SIGSEGV, signal_handler );
-    signal ( SIGFPE , signal_handler );
-}
-
-
-void
-report ( void )
-{
-    static char  dash [] = "---------------------------------------";
-    uintmax_t    sum;
-    uintmax_t    max;
-    int          i;
-    int          j;
-    int          k;
-    char         name [128];
-    char         file [128];
-    char         no   [ 32];
-    size_t       filelen;
-    double       MHz = STD_TIMER_CLK;
-
-#ifdef __linux__
-    FILE*        fp;
-
-    // read out CPU frequency if proc-FS is present
-    if ( (fp = fopen ("/proc/cpuinfo", "r")) != NULL ) {
-        while ( fgets(name, sizeof(name), fp) )
-            if ( 1 == sscanf ( name, "cpu MHz : %lf", &MHz ) )
-                break;
-        (void) fclose (fp);
-    }
-#endif
-
-    // calculate total time
-    for ( sum = 0, i = 1; i < sizeof(timecounter)/sizeof(*timecounter); i++ )
-        sum += timecounter [i];
-
-    (void) fprintf ( stderr, "\n%s%s\n", dash, dash );
-    (void) fprintf ( stderr, "100.0%%   %13.6f ms   *** TOTAL ***%25s[%.1f MHz]\n", sum/(MHz*1000.), "", MHz );
-
-    // output sorted
-    while ( 1 ) {
-        for ( max = 0, j = 1; j < sizeof(timecounter)/sizeof(*timecounter); j++ )
-            if ( timecounter [j] > max )
-                max = timecounter [k = j];
-        if (max == 0)
-            break;
-        sscanf ( timename [k], "%128[^|]|%128[^|]|%32[0-9]", name, file, no );
-        filelen = strlen (file);
-        (void) fprintf ( stderr, "%6.2f%%  %13.6f ms   %-28.28s%18.18s:%s\n",
-                         100. * timecounter[k] / sum, timecounter[k] / (MHz*1000.),
-                         name, filelen < 18 ? file : file+filelen-18, no );
-        timecounter [k] = 0;
-    }
-
-    (void) fprintf ( stderr, "%s%s\n", dash, dash );
-    (void) fflush  ( stderr );
-}
-
-#endif /* PROFILE */
-
-/* end of profile.c */
Index: penc/trunk/profile.h
===================================================================
--- /mppenc/trunk/profile.h	(revision 96)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef MPPDEC_PROFILE_H
-#define MPPDEC_PROFILE_H
-
-#ifdef PROFILE
-
-/* T I M E C O U N T - F U N C T I O N */
-# if   defined _WIN32
-typedef /*unsigned*/ __int64  uintmax_t;
-#pragma warning ( disable: 4035 )
-static __inline uintmax_t  rdtscll ( void ) { __asm { rdtsc }; }
-#pragma warning ( default: 4035 )
-#  define RDTSC()  timetemp = rdtscll ()
-#  define __FUNCTION__  "?"
-# elif defined __TURBOC__
-typedef signed long  uintmax_t;
-uintmax_t readtime ( void );
-#  define RDTSC()  timetemp = readtime ()
-#  define __FUNCTION__  "?"
-# else
-typedef unsigned long long  uintmax_t;
-#  include <asm/msr.h>
-#  define RDTSC()  rdtscll (timetemp)
-# endif /* _WIN32 */
-
-
-/* M A C R O S */
-# define _STR(x)    #x
-# define __STR(x)   _STR(x)
-
-# define ENTER(x)  do {                                                             \
-                     uintmax_t  timetemp;                                           \
-                     RDTSC();                                                       \
-                     timecounter[*functionstack_pointer]       += timetemp;         \
-                     timecounter[*++functionstack_pointer = x] -= timetemp;         \
-                     timename[x] = __FUNCTION__ "()|" __FILE__ "|" __STR(__LINE__); \
-                   } while (0)
-
-# define NEXT(x,n) do {                                                      \
-                     uintmax_t  timetemp;                                    \
-                     RDTSC();                                                \
-                     timecounter[*functionstack_pointer]     += timetemp;    \
-                     timecounter[*functionstack_pointer = x] -= timetemp;    \
-                     timename[x] = __FUNCTION__ "-" __STR(n) "|" __FILE__ "|" __STR(__LINE__); \
-                   } while (0)
-
-# define LEAVE(x)  do {                                                  \
-                     uintmax_t  timetemp;                                \
-                     RDTSC();                                            \
-                     timecounter[x]                        += timetemp;  \
-                     timecounter[*--functionstack_pointer] -= timetemp;  \
-                   } while (0)
-
-# define START()   set_signal ()
-# define REPORT()  report ()
-
-/* V A R I A B L E S */
-extern uintmax_t       timecounter    [256];
-extern const char*     timename       [256];
-extern unsigned char   functionstack [1024];
-extern unsigned char*  functionstack_pointer;
-
-/* F U N C T I O N S */
-void  set_signal ( void );
-void  report     ( void );
-
-#else
-
-/* M A C R O S */
-# define START()
-# define ENTER(x)
-# define NEXT(x,n)
-# define LEAVE(x)
-# define REPORT()
-
-#endif /* PROFILE */
-
-#endif /* MPPDEC_PROFILE_H */
-
-/* end of profile.h */
Index: penc/trunk/psy.c
===================================================================
--- /mppenc/trunk/psy.c	(revision 96)
+++ 	(revision )
@@ -1,1309 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *  Prediction
- *  Short-Block-detection with smooth inset
- *  revise CalcMSThreshold
- *  /dev/audio for Windows too
- *  revise PNS/IS
- *  CVS with smoother inset
- *  several files per call
- *  revise ANS with changing SCFs
-
-  * No IS
-  * PNS estimation very rough, also IS should be used to reduce data rate in the side channel
-  * ANS problems at Frame boundaries when resolution changes
-  * ANS problems at Subframe boundaries when SCF changes
-  * CVS+ with smoother transition
-
-----------------------------------------
-
-Optimize Tabelle[18] (use second table)
-CVS+
-
-- ANS is disregarded during the search for the best Res
-- ANS messes up if res changes (each 36 samples) and/or SCF changes (each 12 samples)
-- PNS not in difference signal
-
-- implement IS in decoder
-- Experimental Quantizer with complete energy preservation
-  - 1D, calculated
-  - 2D, calculated
-  - 2D, manually modified, coeffs set to 1.f
-
- */
-
-#include "mppenc.h"
-
-/* V A R I A B L E S */
-/* further switches for the psymodel */
-unsigned int  CVD_used;         // global flag for ClearVoiceDetection
-float         varLtq;           // variable threshold in quiet
-unsigned int  tmpMask_used;     // global flag for temporal masking
-float         ShortThr;         // Factor to calculate the masking threshold with transients
-float         minSMR;           // minimum SMR for all subbands
-
-float         a          [PART_LONG];
-float         b          [PART_LONG];
-float         c          [PART_LONG];
-float         d          [PART_LONG];           // Integrations for tmpMask
-static float  Xsave_L    [3 * 512];
-static float  Xsave_R    [3 * 512];             // FFT-Amplitudes L/R
-static float  Ysave_L    [3 * 512];
-static float  Ysave_R    [3 * 512];             // FFT-Phases L/R
-float         T_L        [PART_LONG];
-float         T_R        [PART_LONG];           // time-constants for tmpMask
-float         pre_erg_L[2][PART_SHORT];
-float         pre_erg_R[2][PART_SHORT];          // Preecho-control short
-float         PreThr_L   [PART_LONG];
-float         PreThr_R   [PART_LONG];           // for Pre-Echo-control L/R
-float         tmp_Mask_L [PART_LONG];
-float         tmp_Mask_R [PART_LONG];           // for Post-Masking L/R
-int           Vocal_L    [MAX_CVD_LINE + 4];
-int           Vocal_R    [MAX_CVD_LINE + 4];    // FFT-Line belongs to harmonic?
-
-/* F U N C T I O N S */
-// Resets Arrays
-void
-Init_Psychoakustik ( void )
-{
-    int  i;
-
-    ENTER(200);
-    // generate FFT lookup-tables with largest FFT-size of 1024
-    Init_FFT ();
-
-    // setting pre-echo variables to Ltq
-    for ( i = 0; i < PART_LONG; i++ ) {
-        pre_erg_L  [0][i/3] = pre_erg_R  [0][i/3] =
-        pre_erg_L  [1][i/3] = pre_erg_R  [1][i/3] =
-        tmp_Mask_L [i]   = tmp_Mask_R [i]   =
-        PreThr_L   [i]   = PreThr_R   [i]   = partLtq [i];
-    }
-
-    // initializing arrays with zero
-    memset ( Xsave_L,   0, sizeof Xsave_L );
-    memset ( Xsave_R,   0, sizeof Xsave_R );
-    memset ( Ysave_L,   0, sizeof Ysave_L );
-    memset ( Ysave_R,   0, sizeof Ysave_R );
-    memset ( a,         0, sizeof a       );
-    memset ( b,         0, sizeof b       );
-    memset ( c,         0, sizeof c       );
-    memset ( d,         0, sizeof d       );
-    memset ( T_L,       0, sizeof T_L     );
-    memset ( T_R,       0, sizeof T_R     );
-    memset ( Vocal_L,   0, sizeof Vocal_L );
-    memset ( Vocal_R,   0, sizeof Vocal_R );
-
-    LEAVE(200);
-    return;
-}
-
-
-// VBRmode 1: Adjustment of all SMRs via a factor (offset of SMRoffset dB)
-// VBRmode 2: SMRs have a minimum of minSMR dB
-static void
-RaiseSMR_Signal ( const int MaxBand, float* signal, float tmp )
-{
-    int    Band;
-    float  z = 0.;
-
-    for ( Band = MaxBand; Band >= 0; Band-- ) {
-        if ( z < signal [Band]  ) z = signal [Band];
-        if ( z > tmp            ) z = tmp;
-        if ( signal [Band]  < z ) signal [Band] = z;
-    }
-}
-
-
-void
-RaiseSMR ( const int MaxBand, SMRTyp* smr )
-{
-    float  tmp = POW10 ( 0.1 * minSMR );
-
-    ENTER(201);
-    RaiseSMR_Signal ( MaxBand, smr->L, tmp );
-    RaiseSMR_Signal ( MaxBand, smr->R, tmp );
-    RaiseSMR_Signal ( MaxBand, smr->M, tmp );
-    RaiseSMR_Signal ( MaxBand, smr->S, 0.5 * tmp );
-
-    LEAVE(201);
-    return;
-}
-
-// input : *smr
-// output: *smr, *ms, *x        (only the entries for L/R contain relevant data)
-// Check if either M/S- or L/R-coding has a lower perceptual entropy
-// Choose the better mode, copy the appropriate data into the
-// arrays that belong to L and R and set the ms-Flag accordingly.
-void
-MS_LR_Entscheidung ( const int MaxBand, unsigned char* ms, SMRTyp* smr, SubbandFloatTyp* x )
-{
-    int     Band;
-    int     n;
-    float   PE_MS;
-    float   PE_LR;
-    float   tmpM;
-    float   tmpS;
-    float*  l;
-    float*  r;
-
-    ENTER(202);
-
-    for ( Band = 0; Band <= MaxBand; Band++ ) {        // calculate perceptual entropy
-        PE_LR = PE_MS = 1.f;
-        if (smr->L[Band] > 1.) PE_LR *= smr->L[Band];
-        if (smr->R[Band] > 1.) PE_LR *= smr->R[Band];
-        if (smr->M[Band] > 1.) PE_MS *= smr->M[Band];
-        if (smr->S[Band] > 1.) PE_MS *= smr->S[Band];
-
-        if ( PE_MS < PE_LR ) {
-            ms[Band] = 1;
-
-            // calculate M/S-signal and copies it to L/R-array
-            l = x[Band].L;
-            r = x[Band].R;
-            for ( n = 0; n < 36; n++, l++, r++ ) {
-                tmpM = (*l + *r) * 0.5f;
-                tmpS = (*l - *r) * 0.5f;
-                *l   = tmpM;
-                *r   = tmpS;
-            }
-
-            // copy M/S - SMR to L/R-fields
-            smr->L[Band] = smr->M[Band];
-            smr->R[Band] = smr->S[Band];
-        }
-        else {
-            ms[Band] = 0;
-        }
-    }
-
-    LEAVE(202);
-    return;
-}
-
-// input : FFT-spectrums *spec0 und *spec1
-// output: energy in the individual subbands *erg0 and *erg1
-// With Butfly[], you can calculate the results of aliasing during calculation 
-// of subband energy from the FFT-spectrums.
-static void
-SubbandEnergy ( const int     MaxBand,
-                float*        erg0,
-                float*        erg1,
-                const float*  spec0,
-                const float*  spec1 )
-{
-    int    n;
-    int    k;
-    int    alias;
-    float  tmp0;
-    float  tmp1;
-
-    ENTER(203);
-
-    // Is this here correct for FFT-based data or is this calculation rule only for MDCTs???
-
-    for ( k = 0; k <= MaxBand; k++ ) {                  // subband index
-        tmp0 = tmp1 = 0.f;
-        for ( n = 0; n < 16; n++, spec0++, spec1++ ) {  // spectral index
-            tmp0 += *spec0;
-            tmp1 += *spec1;
-
-            // Consideration of Aliasing between the subbands
-            if      ( n <   +sizeof(Butfly)/sizeof(*Butfly)  &&  k !=  0 ) {
-                alias = -1 - (n<<1);
-                tmp0 += Butfly [n]    * (spec0[alias] - *spec0);
-                tmp1 += Butfly [n]    * (spec1[alias] - *spec1);
-            }
-            else if ( n > 15-sizeof(Butfly)/sizeof(*Butfly)  &&  k != 31 ) {
-                alias = 31 - (n<<1);
-                tmp0 += Butfly [15-n] * (spec0[alias] - *spec0);
-                tmp1 += Butfly [15-n] * (spec1[alias] - *spec1);
-            }
-        }
-        *erg0++ = tmp0;
-        *erg1++ = tmp1;
-    }
-
-    LEAVE(203);
-    return;
-}
-
-// input : FFT-Spectrums *spec0 and *spec1
-// output: energy in the individual partitions *erg0 and *erg1
-static void
-PartitionEnergy ( float*        erg0,
-                  float*        erg1,
-                  const float*  spec0,
-                  const float*  spec1 )
-{
-    unsigned int  n;
-    unsigned int  k;
-    float         e0;
-    float         e1;
-
-    ENTER(204);
-
-#if 000000
-    for ( n = 0; n < PART_LONG; n++ ) {
-        k  = wh[n] - wl[n];
-        e0 = *spec0++;
-        e1 = *spec1++;
-        while ( k-- ) {
-            e0 += *spec0++;
-            e1 += *spec1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-#else
-    n = 0;
-
-    for ( ; n < 23; n++ ) {             // 11 or 23
-        k  = wh[n] - wl[n];
-        e0 = *spec0++;
-        e1 = *spec1++;
-        while ( k-- ) {
-            e0 += *spec0++;
-            e1 += *spec1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-
-    for ( ; n < 48; n++ ) {             // 37 ... 46, 48, 57
-        k  = wh[n] - wl[n];
-        e0 = sqrt (*spec0++);
-        e1 = sqrt (*spec1++);
-        while ( k-- ) {
-            e0 += sqrt (*spec0++);
-            e1 += sqrt (*spec1++);
-        }
-        *erg0++ = e0*e0 * iw[n];
-        *erg1++ = e1*e1 * iw[n];
-    }
-
-    for ( ; n < PART_LONG; n++ ) {
-        k  = wh[n] - wl[n];
-        e0 = *spec0++;
-        e1 = *spec1++;
-        while ( k-- ) {
-            e0 += *spec0++;
-            e1 += *spec1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-
-
-#endif
-
-    LEAVE(204);
-    return;
-}
-
-
-// input : FFT-Spectrums *spec0, *spec1 and unpredictability *cw0 and *cw1
-// output: weighted energy in the individual partitions *erg0, *erg1
-static void
-WeightedPartitionEnergy ( float*        erg0,
-                          float*        erg1,
-                          const float*  spec0,
-                          const float*  spec1,
-                          const float*  cw0,
-                          const float*  cw1 )
-{
-    unsigned int  n;
-    unsigned int  k;
-    float         e0;
-    float         e1;
-
-    ENTER(205);
-
-#if 000000
-    for ( n = 0; n < PART_LONG; n++ ) {
-        e0 = *spec0++ * *cw0++;
-        e1 = *spec1++ * *cw1++;
-        k  = wh[n] - wl[n];
-        while ( k-- ) {
-            e0 += *spec0++ * *cw0++;
-            e1 += *spec1++ * *cw1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-#else
-    n = 0;
-
-    for ( ; n < 23; n++ ) {
-        e0 = *spec0++ * *cw0++;
-        e1 = *spec1++ * *cw1++;
-        k  = wh[n] - wl[n];
-        while ( k-- ) {
-            e0 += *spec0++ * *cw0++;
-            e1 += *spec1++ * *cw1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-
-    for ( ; n < 48; n++ ) {
-        e0 = sqrt (*spec0++ * *cw0++);
-        e1 = sqrt (*spec1++ * *cw1++);
-        k  = wh[n] - wl[n];
-        while ( k-- ) {
-            e0 += sqrt (*spec0++ * *cw0++);
-            e1 += sqrt (*spec1++ * *cw1++);
-        }
-        *erg0++ = e0*e0 * iw[n];
-        *erg1++ = e1*e1 * iw[n];
-    }
-
-    for ( ; n < PART_LONG; n++ ) {
-        e0 = *spec0++ * *cw0++;
-        e1 = *spec1++ * *cw1++;
-        k  = wh[n] - wl[n];
-        while ( k-- ) {
-            e0 += *spec0++ * *cw0++;
-            e1 += *spec1++ * *cw1++;
-        }
-        *erg0++ = e0;
-        *erg1++ = e1;
-    }
-#endif
-
-    LEAVE(205);
-    return;
-}
-
-// input : masking thresholds, first half of the arrays *shaped0 and *shaped1
-// output: masking thresholds, second half of the arrays *shaped0 and *shaped1
-// Considering the result of aliasing via InvButfly[]
-// The input *thr0, *thr1 is gathered via address calculation from *shaped0, *shaped1
-
-static void
-AdaptThresholds ( const int MaxLine, float* shaped0, float* shaped1 )
-{
-    int           n;
-    int           mod;
-    int           alias;
-    float         tmp;
-    const float*  invb = InvButfly;
-    const float*  thr0 = shaped0 - 512;
-    const float*  thr1 = shaped1 - 512;
-    float         tmp0;
-    float         tmp1;
-
-    ENTER(206);
-
-    // should be able to optimize it with coasting.  [ 9 ] + n * [ 7 + 7 + 2 ] + [ 7 ]
-    //                                                    Schleife    Schl Schl Ausr  Schleife
-    for ( n = 0; n < MaxLine; n++, thr0++, thr1++ ) {
-        mod  = n & 15;  // n%16
-        tmp0 = *thr0;
-        tmp1 = *thr1;
-
-        if      ( mod <   +sizeof(InvButfly)/sizeof(*InvButfly)  &&  n >  12 ) {
-            alias = -1 - (mod<<1);
-            tmp   = thr0[alias] * invb[mod];
-            if ( tmp < tmp0 ) tmp0 = tmp;
-            tmp   = thr1[alias] * invb[mod];
-            if ( tmp < tmp1 ) tmp1 = tmp;
-        }
-        else if ( mod > 15-sizeof(InvButfly)/sizeof(*InvButfly)  &&  n < 499 ) {
-            alias = 31 - (mod<<1);
-            tmp   = thr0[alias] * invb[15-mod];
-            if ( tmp < tmp0 ) tmp0 = tmp;
-            tmp   = thr1[alias] * invb[15-mod];
-            if ( tmp < tmp1 ) tmp1 = tmp;
-        }
-        *shaped0++ = tmp0;
-        *shaped1++ = tmp1;
-    }
-
-    LEAVE(206);
-    return;
-}
-
-#include "fastmath.h"
-
-// input : current spectrum in the form of power *spec and phase *phase,
-//         the last two earlier spectrums are at position
-//         512 and 1024 of the corresponding Input-Arrays.
-//         Array *vocal, which can mark an FFT_Linie as harmonic
-// output: current amplitude *amp and unpredictability *cw
-static void
-CalcUnpred ( const int     MaxLine,
-             const float*  spec,
-             const float*  phase,
-             const int*    vocal,
-             float*        amp0,
-             float*        phs0,
-             float*        cw )
-{
-    int     n;
-    float   amp;
-    float   tmp;
-#define amp1  ((amp0) +  512)           // amp[ 512...1023] contains data of frame-1
-#define amp2  ((amp0) + 1024)           // amp[1024...1535] contains data of frame-2
-#define phs1  ((phs0) +  512)           // phs[ 512...1023] contains data of frame-1
-#define phs2  ((phs0) + 1024)           // phs[1024...1535] contains data of frame-2
-
-    ENTER(207);
-
-    for ( n = 0; n < MaxLine; n++ ) {
-        tmp     = COSF  ((phs0[n] = phase[n]) - 2*phs1[n] + phs2[n]);   // copy phase to output-array, predict phase and calculate predictive error
-        amp0[n] = SQRTF (spec[n]);                                      // calculate and set amplitude
-        amp     = 2*amp1[n] - amp2[n];                                  // predict amplitude
-
-        // calculate unpredictability
-        cw[n] = SQRTF (spec[n] + amp * (amp - 2*amp0[n] * tmp)) / (amp0[n] + FABS(amp));
-    }
-
-    // postprocessing of harmonic FFT-lines (*cw is set to CVD_UNPRED)
-    if ( CVD_used  &&  vocal != NULL ) {
-        for ( n = 0; n < MAX_CVD_LINE; n++, cw++, vocal++ )
-            if ( *vocal != 0  &&  *cw > CVD_UNPRED * 0.01 * *vocal )
-                *cw = CVD_UNPRED * 0.01 * *vocal;
-    }
-
-    LEAVE(207);
-    return;
-}
-#undef amp1
-#undef amp2
-#undef phs1
-#undef phs2
-
-
-// input : Energy *erg, calibrated energy *werg
-// output: spread energy *res, spread weighted energy *wres
-// SPRD describes the spreading function as calculated in psy_tab.c
-static void
-SpreadingSignal ( const float* erg, const float* werg, float* res, float* wres )
-{
-    int           n;
-    int           k;
-    int           start;
-    int           stop;
-    const float*  sprd;
-    float         e;
-    float         ew;
-
-    ENTER(208);
-
-    for (k=0; k<PART_LONG; ++k, ++erg, ++werg) { // Source (masking partition)
-        start = maxi(k-5, 0);           // minimum affected partition
-        stop  = mini(k+7, PART_LONG-1); // maximum affected partition
-        sprd  = SPRD[k] + start;         // load vector
-        e     = *erg;
-        ew    = *werg;
-
-        for (n=start; n<=stop; ++n, ++sprd) {
-            res [n] += *sprd * e;       // spreading signal
-            wres[n] += *sprd * ew;      // spreading weighted signal
-        }
-    }
-
-    LEAVE(208);
-    return;
-}
-
-// input : spread weighted energy *werg, spread energy *erg
-// output: masking threshold *erg after applying the tonality-offset
-static void
-ApplyTonalityOffset ( float* erg0, float* erg1, const float* werg0, const float* werg1 )
-{
-    int    n;
-    float  Offset;
-    float  quot;
-
-    ENTER(230);
-
-    // calculation of the masked threshold in the partition range
-    for ( n = 0; n < PART_LONG; n++ ) {
-        quot = *werg0++ / *erg0;
-        if      (quot <= 0.05737540597f) Offset = O_MAX;
-        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
-        else                             Offset = O_MIN;
-        *erg0++ *= iw[n] * minf(MinVal[n], Offset);
-
-        quot = *werg1++ / *erg1;
-        if      (quot <= 0.05737540597f) Offset = O_MAX;
-        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
-        else                             Offset = O_MIN;
-        *erg1++ *= iw[n] * minf(MinVal[n], Offset);
-    }
-
-    LEAVE(230);
-    return;
-}
-
-// input: previous loudness *loud, energies *erg, threshold in quiet *adapted_ltq
-// output: tracked loudness *loud, adapted threshold in quiet <Return value>
-static float
-AdaptLtq ( const float* erg0, const float* erg1 )
-{
-    static float  loud   = 0.f;
-    float*        weight = Loudness;
-    float         sum    = 0.f;
-    int           n;
-
-    // calculate loudness
-    for ( n = 0; n < PART_LONG; n++ )
-        sum += (*erg0++ + *erg1++) * *weight++;
-
-    // Utilization of the time constants (fast drop of Ltq T=5, slow rise of Ltq T=20)
-    //loud = (sum < loud) ? (4 * sum + loud)*0.2f : (19 * loud + sum)*0.05f;
-    loud = 0.98 * loud + 0.02 * (0.5 * sum);
-
-    // calculate dynamic offset for threshold in quiet, 0...+20 dB, at 96 dB loudness, an offset of 20 dB is assumed
-    return 1.f + varLtq * loud * 5.023772e-08f;
-}
-
-// input : simultaneous masking threshold *frqthr,
-//         previous masking threshold *tmpthr,
-//         Integrations *a (short-time) and *b (long-time)
-// output: tracked Integrations *a and *b, time constant *tau
-static void
-CalcTemporalThreshold ( float* a, float* b, float* tau, float* frqthr, float* tmpthr )
-{
-    int    n;
-    float  tmp;
-
-    ENTER(220);
-
-    for ( n = 0; n < PART_LONG; n++ ) {
-        // following calculations relative to threshold in quiet
-        frqthr[n] *= invLtq[n];
-        tmpthr[n] *= invLtq[n];
-
-        // new post-masking 'tmp' via time constant tau, if old post-masking  > Ltq (=1)
-        tmp = tmpthr[n] > 1.f  ?  POW ( tmpthr[n], tau[n] )  :  1.f;
-
-        // calculate time constant for post-masking in next frame,
-        // if new time constant has to be calculated (new tmpMask < frqMask)
-        a[n] += 0.5f  * (frqthr[n] - a[n]); // short time integrator
-        b[n] += 0.15f * (frqthr[n] - b[n]); // long  time integrator
-        if (tmp < frqthr[n])
-            tau[n] = a[n] <= b[n]  ?  0.8f  :  0.2f + b[n] / a[n] * 0.6f;
-
-        // use post-masking of (Re-Normalization)
-        tmpthr[n] = maxf (frqthr[n], tmp) * partLtq[n];
-    }
-
-    LEAVE(220);
-    return;
-}
-
-// input : L/R-Masking thresholds in Partitions *thrL, *thrR
-//         L/R-Subband energies *ergL, *ergR
-//         M/S-Subband energies *ergM, *ergS
-// output: M/S-Masking thresholds in Partitions *thrM, *thrS
-static void
-CalcMSThreshold ( const float*  const ergL,
-                  const float*  const ergR,
-                  const float*  const ergM,
-                  const float*  const ergS,
-                  float*        const thrL,
-                  float*        const thrR,
-                  float*        const thrM,
-                  float*        const thrS )
-{
-    int    n;
-    float  norm;
-    float  tmp;
-
-    // All hardcoded numbers here should be pulled from somewhere,
-    // the "4.", the -2 dB, the 0.0625 and the 0.9375, as well as all bands where this is done
-
-    for ( n = 0; n < PART_LONG; n++ ) {
-        // estimate M/S thresholds out of L/R thresholds and M/S and L/R energies
-        thrS[n] = thrM[n] = maxf (ergM[n], ergS[n]) / maxf (ergL[n], ergR[n]) * minf (thrL[n], thrR[n]);
-
-        switch ( MS_Channelmode ) { // preserve 'near-mid' signal components
-        case 3:
-            if ( n > 0 ) {
-                double ratioMS = ergM[n] > ergS[n] ? ergS[n] / ergM[n]  :  ergM[n] / ergS[n];
-                double ratioLR = ergL[n] > ergR[n] ? ergR[n] / ergL[n]  :  ergL[n] / ergR[n];
-                if ( ratioMS < ratioLR ) {              // MS
-                    if ( ergM[n] > ergS[n] )
-                        thrS[n] = thrL[n] = thrR[n] = 1.e18f;
-                    else
-                        thrM[n] = thrL[n] = thrR[n] = 1.e18f;
-                }
-                else {                                  // LR
-                    if ( ergL[n] > ergR[n] )
-                        thrR[n] = thrM[n] = thrS[n] = 1.e18f;
-                    else
-                        thrL[n] = thrM[n] = thrS[n] = 1.e18f;
-                }
-            }
-            break;
-        case 4:
-            if ( n > 0 ) {
-                double ratioMS = ergM[n] > ergS[n] ? ergS[n] / ergM[n]  :  ergM[n] / ergS[n];
-                double ratioLR = ergL[n] > ergR[n] ? ergR[n] / ergL[n]  :  ergL[n] / ergR[n];
-                if ( ratioMS < ratioLR ) {              // MS
-                    if ( ergM[n] > ergS[n] )
-                        thrS[n] = 1.e18f;
-                    else
-                        thrM[n] = 1.e18f;
-                }
-                else {                                  // LR
-                    if ( ergL[n] > ergR[n] )
-                        thrR[n] = 1.e18f;
-                    else
-                        thrL[n] = 1.e18f;
-                }
-            }
-            break;
-        case 5:
-            thrS[n] *= 2.;      // +3 dB
-            break;
-        case 6:
-            break;
-        default:
-            fprintf ( stderr, "Unknown stereo mode\n");
-        case 10:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.70794578f * iw[n];  // -1.5 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = MS2SPAT1 * thrS[n] + (1.f-MS2SPAT1) * tmp;    // raises masking threshold by up to 3 dB
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = MS2SPAT1 * thrM[n] + (1.f-MS2SPAT1) * tmp;
-                }
-            }
-            break;
-        case 11:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.63095734f * iw[n];  // -2.0 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = MS2SPAT2 * thrS[n] + (1.f-MS2SPAT2) * tmp;    // raises masking threshold by up to 6 dB
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = MS2SPAT2 * thrM[n] + (1.f-MS2SPAT2) * tmp;
-                }
-            }
-            break;
-        case 12:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.56234133f * iw[n];  // -2.5 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = MS2SPAT3 * thrS[n] + (1.f-MS2SPAT3) * tmp;    // raises masking threshold by up to 9 dB
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = MS2SPAT3 * thrM[n] + (1.f-MS2SPAT3) * tmp;
-                }
-            }
-            break;
-        case 13:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.50118723f * iw[n];  // -3.0 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = MS2SPAT4 * thrS[n] + (1.f-MS2SPAT4) * tmp;    // raises masking threshold by up to 12 dB
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = MS2SPAT4 * thrM[n] + (1.f-MS2SPAT4) * tmp;
-                }
-            }
-            break;
-        case 15:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.50118723f * iw[n];  // -3.0 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = tmp;                                  // raises masking threshold by up to +oo dB an
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = tmp;
-                }
-            }
-            break;
-        case 22:
-            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
-                norm = 0.56234133f * iw[n];  // -2.5 dB * iwidth
-                if        ( ergM[n] > ergS[n] ) {
-                    tmp = ergS[n] * norm;
-                    if ( thrS[n] > tmp )
-                        thrS[n] = maxf (tmp, ergM[n]*iw[n]*0.025);              // +/- 1.414°
-                } else if ( ergS[n] > ergM[n] ) {
-                    tmp = ergM[n] * norm;
-                    if ( thrM[n] > tmp )
-                        thrM[n] = maxf (tmp, ergS[n]*iw[n]*0.025);              // +/- 1.414°
-                }
-            }
-            break;
-        }
-    }
-
-    return;
-}
-
-// input : Masking thresholds in Partitions *partThr0, *partThr1
-//         level of threshold in quiet *ltq in FFT-resolution
-// output: Masking thresholds in FFT-resolution *thr0, *thr1
-// inline, because it's called 4x
-static void
-ApplyLtq ( float*        thr0,
-           float*        thr1,
-           const float*  partThr0,
-           const float*  partThr1,
-           const float   AdaptedLTQ,
-           int           MSflag )
-{
-    int    n;
-    int    k;
-    float  ltq;
-    float  tmp;
-        float  ms = MSflag  ?  0.125f * AdaptedLTQ  :  0.25f * AdaptedLTQ ;
-
-    for ( n = 0; n < PART_LONG; n++ ) {
-        for ( k = wl[n]; k <= wh[n]; k++, thr0++, thr1++ ) {    // threshold in quiet (Partition)
-#if 0
-            ltq   = AdaptedLTQ * fftLtq [k];
-            *thr0 = maxf ( partThr0 [n], ltq );
-            *thr1 = maxf ( partThr1 [n], ltq );
-#else
-            // Applies a much more gentle ATH rolloff + 6 dB more dynamic
-            ltq   = sqrt (ms * fftLtq [k]);
-            tmp   = sqrt (partThr0 [n]) + ltq;
-            *thr0 = tmp * tmp;
-            tmp   = sqrt (partThr1 [n]) + ltq;
-            *thr1 = tmp * tmp;
-#endif
-        }
-    }
-    return;
-}
-
-// input : Subband energies *erg0, *erg1
-//         Masking thresholds in FFT-resolution *thr0, *thr1
-// output: SMR per Subband *smr0, *smr1
-static void
-CalculateSMR ( const int     MaxBand,
-               const float*  erg0,
-               const float*  erg1,
-               const float*  thr0,
-               const float*  thr1,
-               float*        smr0,
-               float*        smr1 )
-{
-    int    n;
-    int    k;
-    float  tmp0;
-    float  tmp1;
-
-    // calculation of the masked thresholds in the subbands
-    for (n = 0; n <= MaxBand; n++ ) {
-        tmp0 = *thr0++;
-        tmp1 = *thr1++;
-        for (k=1; k<16; ++k, ++thr0, ++thr1) {
-            if (*thr0 < tmp0) tmp0 = *thr0;
-            if (*thr1 < tmp1) tmp1 = *thr1;
-        }
-        *smr0++ = 0.0625f * *erg0++ / tmp0;
-        *smr1++ = 0.0625f * *erg1++ / tmp1;
-    }
-
-    return;
-}
-
-// input : energy spectrums erg[4][128] (4 delayed FFTs)
-//         Energy of the last short block *preerg in short partitions
-//         PreechoFac declares allowed traved of the masking threshold
-// output: masking threshold *thr in short partitions
-//         Energy of the last short block *preerg in short partitions
-#if 0
-static void
-CalcShortThreshold ( const float  erg [] [128],
-                     const float  PreechoFac,
-                     float*       thr,
-                     float        preerg[2][PART_SHORT],
-                     int*         transient )
-{
-    const int*    lo     = wl_short; // lower FFT-index
-    const int*    hi     = wh_short; // upper FFT-index
-    const float*  iwidth = iw_short; // inverse partition-width
-    int           k;
-    int           n;
-    int           m;
-    float         tmp;
-    float         enrg;
-    float         th;
-    const float*  ep;
-
-    for ( k = 0; k < PART_SHORT; k++, lo++, hi++ ) {
-        transient[k] = 0;
-        th           = 1.e20f;
-        for ( n = 0; n < 4; n++ ) {
-            ep   = erg[n] + *lo;
-            m    = *hi - *lo;
-            enrg = *ep++;
-            while (m--)
-                enrg += *ep++;
-
-            // preecho prevention
-            tmp     = enrg;
-            if (preerg[0][k] < enrg)
-                enrg = preerg[0][k];
-            preerg[0][k] = tmp;
-
-            // is signal transient?
-            if (tmp > TransDetect*enrg) transient[k] = 1;
-
-            // assume short threshold = engr*PreechoFac
-            th    = minf (th, enrg*PreechoFac);
-        }
-        thr[k] = th * *iwidth++;
-    }
-
-    return;
-}
-#else
-static void
-CalcShortThreshold ( const float  erg [4] [128],
-                     const float  ShortThr,
-                     float*       thr,
-                     float        old_erg [2][PART_SHORT],
-                     int*         transient )
-{
-    const int*    index_lo = wl_short; // lower FFT-index
-    const int*    index_hi = wh_short; // upper FFT-index
-    const float*  iwidth   = iw_short; // inverse partition-width
-    int           k;
-    int           n;
-    int           m;
-    float         new_erg;
-    float         th;
-    const float*  ep;
-
-    for ( k = 0; k < PART_SHORT; k++ ) {
-        transient [k] = 0;
-        th            = old_erg [0][k];
-        for ( n = 0; n < 4; n++ ) {
-            ep   = erg[n] + index_lo [k];
-            m    = index_hi [k] - index_lo [k];
-
-            new_erg = *ep++;
-            while (m--)
-                new_erg += *ep++;               // e = Short_Partition-energy in piece n
-
-            if ( new_erg > old_erg [0][k] ) {           // bigger than the old?
-
-                if ( new_erg > old_erg [0][k] * TransDetect  ||
-                     new_erg > old_erg [1][k] * TransDetect*2 )  // is signal transient?
-                    transient [k] = 1;
-            }
-            else {
-                th = minf ( th, new_erg );          // assume short threshold = engr*PreechoFac
-            }
-
-            old_erg [1][k] = old_erg [0][k];
-            old_erg [0][k] = new_erg;           // save the current one
-        }
-        thr [k] = th * ShortThr * *iwidth++;  // pull out and multiply only when transient[k]=1
-    }
-
-    return;
-}
-
-#endif
-
-// input : previous simultaneous masking threshold *preThr,
-//         current simultaneous masking threshold *simThr
-// output: update of *preThr for next call,
-//         current masking threshold *partThr
-static void
-PreechoControl ( float*        partThr0,
-                 float*        preThr0,
-                 const float*  simThr0,
-                 float*        partThr1,
-                 float*        preThr1,
-                 const float*  simThr1 )
-{
-    int  n;
-
-    for ( n = 0; n < PART_LONG; n++ ) {
-        *partThr0++ = minf ( *simThr0, *preThr0 * PREFAC_LONG);
-        *partThr1++ = minf ( *simThr1, *preThr1 * PREFAC_LONG);
-        *preThr0++  = *simThr0++;
-        *preThr1++  = *simThr1++;
-    }
-    return;
-}
-
-
-void
-TransientenCalc ( int*       T,
-                  const int* TL,
-                  const int* TR )
-{
-    int  i;
-    int  x1;
-    int  x2;
-
-    memset ( T, 0, 32*sizeof(*T) );
-
-    for ( i = 0; i < PART_SHORT; i++ )
-        if ( TL[i]  ||  TR[i] ) {
-            x1 = wl_short[i] >> 2;
-            x2 = wh_short[i] >> 2;
-            while ( x1 <= x2 )
-                T [x1++] = 1;
-        }
-}
-
-
-// input : PCM-Data *data
-// output: SMRs for the input data
-SMRTyp
-Psychoakustisches_Modell ( const int MaxBand, const PCMDataTyp* data, int* TransientL, int* TransientR )
-{
-    float      Xi_L[32],     Xi_R[32];                          // acoustic pressure per Subband L/R
-    float      Xi_M[32],     Xi_S[32];                          // acoustic pressure per Subband M/S
-    float     cw_L[512],    cw_R[512];                          // unpredictability (only L/R)
-    float     erg0[512],    erg1[512];                          // holds energy spectrum of long FFT
-    float     phs0[512],    phs1[512];                          // holds phase spectrum of long FFT
-    float  Thr_L[2*512], Thr_R[2*512];                          // masking thresholds L/R, second half for triangle swap
-    float  Thr_M[2*512], Thr_S[2*512];                          // masking thresholds M/S, second half for triangle swap
-    float F_256[4][128];                                        // holds energies of short FFTs (L/R only)
-    float    Xerg[1024];                                        // holds energy spectrum of very long FFT
-    float        Ls_L[PART_LONG],       Ls_R[PART_LONG];        // acoustic pressure in Partition L/R
-    float        Ls_M[PART_LONG],       Ls_S[PART_LONG];        // acoustic pressure per each partition M/S
-    float   PartThr_L[PART_LONG],  PartThr_R[PART_LONG];        // masking thresholds L/R (Partition)
-    float   PartThr_M[PART_LONG],  PartThr_S[PART_LONG];        // masking thresholds M/S (Partition)
-    float  sim_Mask_L[PART_LONG], sim_Mask_R[PART_LONG];        // simultaneous masking (only L/R)
-    float      clow_L[PART_LONG],     clow_R[PART_LONG];        // spread, weighted energy (only L/R)
-    float       cLs_L[PART_LONG],      cLs_R[PART_LONG];        // weighted partition energy (only L/R)
-    float shortThr_L[PART_SHORT],shortThr_R[PART_SHORT];        // threshold for short FFT (only L/R)
-    int      n;
-    int      MaxLine    = (MaxBand+1)*16;                       // set FFT-resolution according to MaxBand
-    SMRTyp   SMR0;
-    SMRTyp   SMR1;                                              // holds SMR's for first and second Analysis
-    int      isvoc_L;
-    int      isvoc_R;
-    float    factorLTQ  = 1.f;                                  // Offset after variable LTQ
-
-    ENTER(50);
-    // 'ClearVocalDetection'-Process
-    if ( CVD_used ) {
-        memset ( Vocal_L, 0, sizeof Vocal_L );
-        memset ( Vocal_R, 0, sizeof Vocal_R );
-
-        // left channel
-        PowSpec2048 ( &data->L[0], Xerg );
-        isvoc_L = CVD2048 ( Xerg, Vocal_L );
-        // right channel
-        PowSpec2048 ( &data->R[0], Xerg );
-        isvoc_R = CVD2048 ( Xerg, Vocal_R );
-    }
-
-    // calculation of the spectral energy via FFT
-    PolarSpec1024 ( &data->L[0], erg0, phs0 );  // left
-    PolarSpec1024 ( &data->R[0], erg1, phs1 );  // right
-
-    // calculation of the acoustic pressures per each subband for L/R-signals
-    SubbandEnergy ( MaxBand, Xi_L, Xi_R, erg0, erg1 );
-
-    // calculation of the acoustic pressures per each partition
-    PartitionEnergy ( Ls_L, Ls_R, erg0, erg1 );
-
-    // calculate the predictability of the signal
-    // left
-    memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
-    memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
-    CalcUnpred ( MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
-    // right
-    memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
-    memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
-    CalcUnpred ( MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
-
-    // calculation of the weighted acoustic pressures per each partition
-    WeightedPartitionEnergy ( cLs_L, cLs_R, erg0, erg1, cw_L, cw_R );
-
-    // Spreading Signal & weighted unpredictability-signal
-    // left
-    memset ( clow_L    , 0, sizeof clow_L );
-    memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
-    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
-    // right
-    memset ( clow_R    , 0, sizeof clow_R );
-    memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
-    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
-
-    // Offset depending on tonality
-    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
-
-    // handling of transient signals
-    // calculate four short FFTs (left)
-    PowSpec256 ( &data->L[  0+SHORTFFT_OFFSET], F_256[0] );
-    PowSpec256 ( &data->L[144+SHORTFFT_OFFSET], F_256[1] );
-    PowSpec256 ( &data->L[288+SHORTFFT_OFFSET], F_256[2] );
-    PowSpec256 ( &data->L[432+SHORTFFT_OFFSET], F_256[3] );
-    // calculate short Threshold
-    CalcShortThreshold ( F_256, ShortThr, shortThr_L, pre_erg_L, TransientL );
-
-    // calculate four short FFTs (right)
-    PowSpec256 ( &data->R[  0+SHORTFFT_OFFSET], F_256[0] );
-    PowSpec256 ( &data->R[144+SHORTFFT_OFFSET], F_256[1] );
-    PowSpec256 ( &data->R[288+SHORTFFT_OFFSET], F_256[2] );
-    PowSpec256 ( &data->R[432+SHORTFFT_OFFSET], F_256[3] );
-    // calculate short Threshold
-    CalcShortThreshold ( F_256, ShortThr, shortThr_R, pre_erg_R, TransientR );
-
-    // dynamic adjustment of the threshold in quiet to the loudness of the current sequence
-    if ( varLtq > 0. )
-        factorLTQ = AdaptLtq ( Ls_L, Ls_R );
-
-    // utilization of the temporal post-masking
-    if ( tmpMask_used ) {
-        CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
-        CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
-        memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
-        memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
-    }
-
-    // transient signal?
-    for ( n = 0; n < PART_SHORT; n++ ) {
-        if ( TransientL [n] ) {
-            sim_Mask_L [3*n  ] = minf ( sim_Mask_L [3*n  ], shortThr_L [n] );
-            sim_Mask_L [3*n+1] = minf ( sim_Mask_L [3*n+1], shortThr_L [n] );
-            sim_Mask_L [3*n+2] = minf ( sim_Mask_L [3*n+2], shortThr_L [n] );
-        }
-        if ( TransientR[n] ) {
-            sim_Mask_R [3*n  ] = minf ( sim_Mask_R [3*n  ], shortThr_R [n] );
-            sim_Mask_R [3*n+1] = minf ( sim_Mask_R [3*n+1], shortThr_R [n] );
-            sim_Mask_R [3*n+2] = minf ( sim_Mask_R [3*n+2], shortThr_R [n] );
-        }
-    }
-
-    // Pre-Echo control
-    PreechoControl ( PartThr_L, PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
-
-    // utilization of the threshold in quiet
-    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
-
-    // Consideration of aliasing between the subbands (noise is smeared)
-    // In: Thr[0..511], Out: Thr[512...1023]
-    AdaptThresholds ( MaxLine, Thr_L+512, Thr_R+512 );
-    memmove ( Thr_L, Thr_L+512, 512*sizeof(float) );
-    memmove ( Thr_R, Thr_R+512, 512*sizeof(float) );
-
-    // calculation of the Signal-to-Mask-Ratio
-    CalculateSMR ( MaxBand, Xi_L, Xi_R, Thr_L, Thr_R, SMR0.L, SMR0.R );
-
-    /***************************************************************************************/
-    /***************************************************************************************/
-    if ( MS_Channelmode > 0 ) {
-        // calculation of the spectral energy via FFT
-        PowSpec1024 ( &data->M[0], erg0 );      // mid
-        PowSpec1024 ( &data->S[0], erg1 );      // side
-
-        // calculation of the acoustic pressures per each subband for M/S-signals
-        SubbandEnergy ( MaxBand, Xi_M, Xi_S, erg0, erg1 );
-
-        // calculation of the acoustic pressures per each partition
-        PartitionEnergy ( Ls_M, Ls_S, erg0, erg1 );
-
-        // calculate masking thresholds for M/S
-        CalcMSThreshold ( Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
-        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
-
-        // Consideration of aliasing between the subbands (noise is smeared)
-        // In: Thr[0..511], Out: Thr[512...1023]
-        AdaptThresholds ( MaxLine, Thr_M+512, Thr_S+512 );
-        memmove ( Thr_M, Thr_M+512, 512*sizeof(float) );
-        memmove ( Thr_S, Thr_S+512, 512*sizeof(float) );
-
-        // calculation of the Signal-to-Mask-Ratio
-        CalculateSMR ( MaxBand, Xi_M, Xi_S, Thr_M, Thr_S, SMR0.M, SMR0.S );
-    }
-
-    if ( NS_Order > 0 ) {       // providing the Noise Shaping thresholds
-        memcpy ( ANSspec_L, Thr_L, sizeof ANSspec_L );
-        memcpy ( ANSspec_R, Thr_R, sizeof ANSspec_R );
-        memcpy ( ANSspec_M, Thr_M, sizeof ANSspec_M );
-        memcpy ( ANSspec_S, Thr_S, sizeof ANSspec_S );
-    }
-    /***************************************************************************************/
-    /***************************************************************************************/
-
-    //
-    //-------- second model calculation via shifted FFT ------------------------
-    //
-    // calculation of the spectral power via FFT
-    PolarSpec1024 ( &data->L[576], erg0, phs0 ); // left
-    PolarSpec1024 ( &data->R[576], erg1, phs1 ); // right
-
-    // calculation of the acoustic pressures per each subband for L/R-signals
-    SubbandEnergy ( MaxBand, Xi_L, Xi_R, erg0, erg1 );
-
-    // calculation of the acoustic pressures per each partition
-    PartitionEnergy ( Ls_L, Ls_R, erg0, erg1 );
-
-    // calculate the predictability of the signal
-    // left
-    memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
-    memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
-    CalcUnpred ( MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
-    // right
-    memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
-    memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
-    CalcUnpred ( MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
-
-    // calculation of the weighted acoustic pressure per each partition
-    WeightedPartitionEnergy ( cLs_L, cLs_R, erg0, erg1, cw_L, cw_R );
-
-    // Spreading Signal & weighted unpredictability-signal
-    // left
-    memset ( clow_L    , 0, sizeof clow_L );
-    memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
-    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
-    // right
-    memset ( clow_R    , 0, sizeof clow_R );
-    memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
-    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
-
-    // Offset depending on tonality
-    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
-
-    // Handling of transient signals
-    // calculate four short FFTs (left)
-    PowSpec256 ( &data->L[ 576+SHORTFFT_OFFSET], F_256[0] );
-    PowSpec256 ( &data->L[ 720+SHORTFFT_OFFSET], F_256[1] );
-    PowSpec256 ( &data->L[ 864+SHORTFFT_OFFSET], F_256[2] );
-    PowSpec256 ( &data->L[1008+SHORTFFT_OFFSET], F_256[3] );
-    // calculate short Threshold
-    CalcShortThreshold ( F_256, ShortThr, shortThr_L, pre_erg_L, TransientL );
-
-    // calculate four short FFTs (right)
-    PowSpec256 ( &data->R[ 576+SHORTFFT_OFFSET], F_256[0] );
-    PowSpec256 ( &data->R[ 720+SHORTFFT_OFFSET], F_256[1] );
-    PowSpec256 ( &data->R[ 864+SHORTFFT_OFFSET], F_256[2] );
-    PowSpec256 ( &data->R[1008+SHORTFFT_OFFSET], F_256[3] );
-    // calculate short Threshold
-    CalcShortThreshold ( F_256, ShortThr, shortThr_R, pre_erg_R, TransientR );
-
-    // dynamic adjustment of threshold in quiet to loudness of the current sequence
-    if ( varLtq > 0. )
-        factorLTQ = AdaptLtq ( Ls_L, Ls_R );
-
-    // utilization of temporal post-masking
-    if (tmpMask_used) {
-        CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
-        CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
-        memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
-        memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
-    }
-
-    // transient signal?
-    for ( n = 0; n < PART_SHORT; n++ ) {
-        if ( TransientL[n] ) {
-            sim_Mask_L [3*n  ] = minf ( sim_Mask_L [3*n  ], shortThr_L [n] );
-            sim_Mask_L [3*n+1] = minf ( sim_Mask_L [3*n+1], shortThr_L [n] );
-            sim_Mask_L [3*n+2] = minf ( sim_Mask_L [3*n+2], shortThr_L [n] );
-        }
-        if ( TransientR[n] ) {
-            sim_Mask_R [3*n  ] = minf ( sim_Mask_R [3*n  ], shortThr_R [n] );
-            sim_Mask_R [3*n+1] = minf ( sim_Mask_R [3*n+1], shortThr_R [n] );
-            sim_Mask_R [3*n+2] = minf ( sim_Mask_R [3*n+2], shortThr_R [n] );
-        }
-    }
-
-    // Pre-Echo control
-    PreechoControl ( PartThr_L, PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
-
-    // utilization of threshold in quiet
-    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
-
-    // Consideration of aliasing between the subbands (noise is smeared)
-    // In: Thr[0..511], Out: Thr[512...1023]
-    AdaptThresholds ( MaxLine, Thr_L+512, Thr_R+512 );
-    memmove ( Thr_L, Thr_L+512, 512*sizeof(float) );
-    memmove ( Thr_R, Thr_R+512, 512*sizeof(float) );
-
-    // calculation of the Signal-to-Mask-Ratio
-    CalculateSMR ( MaxBand, Xi_L, Xi_R, Thr_L, Thr_R, SMR1.L, SMR1.R );
-
-    /***************************************************************************************/
-    /***************************************************************************************/
-    if ( MS_Channelmode > 0 ) {
-        // calculation of the spectral energy via FFT
-        PowSpec1024 ( &data->M[576], erg0 );    // mid
-        PowSpec1024 ( &data->S[576], erg1 );    // side
-
-        // calculation of the acoustic pressure per each subband for M/S-signals
-        SubbandEnergy ( MaxBand, Xi_M, Xi_S, erg0, erg1 );
-
-        // calculation of the acoustic pressure per each partition
-        PartitionEnergy ( Ls_M, Ls_S, erg0, erg1 );
-
-        // calculate masking thresholds for M/S
-        CalcMSThreshold ( Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
-        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
-
-        // Consideration of aliasing between the subbands (noise is smeared)
-        // In: Thr[0..511], Out: Thr[512...1023]
-        AdaptThresholds ( MaxLine, Thr_M+512, Thr_S+512 );
-        memmove ( Thr_M, Thr_M+512, 512*sizeof(float) );
-        memmove ( Thr_S, Thr_S+512, 512*sizeof(float) );
-
-        // calculation of the Signal-to-Mask-Ratio
-        CalculateSMR ( MaxBand, Xi_M, Xi_S, Thr_M, Thr_S, SMR1.M, SMR1.S );
-    }
-    /***************************************************************************************/
-    /***************************************************************************************/
-
-    if ( NS_Order > 0 ) {
-        for ( n = 0; n < MAX_ANS_LINES; n++ ) {                 // providing Noise Shaping thresholds
-            ANSspec_L [n] = minf ( ANSspec_L [n], Thr_L [n] );
-            ANSspec_R [n] = minf ( ANSspec_R [n], Thr_R [n] );
-            ANSspec_M [n] = minf ( ANSspec_M [n], Thr_M [n] );
-            ANSspec_S [n] = minf ( ANSspec_S [n], Thr_S [n] );
-        }
-    }
-
-    for ( n = 0; n <= MaxBand; n++ ) {                          // choose 'worst case'-SMR from shifted analysis windows
-        SMR0.L[n] = maxf ( SMR0.L[n], SMR1.L[n] );
-        SMR0.R[n] = maxf ( SMR0.R[n], SMR1.R[n] );
-        SMR0.M[n] = maxf ( SMR0.M[n], SMR1.M[n] );
-        SMR0.S[n] = maxf ( SMR0.S[n], SMR1.S[n] );
-    }
-
-    LEAVE(50);
-    return SMR0;
-}
Index: penc/trunk/psy_tab.c
===================================================================
--- /mppenc/trunk/psy_tab.c	(revision 96)
+++ 	(revision )
@@ -1,462 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-// Antialiasing for calculation of the subband power
-const float  Butfly    [7] = { 0.5f, 0.2776f, 0.1176f, 0.0361f, 0.0075f, 0.000948f, 0.0000598f };
-
-// Antialiasing for calculation of the masking thresholds
-const float  InvButfly [7] = { 2.f, 3.6023f, 8.5034f, 27.701f, 133.33f, 1054.852f, 16722.408f };
-
-// w_low for long               0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56
-const int   wl [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  13,  15,  17,  19,  21,  23,  25,  27,  29,  31,  33,  35,  38,  41,  44,  47,  50,  54,  58,  62,  67,  72,  78,  84,  91,  98, 106, 115, 124, 134, 145, 157, 170, 184, 199, 216, 234, 254, 276, 301, 329, 360, 396, 437, 485 };
-const int   wh [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  12,  14,  16,  18,  20,  22,  24,  26,  28,  30,  32,  34,  37,  40,  43,  46,  49,  53,  57,  61,  66,  71,  77,  83,  90,  97, 105, 114, 123, 133, 144, 156, 169, 183, 198, 215, 233, 253, 275, 300, 328, 359, 395, 436, 484, 511 };
-// Width:                       1    1    1    1    1    1    1    1    1    1    1    2    2    2    2    2    2    2    2    2    2    2    2    3    3    3    3    3    4    4    4    5    5    6    6    7    7    8    9    9   10   11   12   13   14   15   17   18   20   22   25   28   31   36   41   48   27
-
-// inverse partition-width for long
-const float iw [PART_LONG] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/4, 1.f/4, 1.f/4, 1.f/5, 1.f/5, 1.f/6, 1.f/6, 1.f/7, 1.f/7, 1.f/8, 1.f/9, 1.f/9, 1.f/10, 1.f/11, 1.f/12, 1.f/13, 1.f/14, 1.f/15, 1.f/17, 1.f/18, 1.f/20, 1.f/22, 1.f/25, 1.f/28, 1.f/31, 1.f/36, 1.f/41, 1.f/48, 1.f/27 };
-
-// w_low for short                    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17   18
-const int   wl_short [PART_SHORT] = { 0,  1,  2,  3,  4,  5,  6,  8, 10, 12, 15, 18, 23, 29, 36, 46, 59, 75,  99 };
-const int   wh_short [PART_SHORT] = { 0,  1,  2,  3,  5,  6,  7,  9, 12, 14, 18, 23, 29, 36, 46, 58, 75, 99, 127 };
-
-// inverse partition-width for short
-const float iw_short [PART_SHORT] = { 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/4, 1.f/6, 1.f/7, 1.f/8, 1.f/11, 1.f/13, 1.f/17, 1.f/25, 1.f/29 };
-
-/*
-Nr.   wl  wh     fl    fh     bl         bh         bm        Nr.   wl  wh     fl    fh     bl         bh         bm
- 0:    0   0      0     0   0.000000   0.000000   0.000000
- 1:    1   1     43    43   0.425460   0.425460   0.425460     0:   0   0      0     0   0.000000   0.000000     0.000000
- 2:    2   2     86    86   0.850241   0.850241   0.850241
-
- 3:    3   3    129   129   1.273448   1.273448   1.273448
- 4:    4   4    172   172   1.694205   1.694205   1.694205     1:   1   1    172   172   1.694205   1.694205     1.694205
- 5:    5   5    215   215   2.111672   2.111672   2.111672
-
- 6:    6   6    258   258   2.525051   2.525051   2.525051
- 7:    7   7    301   301   2.933594   2.933594   2.933594     2:   2   2    345   345   3.336612   3.336612     3.336612
- 8:    8   8    345   345   3.336612   3.336612   3.336612
-
- 9:    9   9    388   388   3.733479   3.733479   3.733479
-10:   10  10    431   431   4.123635   4.123635   4.123635     3:   3   3    517   517   4.881924   4.881924     4.881924
-11-   11  12    474   517   4.506591   4.881924   4.695234
-
-12:   13  14    560   603   5.249283   5.608381   5.429880
-13:   15  16    646   689   5.958998   6.300971   6.131073     4:   4   5    689   861   6.300971   7.581073     6.958618
-14:   17  18    732   775   6.634195   6.958618   6.797509
-
-15:   19  20    818   861   7.274232   7.581073   7.428745
-16:   21  22    904   947   7.879211   8.168753   8.025049     5:   5   6    861  1034   7.581073   8.722594     8.168753
-17:   23  24    991  1034   8.449828   8.722594   8.587239
-
-18:   25  26   1077  1120   8.987223   9.243908   9.116546
-19:   27  28   1163  1206   9.492850   9.734263   9.614484     6:   6   7   1034  1206   8.722594   9.734263     9.243908
-20:   29  30   1249  1292   9.968365  10.195382  10.082745
-
-21:   31  32   1335  1378  10.415539  10.629064  10.523116
-22:   33  34   1421  1464  10.836184  11.037125  10.937413     7:   8   9   1378  1550  10.629064  11.421352    11.037125
-23:   35  37   1507  1593  11.232108  11.605071  11.421352
-
-24:   38  40   1637  1723  11.783474  12.125139  11.956764
-25:   41  43   1766  1852  12.288791  12.602659  12.447904     8:  10  12   1723  2067  12.125139  13.316883    12.753228
-26:   44  46   1895  1981  12.753228  13.042468  12.899777
-
-27:   47  49   2024  2110  13.181453  13.448898  13.316883
-28:   50  53   2153  2283  13.577635  13.945465  13.764881     9:  12  14   2067  2412  13.316883  14.288198    13.825796
-29:   54  57   2326  2455  14.062349  14.397371  14.232693
-
-30:   58  61   2498  2627  14.504172  14.811258  14.660130
-31:   62  66   2670  2842  14.909464  15.283564  15.100115    10:  15  18   2584  3101  14.711029  15.795819    15.283564
-32:   67  71   2885  3058  15.372757  15.714074  15.546390
-
-33:   72  77   3101  3316  15.795819  16.185532  15.994471
-34:   78  83   3359  3575  16.259980  16.616871  16.441494    11:  18  23   3101  3962  15.795819  17.204658    16.547424
-35:   84  90   3618  3876  16.685418  17.079349  16.885941
-
-36:   91  97   3919  4177  17.142352  17.506445  17.327264
-37:   98 105   4221  4522  17.564981  17.959646  17.765487    12:  23  29   3962  4996  17.204658  18.533945    17.904788
-38:  106 114   4565  4910  18.014031  18.433233  18.227034
-
-39:  115 123   4953  5297  18.483782  18.874805  18.682185
-40:  124 133   5340  5728  18.922095  19.332992  19.130789    13:  29  36   4996  6202  18.533945  19.801451    19.198897
-41:  134 144   5771  6202  19.377073  19.801451  19.592946
-
-42:  145 156   6245  6718  19.842285  20.272889  20.061808
-43:  157 169   6761  7278  20.310373  20.739167  20.529583    14:  36  46   6202  7924  19.801451  21.222342    20.565177
-44:  170 183   7321  7881  20.773175  21.191895  20.987911
-
-45:  184 198   7924  8527  21.222342  21.623344  21.428652
-46:  199 215   8570  9259  21.650236  22.050787  21.857360    15:  46  58   7924  9991  21.222342  22.420001    21.882271
-47:  216 233   9302 10034  22.074042  22.440072  22.263795
-
-48-  234 253  10078 10896  22.459969  22.807140  22.640652
-49:  254 275  10939 11843  22.823891  23.144847  22.991444    16:  59  75  10164 12920  22.499251  23.461146    23.044078
-50:  276 300  11886 12920  23.158772  23.461146  23.317264
-
-51:  301 328  12963 14126  23.472530  23.748999  23.617861
-52:  329 359  14169 15461  23.758199  24.005540  23.888450    17:  75  99  12920 17054  23.461146  24.248491    23.920884
-53:  360 395  15504 17011  24.012922  24.242660  24.134368
-
-54:  396 436  17054 18777  24.248491  24.454928  24.357873
-55:  437 484  18820 20844  24.459492  24.647977  24.559711    18:  99 127  17054 21878  24.248491  24.727775    24.524955
-56:  485 511  20887 22007  24.651498  24.737100  24.695685
-*/
-
-
-/* V A R I A B L E S */
-float  MinVal   [PART_LONG];               // contains minimum tonality soffsets
-float  Loudness [PART_LONG];               // weighting factors for loudness calculation
-float  SPRD     [PART_LONG] [PART_LONG];   // tabulated spreading function
-float  O_MAX;
-float  O_MIN;
-float  FAC1;
-float  FAC2;                               // constants for offset calculation
-float  partLtq  [PART_LONG];               // threshold in quiet (partitions)
-float  invLtq   [PART_LONG];               // inverse threshold in quiet (partitions, long)
-float  fftLtq   [512];                     // threshold in quiet (FFT)
-float  Ltq_offset;                         // Offset for threshold in quiet
-float  Ltq_max;                            // maximum level for threshold in quiet
-float  TMN;
-float  NMT;
-float  TransDetect;
-unsigned int    EarModelFlag;
-int    MinValChoice;
-
-
-/*
- *  Klemm 1994 and 1997. Experimental data. Sorry, data looks a little bit
- *  dodderly. Data below 30 Hz is extrapolated from other material, above 18
- *  kHz the ATH is limited due to the original purpose (too much noise at
- *  ATH is not good even if it's theoretically inaudible).
- */
-
-static float
-ATHformula_Frank ( float freq )
-{
-    /*
-     * one value per 100 cent = 1
-     * semitone = 1/4
-     * third = 1/12
-     * octave = 1/40 decade
-     * rest is linear interpolated, values are currently in millibel rel. 20 µPa
-     */
-    static short tab [] = {
-        /*    10.0 */  9669, 9669, 9626, 9512,
-        /*    12.6 */  9353, 9113, 8882, 8676,
-        /*    15.8 */  8469, 8243, 7997, 7748,
-        /*    20.0 */  7492, 7239, 7000, 6762,
-        /*    25.1 */  6529, 6302, 6084, 5900,
-        /*    31.6 */  5717, 5534, 5351, 5167,
-        /*    39.8 */  5004, 4812, 4638, 4466,
-        /*    50.1 */  4310, 4173, 4050, 3922,
-        /*    63.1 */  3723, 3577, 3451, 3281,
-        /*    79.4 */  3132, 3036, 2902, 2760,
-        /*   100.0 */  2658, 2591, 2441, 2301,
-        /*   125.9 */  2212, 2125, 2018, 1900,
-        /*   158.5 */  1770, 1682, 1594, 1512,
-        /*   199.5 */  1430, 1341, 1260, 1198,
-        /*   251.2 */  1136, 1057,  998,  943,
-        /*   316.2 */   887,  846,  744,  712,
-        /*   398.1 */   693,  668,  637,  606,
-        /*   501.2 */   580,  555,  529,  502,
-        /*   631.0 */   475,  448,  422,  398,
-        /*   794.3 */   375,  351,  327,  322,
-        /*  1000.0 */   312,  301,  291,  268,
-        /*  1258.9 */   246,  215,  182,  146,
-        /*  1584.9 */   107,   61,   13,  -35,
-        /*  1995.3 */   -96, -156, -179, -235,
-        /*  2511.9 */  -295, -350, -401, -421,
-        /*  3162.3 */  -446, -499, -532, -535,
-        /*  3981.1 */  -513, -476, -431, -313,
-        /*  5011.9 */  -179,    8,  203,  403,
-        /*  6309.6 */   580,  736,  881, 1022,
-        /*  7943.3 */  1154, 1251, 1348, 1421,
-        /* 10000.0 */  1479, 1399, 1285, 1193,
-        /* 12589.3 */  1287, 1519, 1914, 2369,
-#if 0
-        /* 15848.9 */  3352, 4865, 5942, 6177,
-        /* 19952.6 */  6385, 6604, 6833, 7009,
-        /* 25118.9 */  7066, 7127, 7191, 7260,
-#else
-        /* 15848.9 */  3352, 4352, 5352, 6352,
-        /* 19952.6 */  7352, 8352, 9352, 9999,
-        /* 25118.9 */  9999, 9999, 9999, 9999,
-#endif
-    };
-    double    freq_log;
-    unsigned  index;
-
-    if ( freq <    10. ) freq =    10.;
-    if ( freq > 29853. ) freq = 29853.;
-
-    freq_log = 40. * log10 (0.1 * freq);   /* 4 steps per third, starting at 10 Hz */
-    index    = (unsigned) freq_log;
-    return 0.01 * (tab [index] * (1 + index - freq_log) + tab [index+1] * (freq_log - index));
-}
-
-
-/* F U N C T I O N S */
-// calculation of the threshold in quiet in FFT-resolution
-static void
-Ruhehoerschwelle ( unsigned int  EarModelFlag,
-                   int           Ltq_offset,
-                   int           Ltq_max )
-{
-    int     n;
-    int     k;
-    float   f;
-    float   erg;
-    double  tmp;
-    float   absLtq [512];
-
-    for ( n = 0; n < 512; n++ ) {
-        f = (float) ( (n+1) * (float)(SampleFreq / 2000.) / 512 );   // Frequency in kHz
-
-        switch ( EarModelFlag / 100 ) {
-        case 0:         // ISO-threshold in quiet
-            tmp  = 3.64*pow (f,-0.8) -  6.5*exp (-0.6*(f-3.3)*(f-3.3)) + 0.001*pow (f, 4.0);
-            break;
-        default:
-        case 1:         // measured threshold in quiet (Nick Berglmeir, Andree Buschmann, Kopfhörer)
-            tmp  = 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
-            break;
-        case 2:         // measured threshold in quiet (Filburt, Kopfhörer)
-            tmp  = 9.00*pow (f,-0.5) - 15.0*exp (-0.1*(f-4.0)*(f-4.0)) + 0.0341796875*pow (f, 2.5)          + 15.*exp (-(f-0.1)*(f-0.1)) - 18;
-            tmp  = mind ( tmp, Ltq_max - 18 );
-            break;
-        case 3:
-            tmp  = ATHformula_Frank ( 1.e3 * f );
-            break;
-        case 4:
-            tmp  = ATHformula_Frank ( 1.e3 * f );
-            if ( f > 4.8 ) {
-                tmp += 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
-                tmp *= 0.5 ;
-            }
-            break;
-        case 5:
-            tmp  = ATHformula_Frank ( 1.e3 * f );
-            if ( f > 4.8 ) {
-                tmp = 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
-            }
-            break;
-        }
-
-        tmp -= f * f * (int)(EarModelFlag % 100 - 50) * 0.0015;  // 00: +30 dB, 100: -30 dB  @20 kHz
-
-        tmp       = mind ( tmp, Ltq_max );              // Limit ATH
-        tmp      += Ltq_offset - 23;                    // Add chosen Offset
-        fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp);     // conversion into power
-    }
-
-    // threshold in quiet in partitions (long)
-    for ( n = 0; n < PART_LONG; n++ ) {
-        erg = 1.e20f;
-        for ( k = wl[n]; k <= wh[n]; k++ )
-            erg = minf (erg, absLtq[k]);
-
-        partLtq[n] = erg;               // threshold in quiet
-        invLtq [n] = 1.f / partLtq[n];  // Inverse
-    }
-}
-
-#ifdef _WIN32
-static double
-asinh ( double x )
-{
-    return x >= 0  ?  log (sqrt (x*x+1) + x)  :  -log (sqrt (x*x+1) - x);
-}
-#endif
-
-
-static double
-Freq2Bark ( double Hz )           // Klemm 2002
-{
-    return 9.97074*asinh (1.1268e-3 * Hz) - 6.25817*asinh (0.197193e-3 * Hz) ;
-}
-
-static double
-Bark2Freq ( double Bark )           // Klemm 2002
-{
-    return 956.86 * sinh (0.101561*Bark) + 11.7296 * sinh (0.304992*Bark) + 6.33622e-3*sinh (0.538621*Bark);
-}
-
-static double
-LongPart2Bark ( int Part )
-{
-    return Freq2Bark ((wl [Part] + wh [Part]) * SampleFreq / 2048.);
-}
-
-// calculating the table for loudness calculation based on absLtq = ank
-static void
-Loudness_Tabelle (void)
-{
-    int    n;
-    float  midfreq;
-    float  tmp;
-
-    // ca. dB(A)
-    for ( n = 0; n < PART_LONG; n++ ){
-        midfreq      = (wh[n] + wl[n] + 3) * (0.25 * SampleFreq / 512);     // center frequency in kHz, why +3 ???
-        tmp          = LOG10 (midfreq) - 3.5f;                                  // dB(A)
-        tmp          = -10 * tmp * tmp + 3 - midfreq/3000;
-        Loudness [n] = POW10 ( 0.1 * tmp );                                     // conversion into power
-    }
-}
-
-
-static double
-Bass ( float f, float TMN, float NMT, float bass )
-{
-    static unsigned char  lfe [11] = { 120, 100, 80, 60, 50, 40, 30, 20, 15, 10, 5 };
-    int                   tmp      = (int) ( 1024/44100. * f + 0.5 );
-
-    switch ( tmp ) {
-    case  0:
-    case  1:
-    case  2:
-    case  3:
-    case  4:
-    case  5:
-    case  6:
-    case  7:
-    case  8:
-    case  9:
-    case 10:
-        return TMN + bass * lfe [tmp];
-    case 11:
-    case 12:
-    case 13:
-    case 14:
-    case 15:
-    case 16:
-    case 17:
-    case 18:
-        return TMN;
-    case 19:
-    case 20:
-    case 21:
-    case 22:
-        return TMN*0.75 + NMT*0.25;
-    case 23:
-    case 24:
-        return TMN*0.50 + NMT*0.50;
-    case 25:
-    case 26:
-        return TMN*0.25 + NMT*0.75;
-    default:
-        return NMT;
-    }
-}
-
-
-// calculating the coefficient for utilization of the tonality offset, depending on TMN und NMT
-static void
-Tonalitaetskoeffizienten ( void )
-{
-    double                tmp;
-    int                   n;
-    float                 bass;
-
-    bass = 0.1/8 * NMT;
-    if ( MinValChoice <= 2  &&  bass > 0.1 )
-        bass = 0.1f;
-    if ( MinValChoice <= 1 )
-        bass = 0.0f;
-
-    // alternative: calculation of the minval-values dependent on TMN and TMN
-    for ( n = 0; n < PART_LONG; n++ ) {
-        tmp        = Bass ( (wl [n] + wh [n]) / 2048. * SampleFreq, TMN, NMT, bass );
-        MinVal [n] = POW10 ( -0.1 * tmp );                      // conversion into power
-    }
-
-    // calculation of the constants for "tonality offset"
-    O_MAX = POW10 ( -0.1 * TMN );
-    O_MIN = POW10 ( -0.1 * NMT );
-    FAC1  = POW10 ( -0.1 * (NMT - (TMN - NMT) * 0.229) ) ;
-    FAC2  = (TMN - NMT) * (0.99011159 * 0.1);
-}
-
-
-// calculation of the spreading function
-static void
-Spread ( void )
-{
-    int    i;
-    int    j;
-    float  tmpx;
-    float  tmpy;
-    float  tmpz;
-    float  x;
-
-    // calculation of the spreading-function for all occuring values
-    for ( i = 0; i < PART_LONG; i++ ) {                 // i is masking Partition, Source
-        for ( j = 0; j < PART_LONG; j++ ) {             // j is masking Partition, Target
-            tmpx = LongPart2Bark (j) - LongPart2Bark (i);// Difference of the partitions in Bark
-            tmpy = tmpz = 0.;                           // tmpz = 0: no dip
-
-            if      ( tmpx < 0 ) {                      // downwards (S1)
-                tmpy  = -32.f * tmpx;                   // 32 dB per Bark, e33 (10)
-            }
-            else if ( tmpx > 0 ) {                      // upwards (S2)
-#if 0
-                x = (wl[i]+wh[i])/2 * (float)(SampleFreq / 2000)/512;   // center frequency in kHz ???????
-                if (i==0) x = 0.5f  * (float)(SampleFreq / 2000)/512;   // if first spectral line
-#else
-                x  = i  ?  wl[i]+wh[i]  :  1;
-                x *= SampleFreq / 1000. / 2048;         // center frequency in kHz
-#endif
-                // dB/Bark
-                tmpy = (22.f + 0.23f / x) * tmpx;       // e33 (10)
-
-                // dip (up to 6 dB)
-                tmpz = 8 * minf ( (tmpx-0.5f) * (tmpx-0.5f) - 2 * (tmpx-0.5f), 0.f );
-            }
-
-            // calculate coefficient
-            SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) );  // [Source] [Target]
-        }
-    }
-
-    // Normierung e33 (10)
-    for ( i = 0; i < PART_LONG; i++ ) {                 // i is masked Partition
-        float  norm = 0.f;
-        for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
-            norm += SPRD [j] [i];
-        for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
-            SPRD [j] [i] /= norm;
-    }
-}
-
-// call all initialisation procedures
-void
-Init_Psychoakustiktabellen ( void )
-{
-    Max_Band = (int) ( Bandwidth * 64. / SampleFreq );
-    if ( Max_Band <  1 ) Max_Band =  1;
-    if ( Max_Band > 31 ) Max_Band = 31;
-
-    Tonalitaetskoeffizienten ();
-    Ruhehoerschwelle ( EarModelFlag, Ltq_offset, Ltq_max );
-    Loudness_Tabelle ();
-    Spread ();
-}
-
-/* end of psy_tab.c */
Index: penc/trunk/pulse.c
===================================================================
--- /mppenc/trunk/pulse.c	(revision 96)
+++ 	(revision )
@@ -1,192 +1,0 @@
-#define FILE_IO 0
-#include "mppdec.h"
-
-Bool_t            output_endianess   = LITTLE;
-
-#define SAMP    44100
-#define DUR     4
-
-/********************************************************************/
-
-typedef void (*fn_t) ( float* );
-
-static void
-sin1 ( float* A )
-{
-    int  i;
-
-    for ( i = 0; i < SAMP*DUR; i++ ) {
-        *A++ = sin (i * (2 * M_PI * 1000 / SAMP) );
-    }
-}
-
-static void
-sin5 ( float* A )
-{
-    int  i;
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        *A++ = sin (i * (2 * M_PI * 5000 / SAMP) );
-}
-
-static void
-sinfou ( float* A )
-{
-    int  i;
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        *A++ = sin (i * (2 * M_PI * 1000 / SAMP) ) / 1
-             + sin (i * (2 * M_PI * 3000 / SAMP) ) / 3
-             + sin (i * (2 * M_PI * 5000 / SAMP) ) / 5
-             + sin (i * (2 * M_PI * 7000 / SAMP) ) / 7
-             + sin (i * (2 * M_PI * 9000 / SAMP) ) / 9
-             + sin (i * (2 * M_PI *11000 / SAMP) ) /11
-             + sin (i * (2 * M_PI *13000 / SAMP) ) /13
-             + sin (i * (2 * M_PI *15000 / SAMP) ) /15;
-}
-
-static void
-noise1 ( float* A )
-{
-    int  i;
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        *A++ = rand() * (2./RAND_MAX) - 1.;
-}
-
-static void
-noise2 ( float* A )
-{
-    long  last;
-    long  curr = RAND_MAX / 2;
-    int   i;
-
-    for ( i = 0; i < SAMP*DUR; i++ ) {
-        last = curr;
-        curr = rand ();
-        *A++ = (last - curr) * (1./RAND_MAX);
-    }
-}
-
-static void
-noise3 ( float* A )
-{
-    double  last = 0.;
-    double  curr;
-    int     i;
-
-    for ( i = 0; i < SAMP*DUR; i++ ) {
-        curr = rand() * (2./RAND_MAX) - 1.;
-        *A++ = last = 0.9 * last + 0.1 * curr;
-    }
-}
-
-/********************************************************************/
-
-static void
-writeFile ( const char* cmd, const float* A, const float* B )
-{
-    static short   Data [SAMP*DUR] [2];
-    int            i;
-    double         max = 0.;
-    FILE_T         fp;
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        if ( fabs ( A[i] * B[i] ) > max )
-             max = fabs ( A[i] * B[i] );
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        Data [i][0] = Data [i][1] = (short) floor ( A[i] * B[i] / max * 24576 + 0.5 );
-
-    stderr_printf ( "%s\n", cmd );
-    fp = POPEN_WRITE_BINARY_OPEN ( cmd );
-    Write_WAVE_Header ( fp, 44100., 16, 2, 10*44100 );
-    WRITE ( fp, Data, sizeof(Data) );
-    PCLOSE ( fp );
-}
-
-/*********************************************************************/
-
-static void
-env ( float* A, double expo, double mult, int ie )
-{
-    static double  x [SAMP*DUR];
-    int            i;
-    int            j;
-    int            k;
-    double         tmp;
-    double         max = 0.;
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        x [i] = pow (i+0.5, expo) * pow ( mult, i );
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        if ( x[i] > max )
-             max = x[i];
-
-    for ( i = 0; i < SAMP*DUR; i++ )
-        x [i] /= max;
-
-    for ( j = 0; j < ie; j++ ) {
-        tmp = x[j];
-        for ( k = 1; j+k*ie < SAMP*DUR  &&  x[j+k*ie] > 1.e-20; k++ )
-            tmp += x[j + k*ie];
-        A[j] = tmp;
-    }
-
-    for ( j = ie; j < SAMP*DUR; j++ ) {
-        A[j] = A[j-ie];
-    }
-}
-
-static float   A [6] [SAMP*DUR];
-
-
-void
-Writefiles ( const float* B, const char* base )
-{
-    char  cmd [128];
-    int   j;
-
-    for ( j = 0; j < 6; j++ ) {
-        sprintf ( cmd, "mppenc - %s_%c.mpc -xtreme", base, 'a'+j );
-        writeFile ( cmd, A[j], B );
-    }
-}
-
-
-/*********************************************************************/
-int
-main ( void )
-{
-    static fn_t    F [6] = { sin1, sin5, sinfou, noise1, noise2, noise3 };
-    static float   B [SAMP*DUR];
-    int            i;
-    int            p;
-    int            s;
-    int            d;
-    char           name [32];
-
-    stderr_printf ("Calculating noises...\n");
-    for ( i = 0; i < sizeof(F)/sizeof(*F); i++ ) {
-        stderr_printf ("[%u] ", i);
-        F [i] (&(A[i][0]));
-    }
-
-    stderr_printf ("\nCalculating envelopes...\n");
-    for ( i = 0; i < SAMP*DUR; i++ ) {
-         B[i] = 1.;
-    }
-    Writefiles ( B, "const" );
-
-    for ( p = 2; p >= 0; p-- )                  // rise
-        for ( s = 3; s < 14; s++ )              // duration
-            for ( d = 25; d <= 400; d *= 2 ) {  // Pulse sequence
-                env ( B, p, 1. - pow (0.5,s), d*SAMP/1000 );
-                sprintf ( name, "%04u_%03u_%1u", 1<<s, d, p );
-                stderr_printf ("\n\n*** %s ***\n", name );
-                Writefiles ( B, name );
-            }
-
-    return 0;
-}
Index: penc/trunk/pulse.dsp
===================================================================
--- /mppenc/trunk/pulse.dsp	(revision 96)
+++ 	(revision )
@@ -1,110 +1,0 @@
-# Microsoft Developer Studio Project File - Name="pulse" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pulse - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pulse.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pulse.mak" CFG="pulse - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pulse - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pulse - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pulse - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "pulse___Win32_Release"
-# PROP BASE Intermediate_Dir "pulse___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib setargv.obj /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "pulse - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "pulse___Win32_Debug"
-# PROP BASE Intermediate_Dir "pulse___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pulse - Win32 Release"
-# Name "pulse - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\pulse.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\wave_out.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/pulse.vcproj
===================================================================
--- /mppenc/trunk/pulse.vcproj	(revision 96)
+++ 	(revision )
@@ -1,204 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="pulse"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/pulse.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib setargv.obj"
-				OutputFile=".\Release/pulse.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/pulse.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/pulse.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/pulse.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib setargv.obj"
-				OutputFile=".\Debug/pulse.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/pulse.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/pulse.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="pulse.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="wave_out.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/quant.c
===================================================================
--- /mppenc/trunk/quant.c	(revision 96)
+++ 	(revision )
@@ -1,319 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-/* V A R I A B L E S */
-float  __SCF    [128 + 6];   // tabulated scalefactors
-float  __invSCF [128 + 6];   // inverted scalefactors
-
-
-// Quantization-coefficients: step/65536 bzw. (2*D[Res]+1)/65536
-static const float  __A [1 + 18] = {
-    0.0000762939453125f,
-    0.0000000000000000f, 0.0000457763671875f, 0.0000762939453125f, 0.0001068115234375f,
-    0.0001373291015625f, 0.0002288818359375f, 0.0004730224609375f, 0.0009613037109375f,
-    0.0019378662109375f, 0.0038909912109375f, 0.0077972412109375f, 0.0156097412109375f,
-    0.0312347412109375f, 0.0624847412109375f, 0.1249847412109375f, 0.2499847412109375f,
-    0.4999847412109375f
-};
-
-
-// Requantization-coefficients: 65536/step bzw. 1/A[Res]
-static const float  __C [1 + 18] = {
-    13107.200000000001f,
-    65535.000000000000f, 21845.333333333332f, 13107.200000000001f, 9362.285714285713f,
-     7281.777777777777f,  4369.066666666666f,  2114.064516129032f, 1040.253968253968f,
-      516.031496062992f,   257.003921568627f,   128.250489236790f,   64.062561094819f,
-       32.015632633121f,    16.003907203907f,     8.000976681723f,    4.000244155527f,
-        2.000061037018f,     1.000015259022f
-};
-
-
-// Requantization-Offset: 2*D+1 = steps of quantizer
-static const int  __D [1 + 18] = {
-    2,
-    0,     1,     2,     3,     4,     7,    15,    31,    63,
-  127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
-};
-
-#define A   (__A + 1)
-#define C   (__C + 1)
-#define D   (__D + 1)
-
-// Generation of the scalefactors and their inverses
-void
-Init_Skalenfaktoren ( void )
-{
-    int  n;
-
-    for ( n = -6; n < 128; n++ ) {
-        SCF[n]    = (float) ( pow(10.,-0.1*(n-1)/1.26) );
-        invSCF[n] = (float) ( pow(10., 0.1*(n-1)/1.26) );
-    }
-}
-
-#pragma warning ( disable : 4305 )
-
-static float  NoiseInjectionCompensation1D [18] = {
-#if 1
-    1.f,
-    0.884621,
-    0.935711,
-    0.970829,
-    0.987941,
-    0.994315,
-    0.997826,
-    0.999744,
-    1., 1., 1., 1., 1., 1., 1., 1., 1., 1.
-#else
-    1.,
-    0.907073,   //  -1...+1
-    0.946334,   //  -2...+2
-    0.974793,   //  -3...+3
-    0.987647,   //  -4...+4
-    0.994330,   //  -7...+7
-    0.997846,   // -15...+15
-    1.,         // -31...+31
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-#endif
-} ;
-
-#if 0
-static float  NoiseInjectionCompensation2D [18] [32] = {
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 0.931595, 0.891390, 0.852494, 0.872420, 0.904053, 0.933716, 0.958976, 0.977719, 0.993979, 1.009011, 1.020961, 1.029564, 1.026582, 1.026753, 1.035573, 1.053251, 1.073429, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344,  },
-    { 0.878264, 0.882351, 0.904261, 0.930843, 0.949243, 0.966741, 0.980500, 0.988182, 0.993361, 0.997112, 0.998918, 0.999501, 1.003179, 1.007445, 1.008678, 0.995890, 0.991015, 0.988019, 0.985479, 0.987646, 1.003605, 1.029301, 1.040511, 1.061531, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302,  },
-    { 0.866977, 0.943500, 0.941561, 0.953049, 0.967274, 0.980476, 0.988678, 0.993240, 0.996376, 0.998513, 0.999545, 0.999775, 1.000898, 1.003954, 1.006308, 1.004932, 1.002867, 1.002922, 1.003624, 1.005487, 1.003919, 1.008022, 0.987693, 1.000358, 1.017461, 1.039166, 1.056053, 1.068191, 1.068191, 1.068191, 1.068191, 1.068191,  },
-    { 0.880390, 0.976713, 0.976180, 0.976596, 0.982011, 0.988786, 0.993619, 0.996641, 0.998824, 1.000297, 1.001195, 1.001718, 1.002395, 1.003503, 1.005617, 1.005072, 1.002409, 1.003703, 1.003412, 1.003318, 1.005290, 1.007112, 1.014370, 1.010040, 1.000780, 1.005700, 1.020505, 1.030123, 1.030123, 1.030123, 1.030123, 1.030123,  },
-    { 0.916894, 0.987164, 0.988734, 0.992318, 0.995268, 0.996932, 0.998141, 0.999072, 0.999674, 1.000104, 1.000292, 1.000386, 1.000399, 1.000222, 1.000671, 1.002127, 1.000137, 1.000046, 0.999644, 0.999156, 1.000568, 1.000098, 0.993764, 0.993954, 0.998971, 1.002835, 1.002972, 0.995376, 1.001643, 1.001643, 1.001643, 1.001643,  },
-    { 0.982771, 0.995034, 0.997118, 0.998294, 0.998652, 0.999016, 0.999382, 0.999598, 0.999746, 0.999851, 0.999837, 0.999881, 0.999847, 1.000154, 0.999885, 1.000222, 0.999963, 1.000934, 0.999804, 0.999927, 1.000379, 0.997574, 0.997943, 0.998748, 0.998151, 0.997458, 1.000319, 1.001091, 0.998461, 0.996151, 1.005969, 1.005969,  },
-    { 0.997150, 0.999903, 0.999424, 0.999537, 0.999661, 0.999753, 0.999851, 0.999903, 0.999928, 0.999963, 0.999969, 0.999941, 0.999974, 0.999967, 0.999996, 0.999975, 0.999966, 0.999704, 0.999946, 0.999894, 0.999905, 1.000840, 1.000716, 1.000799, 1.000406, 0.999912, 1.000153, 0.999789, 1.000495, 1.000495, 1.001167, 1.001347,  },
-    { 0.995524, 0.999983, 1.000044, 0.999965, 0.999970, 0.999974, 0.999986, 0.999995, 0.999996, 1.000011, 0.999997, 1.000010, 1.000010, 1.000026, 1.000006, 1.000148, 1.000048, 0.999999, 1.000161, 1.000193, 0.999797, 1.000145, 0.999974, 1.000039, 0.999731, 0.999985, 1.000563, 1.000256, 1.000637, 1.000050, 1.002013, 1.001053,  },
-    { 0.994796, 0.999833, 1.000003, 1.000012, 0.999986, 0.999991, 0.999991, 1.000000, 1.000004, 0.999999, 1.000005, 1.000004, 1.000008, 0.999996, 1.000027, 1.000097, 0.999951, 0.999938, 0.999989, 1.000001, 1.000048, 0.999935, 1.000068, 1.000134, 0.999961, 1.000198, 0.999956, 0.999957, 0.999844, 1.000087, 0.999708, 1.000198,  },
-    { 0.996046, 0.999902, 1.000019, 1.000017, 0.999983, 0.999997, 1.000002, 0.999993, 0.999999, 1.000003, 1.000001, 1.000015, 1.000004, 1.000006, 0.999987, 0.999993, 0.999992, 1.000029, 1.000064, 0.999997, 1.000044, 1.000044, 0.999919, 0.999875, 1.000011, 0.999897, 0.999905, 0.999996, 0.999934, 0.999968, 1.000008, 0.999902,  },
-    { 0.998703, 0.999963, 1.000021, 1.000006, 1.000008, 1.000000, 1.000003, 0.999994, 0.999990, 0.999990, 1.000003, 1.000009, 1.000001, 0.999999, 1.000001, 1.000009, 0.999999, 0.999988, 1.000003, 0.999971, 1.000005, 1.000042, 0.999924, 0.999995, 0.999998, 0.999988, 0.999961, 0.999942, 1.000046, 1.000061, 1.000112, 1.000052,  },
-    { 0.999872, 1.000001, 1.000004, 0.999998, 0.999999, 0.999998, 0.999992, 0.999990, 0.999991, 1.000000, 1.000000, 1.000000, 1.000002, 0.999996, 1.000004, 1.000011, 0.999963, 1.000016, 1.000050, 0.999996, 0.999998, 1.000006, 0.999990, 0.999948, 0.999974, 1.000060, 1.000014, 0.999987, 0.999986, 0.999917, 0.999973, 1.000035,  },
-    { 1.000366, 1.000006, 0.999996, 0.999995, 0.999998, 0.999996, 0.999991, 1.000001, 0.999990, 0.999996, 1.000010, 0.999999, 1.000002, 1.000000, 0.999996, 0.999990, 1.000014, 0.999978, 1.000011, 0.999983, 0.999988, 0.999971, 0.999997, 0.999989, 0.999986, 0.999958, 1.000005, 0.999992, 0.999975, 0.999975, 0.999975, 0.999975,  },
-    { 0.999736, 0.999995, 1.000002, 1.000004, 0.999999, 1.000000, 1.000003, 1.000000, 1.000007, 0.999992, 0.999997, 0.999998, 0.999998, 0.999997, 1.000007, 1.000012, 1.000004, 0.999995, 0.999996, 1.000009, 1.000003, 1.000008, 1.000001, 1.000003, 1.000011, 1.000019, 0.999991, 0.999970, 0.999970, 0.999970, 0.999970, 0.999965,  },
-    { 0.999970, 1.000000, 1.000000, 1.000000, 1.000001, 1.000000, 1.000000, 0.999999, 1.000001, 1.000000, 0.999999, 0.999999, 0.999999, 1.000007, 1.000005, 1.000002, 0.999999, 0.999999, 1.000000, 0.999997, 0.999999, 1.000001, 1.000001, 0.999988, 0.999988, 0.999984, 0.999995, 0.999986, 0.999986, 0.999986, 0.999986, 0.999986,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-};
-#endif
-
-#pragma warning ( default : 4305 )
-
-
-void
-NoiseInjectionComp ( void )
-{
-    int  i;
-
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation1D)/sizeof(*NoiseInjectionCompensation1D); i++ )
-        NoiseInjectionCompensation1D [i] = 1.f;
-#if 0
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation2D)/sizeof(**NoiseInjectionCompensation2D); i++ )
-        NoiseInjectionCompensation2D [0][i] = 1.f;
-#endif
-}
-
-
-// Quantizes a subband and calculates iSNR
-float
-ISNR_Schaetzer ( const float* input, const float SNRcomp, const int res )
-{
-    int    k;
-    float  fac    = A [res];
-    float  invfac = C [res];
-    float  Signal = 1.e-30f;
-    float  Fehler = 1.e-30f;
-    float  tmp ;
-    float  tmp2;
-    float  tmp3;
-
-    // Summation of the absolute power and the quadratic error
-    for ( k = 0; k < 36; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
-
-        Fehler += tmp * tmp;
-        Signal += tmp2 * tmp2;
-    }
-
-    // Utilization of SNRcomp only if SNR > 1 !!!
-    return Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-}
-
-
-float
-ISNR_Schaetzer_Trans ( const float* input, const float SNRcomp, const int res )
-{
-    int    k;
-    float  fac    = A [res];
-    float  invfac = C [res];
-    float  Signal;
-    float  Fehler;
-    float  ret ;
-    float  tmp ;
-    float  tmp2;
-    float  tmp3;
-
-    // Summation of the absolute power and the quadratic error
-    k = 0;
-    Signal = Fehler = 1.e-30f;
-    for ( ; k < 12; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
-
-        Fehler += tmp * tmp;
-        Signal += tmp2 * tmp2;
-    }
-    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-    ret = tmp;
-    Signal = Fehler = 1.e-30f;
-    for ( ; k < 24; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
-
-        Fehler += tmp * tmp;
-        Signal += tmp2 * tmp2;
-    }
-    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-    if ( tmp > ret ) ret = tmp;
-    //ret += tmp;
-    Signal = Fehler = 1.e-30f;
-    for ( ; k < 36; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        // q = ftol(in), correct rounding
-        tmp  = tmp2 * fac + 0xFF8000;
-        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
-        tmp  = tmp3 - tmp2;
-
-        Fehler += tmp * tmp;
-        Signal += tmp2 * tmp2;
-    }
-    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-    if ( tmp > ret ) ret = tmp;
-    //ret += tmp;
-    //ret *= 0.33333333333f;
-
-    return ret;
-}
-
-
-// Linear quantizer for a subband
-void
-QuantizeSubband ( unsigned int* qu_output, const float* input, const int res, float* errors )
-{
-    int    n;
-    int    offset  = D [res];
-    float  mult    = A [res] * NoiseInjectionCompensation1D [res];
-    float  invmult = C [res];
-    float  tmp;
-    int    quant;
-    float  signal;
-
-    for ( n = 0; n < 36 - MAX_NS_ORDER; n++, input++, qu_output++ ) {
-        // q = ftol(in), correct rounding
-        tmp   = *input * mult + 0xFF8000;
-        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
-
-        // limitation to 0...2D
-        if ((unsigned int)quant > (unsigned int)2*offset ) {
-            quant = mini ( quant, 2*offset );
-            quant = maxi ( quant,        0 );
-        }
-        *qu_output  = quant;
-    }
-
-    for ( ; n < 36; n++, input++, qu_output++ ) {
-        // q = ftol(in), correct rounding
-        signal = *input * mult;
-        tmp   =  signal + 0xFF8000;
-        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
-
-        // calculate the current error and save it for error refeeding
-        errors [n + 6] = invmult * (quant - offset) - signal * NoiseInjectionCompensation1D [res];
-
-        // limitation to 0...2D
-        if ((unsigned int)quant > (unsigned int)2*offset ) {
-            quant = mini ( quant, 2*offset );
-            quant = maxi ( quant,        0 );
-        }
-        *qu_output  = quant;
-    }
-}
-
-
-// NoiseShaper for a subband
-void
-QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, float* errors, const float* FIR )
-{
-#define E(x) *((int*)errors+(x))
-
-    float  signal;
-    float  tmp;
-    float  mult    = A [res];
-    float  invmult = C [res];
-    int    offset  = D [res];
-    int    n;
-    int    quant;
-
-    E(0) = E(1) = E(2) = E(3) = E(4) = E(5) = 0;       // arghh, it produces pops on each frame boundary!
-
-    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
-        signal = *input * NoiseInjectionCompensation1D [res] - (FIR[5]*errors[n+0] + FIR[4]*errors[n+1] + FIR[3]*errors[n+2] + FIR[2]*errors[n+3] + FIR[1]*errors[n+4] + FIR[0]*errors[n+5]);
-
-        // quant = ftol(signal), correct rounding
-        tmp   = signal * mult + 0xFF8000;
-        quant = *(int*) & tmp - 0x4B7F8000;
-
-        // calculate the current error and save it for error refeeding
-        errors [n + 6] = invmult * quant - signal * NoiseInjectionCompensation1D [res];
-
-        // limitation to +/-D
-        quant = minf ( quant, +offset );
-        quant = maxf ( quant, -offset );
-
-        *qu_output = (unsigned int)(quant + offset);
-    }
-}
-
-/* end of quant.c */
-
-// pfk@schnecke.offl.uni-jena.de@EMAIL, Andree.Buschmann@web.de@EMAIL, BuschmannA@becker.de@EMAIL, miyaguch@eskimo.com@EMAIL, r3mix@irc.openprojects.net@EMAIL, dibrom@users.sourceforge.net@EMAIL, m.p.bakker-10@student.utwente.nl@EMAIL, djmrob@essex.ac.uk@EMAIL, dim@psytel-research.co.yu@EMAIL, lerch@zplane.de@EMAIL, takehiro@users.sourceforge.net@EMAIL, aleidinger@users.sourceforge.net@EMAIL, Robert.Hegemann@gmx.de@EMAIL, bouvigne@mp3-tech.org@EMAIL, monty@xiph.org@EMAIL, Pumpkinz99@aol.com@EMAIL, spase@outerspase.net@EMAIL, mt@wildpuppy.com@EMAIL, juha.laaksonheimo@tut.fi@EMAIL, speek@myrealbox.com@EMAIL, w.speek@12move.nl@EMAIL, martin@spueler.de@EMAIL, nicolaus.berglmeir@t-online.de@EMAIL, thomas.a.juerges@ruhr-uni-bochum.de@EMAIL, HelH@mpex.net@EMAIL, garf@roadum.demon.co.uk@EMAIL, gcp@sjeng.org@EMAIL, mike@naivesoftware.com@EMAIL, case@mobiili.net@EMAIL, steve.lhomme@free.fr@EMAIL, walter@binity.com@EMAIL
Index: penc/trunk/quant.c-backup
===================================================================
--- /mppenc/trunk/quant.c-backup	(revision 96)
+++ 	(revision )
@@ -1,267 +1,0 @@
-#include "mppenc.h"
-
-/* V A R I A B L E N */
-float  __SCF    [128 + 6];   // tabellierte Skalenfaktoren
-float  __invSCF [128 + 6];   // invertierte Skalenfaktoren
-
-
-// Quantisierungs-Koeffizienten: step/65536 bzw. (2*D[Res]+1)/65536
-static const float  __A [1 + 18] = {
-    0.0000762939453125f,
-    0.0000000000000000f, 0.0000457763671875f, 0.0000762939453125f, 0.0001068115234375f,
-    0.0001373291015625f, 0.0002288818359375f, 0.0004730224609375f, 0.0009613037109375f,
-    0.0019378662109375f, 0.0038909912109375f, 0.0077972412109375f, 0.0156097412109375f,
-    0.0312347412109375f, 0.0624847412109375f, 0.1249847412109375f, 0.2499847412109375f,
-    0.4999847412109375f
-};
-
-
-// Requantisierungs-Koeffizienten: 65536/step bzw. 1/A[Res]
-static const float  __C [1 + 18] = {
-    13107.200000000001f,
-    65535.000000000000f, 21845.333333333332f, 13107.200000000001f, 9362.285714285713f,
-     7281.777777777777f,  4369.066666666666f,  2114.064516129032f, 1040.253968253968f,
-      516.031496062992f,   257.003921568627f,   128.250489236790f,   64.062561094819f,
-       32.015632633121f,    16.003907203907f,     8.000976681723f,    4.000244155527f,
-        2.000061037018f,     1.000015259022f
-};
-
-
-// Requantisierungs-Offset: 2*D+1 = steps of quantizer
-static const int  __D [1 + 18] = {
-    2,
-    0,     1,     2,     3,     4,     7,    15,    31,    63,
-  127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
-};
-
-#define A   (__A + 1)
-#define C   (__C + 1)
-#define D   (__D + 1)
-
-// Generierung der Skalenfaktoren und ihrer Inversen
-void
-Init_Skalenfaktoren ( void )
-{
-    int  n;
-
-    for ( n = -6; n < 128; n++ ) {
-        SCF[n]    = (float) ( pow(10.,-0.1*(n-1)/1.26) );
-        invSCF[n] = (float) ( pow(10., 0.1*(n-1)/1.26) );
-    }
-}
-
-#pragma warning ( disable : 4305 )
-
-static float  NoiseInjectionCompensation1D [18] = {
-#if 1
-    1.f,
-    0.884621,
-    0.935711,
-    0.970829,
-    0.987941,
-    0.994315,
-    0.997826,
-    0.999744,
-    1., 1., 1., 1., 1., 1., 1., 1., 1., 1.
-#else
-    1.,
-    0.907073,   //  -1...+1
-    0.946334,   //  -2...+2
-    0.974793,   //  -3...+3
-    0.987647,   //  -4...+4
-    0.994330,   //  -7...+7
-    0.997846,   // -15...+15
-    1.,         // -31...+31
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-    1.,
-#endif
-} ;
-
-static float  NoiseInjectionCompensation2D [18] [32] = {
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 0.931595, 0.891390, 0.852494, 0.872420, 0.904053, 0.933716, 0.958976, 0.977719, 0.993979, 1.009011, 1.020961, 1.029564, 1.026582, 1.026753, 1.035573, 1.053251, 1.073429, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344,  },
-    { 0.878264, 0.882351, 0.904261, 0.930843, 0.949243, 0.966741, 0.980500, 0.988182, 0.993361, 0.997112, 0.998918, 0.999501, 1.003179, 1.007445, 1.008678, 0.995890, 0.991015, 0.988019, 0.985479, 0.987646, 1.003605, 1.029301, 1.040511, 1.061531, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302,  },
-    { 0.866977, 0.943500, 0.941561, 0.953049, 0.967274, 0.980476, 0.988678, 0.993240, 0.996376, 0.998513, 0.999545, 0.999775, 1.000898, 1.003954, 1.006308, 1.004932, 1.002867, 1.002922, 1.003624, 1.005487, 1.003919, 1.008022, 0.987693, 1.000358, 1.017461, 1.039166, 1.056053, 1.068191, 1.068191, 1.068191, 1.068191, 1.068191,  },
-    { 0.880390, 0.976713, 0.976180, 0.976596, 0.982011, 0.988786, 0.993619, 0.996641, 0.998824, 1.000297, 1.001195, 1.001718, 1.002395, 1.003503, 1.005617, 1.005072, 1.002409, 1.003703, 1.003412, 1.003318, 1.005290, 1.007112, 1.014370, 1.010040, 1.000780, 1.005700, 1.020505, 1.030123, 1.030123, 1.030123, 1.030123, 1.030123,  },
-    { 0.916894, 0.987164, 0.988734, 0.992318, 0.995268, 0.996932, 0.998141, 0.999072, 0.999674, 1.000104, 1.000292, 1.000386, 1.000399, 1.000222, 1.000671, 1.002127, 1.000137, 1.000046, 0.999644, 0.999156, 1.000568, 1.000098, 0.993764, 0.993954, 0.998971, 1.002835, 1.002972, 0.995376, 1.001643, 1.001643, 1.001643, 1.001643,  },
-    { 0.982771, 0.995034, 0.997118, 0.998294, 0.998652, 0.999016, 0.999382, 0.999598, 0.999746, 0.999851, 0.999837, 0.999881, 0.999847, 1.000154, 0.999885, 1.000222, 0.999963, 1.000934, 0.999804, 0.999927, 1.000379, 0.997574, 0.997943, 0.998748, 0.998151, 0.997458, 1.000319, 1.001091, 0.998461, 0.996151, 1.005969, 1.005969,  },
-    { 0.997150, 0.999903, 0.999424, 0.999537, 0.999661, 0.999753, 0.999851, 0.999903, 0.999928, 0.999963, 0.999969, 0.999941, 0.999974, 0.999967, 0.999996, 0.999975, 0.999966, 0.999704, 0.999946, 0.999894, 0.999905, 1.000840, 1.000716, 1.000799, 1.000406, 0.999912, 1.000153, 0.999789, 1.000495, 1.000495, 1.001167, 1.001347,  },
-    { 0.995524, 0.999983, 1.000044, 0.999965, 0.999970, 0.999974, 0.999986, 0.999995, 0.999996, 1.000011, 0.999997, 1.000010, 1.000010, 1.000026, 1.000006, 1.000148, 1.000048, 0.999999, 1.000161, 1.000193, 0.999797, 1.000145, 0.999974, 1.000039, 0.999731, 0.999985, 1.000563, 1.000256, 1.000637, 1.000050, 1.002013, 1.001053,  },
-    { 0.994796, 0.999833, 1.000003, 1.000012, 0.999986, 0.999991, 0.999991, 1.000000, 1.000004, 0.999999, 1.000005, 1.000004, 1.000008, 0.999996, 1.000027, 1.000097, 0.999951, 0.999938, 0.999989, 1.000001, 1.000048, 0.999935, 1.000068, 1.000134, 0.999961, 1.000198, 0.999956, 0.999957, 0.999844, 1.000087, 0.999708, 1.000198,  },
-    { 0.996046, 0.999902, 1.000019, 1.000017, 0.999983, 0.999997, 1.000002, 0.999993, 0.999999, 1.000003, 1.000001, 1.000015, 1.000004, 1.000006, 0.999987, 0.999993, 0.999992, 1.000029, 1.000064, 0.999997, 1.000044, 1.000044, 0.999919, 0.999875, 1.000011, 0.999897, 0.999905, 0.999996, 0.999934, 0.999968, 1.000008, 0.999902,  },
-    { 0.998703, 0.999963, 1.000021, 1.000006, 1.000008, 1.000000, 1.000003, 0.999994, 0.999990, 0.999990, 1.000003, 1.000009, 1.000001, 0.999999, 1.000001, 1.000009, 0.999999, 0.999988, 1.000003, 0.999971, 1.000005, 1.000042, 0.999924, 0.999995, 0.999998, 0.999988, 0.999961, 0.999942, 1.000046, 1.000061, 1.000112, 1.000052,  },
-    { 0.999872, 1.000001, 1.000004, 0.999998, 0.999999, 0.999998, 0.999992, 0.999990, 0.999991, 1.000000, 1.000000, 1.000000, 1.000002, 0.999996, 1.000004, 1.000011, 0.999963, 1.000016, 1.000050, 0.999996, 0.999998, 1.000006, 0.999990, 0.999948, 0.999974, 1.000060, 1.000014, 0.999987, 0.999986, 0.999917, 0.999973, 1.000035,  },
-    { 1.000366, 1.000006, 0.999996, 0.999995, 0.999998, 0.999996, 0.999991, 1.000001, 0.999990, 0.999996, 1.000010, 0.999999, 1.000002, 1.000000, 0.999996, 0.999990, 1.000014, 0.999978, 1.000011, 0.999983, 0.999988, 0.999971, 0.999997, 0.999989, 0.999986, 0.999958, 1.000005, 0.999992, 0.999975, 0.999975, 0.999975, 0.999975,  },
-    { 0.999736, 0.999995, 1.000002, 1.000004, 0.999999, 1.000000, 1.000003, 1.000000, 1.000007, 0.999992, 0.999997, 0.999998, 0.999998, 0.999997, 1.000007, 1.000012, 1.000004, 0.999995, 0.999996, 1.000009, 1.000003, 1.000008, 1.000001, 1.000003, 1.000011, 1.000019, 0.999991, 0.999970, 0.999970, 0.999970, 0.999970, 0.999965,  },
-    { 0.999970, 1.000000, 1.000000, 1.000000, 1.000001, 1.000000, 1.000000, 0.999999, 1.000001, 1.000000, 0.999999, 0.999999, 0.999999, 1.000007, 1.000005, 1.000002, 0.999999, 0.999999, 1.000000, 0.999997, 0.999999, 1.000001, 1.000001, 0.999988, 0.999988, 0.999984, 0.999995, 0.999986, 0.999986, 0.999986, 0.999986, 0.999986,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-};
-
-#pragma warning ( default : 4305 )
-
-
-void
-NoiseInjectionComp ( void )
-{
-    int  i;
-
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation1D)/sizeof(*NoiseInjectionCompensation1D); i++ )
-        NoiseInjectionCompensation1D [i] = 1.f;
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation2D)/sizeof(**NoiseInjectionCompensation2D); i++ )
-        NoiseInjectionCompensation2D [0][i] = 1.f;
-}
-
-
-// Quantisiert ein Subband und berechnet iSNR
-float
-ISNR_Schaetzer ( const float* input, const float SNRcomp, const int res )
-{
-    int    k;
-    float  fac    = A [res];
-    float  invfac = C [res];
-    float  Signal = 1.e-30f;
-    float  Fehler = 1.e-30f;
-    float  tmp ;
-    float  tmp2 ;
-
-    // Summation der absoluten Leistung und des quadratischen Fehlers
-    for ( k = 0; k < 36; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
-        Signal += tmp2 * tmp2;
-
-        // q = ftol(in), korrektes Runden
-        tmp = tmp2 * fac + 0xFF8000;
-        tmp = (*(int*) & tmp - 0x4B7F8000) * invfac - tmp2;
-
-        Fehler += tmp * tmp;
-    }
-
-    // Anwendung von SNRcomp nur, falls SNR > 1 !!
-    return Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-}
-
-
-#ifdef BUGBUG
-double _old;
-double _new;
-double _tmp;
-
-double _Sum [18];
-long   _Cnt [18];
-
-double __Sum [18][33];
-long   __Cnt [18][33];
-
-void rep ( double _old, double _new, int res )
-{
-    int    i;
-    _Sum [res] += sqrt (_old / _new );
-    _Cnt [res] ++ ;
-    i = _old * (  32. / 36 / 32767 / 32767);
-    // printf ("Res=%u, old=%f, new=%f, X=%f, %3u:", res, _old, _new, X[res], i ); fflush (stdout);
-    __Sum [res][i] += sqrt (_old / _new );
-    __Cnt [res][i] ++ ;
-}
-
-void reppr ( void )
-{
-    int i, j;
-    printf ("\n\n==================\n");
-    for ( i = 0; i < 18; i++ )
-        if ( _Cnt[i] )
-            printf ("%2u: %12.6f\n", i, _Sum[i]/_Cnt[i] );
-    for ( i = 0; i < 18; i++ )
-        for ( j = 0; j <= 32; j++ )
-            if ( __Cnt[i][j] )
-                printf ("%2u[%2u]: %9.6f (%8lu)\n", i, j, __Sum[i][j]/__Cnt[i][j], __Cnt[i][j] );
-
-}
-#endif
-
-// Linearer Quantisierer für ein Subband
-void
-QuantizeSubband ( unsigned int* qu_output, const float* input, const int res, float* errors )
-{
-    int    n;
-    int    offset = D [res];
-    float  mult   = A [res] * NoiseInjectionCompensation1D [res];
-    float  tmp;
-
-    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
-        // q = ftol(in), korrektes Runden
-        tmp = *input * mult + 0xFF8000;
-        *qu_output  = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
-
-        // Begrenzung auf 0...2D
-        if ((unsigned int)*qu_output > (unsigned int)2*offset ) {
-            *qu_output = mini( *qu_output, 2*offset);
-            *qu_output = maxi( *qu_output,        0);
-        }
-#ifdef BUGBUG
-        _old += *input * *input;
-        _tmp  = (int)(*qu_output - offset) * C[res];
-        _new += _tmp * _tmp;
-#endif
-    }
-#ifdef BUGBUG
-    rep ( _old, _new, res );
-    _old = _new = 0;
-#endif
-}
-
-
-// NoiseShaper für ein Subband
-void
-QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, float* errors, const float* FIR )
-{
-#define E(x) *((int*)errors+(x))
-
-    float  signal;
-    float  tmp;
-    float  mult    = A [res];
-    float  invmult = C [res];
-    int    offset  = D [res];
-    int    n;
-    int    quant;
-
-    E(0) = E(1) = E(2) = E(3) = E(4) = E(5) = 0;       // arghh, das gibt ja Knackser an jeder Framegrenze
-
-    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
-        signal = *input * NoiseInjectionCompensation1D [res] - (FIR[5]*errors[n+0] + FIR[4]*errors[n+1] + FIR[3]*errors[n+2] + FIR[2]*errors[n+3] + FIR[1]*errors[n+4] + FIR[0]*errors[n+5]);
-
-        // quant = ftol(signal), korrektes Runden
-        tmp   = signal * mult + 0xFF8000;
-        quant = *(int*) & tmp - 0x4B7F8000;
-
-        // Berechnung des aktuellen Fehlers und Speichern für Fehlerrückführung
-        errors [n + 6] = invmult * quant - signal * NoiseInjectionCompensation1D [res];
-
-        // Begrenzung auf +/-D
-        quant = minf ( quant, +offset );
-        quant = maxf ( quant, -offset );
-
-        *qu_output = (unsigned int)(quant + offset);
-#ifdef BUGBUG
-        _old += *input * *input;
-        _tmp  = invmult * quant;
-        _new += _tmp * _tmp;
-#endif
-    }
-#ifdef BUGBUG
-    rep ( _old, _new, res );
-    _old = _new = 0;
-#endif
-}
-
-/* end of quant.c */
-
-// pfk@schnecke.offl.uni-jena.de@EMAIL, Andree.Buschmann@web.de@EMAIL, BuschmannA@becker.de@EMAIL, miyaguch@eskimo.com@EMAIL, r3mix@irc.openprojects.net@EMAIL, dibrom@users.sourceforge.net@EMAIL, m.p.bakker-10@student.utwente.nl@EMAIL, djmrob@essex.ac.uk@EMAIL, dim@psytel-research.co.yu@EMAIL, lerch@zplane.de@EMAIL, takehiro@users.sourceforge.net@EMAIL, aleidinger@users.sourceforge.net@EMAIL, Robert.Hegemann@gmx.de@EMAIL, bouvigne@mp3-tech.org@EMAIL, monty@xiph.org@EMAIL, Pumpkinz99@aol.com@EMAIL, spase@outerspase.net@EMAIL, mt@wildpuppy.com@EMAIL, juha.laaksonheimo@tut.fi@EMAIL, speek@myrealbox.com@EMAIL, w.speek@12move.nl@EMAIL, martin@spueler.de@EMAIL, nicolaus.berglmeir@t-online.de@EMAIL, thomas.a.juerges@ruhr-uni-bochum.de@EMAIL, HelH@mpex.net@EMAIL, garf@roadum.demon.co.uk@EMAIL, gcp@sjeng.org@EMAIL, mike@naivesoftware.com@EMAIL, case@mobiili.net@EMAIL, steve.lhomme@free.fr@EMAIL, walter@binity.com@EMAIL
Index: penc/trunk/quant_2d.c
===================================================================
--- /mppenc/trunk/quant_2d.c	(revision 96)
+++ 	(revision )
@@ -1,287 +1,0 @@
-#include "mppenc.h"
-
-#define QUANT   256
-
-/* V A R I A B L E S */
-float  __SCF    [128 + 6];   // tabulated scalefactors
-float  __invSCF [128 + 6];   // inverted scalefactors
-
-
-// Quantization-coefficients: step/65536 bzw. (2*D[Res]+1)/65536
-static const float  __A [1 + 18] = {
-    0.0000762939453125f,
-    0.0000000000000000f, 0.0000457763671875f, 0.0000762939453125f, 0.0001068115234375f,
-    0.0001373291015625f, 0.0002288818359375f, 0.0004730224609375f, 0.0009613037109375f,
-    0.0019378662109375f, 0.0038909912109375f, 0.0077972412109375f, 0.0156097412109375f,
-    0.0312347412109375f, 0.0624847412109375f, 0.1249847412109375f, 0.2499847412109375f,
-    0.4999847412109375f
-};
-
-
-// Requantization-coefficients: 65536/step bzw. 1/A[Res]
-static const float  __C [1 + 18] = {
-    13107.200000000001f,
-    65535.000000000000f, 21845.333333333332f, 13107.200000000001f, 9362.285714285713f,
-     7281.777777777777f,  4369.066666666666f,  2114.064516129032f, 1040.253968253968f,
-      516.031496062992f,   257.003921568627f,   128.250489236790f,   64.062561094819f,
-       32.015632633121f,    16.003907203907f,     8.000976681723f,    4.000244155527f,
-        2.000061037018f,     1.000015259022f
-};
-
-
-// Requantization-Offset: 2*D+1 = steps of quantizer
-static const int  __D [1 + 18] = {
-    2,
-    0,     1,     2,     3,     4,     7,    15,    31,    63,
-  127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
-};
-
-#define A   (__A + 1)
-#define C   (__C + 1)
-#define D   (__D + 1)
-
-// generation of scalefactors and their inverses
-void
-Init_Skalenfaktoren ( void )
-{
-    int  n;
-
-    for ( n = -6; n < 128; n++ ) {
-        SCF[n]    = (float) ( pow(10.,-0.1*(n-1)/1.26) );
-        invSCF[n] = (float) ( pow(10., 0.1*(n-1)/1.26) );
-    }
-}
-
-
-static float  NoiseInjectionCompensation1D [18] = {
-    1.f,
-    0.884621,
-    0.935711,
-    0.970829,
-    0.987941,
-    0.994315,
-    0.997826,
-    0.999744,
-    1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f
-} ;
-
-static float  NoiseInjectionCompensation2D [18] [QUANT] = {
-#if 0
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 1.000000, 0.759249, 0.811836, 0.887331, 0.928149, 0.979971, 1.007421, 0.991449, 0.973947, 0.947925, 0.936421, 0.916337, 0.906686, 0.897296, 0.884270, 0.875419, 0.876278, 0.868250, 0.865214, 0.861756, 0.857050, 0.854532, 0.853627, 0.851695, 0.852243, 0.849346, 0.851076, 0.850652, 0.853719, 0.853392, 0.855967, 0.855529, 0.866884, 0.868897, 0.872451, 0.874693, 0.876086, 0.878925, 0.881002, 0.883748, 0.896915, 0.902294, 0.904282, 0.908025, 0.909089, 0.911731, 0.914048, 0.916787, 0.931141, 0.933261, 0.936990, 0.938510, 0.941108, 0.944846, 0.945569, 0.945446, 0.960741, 0.961310, 0.961236, 0.963485, 0.965850, 0.968487, 0.967972, 0.970880, 0.982873, 0.984252, 0.986016, 0.987185, 0.990836, 0.990069, 0.991684, 0.995063, 1.005844, 1.007861, 1.008456, 1.009472, 1.007765, 1.015780, 1.013161, 1.014316, 1.025401, 1.030166, 1.026138, 1.035660, 1.038433, 1.036167, 1.044260, 1.039487, 1.053740, 1.056427, 1.059859, 1.058788, 1.057076, 1.064166, 1.068220, 1.074360, 1.073819, 1.070236, 1.052957, 1.073170, 1.078512, 1.088742, 1.087788, 1.083055, 1.089437, 1.080983, 1.078256, 1.080718, 1.075766, 1.080217, 1.074016, 1.068206, 1.070925, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545, 1.074545,  },
-    { 0.734415, 0.857080, 0.896985, 0.910291, 0.919858, 0.932150, 0.900508, 0.884923, 0.888104, 0.897810, 0.904629, 0.932746, 0.941313, 0.950723, 0.939135, 0.940385, 0.932144, 0.929118, 0.929208, 0.923236, 0.920199, 0.919320, 0.918495, 0.915762, 0.919277, 0.918830, 0.919762, 0.920036, 0.921206, 0.923291, 0.926169, 0.927089, 0.935140, 0.937440, 0.939327, 0.940953, 0.943766, 0.945858, 0.948038, 0.950245, 0.956156, 0.958724, 0.960530, 0.962402, 0.963945, 0.966367, 0.967490, 0.968064, 0.973955, 0.975495, 0.976424, 0.977624, 0.978177, 0.979428, 0.980549, 0.981283, 0.984267, 0.985143, 0.984633, 0.985154, 0.985831, 0.986632, 0.987966, 0.987271, 0.989323, 0.990228, 0.989934, 0.990184, 0.992097, 0.991417, 0.992013, 0.990068, 0.993321, 0.991961, 0.991686, 0.995233, 0.993092, 0.993147, 0.992993, 0.994349, 0.991502, 0.994954, 0.992521, 0.993046, 0.992133, 0.991579, 0.991394, 0.995659, 0.992520, 0.991381, 0.993217, 0.994709, 0.998368, 0.995523, 1.003331, 0.998391, 1.002294, 1.003448, 1.006459, 1.003872, 1.003000, 1.005899, 1.008900, 1.014621, 1.012585, 1.008313, 1.012377, 1.017555, 1.014297, 1.018404, 1.018644, 1.009129, 1.023010, 1.018520, 1.015460, 1.031318, 1.039789, 1.024658, 1.014159, 1.017848, 1.028665, 1.024441, 1.019322, 1.007162, 1.007162, 1.021388, 1.020239, 1.021447, 1.007240, 1.011620, 1.021348, 1.021348, 1.021348, 1.021348, 1.021348, 1.021348, 1.021494, 1.021494, 1.015500, 1.001597, 0.993681, 0.993681, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.993008, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075, 0.986075,  },
-    { 0.777484, 0.849836, 0.881361, 0.906465, 0.865617, 0.848642, 0.858126, 0.889807, 0.906461, 0.928171, 0.938043, 0.949200, 0.962016, 0.969692, 0.961996, 0.966335, 0.963620, 0.961296, 0.958598, 0.962175, 0.962153, 0.961676, 0.958766, 0.960732, 0.959639, 0.961035, 0.960171, 0.960211, 0.960824, 0.961096, 0.961811, 0.962648, 0.963659, 0.964758, 0.965506, 0.966180, 0.967860, 0.969656, 0.970947, 0.971804, 0.975079, 0.976889, 0.978841, 0.979762, 0.981165, 0.981223, 0.982393, 0.983519, 0.985742, 0.986475, 0.986982, 0.987372, 0.988212, 0.989504, 0.989625, 0.989468, 0.991613, 0.993127, 0.991807, 0.993039, 0.992993, 0.993200, 0.994565, 0.994514, 0.994432, 0.996018, 0.995668, 0.996518, 0.996332, 0.996290, 0.996889, 0.995703, 0.996524, 0.995743, 0.999119, 0.998416, 0.999294, 0.998272, 0.999494, 1.000412, 0.998035, 0.996419, 0.998664, 0.998506, 0.997501, 1.001344, 0.999698, 0.994570, 0.995807, 0.993660, 0.998871, 0.996257, 0.997309, 0.995666, 0.990570, 0.995626, 0.999845, 0.998833, 0.997052, 0.996709, 0.999286, 1.002197, 1.002416, 1.000137, 1.003978, 1.004382, 1.009287, 1.008551, 1.013763, 1.008605, 1.004756, 1.012969, 1.010815, 1.010876, 1.015383, 1.017933, 1.019132, 1.021530, 1.013514, 1.024877, 1.015756, 1.013125, 1.015566, 1.021405, 1.013578, 1.014014, 1.018532, 1.018532, 1.020123, 1.027448, 1.027448, 1.027448, 1.027448, 1.027448, 1.027448, 1.019614, 1.019614, 1.019614, 1.019614, 1.019614, 1.019614, 1.021124, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.023807, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142, 1.017142,  },
-    { 0.768899, 0.859566, 0.868660, 0.852532, 0.872490, 0.892725, 0.881562, 0.866837, 0.925723, 0.945194, 0.959959, 0.971813, 0.968389, 0.967759, 0.981668, 0.978640, 0.982425, 0.982213, 0.976421, 0.977012, 0.982413, 0.977864, 0.976401, 0.976838, 0.977443, 0.976589, 0.977748, 0.976002, 0.976800, 0.975999, 0.977034, 0.975927, 0.977154, 0.977273, 0.978960, 0.980006, 0.979935, 0.979307, 0.980530, 0.982598, 0.983128, 0.984904, 0.985876, 0.987222, 0.987732, 0.988199, 0.989208, 0.989228, 0.991007, 0.991598, 0.992215, 0.993467, 0.993710, 0.994069, 0.993981, 0.994361, 0.995747, 0.996312, 0.995699, 0.995950, 0.996376, 0.996878, 0.997838, 0.996955, 0.998374, 0.998594, 0.999679, 0.998351, 0.999414, 0.999537, 0.998618, 0.999754, 1.000731, 0.998966, 1.002234, 1.001931, 0.999167, 1.001205, 1.002779, 1.002699, 1.000894, 1.000027, 1.001136, 0.998800, 0.999445, 1.003775, 1.001074, 1.002857, 1.002555, 0.998466, 0.999644, 0.997879, 1.002654, 1.003206, 0.998430, 1.000023, 1.001060, 1.001502, 0.996861, 1.000298, 1.001281, 0.997420, 1.001959, 0.999228, 1.000719, 1.001420, 0.997701, 0.998687, 1.002896, 1.002422, 1.001887, 1.011236, 1.012831, 1.006676, 1.009851, 1.010054, 1.010092, 1.011967, 1.007694, 1.011416, 1.015280, 1.019717, 1.021681, 1.024486, 1.022072, 1.013151, 1.013151, 1.013151, 1.013151, 1.013151, 1.015019, 1.015019, 1.015019, 1.015019, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.015317, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125, 1.017125,  },
-    { 0.839956, 0.865961, 0.912298, 0.937921, 0.968516, 0.968353, 0.962645, 0.963233, 0.979847, 0.984981, 0.988644, 0.990501, 0.987910, 0.989468, 0.988971, 0.988646, 0.988633, 0.987577, 0.988624, 0.988283, 0.988830, 0.989202, 0.990099, 0.989453, 0.990223, 0.990880, 0.991825, 0.992900, 0.992541, 0.993117, 0.993645, 0.993637, 0.994247, 0.994249, 0.995051, 0.994991, 0.995080, 0.995882, 0.995747, 0.996192, 0.996023, 0.996544, 0.996112, 0.997431, 0.996826, 0.996992, 0.998046, 0.997116, 0.997843, 0.997358, 0.997824, 0.998115, 0.998831, 0.998957, 0.997734, 0.998225, 0.998536, 0.998704, 0.998530, 0.999574, 0.998465, 0.998008, 0.999279, 0.999366, 0.999454, 0.999361, 0.999275, 0.998270, 0.998416, 0.999956, 1.000144, 1.002339, 1.002544, 1.000509, 1.001264, 1.000063, 0.999302, 0.996942, 1.000912, 1.000050, 1.000915, 0.999449, 0.997133, 1.000205, 1.000240, 0.999976, 1.000236, 1.003088, 1.000793, 1.001628, 1.003462, 1.001988, 1.000440, 0.998254, 1.003483, 1.001957, 0.997312, 0.998684, 0.999162, 1.002331, 1.004931, 0.996815, 0.997753, 0.997029, 0.997681, 0.995262, 0.995683, 0.995347, 0.995537, 0.995855, 0.992675, 0.992999, 0.999251, 0.994313, 0.997785, 1.000656, 1.003728, 1.004030, 1.005151, 1.006796, 1.008584, 1.008584, 1.008584, 1.008584, 1.008584, 1.005319, 1.005319, 1.005319, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048, 1.004048,  },
-    { 0.861658, 0.925399, 0.971516, 0.982990, 0.992434, 0.991670, 0.999973, 1.000043, 0.993083, 0.995639, 0.995057, 0.994765, 0.995116, 0.995923, 0.996336, 0.996430, 0.995870, 0.996637, 0.996606, 0.997476, 0.997240, 0.998162, 0.998235, 0.998083, 0.997596, 0.998039, 0.998771, 0.998811, 0.998454, 0.998627, 0.998150, 0.998736, 0.998806, 0.998505, 0.998143, 0.998593, 0.998706, 0.998098, 0.998872, 0.998888, 0.998844, 0.998687, 0.999085, 0.998703, 0.999004, 0.999388, 0.999620, 0.999266, 0.998804, 0.998950, 0.999404, 0.999814, 0.999143, 1.000488, 0.998742, 0.999974, 1.000739, 0.999638, 0.999379, 0.998059, 0.998744, 0.998998, 0.999441, 1.000469, 1.000281, 0.999614, 0.998420, 0.999277, 0.998442, 1.000233, 0.999099, 0.999995, 1.000365, 1.000578, 1.000795, 0.997980, 0.999078, 0.998692, 1.000042, 1.001127, 0.999597, 1.000944, 0.998729, 1.000249, 1.002022, 1.001158, 1.001404, 0.999505, 0.999044, 1.000293, 1.001153, 0.998334, 1.001352, 1.003395, 1.001892, 1.001279, 0.999643, 0.999199, 0.999447, 0.997067, 0.997998, 1.000928, 1.000157, 1.000559, 1.000173, 0.999746, 0.999867, 1.000447, 1.001589, 1.001497, 1.002821, 1.001103, 1.001643, 1.000214, 1.000987, 1.000282, 1.002714, 1.003704, 1.003704, 1.004103, 1.004103, 1.004103, 1.003721, 1.001320, 1.001320, 1.000950, 1.000627, 0.999960, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.997901, 0.999925, 0.999925, 0.999925, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.000831, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.002081, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370, 1.001370,  },
-    { 0.888012, 0.888012, 0.976153, 0.992298, 0.998194, 1.000647, 0.999943, 1.001850, 1.000058, 1.001049, 1.000415, 1.000445, 0.999754, 0.999602, 0.999038, 0.999360, 0.999352, 0.999436, 0.999568, 0.999189, 0.999526, 0.999854, 0.999661, 0.999592, 0.999705, 0.999757, 0.999562, 0.999328, 0.999065, 0.999693, 0.999667, 0.999524, 0.999433, 0.999448, 0.999285, 0.999274, 0.999776, 0.999271, 1.000119, 0.999198, 0.999772, 1.000295, 0.999845, 0.999724, 0.999606, 0.999950, 0.999794, 0.999597, 0.999305, 0.999749, 0.999644, 0.999705, 0.999882, 0.999665, 0.999794, 1.000224, 0.999795, 0.999888, 0.999818, 0.999782, 1.000380, 0.999894, 1.000021, 1.000553, 1.000501, 1.000478, 0.999858, 1.000275, 1.000135, 1.000516, 1.000148, 0.999943, 1.000052, 0.999137, 1.000090, 1.000529, 0.999132, 0.998689, 1.000216, 1.000217, 1.000034, 1.000121, 1.000197, 0.998887, 1.000615, 0.999998, 0.999232, 0.998459, 1.000808, 0.999540, 0.999216, 0.998480, 0.999391, 1.001703, 0.999803, 0.999429, 1.001745, 0.999870, 1.000718, 1.000747, 0.996927, 1.000126, 0.999562, 0.997671, 0.997870, 1.001165, 1.001102, 1.000046, 1.000708, 1.001004, 1.000856, 1.000705, 1.000177, 1.001061, 0.999174, 0.999368, 0.999040, 0.999040, 1.000290, 0.999860, 0.998796, 0.998993, 0.998926, 0.997532, 0.997532, 0.997532, 0.997532, 0.997532, 0.997532, 0.997083, 0.997083, 0.997083, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414, 0.997414,  },
-    { 0.958439, 0.980896, 0.986292, 0.995460, 0.998478, 0.998143, 0.998741, 1.000420, 1.000390, 1.000282, 1.000941, 0.999899, 0.999658, 0.999880, 1.001323, 1.000942, 1.000966, 1.000292, 0.999813, 1.000177, 0.999448, 1.000041, 1.000118, 0.999570, 1.000439, 0.999770, 0.999341, 0.999963, 0.999964, 0.999458, 1.000023, 1.000060, 1.000155, 0.999964, 1.000191, 0.999619, 1.000167, 1.000044, 0.999825, 0.999902, 0.999925, 1.000143, 1.000025, 0.999873, 0.999936, 1.000027, 0.999925, 1.000038, 0.999952, 0.999899, 0.999997, 0.999940, 0.999993, 1.000095, 0.999888, 1.000105, 0.999878, 0.999830, 0.999957, 1.000073, 1.000024, 1.000097, 0.999882, 1.000041, 1.000012, 0.999845, 1.000008, 0.999899, 1.000071, 0.999875, 0.999937, 0.999826, 1.000039, 0.999879, 0.999985, 1.000118, 0.999893, 0.999673, 1.000376, 1.000346, 1.000074, 1.000109, 1.000228, 0.999908, 0.999992, 1.000085, 1.000146, 0.999856, 0.999994, 1.000121, 0.999061, 1.000332, 1.000196, 0.999850, 0.999403, 0.999475, 0.998438, 0.999499, 0.999726, 0.999579, 0.999913, 0.999626, 0.999549, 0.999581, 1.000025, 1.000519, 1.000716, 0.999857, 1.000405, 1.000931, 1.000229, 0.999823, 0.999984, 1.000652, 1.000086, 0.999971, 0.999104, 0.999585, 1.000595, 0.999333, 0.999842, 0.999031, 0.999704, 0.999704, 0.999301, 0.999830, 0.999695, 0.999542, 1.000159, 1.000417, 1.000110, 1.000110, 1.000017, 1.000017, 1.000017, 1.000637, 1.000637, 1.000153, 1.000153, 1.000153, 1.000153, 1.000404, 1.000404, 1.000404, 1.000404, 1.000404, 1.000404, 1.000404, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000780, 1.000220, 1.000220, 1.000220, 1.000220, 1.000326, 1.000326, 1.000326, 1.000326, 1.000066, 1.000066, 1.000078, 1.000091, 1.000091, 1.000091, 1.000091, 0.999682, 0.999682, 0.999682, 0.999682, 1.000359, 1.000576, 1.000576, 1.000576, 1.000576, 1.000576, 1.000576, 1.000576, 1.000576, 1.000576, 1.001357, 1.001357, 1.001357, 1.001357, 1.001357, 1.001357, 1.001357, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000684, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394, 1.000394,  },
-    { 0.944965, 0.944965, 0.944965, 0.944965, 0.944965, 0.944965, 0.966881, 0.986033, 0.991892, 0.996405, 0.998322, 1.000154, 0.999697, 1.000262, 1.000323, 0.999933, 0.999551, 0.999867, 0.999910, 1.000066, 1.000620, 1.000105, 1.000308, 0.999734, 1.000108, 0.999844, 0.999806, 0.999652, 0.999982, 0.999906, 1.000015, 0.999880, 0.999729, 0.999963, 0.999786, 0.999917, 0.999756, 1.000028, 0.999854, 1.000070, 0.999969, 1.000092, 0.999666, 0.999958, 1.000054, 0.999872, 0.999901, 1.000070, 0.999904, 0.999958, 0.999941, 1.000017, 0.999970, 0.999901, 1.000156, 0.999956, 0.999996, 0.999868, 0.999849, 1.000034, 0.999826, 0.999900, 1.000018, 1.000045, 0.999931, 1.000022, 1.000078, 1.000018, 1.000118, 1.000235, 0.999987, 0.999758, 0.999765, 1.000121, 0.999940, 0.999707, 0.999862, 0.999903, 1.000216, 1.000211, 1.000152, 1.000181, 0.999979, 0.999721, 0.999863, 0.999737, 1.000034, 0.999674, 1.000281, 1.000399, 1.000296, 1.000299, 1.000124, 1.000082, 1.000306, 1.000057, 0.999740, 0.999842, 0.999829, 0.999918, 1.000016, 0.999204, 0.999476, 0.999756, 1.000143, 1.000383, 0.999942, 1.000134, 1.000132, 1.000204, 0.999867, 1.000072, 1.000066, 1.000167, 0.999971, 0.999706, 0.999531, 0.999722, 1.000031, 1.000123, 1.000701, 1.000530, 1.000339, 1.000240, 0.999823, 1.000075, 1.000122, 1.000202, 1.000020, 0.999771, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 0.999538, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048,  },
-    { 0.959841, 0.959841, 0.959841, 0.959841, 0.959841, 0.971405, 0.991069, 0.996331, 0.997500, 0.999523, 0.999033, 1.000030, 0.999960, 0.999803, 0.999719, 0.999968, 1.000139, 1.000104, 1.000096, 1.000045, 1.000033, 1.000075, 0.999997, 0.999958, 0.999890, 1.000051, 1.000052, 0.999951, 1.000100, 1.000154, 0.999983, 1.000075, 1.000198, 1.000173, 0.999903, 0.999898, 0.999951, 0.999970, 1.000196, 1.000154, 0.999989, 0.999829, 1.000132, 1.000080, 1.000026, 0.999949, 0.999788, 1.000058, 1.000135, 1.000127, 0.999912, 0.999970, 1.000062, 1.000131, 0.999988, 0.999950, 1.000113, 1.000016, 1.000027, 1.000001, 1.000113, 0.999860, 1.000142, 1.000008, 0.999977, 1.000269, 1.000245, 0.999972, 1.000018, 0.999952, 0.999987, 0.999940, 1.000007, 1.000001, 1.000090, 1.000006, 1.000017, 0.999902, 1.000133, 1.000035, 0.999949, 0.999737, 0.999803, 0.999850, 1.000085, 1.000198, 1.000111, 1.000228, 0.999878, 0.999962, 0.999991, 1.000120, 0.999840, 1.000209, 1.000227, 0.999937, 0.999899, 0.999865, 1.000047, 1.000078, 0.999774, 1.000111, 0.999939, 0.999761, 0.999814, 1.000362, 1.000362, 1.000206, 1.000215, 1.000465, 1.000288, 1.000104, 1.000206, 1.000154, 1.000154, 1.000154, 1.000154, 1.000058, 1.000058, 0.999760, 0.999638, 0.999638, 0.999638, 0.999638, 0.999498, 0.999498, 0.999828, 1.000688, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768, 0.999768,  },
-    { 0.977692, 0.977692, 0.977692, 0.977692, 0.977692, 0.977692, 0.992476, 0.996357, 0.998241, 0.999482, 0.999859, 1.000138, 1.000226, 1.000218, 1.000160, 1.000172, 1.000060, 0.999980, 0.999946, 0.999932, 0.999926, 0.999999, 1.000090, 1.000081, 1.000105, 1.000194, 1.000172, 1.000139, 1.000181, 1.000103, 1.000137, 1.000114, 0.999955, 0.999993, 0.999908, 0.999965, 1.000107, 1.000065, 0.999976, 1.000006, 0.999907, 1.000030, 0.999984, 1.000043, 1.000072, 1.000039, 0.999933, 1.000049, 1.000029, 1.000097, 1.000074, 1.000127, 1.000054, 0.999979, 0.999896, 0.999792, 0.999908, 0.999799, 0.999940, 0.999930, 0.999971, 1.000126, 0.999884, 0.999817, 0.999802, 1.000000, 0.999999, 0.999916, 0.999937, 0.999856, 0.999865, 0.999974, 0.999856, 0.999901, 0.999796, 0.999769, 0.999882, 0.999759, 0.999964, 0.999877, 0.999942, 0.999844, 0.999942, 0.999757, 0.999862, 0.999852, 0.999795, 1.000173, 0.999926, 0.999926, 0.999895, 0.999852, 0.999933, 0.999928, 0.999783, 0.999745, 0.999664, 0.999785, 0.999941, 0.999882, 1.000006, 0.999662, 0.999713, 0.999866, 0.999961, 0.999754, 0.999928, 0.999938, 1.000214, 0.999984, 1.000157, 1.000079, 1.000119, 1.000119, 0.999842, 1.000085, 0.999930, 1.000032, 0.999928, 0.999928, 0.999928, 1.000185, 1.000185, 0.999894, 0.999918, 0.999918, 0.999918, 0.999918, 1.000264, 1.000264, 1.000264, 1.000264, 1.000264, 1.000264, 1.000264, 1.000264, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375, 1.000375,  },
-    { 0.995891, 0.995891, 0.995891, 0.995891, 0.995891, 0.997098, 0.998660, 0.999597, 0.999820, 0.999820, 0.999904, 0.999960, 1.000008, 1.000012, 1.000043, 1.000136, 1.000030, 0.999990, 0.999912, 0.999912, 1.000009, 1.000000, 1.000030, 1.000069, 1.000035, 1.000062, 1.000029, 0.999970, 0.999942, 0.999957, 0.999964, 1.000010, 0.999967, 1.000050, 1.000013, 0.999899, 0.999934, 0.999995, 0.999999, 1.000017, 1.000008, 0.999999, 1.000051, 1.000036, 1.000045, 1.000012, 1.000023, 1.000006, 1.000031, 0.999981, 0.999915, 0.999953, 1.000002, 1.000029, 1.000043, 1.000002, 1.000001, 1.000009, 1.000025, 1.000025, 1.000025, 1.000021, 1.000003, 1.000003, 1.000018, 1.000018, 0.999998, 0.999998, 0.999998, 0.999998, 0.999994, 0.999994, 1.000055, 1.000055, 1.000055, 1.000055, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000036, 1.000061, 0.999877, 0.999984, 0.999808, 0.999715, 0.999831, 0.999831, 0.999930, 0.999893, 0.999904, 0.999891, 0.999933, 0.999963, 1.000090, 1.000060, 0.999985, 1.000026, 1.000038, 1.000038, 1.000027, 1.000027, 1.000148, 1.000320, 1.000320, 1.000165, 1.000165, 1.000268, 1.000206, 1.000116, 1.000116, 1.000116, 1.000116, 1.000116, 1.000046, 1.000061, 1.000061, 1.000201, 1.000201, 1.000201, 1.000201, 0.999988, 0.999988, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052, 1.000052,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 0.999989, 1.000000, 0.999982, 0.999982, 1.000037, 1.000009, 1.000009, 0.999996, 1.000007, 1.000016, 1.000016, 1.000003, 1.000003, 1.000003, 0.999991, 0.999977, 1.000018, 1.000003, 0.999986, 0.999986, 1.000000, 1.000015, 1.000013, 1.000013, 0.999972, 0.999957, 0.999974, 1.000016, 0.999993, 1.000004, 0.999991, 1.000008, 1.000019, 0.999983, 0.999992, 1.000007, 0.999979, 0.999997, 1.000014, 1.000003, 1.000003, 0.999989, 1.000003, 1.000013, 1.000015, 1.000006, 0.999993, 1.000026, 0.999998, 0.999990, 0.999991, 0.999991, 0.999982, 1.000006, 1.000006, 1.000013, 1.000013, 1.000013, 1.000013, 1.000013, 1.000007, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 0.999955, 0.999892, 1.000013, 1.000013, 0.999958, 0.999970, 1.000042, 1.000095, 1.000189, 1.000057, 1.000033, 1.000033, 1.000060, 1.000058, 1.000055, 0.999980, 0.999949, 0.999949, 0.999949, 0.999845, 0.999845, 0.999919, 0.999919, 0.999919, 0.999919, 0.999919, 0.999987, 0.999895, 0.999895, 0.999953, 0.999953, 0.999953, 0.999891, 0.999891, 0.999936, 1.000008, 1.000039, 1.000039, 1.000065, 0.999986, 0.999986, 0.999977, 0.999977, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950, 0.999950,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 0.999992, 0.999992, 1.000010, 1.000010, 1.000021, 1.000023, 1.000005, 0.999999, 1.000015, 1.000022, 1.000022, 1.000022, 1.000022, 1.000004, 0.999980, 0.999978, 0.999969, 0.999988, 0.999981, 0.999995, 1.000013, 1.000008, 1.000008, 1.000014, 1.000015, 1.000012, 1.000000, 0.999999, 1.000003, 1.000006, 1.000000, 1.000000, 0.999991, 1.000004, 1.000003, 0.999998, 0.999998, 1.000003, 1.000000, 0.999997, 0.999982, 1.000000, 0.999988, 0.999988, 0.999995, 1.000000, 0.999999, 1.000002, 1.000002, 1.000005, 1.000003, 1.000003, 1.000003, 1.000000, 1.000002, 0.999996, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 0.999997, 1.000040, 1.000004, 1.000004, 1.000006, 0.999967, 0.999967, 0.999967, 0.999995, 0.999995, 0.999995, 1.000045, 1.000045, 1.000045, 1.000045, 1.000045, 1.000045, 1.000050, 1.000050, 1.000050, 1.000027, 0.999987, 0.999998, 1.000003, 0.999999, 0.999985, 1.000003, 0.999962, 0.999979, 0.999966, 0.999996, 1.000018, 1.000018, 1.000018, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048, 1.000048,  },
-    { 0.999921, 0.999995, 0.999984, 1.000001, 0.999993, 1.000002, 1.000005, 1.000001, 1.000003, 1.000004, 0.999999, 0.999999, 0.999996, 0.999999, 1.000003, 0.999999, 0.999998, 0.999997, 1.000000, 1.000001, 0.999998, 0.999997, 0.999998, 1.000002, 1.000001, 1.000001, 0.999990, 0.999994, 1.000001, 1.000001, 0.999995, 0.999996, 0.999998, 0.999998, 1.000008, 0.999999, 0.999996, 0.999997, 0.999994, 0.999999, 0.999995, 0.999994, 0.999996, 0.999995, 1.000002, 0.999995, 1.000002, 0.999997, 0.999995, 1.000001, 1.000004, 1.000002, 0.999991, 0.999999, 1.000003, 1.000004, 0.999997, 0.999999, 0.999999, 0.999995, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 1.000000, 0.999993, 0.999993, 0.999990, 0.999990, 0.999990, 0.999990, 0.999990, 0.999990, 0.999990, 0.999992, 0.999992, 0.999992, 0.999992, 0.999992, 0.999992, 0.999992, 0.999996, 0.999996, 0.999996, 0.999996, 1.000000, 1.000000, 1.000000, 0.999998, 0.999998, 0.999998, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999988, 0.999985, 0.999985, 0.999985, 0.999985, 0.999985, 0.999985, 0.999985, 0.999985, 0.999985, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999993, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999998, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999, 0.999999,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
-#else
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, },
-    { 0.616131, 0.616131, 0.734747, 0.886817, 0.980358, 0.954706, 0.950045, 0.960931, 0.959150, 0.943952, 0.930077, 0.918955, 0.908105, 0.900059, 0.890206, 0.882758, 0.876392, 0.871656, 0.867785, 0.864705, 0.862837, 0.860063, 0.858112, 0.855724, 0.854318, 0.853730, 0.854255, 0.854730, 0.856689, 0.858025, 0.859946, 0.861590, 0.865622, 0.868217, 0.870760, 0.873500, 0.876042, 0.878973, 0.882292, 0.885696, 0.892888, 0.897370, 0.900918, 0.905012, 0.907881, 0.911784, 0.914552, 0.918197, 0.927057, 0.930175, 0.934090, 0.936766, 0.940359, 0.944065, 0.946316, 0.947698, 0.958108, 0.960000, 0.961662, 0.964533, 0.967846, 0.971715, 0.972701, 0.976633, 0.986332, 0.988553, 0.991205, 0.994059, 0.998284, 0.999573, 1.001752, 1.006336, 1.016049, 1.018810, 1.020155, 1.022868, 1.023305, 1.030555, 1.030578, 1.032943, 1.043712, 1.047066, 1.047879, 1.054832, 1.057873, 1.060241, 1.068205, 1.063556, 1.076127, 1.080065, 1.084100, 1.082207, 1.083114, 1.087343, 1.093541, 1.093648, 1.091946, 1.094561, 1.080420, 1.098269, 1.110210, 1.127212, 1.112505, 1.115807, 1.128031, 1.110317, 1.106405, 1.115765, 1.108560, 1.100118, 1.096582, 1.097625, 1.094705, 1.112193, 1.098206, 1.111359, 1.102994, 1.102994, 1.113800, 1.109949, 1.109949, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, 1.112013, },
-    { 0.682484, 0.880496, 0.933150, 0.958092, 0.920851, 0.914449, 0.893873, 0.876759, 0.876373, 0.899515, 0.913776, 0.922544, 0.923000, 0.920533, 0.926424, 0.922544, 0.922558, 0.922367, 0.921105, 0.922131, 0.922986, 0.922701, 0.921832, 0.918927, 0.917866, 0.916825, 0.916769, 0.916389, 0.917947, 0.919901, 0.922736, 0.925191, 0.929896, 0.933066, 0.935910, 0.938847, 0.941973, 0.945050, 0.947802, 0.950800, 0.954503, 0.957288, 0.959916, 0.962157, 0.964407, 0.966783, 0.968470, 0.970027, 0.973132, 0.974853, 0.976195, 0.977813, 0.978842, 0.980216, 0.981274, 0.982492, 0.984145, 0.985066, 0.985370, 0.986200, 0.986943, 0.987840, 0.988997, 0.989405, 0.990457, 0.991030, 0.991626, 0.992166, 0.993854, 0.993865, 0.994239, 0.993748, 0.995467, 0.995010, 0.995235, 0.997263, 0.996522, 0.996437, 0.998079, 0.997185, 0.995883, 0.997825, 0.995797, 0.996259, 0.995685, 0.994869, 0.993122, 0.994995, 0.995255, 0.992955, 0.993960, 0.995288, 0.998428, 0.997589, 1.000767, 0.998583, 1.000946, 1.001708, 1.005122, 1.004659, 1.004930, 1.007516, 1.010077, 1.015583, 1.011771, 1.013571, 1.016376, 1.022755, 1.020342, 1.020257, 1.019837, 1.022947, 1.028265, 1.012395, 1.011431, 1.024815, 1.032472, 1.025095, 1.025829, 1.025144, 1.031136, 1.032366, 1.014361, 1.015134, 1.021166, 1.006008, 1.014564, 1.008802, 0.986902, 1.013066, 1.015823, 1.003702, 1.008200, 1.000433, 1.008661, 0.993279, 1.025083, 1.008555, 1.016568, 0.989536, 0.975502, 0.993166, 0.992309, 0.979477, 0.963696, 0.966868, 0.976616, 0.969930, 0.983457, 0.983457, 1.000261, 0.996421, 0.992135, 0.982932, 0.979702, 0.980815, 0.991218, 0.992173, 1.006269, 0.993281, 0.991224, 0.992747, 0.989325, 0.987845, 0.987845, 0.989084, 0.997563, 0.997563, 1.003053, 1.002884, 1.003967, 1.007797, 1.009997, 1.016264, 1.020943, 1.020943, 1.025365, 1.025365, 1.025365, 1.027905, 1.027905, 1.027905, 1.027905, 1.034669, 1.041676, 1.041676, 1.041676, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, 1.045761, },
-    { 0.789151, 0.895977, 0.899902, 0.888249, 0.863900, 0.849525, 0.855401, 0.884939, 0.891570, 0.910757, 0.920988, 0.913430, 0.944910, 0.947936, 0.948704, 0.950504, 0.953459, 0.956819, 0.956571, 0.954463, 0.954719, 0.955415, 0.955631, 0.955920, 0.956659, 0.957066, 0.957613, 0.957999, 0.958500, 0.959206, 0.960202, 0.961279, 0.962476, 0.963613, 0.964988, 0.966308, 0.967875, 0.969465, 0.971099, 0.972745, 0.974691, 0.976501, 0.978060, 0.979447, 0.980996, 0.981924, 0.983243, 0.984302, 0.985790, 0.986402, 0.987427, 0.988074, 0.988790, 0.989732, 0.990233, 0.990590, 0.991629, 0.992656, 0.992510, 0.992951, 0.993348, 0.993670, 0.994681, 0.994879, 0.995219, 0.996306, 0.996527, 0.996819, 0.997100, 0.996882, 0.998285, 0.997338, 0.997747, 0.997374, 0.999004, 0.999430, 0.999085, 0.998994, 1.000086, 1.000515, 0.999084, 0.999072, 0.997866, 0.997644, 0.997072, 0.999242, 0.998522, 0.997645, 0.996785, 0.995702, 0.998996, 0.996993, 0.996306, 0.997134, 0.994041, 0.996872, 0.995996, 0.997920, 0.997196, 0.997764, 0.999380, 1.000592, 1.001749, 1.001423, 1.004040, 1.003727, 1.007266, 1.008974, 1.011074, 1.011305, 1.008859, 1.014175, 1.011539, 1.018990, 1.016312, 1.018360, 1.016701, 1.024859, 1.019605, 1.021984, 1.017429, 1.013235, 1.010488, 1.016077, 1.015345, 1.013296, 1.011784, 1.006059, 1.029704, 1.019436, 1.029598, 1.013764, 1.020913, 1.021190, 1.014372, 1.011797, 1.012959, 1.020472, 1.016675, 1.015356, 1.010937, 1.015670, 1.019325, 1.017865, 1.025488, 1.025650, 1.025650, 1.025650, 1.020218, 1.029207, 1.030376, 1.024211, 1.023268, 1.023268, 1.023268, 1.023268, 1.028098, 1.027407, 1.032736, 1.032736, 1.030909, 1.030909, 1.030909, 1.030909, 1.025261, 1.013170, 1.013170, 1.014094, 1.014094, 1.014094, 1.015222, 1.015222, 1.015222, 1.015222, 1.022498, 1.022498, 1.022498, 1.022498, 1.022498, 1.007050, 1.007050, 1.004453, 1.004453, 1.004453, 1.004453, 1.004453, 1.006778, 1.010545, 1.010545, 1.010545, 1.010545, 1.010545, 1.010545, 1.010545, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, 1.018806, },
-    { 0.814332, 0.896248, 0.876293, 0.844228, 0.834564, 0.870821, 0.895009, 0.927252, 0.945764, 0.945946, 0.961786, 0.968900, 0.970908, 0.979862, 0.980358, 0.979291, 0.978855, 0.976864, 0.977286, 0.976420, 0.977588, 0.976528, 0.976966, 0.976470, 0.976110, 0.975982, 0.976006, 0.975435, 0.975317, 0.975288, 0.975882, 0.976030, 0.976923, 0.977154, 0.978024, 0.978862, 0.979845, 0.979924, 0.981186, 0.982767, 0.983479, 0.984747, 0.985991, 0.987061, 0.987816, 0.988622, 0.989690, 0.990369, 0.991295, 0.991780, 0.992481, 0.993135, 0.993882, 0.994527, 0.994501, 0.995248, 0.995907, 0.996427, 0.996390, 0.996621, 0.997259, 0.997409, 0.998096, 0.997957, 0.998541, 0.998584, 0.999439, 0.998592, 0.999987, 0.999972, 0.999644, 1.000285, 1.000988, 1.000139, 1.001206, 1.001282, 1.000188, 1.001359, 1.001694, 1.001627, 1.000789, 1.000912, 1.001981, 1.000228, 1.000351, 1.002311, 1.002417, 1.002421, 1.002071, 1.000903, 1.000191, 1.001110, 1.000952, 0.999693, 1.001240, 1.000438, 1.000509, 1.001116, 0.999694, 0.999756, 1.001231, 1.000523, 1.001255, 1.000204, 1.001585, 1.003166, 1.000129, 1.000272, 1.005635, 1.003530, 1.001516, 1.008032, 1.012237, 1.006608, 1.009053, 1.011160, 1.013107, 1.012571, 1.008652, 1.013285, 1.013899, 1.009900, 1.022898, 1.020338, 1.022302, 1.013907, 1.011245, 1.015492, 1.012694, 1.007702, 1.018534, 1.008326, 1.017731, 1.014660, 1.019608, 1.005804, 1.010028, 1.013225, 1.007712, 1.009375, 1.011659, 1.011659, 1.005437, 1.008122, 1.008122, 1.006613, 1.003185, 1.007230, 1.005147, 1.005147, 1.007733, 1.004279, 1.004279, 1.004279, 1.008603, 1.008603, 1.008603, 1.002206, 1.012225, 1.011828, 1.011174, 1.011174, 1.011174, 1.020357, 1.020357, 1.020357, 1.020357, 1.020357, 1.020357, 1.021572, 1.021572, 1.021572, 1.021572, 1.021572, 1.021572, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.019650, 1.010059, 1.010059, 1.010059, 1.010059, 1.010059, 1.005427, 1.005427, 1.005427, 1.013256, 1.013256, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, 1.009970, },
-    { 0.858227, 0.835587, 0.909241, 0.955173, 0.961592, 0.973367, 0.978602, 0.983938, 0.984539, 0.987252, 0.985549, 0.986137, 0.987582, 0.987367, 0.987766, 0.987784, 0.987745, 0.988689, 0.988358, 0.988600, 0.988875, 0.989293, 0.989705, 0.990029, 0.990470, 0.991156, 0.991551, 0.992208, 0.992572, 0.993020, 0.993576, 0.993856, 0.994439, 0.994666, 0.994902, 0.995232, 0.995428, 0.995635, 0.995890, 0.996078, 0.996244, 0.996496, 0.996496, 0.996914, 0.997054, 0.997226, 0.997453, 0.997607, 0.997668, 0.997852, 0.997987, 0.997985, 0.998166, 0.998320, 0.998163, 0.998626, 0.998849, 0.999001, 0.998870, 0.999212, 0.998890, 0.999065, 0.999312, 0.999570, 0.999283, 0.999392, 0.999472, 0.999559, 1.000136, 0.999971, 1.000137, 1.000171, 1.000619, 0.999684, 1.000420, 1.000286, 0.999898, 0.999951, 1.000012, 0.999540, 1.000046, 1.000230, 1.000375, 1.000555, 1.000350, 0.999877, 1.000192, 1.001255, 1.000443, 1.000823, 1.000760, 1.000983, 1.000327, 0.999792, 1.000579, 0.999569, 1.000239, 0.999329, 0.998884, 1.000581, 1.000055, 0.999467, 1.000162, 0.998296, 0.997568, 0.997628, 0.998421, 0.998911, 0.997357, 0.998709, 0.997042, 0.996396, 0.999556, 1.000073, 0.999243, 1.000316, 1.000907, 0.999008, 1.004315, 1.002645, 1.004206, 1.007813, 1.008300, 1.004697, 1.005047, 1.004431, 0.998737, 1.001784, 1.000455, 1.001740, 1.001106, 1.002817, 1.003844, 1.003530, 1.000599, 0.994017, 1.001614, 1.000397, 0.996718, 0.997037, 0.998441, 1.000001, 0.993741, 1.000908, 1.000908, 1.001036, 1.001036, 1.003975, 1.003975, 1.008938, 1.008785, 1.005417, 1.004545, 0.998832, 0.999253, 1.000662, 0.996537, 0.995415, 0.997241, 0.990184, 0.992132, 0.992132, 1.000281, 1.000281, 1.000447, 0.999427, 0.999427, 0.999427, 1.000596, 1.000596, 1.000596, 1.000596, 1.000596, 1.000596, 1.003926, 1.003926, 1.003926, 1.003926, 1.003926, 1.002241, 1.002241, 1.002241, 1.002241, 1.002241, 0.999984, 0.999984, 0.999984, 0.999984, 0.999984, 0.999984, 0.999984, 0.999984, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, 1.004992, },
-    { 0.849514, 0.967738, 0.982055, 0.985196, 0.988990, 0.992610, 0.989578, 0.990533, 0.994646, 0.994194, 0.994784, 0.995109, 0.995116, 0.995406, 0.995684, 0.996098, 0.996242, 0.996673, 0.996910, 0.997312, 0.997416, 0.997589, 0.997800, 0.998024, 0.998077, 0.998168, 0.998279, 0.998397, 0.998475, 0.998393, 0.998379, 0.998509, 0.998463, 0.998637, 0.998609, 0.998689, 0.998628, 0.998793, 0.998716, 0.998763, 0.998837, 0.999005, 0.999017, 0.999103, 0.999218, 0.999230, 0.999159, 0.999138, 0.999170, 0.999117, 0.999173, 0.999350, 0.999440, 0.999405, 0.999402, 0.999642, 0.999779, 0.999514, 0.999587, 0.999662, 0.999539, 0.999542, 0.999493, 0.999791, 0.999788, 0.999623, 0.999436, 0.999813, 0.999996, 0.999789, 0.999788, 0.999908, 0.999775, 0.999595, 0.999552, 0.999594, 0.999823, 0.999817, 0.999720, 0.999997, 1.000167, 1.000052, 1.000043, 0.999362, 0.999311, 0.999809, 0.999453, 0.999422, 0.999543, 1.000417, 0.999728, 0.999776, 1.000459, 1.000544, 0.999527, 0.999973, 0.999542, 0.999629, 0.999543, 0.999983, 0.999980, 0.999725, 0.999206, 0.998993, 0.999610, 0.999988, 0.999857, 1.000845, 1.000643, 0.999988, 0.999580, 0.998932, 0.999068, 1.000619, 0.999884, 0.999302, 0.999250, 1.002150, 0.999881, 0.999011, 0.998997, 1.000695, 1.000825, 1.000397, 1.002974, 0.998637, 0.997673, 0.997554, 0.998931, 1.001232, 1.000958, 1.001564, 0.999779, 1.000649, 0.999308, 1.000964, 1.001280, 1.002232, 1.000503, 0.998577, 0.998245, 1.001079, 1.001291, 0.999071, 0.999071, 1.000005, 1.001124, 1.001384, 1.001663, 1.003587, 1.003587, 1.003079, 1.002593, 1.001578, 1.000020, 1.001489, 1.001913, 1.000311, 1.001327, 1.002771, 1.002771, 1.002579, 0.998380, 0.998380, 0.998947, 0.998947, 1.003311, 1.002575, 1.002575, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001160, 1.001026, 1.001031, 1.001031, 1.001329, 1.001329, 1.001329, 1.000726, 1.000726, 1.000726, 1.000726, 1.002521, 1.001268, 1.001268, 1.001268, 1.001268, 0.999547, 0.999547, 0.999547, 1.000632, 1.000632, 1.000632, 1.000632, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.000082, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, 1.001154, },
-    { 0.920871, 0.989518, 0.996647, 0.997549, 0.998742, 1.000943, 1.000874, 1.001488, 1.001089, 1.000924, 1.000418, 1.000218, 0.999888, 0.999827, 0.999459, 0.999532, 0.999514, 0.999490, 0.999290, 0.999342, 0.999446, 0.999536, 0.999412, 0.999405, 0.999531, 0.999554, 0.999526, 0.999648, 0.999569, 0.999591, 0.999564, 0.999553, 0.999626, 0.999667, 0.999671, 0.999539, 0.999683, 0.999676, 0.999702, 0.999697, 0.999717, 0.999760, 0.999754, 0.999807, 0.999786, 0.999830, 0.999758, 0.999716, 0.999755, 0.999823, 0.999932, 0.999887, 0.999905, 0.999868, 0.999858, 0.999822, 0.999884, 1.000041, 0.999881, 0.999880, 1.000030, 0.999878, 0.999975, 0.999914, 0.999847, 0.999974, 0.999851, 0.999855, 0.999881, 1.000058, 0.999940, 1.000075, 0.999833, 0.999786, 0.999887, 0.999897, 0.999671, 1.000026, 0.999860, 0.999627, 0.999917, 0.999961, 0.999614, 0.999897, 0.999509, 0.999874, 1.000254, 0.999772, 0.999761, 1.000059, 0.999613, 0.999925, 0.999479, 0.999945, 0.999423, 0.999651, 1.000066, 0.999763, 1.000078, 0.999873, 0.999871, 1.000126, 0.999602, 0.999646, 0.999434, 0.999696, 0.999213, 1.000221, 1.000273, 0.999856, 1.000287, 1.000048, 0.999923, 0.999587, 0.999996, 0.998859, 0.999870, 1.000013, 1.000513, 0.999477, 0.999637, 1.000142, 0.999760, 0.999749, 0.999794, 1.000090, 0.999062, 0.998599, 0.999196, 0.998599, 0.999449, 1.000884, 1.001418, 1.001911, 1.000091, 0.999568, 0.998772, 0.998567, 1.000621, 0.999673, 1.000687, 1.002959, 0.999669, 0.999334, 1.000141, 0.998551, 0.999158, 0.999158, 0.999158, 0.998715, 0.999914, 1.000906, 1.000649, 1.000755, 1.000378, 1.000378, 0.999512, 0.999759, 0.999759, 0.999425, 0.998542, 0.999474, 0.999610, 0.999685, 1.000120, 1.000120, 1.000669, 1.000669, 1.000547, 1.000547, 1.000547, 1.000547, 0.999443, 0.999911, 0.999911, 0.999911, 1.001443, 1.001443, 1.000810, 1.000810, 1.000810, 0.999297, 0.999297, 0.999297, 0.999297, 0.999950, 0.999950, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 0.999188, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000086, 1.000164, 1.000164, 1.000164, 1.000164, 1.000164, 1.000164, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, 0.999236, },
-    { 0.983884, 1.009527, 0.998399, 0.998548, 0.998817, 0.999316, 0.999543, 0.996498, 0.999865, 1.000339, 0.999933, 0.999915, 0.999840, 1.000045, 1.000348, 1.000024, 0.999951, 1.000038, 0.999801, 1.000194, 1.000213, 1.000145, 1.000086, 1.000056, 1.000119, 0.999890, 0.999941, 0.999898, 0.999950, 0.999867, 1.000043, 0.999971, 0.999986, 1.000027, 1.000016, 0.999969, 0.999999, 0.999975, 0.999970, 0.999990, 0.999974, 0.999990, 1.000003, 0.999955, 0.999985, 0.999990, 0.999973, 0.999986, 0.999996, 1.000011, 1.000029, 0.999961, 0.999968, 1.000010, 0.999949, 0.999984, 0.999970, 0.999959, 0.999986, 1.000006, 0.999956, 1.000019, 0.999980, 0.999974, 1.000037, 1.000024, 0.999996, 0.999963, 1.000020, 0.999996, 1.000023, 1.000038, 1.000023, 0.999969, 0.999985, 0.999986, 1.000033, 0.999991, 1.000006, 1.000031, 0.999973, 1.000074, 0.999942, 0.999926, 0.999948, 1.000055, 0.999984, 0.999867, 0.999994, 0.999941, 1.000031, 0.999998, 1.000054, 1.000011, 1.000009, 0.999933, 0.999837, 1.000151, 0.999973, 1.000008, 1.000081, 0.999886, 1.000129, 1.000051, 0.999748, 0.999908, 1.000367, 1.000060, 1.000032, 1.000296, 1.000238, 1.000135, 1.000086, 1.000070, 0.999961, 0.999999, 0.999738, 0.999696, 1.000215, 1.000302, 1.000066, 1.000019, 0.999921, 0.999859, 0.999876, 0.999814, 0.999672, 0.999922, 1.000232, 1.000249, 1.000077, 0.999522, 0.999170, 1.000412, 1.000480, 1.000544, 1.000280, 0.999999, 1.000061, 1.000291, 1.000023, 0.999751, 0.999210, 0.999799, 0.999731, 1.000166, 0.999796, 1.000074, 0.999907, 0.999443, 1.000727, 1.000373, 0.999860, 1.000092, 0.999796, 1.000332, 0.999885, 1.000012, 1.000141, 0.999420, 1.000435, 0.999961, 1.000131, 0.999702, 0.999281, 0.999257, 1.000092, 0.999929, 1.000442, 1.000034, 0.999452, 0.999570, 0.999108, 0.999829, 0.999834, 0.999734, 0.999914, 0.999008, 0.998763, 0.999507, 0.999716, 0.999819, 1.000297, 0.999654, 1.000330, 1.000227, 1.000450, 1.000444, 1.000000, 1.000000, 1.000000, 1.000899, 0.999760, 0.999760, 1.000840, 1.000459, 0.999433, 0.999433, 0.999933, 0.999753, 1.000344, 1.000348, 1.000501, 1.000219, 1.000771, 1.000624, 1.000413, 1.000203, 0.999734, 1.000613, 1.000494, 0.999514, 1.000282, 1.000038, 1.000317, 1.000192, 0.999972, 0.999738, 0.999804, 1.000320, 1.000031, 1.000031, 1.000031, 1.000031, 1.000031, 1.000031, 1.000031, 1.000013, 0.999737, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, 0.999692, },
-    { 0.972613, 1.005636, 1.000563, 1.000465, 0.999341, 1.000017, 0.999630, 0.999826, 1.000067, 1.000026, 0.999776, 1.000350, 1.000098, 0.999771, 1.000017, 0.999927, 1.000153, 1.000053, 1.000045, 1.000025, 1.000057, 1.000000, 0.999953, 0.999978, 0.999879, 1.000067, 1.000001, 1.000033, 1.000003, 1.000129, 1.000133, 0.999988, 1.000043, 1.000061, 0.999960, 1.000029, 1.000011, 1.000043, 0.999970, 0.999969, 1.000078, 1.000021, 0.999938, 0.999995, 1.000016, 0.999960, 0.999931, 0.999965, 0.999993, 1.000002, 0.999980, 0.999972, 0.999960, 0.999952, 1.000024, 0.999992, 0.999965, 1.000005, 0.999979, 0.999994, 0.999951, 0.999982, 0.999927, 0.999977, 0.999969, 0.999953, 1.000000, 1.000026, 1.000007, 1.000084, 1.000018, 0.999933, 0.999953, 1.000088, 0.999969, 1.000011, 1.000112, 0.999922, 1.000015, 1.000099, 0.999974, 1.000027, 1.000068, 1.000036, 1.000059, 1.000073, 0.999891, 0.999927, 1.000089, 1.000148, 1.000019, 1.000053, 0.999965, 1.000004, 1.000009, 1.000013, 1.000036, 0.999920, 0.999922, 1.000045, 0.999952, 0.999985, 0.999909, 0.999912, 1.000083, 1.000111, 0.999937, 0.999965, 1.000067, 0.999992, 1.000182, 1.000169, 1.000110, 0.999965, 0.999937, 0.999688, 1.000110, 0.999912, 1.000067, 1.000033, 0.999755, 0.999927, 1.000160, 1.000469, 1.000122, 1.000154, 1.000144, 1.000154, 0.999902, 0.999619, 0.999788, 0.999892, 0.999974, 0.999919, 1.000067, 1.000289, 0.999877, 0.999938, 1.000251, 1.000306, 1.000398, 1.000140, 0.999697, 1.000048, 0.999990, 1.000091, 0.999976, 1.000639, 1.000194, 1.000138, 1.000310, 0.999639, 0.999651, 0.999889, 0.999977, 1.000589, 1.000297, 1.000558, 1.000342, 0.999972, 1.000066, 0.999743, 0.999917, 0.999895, 0.999860, 1.000289, 1.000542, 1.000366, 0.999994, 0.999970, 0.999884, 1.000112, 0.999925, 0.999863, 1.000140, 1.000035, 0.999967, 1.000013, 0.999705, 1.000061, 0.999820, 1.000120, 1.000329, 0.999935, 0.999759, 1.000075, 0.999780, 0.999872, 1.000153, 0.999895, 0.999917, 0.999848, 0.999907, 0.999650, 0.999864, 1.000030, 0.999972, 0.999892, 1.000175, 0.999824, 0.999844, 1.000162, 0.999860, 0.999860, 0.999860, 0.999931, 0.999865, 1.000174, 1.000353, 1.000186, 1.000186, 1.000101, 1.000069, 0.999987, 1.000273, 1.000374, 1.000190, 0.999860, 0.999860, 0.999860, 0.999860, 0.999790, 1.000435, 1.000435, 1.000435, 1.000482, 1.000482, 1.000417, 1.000319, 1.000286, 1.000353, 1.000574, 1.000574, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, 1.000371, },
-    { 0.969643, 0.995186, 0.999637, 1.000524, 0.999958, 0.999958, 1.000003, 0.999882, 0.999914, 1.000140, 0.999899, 0.999910, 1.000087, 0.999961, 1.000175, 0.999951, 0.999953, 1.000086, 1.000040, 1.000061, 1.000059, 1.000057, 1.000023, 0.999947, 0.999984, 1.000004, 1.000044, 0.999992, 1.000007, 1.000009, 1.000021, 1.000054, 1.000038, 1.000030, 0.999997, 1.000020, 0.999975, 1.000000, 0.999983, 1.000027, 1.000026, 1.000042, 1.000023, 1.000009, 1.000054, 0.999938, 1.000027, 0.999986, 0.999916, 0.999953, 0.999992, 0.999979, 1.000049, 0.999955, 0.999968, 1.000013, 0.999996, 0.999961, 1.000015, 0.999975, 0.999987, 0.999966, 1.000013, 0.999965, 0.999989, 0.999976, 0.999998, 1.000023, 1.000043, 1.000031, 0.999963, 0.999975, 0.999964, 0.999953, 1.000050, 1.000048, 1.000004, 1.000007, 0.999973, 0.999938, 0.999985, 1.000016, 0.999983, 1.000007, 1.000065, 1.000030, 1.000012, 0.999927, 0.999978, 0.999998, 1.000026, 1.000004, 1.000014, 0.999979, 0.999934, 1.000009, 1.000060, 1.000016, 0.999951, 1.000031, 1.000074, 0.999946, 1.000027, 1.000027, 0.999956, 0.999998, 0.999914, 1.000032, 0.999988, 1.000005, 0.999905, 0.999891, 1.000047, 0.999804, 0.999948, 1.000019, 0.999941, 1.000052, 1.000015, 0.999903, 0.999844, 0.999907, 1.000020, 1.000077, 0.999830, 1.000096, 1.000254, 0.999959, 0.999860, 1.000008, 0.999844, 1.000119, 1.000277, 1.000211, 1.000230, 0.999929, 1.000405, 1.000142, 1.000270, 1.000255, 1.000137, 1.000228, 0.999847, 0.999916, 0.999787, 0.999866, 1.000208, 0.999924, 1.000359, 1.000178, 1.000075, 1.000027, 1.000003, 0.999950, 1.000024, 1.000054, 1.000042, 0.999851, 1.000153, 1.000090, 0.999910, 1.000029, 1.000052, 1.000131, 1.000080, 1.000192, 1.000076, 1.000029, 1.000209, 1.000044, 0.999959, 0.999974, 0.999847, 0.999951, 1.000046, 0.999922, 1.000044, 0.999857, 0.999907, 0.999974, 1.000027, 1.000016, 1.000086, 1.000045, 1.000058, 1.000000, 0.999747, 0.999829, 0.999894, 0.999832, 0.999818, 0.999790, 0.999954, 1.000020, 0.999994, 1.000041, 0.999971, 1.000042, 1.000043, 1.000025, 1.000088, 0.999924, 0.999881, 0.999942, 1.000044, 0.999982, 0.999825, 1.000037, 1.000019, 1.000103, 1.000011, 1.000004, 0.999973, 0.999980, 0.999997, 1.000004, 0.999952, 1.000045, 1.000048, 1.000048, 1.000048, 1.000048, 1.000105, 1.000111, 1.000089, 1.000089, 1.000089, 1.000089, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, 1.000106, },
-    { 0.993031, 1.003014, 0.999715, 0.999715, 0.999715, 0.999945, 0.999993, 1.000025, 0.999986, 0.999976, 1.000036, 1.000081, 1.000039, 0.999983, 0.999929, 0.999946, 0.999991, 1.000067, 1.000040, 1.000040, 1.000016, 1.000029, 1.000012, 1.000033, 0.999997, 1.000045, 1.000016, 1.000057, 1.000028, 1.000021, 1.000007, 1.000023, 0.999971, 1.000047, 0.999960, 1.000017, 0.999967, 1.000008, 1.000007, 0.999969, 0.999993, 1.000043, 1.000023, 1.000030, 0.999991, 0.999995, 1.000001, 1.000036, 1.000003, 0.999981, 1.000031, 1.000027, 1.000033, 1.000000, 0.999931, 0.999958, 1.000011, 1.000004, 1.000012, 1.000008, 1.000023, 1.000075, 1.000014, 1.000033, 1.000072, 1.000052, 1.000039, 0.999999, 1.000060, 1.000013, 1.000001, 1.000033, 1.000006, 1.000052, 1.000036, 0.999992, 0.999966, 0.999977, 1.000008, 1.000014, 0.999963, 1.000022, 0.999981, 0.999970, 0.999988, 0.999998, 1.000002, 1.000023, 1.000015, 0.999974, 0.999990, 0.999978, 1.000011, 0.999977, 1.000008, 1.000042, 1.000017, 1.000012, 0.999998, 1.000041, 1.000032, 0.999981, 1.000063, 1.000000, 1.000017, 0.999949, 0.999952, 0.999963, 0.999961, 1.000037, 0.999985, 1.000009, 1.000075, 1.000029, 1.000030, 1.000046, 0.999920, 0.999930, 1.000005, 0.999908, 0.999880, 1.000008, 1.000111, 1.000044, 0.999912, 1.000011, 1.000090, 1.000026, 0.999871, 0.999857, 0.999971, 1.000252, 1.000148, 1.000154, 1.000110, 1.000110, 1.000153, 1.000022, 1.000170, 1.000071, 1.000021, 1.000024, 1.000022, 0.999902, 0.999962, 0.999925, 1.000006, 1.000006, 1.000006, 1.000030, 1.000030, 0.999999, 0.999952, 0.999952, 0.999952, 0.999952, 1.000013, 0.999988, 1.000027, 1.000014, 1.000014, 1.000014, 1.000014, 1.000014, 1.000014, 1.000014, 1.000059, 1.000059, 1.000059, 0.999999, 0.999999, 0.999969, 0.999969, 0.999969, 0.999955, 0.999955, 0.999981, 0.999981, 0.999995, 0.999995, 0.999995, 0.999995, 0.999995, 0.999995, 0.999995, 0.999995, 0.999995, 0.999964, 0.999964, 0.999964, 0.999964, 0.999964, 0.999964, 0.999964, 0.999964, 1.000012, 0.999992, 1.000015, 1.000002, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, },
-    { 0.998593, 1.002169, 0.999993, 0.999993, 0.999993, 0.999993, 1.000001, 1.000005, 1.000023, 1.000007, 1.000019, 1.000017, 1.000002, 1.000024, 1.000000, 1.000031, 1.000005, 1.000006, 1.000024, 0.999972, 0.999952, 1.000000, 1.000028, 1.000031, 1.000016, 1.000006, 1.000005, 1.000000, 0.999994, 0.999994, 1.000021, 1.000012, 0.999990, 1.000005, 0.999996, 0.999990, 0.999971, 0.999997, 0.999989, 1.000009, 0.999998, 0.999990, 0.999966, 1.000010, 1.000015, 0.999989, 1.000003, 1.000000, 1.000024, 1.000003, 0.999990, 0.999979, 1.000020, 0.999932, 0.999972, 0.999973, 0.999964, 0.999936, 0.999924, 0.999951, 1.000024, 1.000024, 0.999983, 1.000005, 1.000026, 0.999964, 1.000050, 1.000011, 0.999988, 0.999928, 0.999972, 0.999991, 0.999970, 0.999946, 0.999956, 0.999923, 0.999969, 1.000032, 1.000037, 1.000071, 1.000031, 0.999988, 1.000004, 0.999989, 1.000034, 0.999981, 1.000016, 0.999999, 1.000039, 0.999984, 0.999970, 1.000029, 0.999987, 1.000014, 0.999996, 0.999993, 0.999968, 0.999994, 0.999982, 0.999971, 0.999975, 0.999956, 0.999966, 1.000079, 1.000025, 1.000022, 1.000018, 0.999850, 0.999961, 0.999955, 0.999996, 0.999997, 1.000061, 0.999991, 0.999957, 1.000009, 1.000001, 1.000042, 1.000002, 1.000025, 0.999935, 1.000025, 1.000028, 0.999935, 1.000019, 0.999984, 1.000034, 1.000019, 1.000070, 0.999994, 0.999993, 0.999993, 0.999983, 0.999983, 0.999942, 0.999985, 0.999988, 1.000059, 1.000035, 0.999973, 0.999975, 1.000004, 1.000019, 1.000019, 1.000000, 0.999986, 0.999947, 0.999947, 0.999947, 0.999966, 0.999966, 1.000014, 1.000014, 1.000014, 1.000019, 1.000032, 1.000032, 1.000034, 1.000034, 1.000029, 1.000029, 1.000029, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, 1.000258, },
-    { 1.008129, 0.999989, 0.999989, 0.999989, 0.999989, 0.999989, 0.999988, 1.000001, 0.999985, 0.999992, 0.999998, 0.999985, 0.999980, 1.000013, 0.999993, 1.000005, 0.999978, 0.999975, 0.999990, 1.000001, 1.000002, 1.000004, 0.999995, 1.000006, 0.999986, 1.000003, 0.999995, 0.999992, 0.999995, 0.999988, 0.999998, 0.999996, 0.999991, 1.000002, 1.000006, 0.999996, 0.999997, 1.000005, 0.999984, 0.999991, 1.000004, 1.000000, 1.000002, 1.000008, 1.000015, 0.999996, 0.999976, 0.999983, 1.000013, 1.000001, 0.999984, 1.000007, 0.999998, 1.000004, 0.999983, 0.999979, 0.999964, 0.999977, 1.000041, 1.000075, 1.000015, 1.000020, 1.000025, 1.000071, 0.999968, 0.999994, 1.000008, 0.999938, 0.999969, 0.999996, 1.000016, 0.999966, 0.999935, 0.999973, 0.999970, 0.999950, 1.000004, 0.999986, 1.000021, 1.000066, 1.000004, 1.000031, 0.999954, 1.000035, 1.000018, 1.000041, 0.999997, 1.000004, 1.000050, 1.000059, 1.000012, 0.999986, 1.000012, 1.000017, 0.999953, 0.999981, 1.000027, 1.000002, 1.000030, 0.999960, 1.000021, 0.999991, 1.000008, 1.000018, 0.999994, 0.999986, 1.000042, 0.999968, 0.999986, 0.999971, 1.000005, 1.000015, 1.000025, 0.999999, 1.000033, 1.000003, 0.999995, 1.000037, 1.000022, 0.999998, 1.000006, 1.000047, 1.000012, 0.999965, 0.999983, 0.999954, 1.000019, 0.999976, 0.999996, 1.000003, 0.999958, 0.999998, 0.999992, 1.000010, 1.000010, 1.000006, 1.000003, 1.000003, 1.000033, 1.000006, 0.999984, 0.999980, 0.999971, 0.999961, 0.999998, 1.000033, 1.000044, 1.000016, 1.000007, 1.000048, 1.000009, 1.000009, 0.999991, 0.999944, 0.999960, 0.999952, 1.000004, 1.000007, 1.000007, 1.000021, 1.000009, 1.000054, 1.000008, 1.000018, 1.000011, 1.000011, 1.000011, 1.000030, 1.000045, 1.000045, 1.000101, 1.000085, 1.000043, 1.000020, 1.000029, 0.999964, 0.999964, 0.999964, 0.999964, 1.000050, 1.000018, 1.000018, 1.000018, 1.000010, 1.000043, 1.000043, 1.000043, 1.000043, 1.000018, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, 1.000017, },
-    { 0.981024, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 0.999999, 1.000004, 0.999994, 0.999995, 1.000007, 1.000003, 1.000003, 0.999996, 0.999997, 1.000001, 0.999991, 0.999990, 0.999997, 1.000007, 1.000000, 1.000001, 1.000002, 1.000002, 1.000005, 1.000006, 1.000006, 1.000006, 1.000003, 1.000001, 1.000004, 1.000001, 1.000000, 0.999998, 0.999999, 1.000006, 1.000006, 0.999994, 1.000000, 0.999997, 0.999993, 0.999995, 0.999995, 1.000003, 1.000001, 1.000000, 1.000000, 0.999998, 1.000005, 1.000002, 1.000010, 1.000000, 1.000002, 0.999999, 0.999999, 1.000002, 0.999996, 0.999994, 0.999989, 0.999994, 0.999986, 0.999995, 1.000006, 0.999998, 1.000002, 1.000010, 1.000009, 1.000002, 1.000017, 1.000004, 1.000011, 1.000021, 0.999997, 0.999997, 0.999997, 0.999969, 0.999989, 0.999999, 0.999989, 0.999984, 1.000037, 1.000029, 1.000001, 0.999936, 0.999952, 0.999994, 0.999973, 0.999987, 1.000006, 1.000039, 0.999993, 0.999990, 1.000004, 1.000015, 0.999996, 1.000020, 0.999999, 0.999991, 0.999977, 0.999999, 1.000023, 0.999983, 1.000004, 1.000000, 0.999980, 0.999990, 1.000009, 0.999986, 0.999978, 0.999970, 0.999996, 0.999985, 1.000005, 0.999988, 0.999992, 1.000019, 1.000006, 1.000000, 1.000005, 1.000007, 1.000009, 1.000018, 1.000015, 1.000022, 1.000017, 1.000023, 1.000010, 0.999993, 1.000010, 1.000005, 1.000023, 0.999990, 1.000007, 1.000008, 0.999996, 0.999976, 0.999967, 0.999985, 0.999982, 0.999993, 0.999998, 1.000006, 0.999987, 0.999995, 0.999986, 1.000005, 1.000006, 1.000019, 1.000010, 0.999996, 1.000033, 1.000019, 1.000003, 1.000013, 0.999991, 0.999997, 0.999992, 0.999995, 0.999990, 0.999998, 0.999996, 0.999983, 0.999984, 0.999989, 0.999996, 0.999998, 1.000019, 1.000056, 1.000006, 1.000018, 1.000018, 1.000018, 1.000012, 1.000032, 1.000001, 1.000001, 1.000001, 0.999961, 0.999961, 0.999961, 0.999979, 0.999979, 0.999979, 0.999979, 0.999979, 0.999998, 0.999998, 0.999998, 0.999992, 0.999992, 0.999986, 0.999986, 0.999986, 0.999986, 0.999986, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999996, 0.999992, 0.999992, 0.999992, 0.999992, 0.999992, 0.999992, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, 1.000006, },
-    { 0.993343, 0.999978, 1.000002, 0.999995, 0.999998, 1.000002, 0.999999, 1.000000, 1.000001, 1.000001, 1.000001, 1.000001, 0.999999, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000000, 1.000000, 1.000001, 1.000002, 1.000000, 1.000001, 0.999999, 0.999999, 1.000000, 0.999999, 0.999999, 0.999999, 0.999999, 1.000001, 1.000001, 1.000000, 1.000000, 0.999999, 1.000000, 1.000003, 1.000000, 0.999999, 1.000000, 1.000000, 1.000004, 0.999998, 1.000000, 0.999996, 0.999998, 1.000003, 0.999999, 1.000000, 0.999998, 1.000002, 1.000001, 1.000003, 0.999998, 1.000000, 1.000000, 1.000002, 1.000002, 1.000000, 0.999997, 0.999998, 0.999998, 1.000000, 0.999998, 0.999992, 0.999997, 0.999997, 0.999996, 0.999996, 0.999992, 0.999982, 0.999994, 1.000000, 0.999996, 0.999999, 1.000006, 0.999998, 0.999991, 0.999999, 1.000015, 1.000015, 1.000001, 1.000010, 1.000005, 0.999994, 1.000003, 0.999995, 0.999989, 0.999996, 1.000010, 1.000014, 1.000000, 1.000007, 1.000001, 1.000008, 1.000002, 0.999999, 1.000003, 1.000002, 0.999997, 1.000002, 1.000012, 1.000008, 1.000009, 0.999999, 1.000001, 0.999998, 0.999995, 0.999994, 0.999998, 1.000002, 0.999999, 0.999991, 0.999985, 0.999998, 1.000001, 0.999993, 0.999999, 1.000007, 0.999998, 0.999995, 1.000006, 1.000004, 1.000007, 0.999997, 1.000001, 0.999999, 1.000001, 0.999996, 0.999977, 0.999978, 0.999986, 0.999996, 0.999995, 0.999994, 0.999991, 0.999992, 0.999997, 1.000002, 1.000003, 1.000001, 1.000009, 0.999996, 1.000003, 1.000003, 1.000011, 1.000011, 1.000011, 1.000011, 1.000008, 1.000007, 1.000001, 1.000000, 0.999993, 0.999993, 0.999995, 0.999995, 1.000004, 1.000004, 1.000004, 1.000004, 1.000004, 1.000004, 0.999996, 0.999996, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, 1.000001, },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, },
-    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, },
-#endif
-};
-
-
-void
-NoiseInjectionComp ( void )
-{
-    int  i;
-
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation1D)/sizeof(*NoiseInjectionCompensation1D); i++ )
-        NoiseInjectionCompensation1D [i] = 1.f;
-    for ( i = 0; i < sizeof(NoiseInjectionCompensation2D)/sizeof(**NoiseInjectionCompensation2D); i++ )
-        NoiseInjectionCompensation2D [0][i] = 1.f;
-}
-
-
-// Quantizes a subband and calculates iSNR
-float
-ISNR_Schaetzer ( const float* input, const float SNRcomp, const int res )
-{
-    int    k;
-    float  fac    = A [res];
-    float  invfac = C [res];
-    float  Signal = 1.e-30f;
-    float  Fehler = 1.e-30f;
-    float  tmp ;
-    float  tmp2 ;
-    int    idx;
-
-    tmp = 0.;
-    for ( k = 0; k < 36; k++ )
-        tmp += input[k] * input[k];
-    tmp *= QUANT / 36. / 32768 / 32768 ;
-    idx  = tmp;
-
-    // Summation of the absolute power and the quadratic error
-    for ( k = 0; k < 36; k++ ) {
-        tmp2    = input[k] * NoiseInjectionCompensation2D [res] [idx];
-        Signal += tmp2 * tmp2;
-
-        // q = ftol(in), correct rounding
-        tmp = tmp2 * fac + 0xFF8000;
-        tmp = (*(int*) & tmp - 0x4B7F8000) * invfac - tmp2;
-
-        Fehler += tmp * tmp;
-    }
-
-    // Utilization of SNRcomp only if SNR > 1 !!!
-    return Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
-}
-
-
-#ifdef BUGBUG
-double _old;
-double _new;
-double _tmp;
-
-double _Sum [18];
-long   _Cnt [18];
-
-double __Sum [18] [QUANT];
-long   __Cnt [18] [QUANT];
-
-void rep ( double _old, double _new, int res )
-{
-    int    i;
-    _Sum [res] += sqrt (_old / _new );
-    _Cnt [res] ++ ;
-    i = _old * (  QUANT / 36. / 32768 / 32768 );
-    // printf ("Res=%u, old=%f, new=%f, X=%f, %3u:", res, _old, _new, X[res], i ); fflush (stdout);
-    __Sum [res][i] += sqrt (_old / _new );
-    __Cnt [res][i] ++ ;
-}
-
-void reppr ( void )
-{
-    int i, j;
-    printf ("\n\n==================\n");
-    for ( i = 0; i < 18; i++ )
-        if ( _Cnt[i] )
-            printf ("%2u: %12.6f\n", i, _Sum[i]/_Cnt[i] * NoiseInjectionCompensation1D[i] );
-    for ( i = 0; i < 18; i++ )
-        for ( j = 0; j < QUANT; j++ )
-            if ( __Cnt[i][j] )
-                printf ("%2u[%3u]: %9.6f (%8lu)\n", i, j, __Sum[i][j]/__Cnt[i][j] * NoiseInjectionCompensation2D [i][j], __Cnt[i][j] );
-
-}
-#endif
-
-// Linear quantizer for a subband
-void
-QuantizeSubband ( unsigned int* qu_output, const float* input, const int res )
-{
-    int    n;
-    int    offset = D [res];
-    float  mult   = A [res];
-    float  tmp;
-    int    idx;
-
-    tmp = 0.;
-    for ( n = 0; n < 36; n++ )
-        tmp += input[n] * input[n];
-    tmp *=  QUANT / 36. / 32768 / 32768 ;
-    idx = tmp;
-
-    mult   *= NoiseInjectionCompensation2D [res][idx];
-
-    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
-        // q = ftol(in), correct rounding
-        tmp = *input * mult + 0xFF8000;
-        *qu_output  = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
-
-        // Limitation to 0...2D
-        if ((unsigned int)*qu_output > (unsigned int)2*offset ) {
-            *qu_output = mini( *qu_output, 2*offset);
-            *qu_output = maxi( *qu_output,        0);
-        }
-#ifdef BUGBUG
-        _old += *input * *input;
-        _tmp  = (int)(*qu_output - offset) * C[res];
-        _new += _tmp * _tmp;
-#endif
-    }
-#ifdef BUGBUG
-    rep ( _old, _new, res );
-    _old = _new = 0;
-#endif
-}
-
-
-// NoiseShaper for a subband
-void
-QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, const float* FIR, float* errors )
-{
-#define E(x) *((int*)errors+(x))
-
-    float  signal;
-    float  tmp;
-    float  mult    = A [res];
-    float  invmult = C [res];
-    int    offset  = D [res];
-    int    n;
-    int    quant;
-    int    idx;
-
-    tmp = 0.;
-    for ( n = 0; n < 36; n++ )
-        tmp += input[n] * input[n];
-    tmp *=  QUANT / 36. / 32768 / 32768 ;
-    idx = tmp;
-
-    E(0) = E(1) = E(2) = E(3) = E(4) = 0;       // arghh, it produces pops on each frame boundary!
-
-    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
-        signal = *input * NoiseInjectionCompensation2D [res][idx] - (FIR[4]*errors[n+0] + FIR[3]*errors[n+1] + FIR[2]*errors[n+2] + FIR[1]*errors[n+3] + FIR[0]*errors[n+4]);
-
-        // quant = ftol(signal), correct rounding
-        tmp   = signal * mult + 0xFF8000;
-        quant = *(int*) & tmp - 0x4B7F8000;
-
-        // calculate the current error and save it for error refeeding
-        errors [n + 5] = invmult * quant - signal;
-
-        //  limitation to +/-D
-        quant = minf ( quant, +offset );
-        quant = maxf ( quant, -offset );
-
-        *qu_output = (unsigned int)(quant + offset);
-#ifdef BUGBUG
-        _old += *input * *input;
-        _tmp  = invmult * quant;
-        _new += _tmp * _tmp;
-#endif
-    }
-#ifdef BUGBUG
-    rep ( _old, _new, res );
-    _old = _new = 0;
-#endif
-}
-
-/* end of quant.c */
Index: penc/trunk/regress.c
===================================================================
--- /mppenc/trunk/regress.c	(revision 96)
+++ 	(revision )
@@ -1,125 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define _x(i)       (p[i])
-#define _y(i)       (q[i])
-#define _x2(i)      (p[i]*p[i])
-#define _y2(i)      (q[i]*q[i])
-#define _xy(i)      (p[i]*q[i])
-
-#define EXPR36(x)   x( 0)+x( 1)+x( 2)+x( 3)+x( 4)+x( 5)+x( 6)+x( 7)+x( 8)+x( 9)+x(10)+x(11)+\
-                    x(12)+x(13)+x(14)+x(15)+x(16)+x(17)+x(18)+x(19)+x(20)+x(21)+x(22)+x(23)+\
-                    x(24)+x(25)+x(26)+x(27)+x(28)+x(29)+x(30)+x(31)+x(32)+x(33)+x(34)+x(35)
-
-#define n           36
-
-
-static inline float
-atan2i ( float x, float y )       // maximum 0.915° error between -0.82765 ... +2.39845 radian
-{
-    if      ( x < y ) {
-        x  = x / y;
-        y  = x * x;
-        x *= 1. - (1 - M_PI/4) * y;
-    }
-    else if ( x > y ) {
-        x  = y / x;
-        y  = x * x;
-        x *= 1. - (1 - M_PI/4) * y;
-        x  = M_PI/2 - x;
-    }
-    else {
-        x  = M_PI/4;
-    }
-
-    return x;
-}
-
-
-void
-Regression ( float* const  _r,
-             float* const  _b,
-             const float*  p ,
-             const float*  q )
-{
-    float  x  = EXPR36 (_x );
-    float  y  = EXPR36 (_y );
-    float  x2 = EXPR36 (_x2);
-    float  y2 = EXPR36 (_y2);
-    float  xy = EXPR36 (_xy);
-    float  r;
-    float  sx;
-    float  sy;
-    float  b;
-
-    r  = (x2*n - x*x) * (y2*n - y*y);
-    r  = r > 0.  ?  (xy*n - x*y) / sqrt (r)  :  1.;
-    sx = sqrt ( (x2 - x*x/n) / (n - 1) );
-    sy = sqrt ( (y2 - y*y/n) / (n - 1) );
-    x  = x/n;
-    y  = y/n;
-
-    b  = atan2 ( sy, sx );
-    if ( r < 0 )
-        b = M_PI - b;
-
-    *_r = r;
-    *_b = b;
-
-    printf ( "r=%6.3f  sx=%6.3f  sy=%6.3f  b=%6.3f\n", r, sx, sy, b );
-}
-
-
-
-
-/*
-int
-main ( void )
-{
-    float  p[36];
-    float  q[36];
-    float  r;
-    float  b;
-    int    i;
-    int    j;
-
-    float  w;
-    float  c;
-    float  s;
-    float  rnd;
-    float  rnd1;
-    float  rnd2;
-
-    for ( i = 0; i <= 200; i++ ) {
-        w = 2 * M_PI / 200. * i;
-        c = cos (w);
-        s = sin (w);
-        for ( j = 0; j < 36; j++ ) {
-            rnd  = 2. * rand() / RAND_MAX - 1;
-            p[j] = c * rnd;
-            q[j] = s * rnd;
-        }
-        printf ( "i=%3u: ", i );
-        Regression ( &r, &b, p, q );
-    }
-    printf ( "\n" );
-
-    for ( i = 0; i <= 200; i++ ) {
-        w = M_PI / 200. * i;
-        c = cos(w);
-        s = sin(w);
-        for ( j = 0; j < 36; j++ ) {
-            rnd1 = 2. * rand() / RAND_MAX - 1;
-            rnd2 = 2. * rand() / RAND_MAX - 1;
-            p[j] = rnd1;
-            q[j] = rnd1 * c + rnd2 * s;
-        }
-        printf ( "i=%3u: (%6.4f) ", i, s/c );
-        Regression ( &r, &b, p, q );
-    }
-    printf ( "\n" );
-
-    return 0;
-}
-*/
Index: penc/trunk/replaygain.c
===================================================================
--- /mppenc/trunk/replaygain.c	(revision 96)
+++ 	(revision )
@@ -1,679 +1,0 @@
-/*
- *   Should also set the ClipPrev Header by means of decoding
- *   Should clipprev automatically activated for ReplayGain != 0.0 dB ?
- *
- *   TODO:
- *     - better filter with more bass (bass is currently understimated)
- *     - clear up gain_analysis
- *     - mppdec: also blends between 0, 1 and 2
- *     - Output of album values with --list and --listdB only if they are identical!
- *     - ID3v2 Tags must be ignored
- * Ability to suppress automatic Album classification  ?????
- * Error with /[] with list or listall ??? however, auto is working ??????
- *
- * --smart does some stupid stuff
- *
- * Output of the dynamics of a track
- * Special treatment for short tracks < 30 seconds (determine the values from the neighboring tracks)
- * Combine tracks that have no Pause/Silence
- * Allow different album naming
- *
- * madplay -d -o wav:- -a -6.0205999132796239042 -q dateiname > 11.wav
- */
-
-// Bugs: Assume fs=44.1 kHz, which is not true anymore for MPC
-
-#define VERSION "0.84"
-
-#define CD_SAMPLE_FREQ   44100.
-
-#include <ctype.h>
-#include <math.h>
-#include "mppdec.h"
-#include "gain_analysis.h"
-
-#define LEVEL_THR       0.f
-
-int dBp     = 0;
-int smart   = 0;
-int Kreport = 0;
-
-typedef struct {
-    const char*   FileName;
-    float         TitleGain;
-    float         AlbumGain;
-    Uint32_t      TitlePeak;
-    Uint32_t      AlbumPeak;
-    unsigned int  Silence;
-} gain_info_t;
-
-
-#define AUTO      (Int32_t)0x80000000
-#define LIST      (Int32_t)0x80000001
-#define LISTALL   (Int32_t)0x80000002
-
-#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
-
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
-
-    while ( bytes > 0 ) {
-        ret = read ( fd, dest, bytes );
-        if ( ret == 0  ||  ret == (size_t)-1 )
-            break;
-        dest       = (void*)(((char*)dest) + ret);
-        bytes     -= ret;
-        bytesread += ret;
-    }
-    return bytesread;
-}
-
-#endif
-
-
-static Float_t
-OverSample ( Int16_t* src, size_t len )
-{
-    size_t  i;
-    float   S;
-    float   max = 0.;
-
-#if 1
-    // Legato Link
-    for ( i = 3; i < len-4; i++ ) {
-        S = + 0.597025167f    * (src[i  ] + src[i+1])
-            - 0.117586444f    * (src[i-1] + src[i+2])
-            + 0.0228418825f   * (src[i-2] + src[i+3])
-            - 0.002280605625f * (src[i-3] + src[i+4]);
-        S = fabs (S);
-        if ( S > max )
-            max = S;
-    }
-#else
-
-/*
-constant gain factor     3.4736680887566E-02
-z plane Denominator      Numerator
- 0   1.000000000E+00   3.473668089E-02
- 1  -9.080904743E-01   1.516197951E-01
- 2   1.325659333E+00   2.841012960E-01
- 3  -7.693859648E-01   2.841012960E-01
- 4   3.797256375E-01   1.516197951E-01
- 5  -8.699298700E-02   3.473668089E-02
-
----------------------------------------------
-constant gain factor     1.1780713261043E-02
-z plane Denominator      Numerator
- 0   1.000000000E+00   1.178071326E-02
- 1  -1.802715403E+00   5.120893530E-02
- 2   3.025911944E+00   1.163859288E-01
- 3  -2.988454267E+00   1.697423622E-01
- 4   2.358550858E+00   1.697423622E-01
- 5  -1.273440642E+00   1.163859288E-01
- 6   4.710392622E-01   5.120893530E-02
- 7  -9.265587323E-02   1.178071326E-02
- */
-
-/*
-    0.0000000000, -0.0004061767, -0.0006554074, -0.0005603479,
-    0.0000000000, +0.0010332072, +0.0024067306, +0.0038511274, +0.0049972718, +0.0054446460, +0.0048504364, +0.0030230276,
-    0.0000000000, -0.0039090311, -0.0081300062, -0.0118895363, -0.0143338396, -0.0146862233, -0.0124177060, -0.0073988790,
-    0.0000000000, +0.0088885044, +0.0179316783, +0.0255223974, +0.0300328067, +0.0301098647, +0.0249669378, +0.0146174761,
-    0.0000000000, -0.0170435762, -0.0339530545, -0.0477884869, -0.0556838859, -0.0553529653, -0.0455668957, -0.0265189851,
-    0.0000000000, +0.0306695549, +0.0609699140, +0.0857542392, +0.1000000000, +0.0996415654, +0.0823628662, +0.0482228773,
-    0.0000000000, -0.0568263967, -0.1144916118, -0.1637363938, -0.1948936008, -0.1991420526, -0.1697652726, -0.1032409730,
-    0.0000000000, +0.1352696593, +0.2938416526, +0.4636919170, +0.6306889405, +0.7800976241, +0.8982140690, +0.9739261298,
-    1.0000000000, +0.9739261298, +0.8982140690, +0.7800976241, +0.6306889405, +0.4636919170, +0.2938416526, +0.1352696593,
-    0.0000000000, -0.1032409730, -0.1697652726, -0.1991420526, -0.1948936008, -0.1637363938, -0.1144916118, -0.0568263967,
-    0.0000000000, +0.0482228773, +0.0823628662, +0.0996415654, +0.1000000000, +0.0857542392, +0.0609699140, +0.0306695549,
-    0.0000000000, -0.0265189851, -0.0455668957, -0.0553529653, -0.0556838859, -0.0477884869, -0.0339530545, -0.0170435762,
-    0.0000000000, +0.0146174761, +0.0249669378, +0.0301098647, +0.0300328067, +0.0255223974, +0.0179316783, +0.0088885044,
-    0.0000000000, -0.0073988790, -0.0124177060, -0.0146862233, -0.0143338396, -0.0118895363, -0.0081300062, -0.0039090311,
-    0.0000000000, +0.0030230276, +0.0048504364, +0.0054446460, +0.0049972718, +0.0038511274, +0.0024067306, +0.0010332072,
-    0.0000000000, -0.0005603479, -0.0006554074, -0.0004061767,
-    0.0000000000,
-
- */
-
-    for ( i = 7; i < len-8; i++ ) {
-        S = + 0.50000f * (src[i  ] + src[i+1])
-            - 0.00000f * (src[i-1] + src[i+2])
-            + 0.00000f * (src[i-2] + src[i+3])
-            - 0.00000f * (src[i-3] + src[i+4])
-            + 0.00000f * (src[i-4] + src[i+5])
-            - 0.00000f * (src[i-5] + src[i+6])
-            + 0.00000f * (src[i-6] + src[i+7])
-            - 0.00000f * (src[i-7] + src[i+8]);
-        S = fabs (S);
-        if ( S > max )
-            max = S;
-    }
-#endif
-    return S;
-}
-
-static Int32_t
-ReadReplayGain ( const char* p )
-{
-    Int32_t  ret =  0;
-    int      sgn = +1;
-
-    if ( 0 == strcmp ( p, "--auto") )
-        return AUTO;
-    if ( 0 == strcmp ( p, "--list") )
-        return LIST;
-    if ( 0 == strcmp ( p, "--listall") )
-        return LISTALL;
-    if ( 0 == strcmp ( p, "--listreport") )
-        return Kreport = 1, LIST;
-    if ( 0 == strcmp ( p, "--listallreport") )
-        return Kreport = 1, LISTALL;
-    if ( 0 == strcmp ( p, "--autodB") )
-        return dBp = 1, AUTO;
-    if ( 0 == strcmp ( p, "--listdB") )
-        return dBp = 1, LIST;
-    if ( 0 == strcmp ( p, "--listalldB") )
-        return dBp = 1, LISTALL;
-    if ( 0 == strcmp ( p, "--listreportdB") )
-        return dBp = 1, Kreport = 1, LIST;
-    if ( 0 == strcmp ( p, "--listallreportdB") )
-        return dBp = 1, Kreport = 1, LISTALL;
-
-    if (*p == '+')
-        p++;
-    else if (*p == '-')
-        sgn = -sgn, p++;
-
-    while ( (unsigned int)(*p - '0') < 10u )
-        ret = 10 * ret + (unsigned int)(*p++ - '0');
-
-    ret *= 100;
-    switch (*p) {
-    case '.':
-        if ( p[1] == '\0' )
-            break;
-        else if ( (unsigned int)(p[1] - '0') < 10u )
-            ret += (p[1] - '0') * 10;
-        else
-            goto error;
-
-        if ( p[2] == '\0' )
-            break;
-        else if ( (unsigned int)(p[2] - '0') < 10u )
-            ret += (p[2] - '0');
-        else
-            goto error;
-
-        if ( p[3] == '\0' )
-            break;
-        else if ( (unsigned int)(p[3] - '0') < 10u )
-            ret += (p[2] >= '5');
-        else
-            goto error;
-        break;
-
-    default:
-    error:
-        stderr_printf ("Illegal string in number: %s\n", p );
-        exit (1);
-
-    case '\0':
-        break;
-    }
-
-    return ret * sgn;
-}
-
-
-void sh ( const char* name, float level)
-{
-#if 0
-    FILE* fp = fopen ("/tmp/silence", "a+");
-    if ( fp == NULL ) {
-        fprintf (stderr, "Can't append on '/tmp/silence'\n");
-        return;
-    }
-    if (name)
-        fprintf (fp, "%8.2f  %s\n", level, name );
-    else
-        fprintf (fp, "%8.2f ", level );
-    fclose (fp);
-#endif
-}
-
-#define NO   (size_t)(44100 * 0.05)
-
-static void
-CalcReplayGain ( const char* filename, gain_info_t* G )
-{
-    FILE*    fp;
-    float    buffl [NO];
-    float    buffr [NO];
-    Int16_t  buff  [NO] [2];
-    size_t   i;
-    size_t   len;
-    size_t   lastlen = 0;
-    unsigned int max = 0;
-    float    level;
-    float    mult;
-
-    if ((fp = pipeopen ( "mppdec --silent --scale 0.5 --gain 0 --raw - - < #", filename)) == NULL) {
-        stderr_printf ( "Can't decode '%s'\n", filename );
-        exit (9);
-    }
-
-    memset ( buff, 0, sizeof(buff) );
-    G->Silence = 0;
-
-    lastlen = len = fread (buff, 4, NO, fp);
-    for ( i = 0; i < len; i++ ) {
-        buffl [i] = 2. * buff [i] [0];
-        buffr [i] = 2. * buff [i] [1];
-        if ( abs(buff[i][0]) > max ) max = abs(buff[i][0]);
-        if ( abs(buff[i][1]) > max ) max = abs(buff[i][1]);
-    }
-    AnalyzeSamples ( buffl, buffr, len, 2 );
-
-    level = 0.;
-    mult  = 1.;
-    for ( i = 0; i < len; i++ ) {
-        level += mult * (buff [i] [0] * buff [i] [0] + buff [i] [1] * buff [i] [1]);
-        mult  *= 0.95;
-    }
-    level = 2*sqrt(level * 0.05);
-    if ( level > LEVEL_THR )
-        G->Silence |= 2;
-
-    sh ( NULL, level );
-
-    while (( len = fread (buff, 4, NO, fp) ) > 0 ) {
-        lastlen = len;
-        for ( i = 0; i < len; i++ ) {
-            buffl [i] = 2. * buff [i] [0];
-            buffr [i] = 2. * buff [i] [1];
-            if ( abs(buff[i][0]) > max ) max = abs(buff[i][0]);
-            if ( abs(buff[i][1]) > max ) max = abs(buff[i][1]);
-        }
-        AnalyzeSamples ( buffl, buffr, len, 2 );
-    }
-
-    level = 0.;
-    mult  = 1.;
-    for ( i = 1; i <= NO; i++ ) {
-        int  idx = (lastlen + NO - i) % NO;
-        level += mult * (buff [idx] [0] * buff [idx] [0] + buff [idx] [1] * buff [idx] [1]);
-        mult  *= 0.95;
-    }
-    level = 2*sqrt(level * 0.05);
-    if ( level > LEVEL_THR )
-        G->Silence |= 1;
-
-    sh(filename,level);
-
-    PCLOSE (fp);
-#if 0
-    GetTitleDynamics ();
-#endif
-    G -> FileName  = filename;
-    G -> TitleGain = GetTitleGain ();
-    G -> TitlePeak = 2 * max + 1;
-    G -> AlbumGain = GetAlbumGain ();
-    G -> AlbumPeak = G->AlbumPeak < G->TitlePeak  ?  G->TitlePeak  :  G->AlbumPeak;
-    return;
-}
-
-
-int
-ModifyFile ( const gain_info_t* G, unsigned int mask )
-{
-    unsigned char  buff [20];
-    Int32_t        val;
-    FILE_T         fd = OPENRW ( G -> FileName );
-
-    if ( fd == INVALID_FILEDESC ) {
-        stderr_printf ("Can't patch '%s'\n", G -> FileName );
-        return 1;
-    }
-    if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-        stderr_printf ("Can't read header of '%s'\n", G -> FileName );
-        return 2;
-    }
-    if ( 0 != memcmp ( buff, "MP+", 3)  ||  (buff[3] & 15) != 7 ) {
-        stderr_printf ("Not a MPC file SV7: '%s'\n", G -> FileName );
-        return 3;
-    }
-
-    if ( mask & 1 ) {   // Title Peak level
-        val       = G -> TitlePeak;
-        buff [12] = (Uint8_t)(val >> 0);
-        buff [13] = (Uint8_t)(val >> 8);
-        val       = (Int32_t)(G -> TitlePeak / 1.18);
-        buff [ 8] = (Uint8_t)(val >> 0);
-        buff [ 9] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 2 ) {   // Album Peak level
-        val       = G -> AlbumPeak;
-        buff [16] = (Uint8_t)(val >> 0);
-        buff [17] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 4 ) {   // Title RMS
-        val       = 100. * G -> TitleGain;
-        buff [14] = (Uint8_t)(val >> 0);
-        buff [15] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 8 ) {   // Album RMS
-        val       = 100. * G -> AlbumGain;
-        buff [18] = (Uint8_t)(val >> 0);
-        buff [19] = (Uint8_t)(val >> 8);
-    }
-
-    if ( SEEK  ( fd, 0L, SEEK_SET ) < 0 ) {
-        stderr_printf ("Seek error in '%s'\n", G -> FileName );
-        return 4;
-    }
-    if ( WRITE ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-        stderr_printf ("Can't write data in '%s'\n", G -> FileName );
-        return 5;
-    }
-    if ( CLOSE (fd) < 0 ) {
-        stderr_printf ("Error closing '%s'\n", G -> FileName );
-        return 6;
-    }
-    return 0;
-}
-
-
-char* dB ( double val )
-{
-    static unsigned int x = 0;
-    static char buff[8][12];
-
-    x = (x+1) & 7;
-
-    if (dBp) {
-        double dB = 20. * log10 (val/32767.);
-        if (dB <= -60)
-            return "     ";
-        sprintf ( buff[x], fabs(dB) < 9.995 ? "%+5.2f" : "%+5.1f", dB  );
-    }
-    else {
-        sprintf ( buff[x], "%5u", (int)val );
-    }
-    return buff[x];
-}
-
-
-// " -- [xx] "          9
-// " -- [xx]."          9
-// "/[xx] -- "          9
-// "/[xx] --."          9
-// " -- xx -- "        10
-// " -- xx --."        10
-// "/xx -- "            7
-// "/xx --."            7
-
-static size_t
-AlbumNameLen ( const char* filename )
-{
-    const char*  p = filename + strlen (filename) - 9;
-
-    while ( p >= filename ) {
-        if ( 0 == memcmp ( p, " -- [", 5)  &&  isdigit (p[5])  &&  isdigit(p[6])  &&  p[7] == ']'  &&  (p[8]=='.' || p[8]==' ') )
-            return p - filename;
-        if ( (p[0]=='/' || p[0]=='\\')  &&  p[1] == '[' &&  isdigit (p[2])  &&  isdigit(p[3])  &&  0 == memcmp (p+4, "] --", 4)  &&  (p[8]=='.' || p[8]==' ') )
-            return p - filename;
-        if ( 0 == memcmp ( p, " -- ", 4)  &&  isdigit (p[4])  &&  isdigit(p[5])  &&  0 == memcmp (p+6, " --", 3)  &&  (p[9]=='.' || p[9]==' ') )
-            return p - filename;
-        if ( (p[0]=='/' || p[0]=='\\')  &&  isdigit (p[1])  &&  isdigit(p[2])  &&  0 == memcmp (p+3, " --", 3)  &&  (p[6]=='.' || p[6]==' ') )
-            return p - filename;
-        p--;
-    }
-
-    return 0;
-}
-
-
-int Cdecl
-main ( int argc, char** argv )
-{
-    static const char*
-                 extentions [] = { ".mpc", ".mpp", ".mp+", NULL };
-    Int32_t      mode;
-    Int32_t      title_gain;
-    Int32_t      title_peak;
-    Int32_t      album_gain;
-    Int32_t      album_peak;
-    double       title_peak_max     = 0.;
-    double       title_peak_adj_max = 0.;
-    double       album_peak_max     = 0.;
-    double       album_peak_adj_max = 0.;
-    FILE_T       fd;
-    Uint8_t      buff [20];
-    const char*  name;
-    gain_info_t  Gain;
-    int          i;
-    int          ilast;
-
-#ifdef USE_ARGV
-    mysetargv ( &argc, &argv, extentions );
-#endif
-
-    stderr_printf ( "Replaygain " VERSION "     (C) 2001-2002 Klemm/Robinson/Sawyer\n\n" );
-
-    if ( argv[1] != NULL  &&  0 == strncmp (argv[1], "--9", 3) )
-        SetPercentile (0.01 * atoi (*++argv + 2) );
-
-    if ( argv[1] != NULL  &&  0 == strcmp (argv[1], "--smart" ) )
-        smart++, argv++;
-
-    memset ( &Gain, 0, sizeof(Gain) );
-    InitGainAnalysis  ( CD_SAMPLE_FREQ );
-
-    if ( argc < 3 ) {
-        stderr_printf ("usage: ReplayGain level MPC_Title_01 [MPC_Title_02 MPC_Title_03 ...]\n"
-                       "\n"
-                       "percentile can be:\n"
-                       "  --92 | --93 | --94 | --95 | --96 | --97 | --98\n"
-                       "\n"
-                       "level can be:\n"
-                       "  * value in the range -300 dB...+300 dB, set as title based replay gain\n"
-                       "  * --auto   | --autodB    : auto determine gains and peak values\n"
-                       "  * --list   | --listdB    : list title based values\n"
-                       "  * --listall| --listalldB : list title and album based values\n"
-                       "  * --listreport           : list title based values + K suggestion\n"
-                       "  * --listallreport        : list title and album based values + K suggestion\n" );
-        return 1;
-    }
-
-    argv++;
-    mode = ReadReplayGain (*argv);
-    if ( mode != AUTO  &&  mode != LIST  &&  mode != LISTALL ) {
-        if ( mode != (Int16_t) mode ) {
-            stderr_printf ("level can only be in the range -327.68 dB...+327.67 dB\n" );
-            return 2;
-        }
-        Gain.TitleGain = 0.01 * mode;
-    }
-
-    switch (mode) {
-    case AUTO:
-    default:
-        printf ("   Level Adjustment   |   Peak Level   (Adjst)|  Filename\n"
-                "----------------------+-----------------------+-------------------------------\n");
-        break;
-    case LIST:
-        printf ("  Level-  |       (Peak+)|\n"
-                "Adjustment|  Peak (Adjst)|  Filename\n"
-                "----------+--------------+-----------------------------------------------------\n");
-        break;
-    case LISTALL:
-        printf ("        Title            |        Album            |\n"
-                "  Level-  |       (Peak+)|  Level-  |       (Peak+)|\n"
-                "Adjustment|  Peak (Adjst)|Adjustment|  Peak (Adjst)|  Filename\n"
-                "----------+--------------+----------+--------------+---------------------------\n");
-        break;
-    }
-    argv++;
-
-repeat:
-    ilast = -1;
-    for ( i = 0; argv[i]  &&  (mode != AUTO || (AlbumNameLen (argv[0])==AlbumNameLen (argv[i])  &&  0 == memcmp (argv[0], argv[i], AlbumNameLen (argv[0])))); i++ ) {
-        ilast = i;
-        name = argv [i];
-        Gain.FileName = name;
-        if ( mode == AUTO ) {
-            if (smart) {
-                fd = OPEN (name);
-                if ( fd == INVALID_FILEDESC ) {
-                    stderr_printf ("Can't open: %s\n", name );
-                    continue;
-                }
-                if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-                    stderr_printf ("Can't read header: %s\n", name );
-                    continue;
-                }
-                if ( CLOSE (fd) < 0 ) {
-                    stderr_printf ("Error closing file: %s\n", name );
-                    continue;
-                }
-                if ( buff[12] || buff[13] || buff[14] || buff[15] || buff[16] || buff[17] || buff[18] || buff[19])
-                    continue;
-            }
-            if ( ISATTY (FILENO(STDOUT)) ) {
-                printf ("%s\r", name );
-                FLUSH (stdout);
-                fflush (stdout);
-            }
-            fd = OPENRW (name);
-            if ( fd == INVALID_FILEDESC ) {
-                stderr_printf ("Can't patch '%s'\n", name );
-                goto nopatch;
-            }
-            if ( CLOSE (fd) < 0 ) {
-                stderr_printf ("Error closing '%s'\n", name );
-                return 6;
-            }
-            CalcReplayGain ( name, &Gain );
-            if ( Gain.TitleGain > +36. )
-                Gain.TitleGain = 0.;
-            if ( Gain.AlbumGain > +24. )
-                Gain.AlbumGain = 0.;
-        }
-        fd = OPEN (name);
-        if ( fd == INVALID_FILEDESC ) {
-            stderr_printf ("Can't open: %s\n", name );
-            continue;
-        }
-        if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-            stderr_printf ("Can't read header: %s\n", name );
-            continue;
-        }
-        if ( CLOSE (fd) < 0 ) {
-            stderr_printf ("Error closing file: %s\n", name );
-            continue;
-        }
-        if ( 0 != memcmp ( buff, "MP+", 3)  ||  (buff[3] & 15) != 7 ) {
-            stderr_printf ("Not a MPC file SV7: '%s'\n", name );
-            continue;
-        }
-
-        title_gain = (Uint8_t)buff[14] + 256 * (Int8_t) buff[15];
-        album_gain = (Uint8_t)buff[18] + 256 * (Int8_t) buff[19];
-        title_peak = (Uint8_t)buff[12] + 256 * (Uint8_t)buff[13];
-        album_peak = (Uint8_t)buff[16] + 256 * (Uint8_t)buff[17];
-
-        switch (mode) {
-        case LIST:
-            printf ("%+6.2f dB | %s (%s)| %s\n",
-                    0.01 * title_gain, dB(title_peak), dB(title_peak * pow (10., title_gain/2000.)),
-                    name );
-            if ( argv[i+1] == NULL  ||  0 != memcmp (argv[i], argv[i+1], AlbumNameLen (argv[i])) )  {
-                int len = AlbumNameLen (argv[i]);
-                printf ("%+6.2f dB | %s (%s)| %*.*s\n"
-                        "----------+--------------+-----------------------------------------------------\n",
-                    0.01 * album_gain, dB(album_peak), dB(album_peak * pow (10., album_gain/2000.)),
-                    len, len, argv[i] );
-            }
-            break;
-        case LISTALL:
-            printf ("%+6.2f dB | %s (%s)|%+6.2f dB | %s (%s)| %s\n",
-                    0.01 * title_gain, dB(title_peak), dB(title_peak * pow (10., title_gain/2000.)),
-                    0.01 * album_gain, dB(album_peak), dB(album_peak * pow (10., album_gain/2000.)),
-                    name );
-            break;
-        default:
-            Gain.TitlePeak = title_peak;
-        case AUTO:
-            ModifyFile ( &Gain, mode==AUTO  ?  4|1  :  4);
-            printf ("%+6.2f dB =>%+6.2f dB | %s => %s (%s)| %s\n",
-                    0.01 * title_gain, Gain.TitleGain,
-                    dB(title_peak), dB(Gain.TitlePeak),
-                    dB(Gain.TitlePeak * pow (10., Gain.TitleGain/20.)),
-                    name );
-            break;
-        }
-        fflush (stdout);
-
-        if (mode == LIST || mode == LISTALL) {
-            if (title_peak > title_peak_max) title_peak_max = title_peak;
-            if (album_peak > album_peak_max) album_peak_max = album_peak;
-            if (title_peak * pow (10., title_gain/2000.) > title_peak_adj_max) title_peak_adj_max = title_peak * pow (10., title_gain/2000.);
-            if (album_peak * pow (10., album_gain/2000.) > album_peak_adj_max) album_peak_adj_max = album_peak * pow (10., album_gain/2000.);
-        }
-	nopatch: ;
-    }
-
-    if ( mode == AUTO ) {
-        int len = AlbumNameLen (argv[0]);
-        printf ("          =>%+6.2f dB |       => %s (%s)| %*.*s\n",
-                Gain.AlbumGain,
-                dB(Gain.AlbumPeak),
-                dB(Gain.AlbumPeak * pow (10., Gain.AlbumGain/20.)), len, len, *argv );
-        fflush (stdout);
-        for ( i = 0; i <= ilast; i++ ) {
-            name = argv [i];
-            Gain.FileName = name;
-            ModifyFile ( &Gain, 2|8 );
-        }
-        argv += ilast + 1;
-        if ( argv[0] != NULL ) {
-            printf ( "----------------------+-----------------------+-------------------------------\n");
-            memset ( &Gain, 0, sizeof(Gain) );
-            InitGainAnalysis  ( CD_SAMPLE_FREQ );
-            goto repeat;
-        }
-    }
-
-    switch (mode) {
-    case LIST:
-        printf ("          | %s (%s)| %s\n",
-                dB(title_peak_max), dB(title_peak_adj_max),
-                "--- maximum (title based) ---" );
-        printf ("          | %s (%s)| %s\n",
-                dB(album_peak_max), dB(album_peak_adj_max),
-                "--- maximum (album based) ---" );
-        break;
-    case LISTALL:
-        printf ("          | %s (%s)|          | %s (%s)| %s\n",
-                dB(title_peak_max), dB(title_peak_adj_max),
-                dB(album_peak_max), dB(album_peak_adj_max),
-                "--- maximum ---" );
-        break;
-    }
-
-    if ( Kreport ) {
-        printf ("\n\nSuggested mode for\n");
-        printf ("  title based replay gain:   K%+d\n", -14 - (int) ceil (20.*log10(title_peak_adj_max/32767.)) );
-        printf ("  album based replay gain:   K%+d\n", -14 - (int) ceil (20.*log10(album_peak_adj_max/32767.)) );
-        printf ("  title based clipping prev: K%+d\n", -14 - (int) ceil (20.*log10(title_peak_max    /32767.)) );
-        printf ("  album based clipping prev: K%+d\n", -14 - (int) ceil (20.*log10(album_peak_max    /32767.)) );
-        printf ("\nLast two setting only possible in plugins using K setting also for\nnon-replaygain modes.\n");
-    }
-
-    return 0;
-}
-
-/* end of replaygain.c */
Index: penc/trunk/replaygain.c.new
===================================================================
--- /mppenc/trunk/replaygain.c.new	(revision 96)
+++ 	(revision )
@@ -1,730 +1,0 @@
-/*
- *   Should also set the ClipPrev Header by means of decoding
- *   Should clipprev automatically activated for ReplayGain != 0.0 dB ?
- *
- *   TODO:
- *     - better filter with more bass (bass is currently understimated)
- *     - clear up gain_analysis
- *     - mppdec: also blends between 0, 1 and 2
- *     - Output of album values with --list and --listdB only if they are identical!
- *     - ID3v2 Tags must be ignored
- * Ability to suppress automatic Album classification  ?????
- * Error with /[] with list or listall ??? however, auto is working ??????
- *
- * --smart does some stupid stuff
- *
- * Output of the dynamics of a track
- * Special treatment for short tracks < 30 seconds (determine the values from the neighboring tracks)
- * Combine tracks that have no Pause/Silence
- * Allow different album naming
- *
- * madplay -d -o wav:- -a -6.0205999132796239042 -q dateiname > 11.wav
- */
-
-// Bugs: Assume fs=44.1 kHz, which is not true anymore for MPC
-
-#define VERSION "0.84"
-
-#include <ctype.h>
-#include <math.h>
-#include "mppdec.h"
-#include "gain_analysis.h"
-
-#define LEVEL_THR       0.f
-
-int dBp     = 0;
-int smart   = 0;
-int Kreport = 0;
-
-typedef struct {
-    const char*   FileName;
-    float         TitleGain;
-    float         AlbumGain;
-    Uint32_t      TitlePeak;
-    Uint32_t      AlbumPeak;
-    unsigned int  Silence;
-} gain_info_t;
-
-
-#define AUTO      (Int32_t)0x80000000
-#define LIST      (Int32_t)0x80000001
-#define LISTALL   (Int32_t)0x80000002
-
-#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
-
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
-
-    while ( bytes > 0 ) {
-        ret = read ( fd, dest, bytes );
-        if ( ret == 0  ||  ret == (size_t)-1 )
-            break;
-        dest       = (void*)(((char*)dest) + ret);
-        bytes     -= ret;
-        bytesread += ret;
-    }
-    return bytesread;
-}
-
-#endif
-
-
-static Float_t
-OverSample ( Int16_t* src, size_t len )
-{
-    size_t  i;
-    float   S;
-    float   max = 0.;
-
-#if 1
-    // Legato Link
-    for ( i = 3; i < len-4; i++ ) {
-        S = + 0.597025167f    * (src[i  ] + src[i+1])
-            - 0.117586444f    * (src[i-1] + src[i+2])
-            + 0.0228418825f   * (src[i-2] + src[i+3])
-            - 0.002280605625f * (src[i-3] + src[i+4]);
-        S = fabs (S);
-        if ( S > max )
-            max = S;
-    }
-#else
-
-/*
-constant gain factor     3.4736680887566E-02
-z plane Denominator      Numerator
- 0   1.000000000E+00   3.473668089E-02
- 1  -9.080904743E-01   1.516197951E-01
- 2   1.325659333E+00   2.841012960E-01
- 3  -7.693859648E-01   2.841012960E-01
- 4   3.797256375E-01   1.516197951E-01
- 5  -8.699298700E-02   3.473668089E-02
-
----------------------------------------------
-constant gain factor     1.1780713261043E-02
-z plane Denominator      Numerator
- 0   1.000000000E+00   1.178071326E-02
- 1  -1.802715403E+00   5.120893530E-02
- 2   3.025911944E+00   1.163859288E-01
- 3  -2.988454267E+00   1.697423622E-01
- 4   2.358550858E+00   1.697423622E-01
- 5  -1.273440642E+00   1.163859288E-01
- 6   4.710392622E-01   5.120893530E-02
- 7  -9.265587323E-02   1.178071326E-02
- */
-
-/*
-    0.0000000000, -0.0004061767, -0.0006554074, -0.0005603479,
-    0.0000000000, +0.0010332072, +0.0024067306, +0.0038511274, +0.0049972718, +0.0054446460, +0.0048504364, +0.0030230276,
-    0.0000000000, -0.0039090311, -0.0081300062, -0.0118895363, -0.0143338396, -0.0146862233, -0.0124177060, -0.0073988790,
-    0.0000000000, +0.0088885044, +0.0179316783, +0.0255223974, +0.0300328067, +0.0301098647, +0.0249669378, +0.0146174761,
-    0.0000000000, -0.0170435762, -0.0339530545, -0.0477884869, -0.0556838859, -0.0553529653, -0.0455668957, -0.0265189851,
-    0.0000000000, +0.0306695549, +0.0609699140, +0.0857542392, +0.1000000000, +0.0996415654, +0.0823628662, +0.0482228773,
-    0.0000000000, -0.0568263967, -0.1144916118, -0.1637363938, -0.1948936008, -0.1991420526, -0.1697652726, -0.1032409730,
-    0.0000000000, +0.1352696593, +0.2938416526, +0.4636919170, +0.6306889405, +0.7800976241, +0.8982140690, +0.9739261298,
-    1.0000000000, +0.9739261298, +0.8982140690, +0.7800976241, +0.6306889405, +0.4636919170, +0.2938416526, +0.1352696593,
-    0.0000000000, -0.1032409730, -0.1697652726, -0.1991420526, -0.1948936008, -0.1637363938, -0.1144916118, -0.0568263967,
-    0.0000000000, +0.0482228773, +0.0823628662, +0.0996415654, +0.1000000000, +0.0857542392, +0.0609699140, +0.0306695549,
-    0.0000000000, -0.0265189851, -0.0455668957, -0.0553529653, -0.0556838859, -0.0477884869, -0.0339530545, -0.0170435762,
-    0.0000000000, +0.0146174761, +0.0249669378, +0.0301098647, +0.0300328067, +0.0255223974, +0.0179316783, +0.0088885044,
-    0.0000000000, -0.0073988790, -0.0124177060, -0.0146862233, -0.0143338396, -0.0118895363, -0.0081300062, -0.0039090311,
-    0.0000000000, +0.0030230276, +0.0048504364, +0.0054446460, +0.0049972718, +0.0038511274, +0.0024067306, +0.0010332072,
-    0.0000000000, -0.0005603479, -0.0006554074, -0.0004061767,
-    0.0000000000,
-
- */
-
-    for ( i = 7; i < len-8; i++ ) {
-        S = + 0.50000f * (src[i  ] + src[i+1])
-            - 0.00000f * (src[i-1] + src[i+2])
-            + 0.00000f * (src[i-2] + src[i+3])
-            - 0.00000f * (src[i-3] + src[i+4])
-            + 0.00000f * (src[i-4] + src[i+5])
-            - 0.00000f * (src[i-5] + src[i+6])
-            + 0.00000f * (src[i-6] + src[i+7])
-            - 0.00000f * (src[i-7] + src[i+8]);
-        S = fabs (S);
-        if ( S > max )
-            max = S;
-    }
-#endif
-    return S;
-}
-
-static Int32_t
-ReadReplayGain ( const char* p )
-{
-    Int32_t  ret =  0;
-    int      sgn = +1;
-
-    if ( 0 == strcmp ( p, "--auto") )
-        return AUTO;
-    if ( 0 == strcmp ( p, "--list") )
-        return LIST;
-    if ( 0 == strcmp ( p, "--listall") )
-        return LISTALL;
-    if ( 0 == strcmp ( p, "--listreport") )
-        return Kreport = 1, LIST;
-    if ( 0 == strcmp ( p, "--listallreport") )
-        return Kreport = 1, LISTALL;
-    if ( 0 == strcmp ( p, "--autodB") )
-        return dBp = 1, AUTO;
-    if ( 0 == strcmp ( p, "--listdB") )
-        return dBp = 1, LIST;
-    if ( 0 == strcmp ( p, "--listalldB") )
-        return dBp = 1, LISTALL;
-    if ( 0 == strcmp ( p, "--listreportdB") )
-        return dBp = 1, Kreport = 1, LIST;
-    if ( 0 == strcmp ( p, "--listallreportdB") )
-        return dBp = 1, Kreport = 1, LISTALL;
-
-    if (*p == '+')
-        p++;
-    else if (*p == '-')
-        sgn = -sgn, p++;
-
-    while ( (unsigned int)(*p - '0') < 10u )
-        ret = 10 * ret + (unsigned int)(*p++ - '0');
-
-    ret *= 100;
-    switch (*p) {
-    case '.':
-        if ( p[1] == '\0' )
-            break;
-        else if ( (unsigned int)(p[1] - '0') < 10u )
-            ret += (p[1] - '0') * 10;
-        else
-            goto error;
-
-        if ( p[2] == '\0' )
-            break;
-        else if ( (unsigned int)(p[2] - '0') < 10u )
-            ret += (p[2] - '0');
-        else
-            goto error;
-
-        if ( p[3] == '\0' )
-            break;
-        else if ( (unsigned int)(p[3] - '0') < 10u )
-            ret += (p[2] >= '5');
-        else
-            goto error;
-        break;
-
-    default:
-    error:
-        stderr_printf ("Illegal string in number: %s\n", p );
-        exit (1);
-
-    case '\0':
-        break;
-    }
-
-    return ret * sgn;
-}
-
-
-void sh ( const char* name, float level)
-{
-#if 0
-    FILE* fp = fopen ("/tmp/silence", "a+");
-    if ( fp == NULL ) {
-        fprintf (stderr, "Can't append on '/tmp/silence'\n");
-        return;
-    }
-    if (name)
-        fprintf (fp, "%8.2f  %s\n", level, name );
-    else
-        fprintf (fp, "%8.2f ", level );
-    fclose (fp);
-#endif
-}
-
-#define NO   (size_t)(44100 * 0.05)
-
-static void
-CalcReplayGain ( const char* filename, gain_info_t* G )
-{
-    FILE*    fp;
-    float    buffl [NO];
-    float    buffr [NO];
-    Int16_t  buff  [NO] [2];
-    size_t   i;
-    size_t   len;
-    size_t   lastlen = 0;
-    unsigned int max = 0;
-    float    level;
-    float    mult;
-
-    if ((fp = pipeopen ( "mppdec --silent --scale 0.5 --gain 0 --raw - - < #", filename)) == NULL) {
-        stderr_printf ( "Can't decode '%s'\n", filename );
-        exit (9);
-    }
-
-    memset ( buff, 0, sizeof(buff) );
-    G->Silence = 0;
-
-    lastlen = len = fread (buff, 4, NO, fp);
-    for ( i = 0; i < len; i++ ) {
-        buffl [i] = 2. * buff [i] [0];
-        buffr [i] = 2. * buff [i] [1];
-        if ( abs(buff[i][0]) > max ) max = abs(buff[i][0]);
-        if ( abs(buff[i][1]) > max ) max = abs(buff[i][1]);
-    }
-    AnalyzeSamples ( buffl, buffr, len, 2 );
-
-    level = 0.;
-    mult  = 1.;
-    for ( i = 0; i < len; i++ ) {
-        level += mult * (buff [i] [0] * buff [i] [0] + buff [i] [1] * buff [i] [1]);
-        mult  *= 0.95;
-    }
-    level = 2*sqrt(level * 0.05);
-    if ( level > LEVEL_THR )
-        G->Silence |= 2;
-
-    sh ( NULL, level );
-
-    while (( len = fread (buff, 4, NO, fp) ) > 0 ) {
-        lastlen = len;
-        for ( i = 0; i < len; i++ ) {
-            buffl [i] = 2. * buff [i] [0];
-            buffr [i] = 2. * buff [i] [1];
-            if ( abs(buff[i][0]) > max ) max = abs(buff[i][0]);
-            if ( abs(buff[i][1]) > max ) max = abs(buff[i][1]);
-        }
-        AnalyzeSamples ( buffl, buffr, len, 2 );
-    }
-
-    level = 0.;
-    mult  = 1.;
-    for ( i = 1; i <= NO; i++ ) {
-        int  idx = (lastlen + NO - i) % NO;
-        level += mult * (buff [idx] [0] * buff [idx] [0] + buff [idx] [1] * buff [idx] [1]);
-        mult  *= 0.95;
-    }
-    level = 2*sqrt(level * 0.05);
-    if ( level > LEVEL_THR )
-        G->Silence |= 1;
-
-    sh(filename,level);
-
-    PCLOSE (fp);
-#if 0
-    GetTitleDynamics ();
-#endif
-    G -> FileName  = filename;
-    G -> TitleGain = GetTitleGain ();
-    G -> TitlePeak = 2 * max + 1;
-    G -> AlbumGain = GetAlbumGain ();
-    G -> AlbumPeak = G->AlbumPeak < G->TitlePeak  ?  G->TitlePeak  :  G->AlbumPeak;
-    return;
-}
-
-
-int
-ModifyFile ( const gain_info_t* G, unsigned int mask )
-{
-    unsigned char  buff [20];
-    Int32_t        val;
-    FILE_T         fd = OPENRW ( G -> FileName );
-
-    if ( fd == INVALID_FILEDESC ) {
-        stderr_printf ("Can't patch '%s'\n", G -> FileName );
-        return 1;
-    }
-    if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-        stderr_printf ("Can't read header of '%s'\n", G -> FileName );
-        return 2;
-    }
-    if ( 0 != memcmp ( buff, "MP+", 3)  ||  (buff[3] & 15) != 7 ) {
-        stderr_printf ("Not a MPC file SV7: '%s'\n", G -> FileName );
-        return 3;
-    }
-
-    if ( mask & 1 ) {   // Title Peak level
-        val       = G -> TitlePeak;
-        buff [12] = (Uint8_t)(val >> 0);
-        buff [13] = (Uint8_t)(val >> 8);
-        val       = (Int32_t)(G -> TitlePeak / 1.18);
-        buff [ 8] = (Uint8_t)(val >> 0);
-        buff [ 9] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 2 ) {   // Album Peak level
-        val       = G -> AlbumPeak;
-        buff [16] = (Uint8_t)(val >> 0);
-        buff [17] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 4 ) {   // Title RMS
-        val       = 100. * G -> TitleGain;
-        buff [14] = (Uint8_t)(val >> 0);
-        buff [15] = (Uint8_t)(val >> 8);
-    }
-    if ( mask & 8 ) {   // Album RMS
-        val       = 100. * G -> AlbumGain;
-        buff [18] = (Uint8_t)(val >> 0);
-        buff [19] = (Uint8_t)(val >> 8);
-    }
-
-    if ( SEEK  ( fd, 0L, SEEK_SET ) < 0 ) {
-        stderr_printf ("Seek error in '%s'\n", G -> FileName );
-        return 4;
-    }
-    if ( WRITE ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-        stderr_printf ("Can't write data in '%s'\n", G -> FileName );
-        return 5;
-    }
-    if ( CLOSE (fd) < 0 ) {
-        stderr_printf ("Error closing '%s'\n", G -> FileName );
-        return 6;
-    }
-    return 0;
-}
-
-
-char* dB ( double val )
-{
-    static unsigned int x = 0;
-    static char buff[8][12];
-
-    x = (x+1) & 7;
-
-    if (dBp) {
-        double dB = 20. * log10 (val/32767.);
-        if (dB <= -60)
-            return "     ";
-        sprintf ( buff[x], fabs(dB) < 9.995 ? "%+5.2f" : "%+5.1f", dB  );
-    }
-    else {
-        sprintf ( buff[x], "%5u", (int)val );
-    }
-    return buff[x];
-}
-
-
-// " -- [xx] "          9
-// " -- [xx]."          9
-// "/[xx] -- "          9
-// "/[xx] --."          9
-// " -- xx -- "        10
-// " -- xx --."        10
-// "/xx -- "            7
-// "/xx --."            7
-
-static size_t
-AlbumNameLen ( const char* filename )
-{
-    const char*  p = filename + strlen (filename) - 9;
-
-    while ( p >= filename ) {
-        if ( 0 == memcmp ( p, " -- [", 5)  &&  isdigit (p[5])  &&  isdigit(p[6])  &&  p[7] == ']'  &&  (p[8]=='.' || p[8]==' ') )
-            return p - filename;
-        if ( (p[0]=='/' || p[0]=='\\')  &&  p[1] == '[' &&  isdigit (p[2])  &&  isdigit(p[3])  &&  0 == memcmp (p+4, "] --", 4)  &&  (p[8]=='.' || p[8]==' ') )
-            return p - filename;
-        if ( 0 == memcmp ( p, " -- ", 4)  &&  isdigit (p[4])  &&  isdigit(p[5])  &&  0 == memcmp (p+6, " --", 3)  &&  (p[9]=='.' || p[9]==' ') )
-            return p - filename;
-        if ( (p[0]=='/' || p[0]=='\\')  &&  isdigit (p[1])  &&  isdigit(p[2])  &&  0 == memcmp (p+3, " --", 3)  &&  (p[6]=='.' || p[6]==' ') )
-            return p - filename;
-        p--;
-    }
-
-    return 0;
-}
-
-
-int Cdecl
-main ( int argc, char** argv )
-{
-    static const char*
-                 extentions [] = { ".mpc", ".mpp", ".mp+", NULL };
-    Int32_t      mode;
-    Int32_t      title_gain;
-    Int32_t      title_peak;
-    Int32_t      album_gain;
-    Int32_t      album_peak;
-    double       title_peak_max     = 0.;
-    double       title_peak_adj_max = 0.;
-    double       album_peak_max     = 0.;
-    double       album_peak_adj_max = 0.;
-    FILE_T       fd;
-    Uint8_t      buff [20];
-    const char*  name;
-    gain_info_t  Gain;
-    int          i;
-    int          ilast;
-    int          smartskip;
-
-#ifdef USE_ARGV
-    mysetargv ( &argc, &argv, extentions );
-#endif
-
-    stderr_printf ( "Replaygain " VERSION "     (C) 2001-2002 Klemm/Robinson/Sawyer\n\n" );
-
-    if ( argv[1] != NULL  &&  0 == strncmp (argv[1], "--9", 3) )
-        SetPercentile (0.01 * atoi (*++argv + 2) );
-
-    if ( argv[1] != NULL  &&  0 == strcmp (argv[1], "--smart" ) )
-        smart++, argv++;
-
-    memset ( &Gain, 0, sizeof(Gain) );
-    InitGainAnalysis  ( 44100 /*CD_SAMPLE_FREQ*/ );
-
-    if ( argc < 3 ) {
-        stderr_printf ("usage: ReplayGain level MPC_Title_01 [MPC_Title_02 MPC_Title_03 ...]\n"
-                       "\n"
-                       "percentile can be:\n"
-                       "  --92 | --93 | --94 | --95 | --96 | --97 | --98\n"
-                       "\n"
-                       "level can be:\n"
-                       "  * value in the range -300 dB...+300 dB, set as title based replay gain\n"
-                       "  * --auto   | --autodB    : auto determine gains and peak values\n"
-                       "  * --list   | --listdB    : list title based values\n"
-                       "  * --listall| --listalldB : list title and album based values\n"
-                       "  * --listreport           : list title based values + K suggestion\n"
-                       "  * --listallreport        : list title and album based values + K suggestion\n" );
-        return 1;
-    }
-
-    argv++;
-    mode = ReadReplayGain (*argv);
-    if ( mode != AUTO  &&  mode != LIST  &&  mode != LISTALL ) {
-        if ( mode != (Int16_t) mode ) {
-            stderr_printf ("level can only be in the range -327.68 dB...+327.67 dB\n" );
-            return 2;
-        }
-        Gain.TitleGain = 0.01 * mode;
-    }
-
-    switch (mode) {
-    case AUTO:
-    default:
-        printf ("   Level Adjustment   |   Peak Level   (Adjst)|  Filename\n"
-                "----------------------+-----------------------+-------------------------------\n");
-        break;
-    case LIST:
-        printf ("  Level-  |       (Peak+)|\n"
-                "Adjustment|  Peak (Adjst)|  Filename\n"
-                "----------+--------------+-----------------------------------------------------\n");
-        break;
-    case LISTALL:
-        printf ("        Title            |        Album            |\n"
-                "  Level-  |       (Peak+)|  Level-  |       (Peak+)|\n"
-                "Adjustment|  Peak (Adjst)|Adjustment|  Peak (Adjst)|  Filename\n"
-                "----------+--------------+----------+--------------+---------------------------\n");
-        break;
-    }
-    argv++;
-
-repeat:
-    ilast = -1;
-    smartskip = 0;
-    if ( smart ) {
-        for ( i = 0; argv[i]  &&  (mode != AUTO || (AlbumNameLen (argv[0])==AlbumNameLen (argv[i])  &&  0 == memcmp (argv[0], argv[i], AlbumNameLen (argv[0])))); i++ ) {
-            ilast = i;
-            name = argv [i];
-            Gain.FileName = name;
-            if ( mode == AUTO ) {
-                fd = OPEN (name);
-                if ( fd == INVALID_FILEDESC ) {
-                    stderr_printf ("Can't open: %s\n", name );
-                    //break;
-                }
-                if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-                    stderr_printf ("Can't read header: %s\n", name );
-                    //break;
-                }
-                if ( CLOSE (fd) < 0 ) {
-                    stderr_printf ("Error closing file: %s\n", name );
-                    //break;
-                }
-                if ( buff[12] || buff[13] || buff[14] || buff[15] || buff[16] || buff[17] || buff[18] || buff[19]) {
-                    smartskip = 1;
-                    //break;
-                } else {
-                    smartskip = 0;
-                    break;
-                }
-            }
-        }
-    }
-    for ( i = 0; argv[i]  &&  (mode != AUTO || (AlbumNameLen (argv[0])==AlbumNameLen (argv[i])  &&  0 == memcmp (argv[0], argv[i], AlbumNameLen (argv[0])))); i++ ) {
-        ilast = i;
-        name = argv [i];
-        Gain.FileName = name;
-        if ( mode == AUTO ) {
-            if ( smartskip == 0 ) {
-            /*
-            if (smart) {
-                fd = OPEN (name);
-                if ( fd == INVALID_FILEDESC ) {
-                    stderr_printf ("Can't open: %s\n", name );
-                    continue;
-                }
-                if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-                    stderr_printf ("Can't read header: %s\n", name );
-                    continue;
-                }
-                if ( CLOSE (fd) < 0 ) {
-                    stderr_printf ("Error closing file: %s\n", name );
-                    continue;
-                }
-                if ( buff[12] || buff[13] || buff[14] || buff[15] || buff[16] || buff[17] || buff[18] || buff[19])
-                    continue;
-            }
-            */
-            if ( ISATTY (FILENO(STDOUT)) ) {
-                printf ("%s\r", name );
-                FLUSH (stdout);
-                fflush (stdout);
-            }
-            fd = OPENRW (name);
-            if ( fd == INVALID_FILEDESC ) {
-                stderr_printf ("Can't patch '%s'\n", name );
-                return 1;
-            }
-            if ( CLOSE (fd) < 0 ) {
-                stderr_printf ("Error closing '%s'\n", name );
-                return 6;
-            }
-            CalcReplayGain ( name, &Gain );
-            if ( Gain.TitleGain > +36. )
-                Gain.TitleGain = 0.;
-            if ( Gain.AlbumGain > +24. )
-                Gain.AlbumGain = 0.;
-            }
-        }
-        fd = OPEN (name);
-        if ( fd == INVALID_FILEDESC ) {
-            stderr_printf ("Can't open: %s\n", name );
-            continue;
-        }
-        if ( READ ( fd, buff, sizeof(buff) ) != sizeof(buff) ) {
-            stderr_printf ("Can't read header: %s\n", name );
-            continue;
-        }
-        if ( CLOSE (fd) < 0 ) {
-            stderr_printf ("Error closing file: %s\n", name );
-            continue;
-        }
-        if ( 0 != memcmp ( buff, "MP+", 3)  ||  (buff[3] & 15) != 7 ) {
-            stderr_printf ("Not a MPC file SV7: '%s'\n", name );
-            continue;
-        }
-
-        title_gain = (Uint8_t)buff[14] + 256 * (Int8_t) buff[15];
-        album_gain = (Uint8_t)buff[18] + 256 * (Int8_t) buff[19];
-        title_peak = (Uint8_t)buff[12] + 256 * (Uint8_t)buff[13];
-        album_peak = (Uint8_t)buff[16] + 256 * (Uint8_t)buff[17];
-
-        switch (mode) {
-        case LIST:
-            printf ("%+6.2f dB | %s (%s)| %s\n",
-                    0.01 * title_gain, dB(title_peak), dB(title_peak * pow (10., title_gain/2000.)),
-                    name );
-            if ( argv[i+1] == NULL  ||  0 != memcmp (argv[i], argv[i+1], AlbumNameLen (argv[i])) )  {
-                int len = AlbumNameLen (argv[i]);
-                printf ("%+6.2f dB | %s (%s)| %*.*s\n"
-                        "----------+--------------+-----------------------------------------------------\n",
-                    0.01 * album_gain, dB(album_peak), dB(album_peak * pow (10., album_gain/2000.)),
-                    len, len, argv[i] );
-            }
-            break;
-        case LISTALL:
-            printf ("%+6.2f dB | %s (%s)|%+6.2f dB | %s (%s)| %s\n",
-                    0.01 * title_gain, dB(title_peak), dB(title_peak * pow (10., title_gain/2000.)),
-                    0.01 * album_gain, dB(album_peak), dB(album_peak * pow (10., album_gain/2000.)),
-                    name );
-            break;
-        default:
-            Gain.TitlePeak = title_peak;
-            if ( mode == 0 ) {
-                Gain.TitleGain = 0;
-                Gain.TitlePeak = 0;
-                Gain.AlbumPeak = 0;
-                Gain.AlbumGain = 0;
-            }
-        case AUTO:
-            if ( !smartskip ) {
-                if ( mode == 0 )
-                    ModifyFile ( &Gain, 15);
-                else
-                    ModifyFile ( &Gain, mode==AUTO  ?  4|1  :  4);
-                printf ("%+6.2f dB =>%+6.2f dB | %s => %s (%s)| %s\n",
-                        0.01 * title_gain, Gain.TitleGain,
-                        dB(title_peak), dB(Gain.TitlePeak),
-                        dB(Gain.TitlePeak * pow (10., Gain.TitleGain/20.)),
-                        name );
-            } else {
-                printf ("skipped: %s\n", name );
-            }
-            break;
-        }
-        fflush (stdout);
-
-        if (mode == LIST || mode == LISTALL) {
-            if (title_peak > title_peak_max) title_peak_max = title_peak;
-            if (album_peak > album_peak_max) album_peak_max = album_peak;
-            if (title_peak * pow (10., title_gain/2000.) > title_peak_adj_max) title_peak_adj_max = title_peak * pow (10., title_gain/2000.);
-            if (album_peak * pow (10., album_gain/2000.) > album_peak_adj_max) album_peak_adj_max = album_peak * pow (10., album_gain/2000.);
-        }
-
-    }
-
-    if ( mode == AUTO ) {
-        int len = AlbumNameLen (argv[0]);
-        if ( !smartskip ) {
-            printf ("          =>%+6.2f dB |       => %s (%s)| %*.*s\n",
-                    Gain.AlbumGain,
-                    dB(Gain.AlbumPeak),
-                    dB(Gain.AlbumPeak * pow (10., Gain.AlbumGain/20.)), len, len, *argv );
-        } else {
-            printf ( "          skipped...\n" );
-        }
-        fflush (stdout);
-        for ( i = 0; i <= ilast; i++ ) {
-            name = argv [i];
-            Gain.FileName = name;
-            if ( !smartskip )
-                ModifyFile ( &Gain, 2|8 );
-        }
-        argv += ilast + 1;
-        if ( argv[0] != NULL ) {
-            printf ( "----------------------+-----------------------+-------------------------------\n");
-            memset ( &Gain, 0, sizeof(Gain) );
-            InitGainAnalysis  ( 44100 /*CD_SAMPLE_FREQ*/ );
-            goto repeat;
-        }
-    }
-
-    switch (mode) {
-    case LIST:
-        printf ("          | %s (%s)| %s\n",
-                dB(title_peak_max), dB(title_peak_adj_max),
-                "--- maximum (title based) ---" );
-        printf ("          | %s (%s)| %s\n",
-                dB(album_peak_max), dB(album_peak_adj_max),
-                "--- maximum (album based) ---" );
-        break;
-    case LISTALL:
-        printf ("          | %s (%s)|          | %s (%s)| %s\n",
-                dB(title_peak_max), dB(title_peak_adj_max),
-                dB(album_peak_max), dB(album_peak_adj_max),
-                "--- maximum ---" );
-        break;
-    }
-
-    if ( Kreport ) {
-        printf ("\n\nSuggested mode for\n");
-        printf ("  title based replay gain:   K%+d\n", -14 - (int) ceil (20.*log10(title_peak_adj_max/32767.)) );
-        printf ("  album based replay gain:   K%+d\n", -14 - (int) ceil (20.*log10(album_peak_adj_max/32767.)) );
-        printf ("  title based clipping prev: K%+d\n", -14 - (int) ceil (20.*log10(title_peak_max    /32767.)) );
-        printf ("  album based clipping prev: K%+d\n", -14 - (int) ceil (20.*log10(album_peak_max    /32767.)) );
-        printf ("\nLast two setting only possible in plugins using K setting also for\nnon-replaygain modes.\n");
-    }
-
-    return 0;
-}
-
-/* end of replaygain.c */
Index: penc/trunk/replaygain.dsp
===================================================================
--- /mppenc/trunk/replaygain.dsp	(revision 96)
+++ 	(revision )
@@ -1,122 +1,0 @@
-# Microsoft Developer Studio Project File - Name="replaygain" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=replaygain - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "replaygain.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "replaygain.mak" CFG="replaygain - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "replaygain - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "replaygain - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "replaygain - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "replaygain - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "MPP_ENCODER" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "replaygain - Win32 Release"
-# Name "replaygain - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\_setargv.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gain_analysis.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\gain_analysis.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\pipeopen.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\replaygain.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\stderr.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/replaygain.vcproj
===================================================================
--- /mppenc/trunk/replaygain.vcproj	(revision 96)
+++ 	(revision )
@@ -1,243 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="replaygain"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/replaygain.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj"
-				OutputFile=".\Release/replaygain.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/replaygain.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/replaygain.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;MPP_ENCODER;WIN32;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/replaygain.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj"
-				OutputFile=".\Debug/replaygain.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/replaygain.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/replaygain.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="_setargv.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="gain_analysis.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="gain_analysis.h">
-			</File>
-			<File
-				RelativePath="pipeopen.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="replaygain.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="stderr.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/requant.c
===================================================================
--- /mppenc/trunk/requant.c	(revision 96)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppdec.h"
-
-Int8_t      Q_bit [32];         // Number of bits to save the resolution (SV6)
-Int8_t      Q_res [32] [16];    // Index -> resolution (SV6)
-Float       __SCF [6 + 128];    // tabulated scalefactors with safety margin
-Float       __Cc  [1 + 18];     // Requantization-coefficients
-const Uint  __Dc  [1 + 18] = {  // Requantization-Offset
-      2,
-      0,     1,     2,     3,     4,     7,    15,    31,    63,
-    127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
-};
-Uint        Bitrate;
-Int         Min_Band;
-Int         Max_Band;
-
-
-// Initialize Min_Band, Max_Band; Input is function-parameter and bitrate
-
-static void
-Set_BandLimits ( Int Max_Band_desired, Bool_t used_IS )
-{
-    if ( Max_Band_desired > 0 ) {   // Bandwidth as chosen by user
-        Max_Band = Max_Band_desired;
-    } else {                        // Default-Bandwidth
-        if      ( Bitrate > 384 ) Max_Band = 31;        // 22.05 kHz
-        else if ( Bitrate > 160 ) Max_Band = 29;        // 20.67 kHz
-        else if ( Bitrate >  64 ) Max_Band = 26;        // 18.60 kHz
-        else if ( Bitrate >   0 ) Max_Band = 20;        // 14.47 kHz
-        else                      Max_Band = 31;        // 22.05 kHz
-    }
-
-    if ( used_IS ) {
-        if      ( Bitrate > 384 ) assert (0);
-        else if ( Bitrate > 160 ) Min_Band = 16;        // 11.02 kHz
-        else if ( Bitrate > 112 ) Min_Band = 12;        //  8.27 kHz
-        else if ( Bitrate > 64  ) Min_Band =  8;        //  5.51 kHz
-        else                      Min_Band =  4;        //  2.76 kHz
-
-        if ( Min_Band >= Max_Band )
-            Min_Band = Max_Band /* + 1 ????? */;
-    } else {
-        Min_Band = Max_Band + 1;
-    }
-}
-
-
-// Initialize Q_bit and Q_res
-
-static void
-Set_QuantizeMode_SV4_6 ( void )
-{
-    Int  Band;
-    Int  i;
-
-    for ( Band = 0; Band < 11; Band++ ) {
-        Q_bit [Band] = 4;
-        for ( i = 0; i < (1<<4)-1; i++ )
-            Q_res [Band] [i] = (Uint8_t)i;
-        Q_res [Band] [(1<<4)-1] = 17;
-    }
-    for ( Band = 11; Band < 23; Band++ ) {
-        Q_bit [Band] = 3;
-        for ( i = 0; i < (1<<3)-1; i++ )
-            Q_res [Band] [i] = (Uint8_t)i;
-        Q_res [Band] [(1<<3)-1] = 17;
-    }
-    for ( Band = 23; Band < 32; Band++ ) {
-        Q_bit [Band] = 2;
-        for ( i = 0; i < (1<<2)-1; i++ )
-            Q_res [Band] [i] = (Uint8_t)i;
-        Q_res [Band] [(1<<2)-1] = 17;
-    }
-}
-
-
-// Initialize table SCF
-
-static void
-Calc_ScaleFactors ( Ldouble start, Ldouble mult )
-{
-    size_t  i;
-
-    for ( i = 0; i < sizeof(__SCF)/sizeof(*__SCF); i++ ) {
-        __SCF [i] = (Float) start;
-        start    *= mult;
-    }
-}
-
-
-// Initialize Cc, needs table Dc
-
-static void
-Calc_RequantTab_SV4_7 ( void )
-{
-    size_t  i;
-
-    __Cc [0] = 111.28596247532739441973f;                                       // 16384 / 255 * sqrt(3)
-    for ( i = 1; i < sizeof(__Cc)/sizeof(*__Cc); i++ )
-        __Cc [i] = (Float) (32768. / (__Dc [i] + 0.5));
-}
-
-
-static void
-Calc_RequantTab_SV8 ( void )
-{
-    size_t  i;
-
-    for ( i = 0; i < sizeof(__Cc)/sizeof(*__Cc); i++ )
-        __Cc [i] = (Float) 1.;
-}
-
-
-#define C1  1.20050805774840750476L
-#define C2  0.83298066476582673961L
-#define C3  0.501187233627272285285L
-#define C4  1.122018454301963435591L
-
-void
-Init_QuantTab ( Int maximum_Band, Bool_t used_IS, Double amplification, Uint StreamVersion )
-{
-    // Initializations are independent from each other, order is arbitrary
-    Set_BandLimits ( maximum_Band, used_IS );
-    Set_QuantizeMode_SV4_6 ();
-
-    if ( (StreamVersion & 15) < 8 ) {
-        Calc_RequantTab_SV4_7 ();
-        // Covers the range +7.936...-98.4127 dB, where scf[n]/scf[n-1] = 1.20050805774840750476
-        Calc_ScaleFactors ( amplification * C1/(C2*C2*C2*C2*C2*C2), C2 );
-    } else {
-        Calc_RequantTab_SV8 ();
-        Calc_ScaleFactors ( amplification * C3/(C4*C4*C4*C4*C4*C4), C4 );
-    }
-}
-
-/* end of requant.c */
Index: penc/trunk/seekspeed.c
===================================================================
--- /mppenc/trunk/seekspeed.c	(revision 96)
+++ 	(revision )
@@ -1,543 +1,0 @@
-/*
-
-Pentium-4/1.7, Windows 2000, VS 6.0, 80 GB HD, 7200 rpm        Athlon/0.7, Linux 2.2.17, gcc 2.95.3, 60 GB HD, 5400 rpm
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-                               222.9x     normal decode (from Cache)                                              156.8x
-                               631.1x     decode with --scale 0 (from Cache)                                      493.0x
-3600.0 s :    1.1204 ms =  3213228.3x     FastCached, notoptimized                3600.0 s :    1.0078 ms =  3571982.0x
-3600.0 s :    0.4342 ms =  8290771.0x     FastCached, Addition optimized          3600.0 s :    0.1972 ms = 18253801.0x
-3599.7 s : 1417.5366 ms =     2539.4x     FAT32/ext2,  fseek/fread                1464.3 s :  181.8882 ms =     8050.7x
-3599.7 s : 1242.3945 ms =     2897.4x     FAT32/ext2,  lseek/read                 1464.3 s :  109.3096 ms =    13396.1x
-3599.7 s :  180.8211 ms =    19907.4x     FAT32/ext2,  fread                      1464.3 s :  101.8035 ms =    14383.8x
-3599.7 s :  159.8485 ms =    22519.3x     FAT32/ext2,  read                       1464.3 s :  101.4027 ms =    14440.6x
-3599.7 s : 1431.0977 ms =     2515.3x     NTFS/reiser, fseek/fread                1464.3 s :  183.1137 ms =     7996.8x
-3599.7 s : 1251.7135 ms =     2875.8x     NTFS/reiser, lseek/read                 1464.3 s :  127.6082 ms =    11475.1x
-3599.7 s :  186.2180 ms =    19330.4x     NTFS/reiser, fread                      1464.3 s :  103.0833 ms =    14205.2x
-3599.7 s :  163.7307 ms =    21985.3x     NTFS/reiser, read                       1464.3 s :  102.6841 ms =    14260.4x
-3599.7 s :22066.5936 ms =      163.1x     NTFS/reiser, uncached, fseek/fread    1464.3 s : 1671.0040 ms =      876.3x
-3599.7 s :23131.4043 ms =      155.6x     NTFS/reiser, uncached, lseek/read     1464.3 s : 1519.3631 ms =      963.8x
-                                          NTFS/reiser, uncached, fread          1464.3 s : 1515.6563 ms =      966.1x
-3599.7 s : 9520.1631 ms =      378.1x     NTFS/reiser, uncached, read           1464.3 s : 1516.3300 ms =      965.7x
-                                          FAT32, uncached, fseek/fread
-                                          FAT32, uncached, lseek/read
-                                          FAT32, uncached, fread
-                                          FAT32, uncached, read
-
-*/
-
-#include "mppdec.h"
-
-
-#ifdef _WIN32
-Int64_t  __rdtscll ( void )
-{
-    __asm { rdtsc };
-}
-# define rdtscll(__var)     (__var = __rdtscll() )
-#else
-# include <asm/msr.h>
-#endif
-
-
-#ifdef _WIN32
-# define TESTDATEI1       "D:\\AUDIO\\MIKE OLDFIELD\\AMAROK -- [01] Amarok.mpc"         // FAT32
-# define TESTDATEI2       "C:\\AUDIO\\AMAROK.mpc"                                       // NTFS
-# define TESTDATEIFRAMES  137800
-# define FLUSHCMD         "copy /B \"D:\\AUDIO\\Tangerine Dream\\*\" nul 1> nul"        // should read RAM size of data
-# define RAMSIZE          512                                                           // RAM size in MByte
-#else
-# define TESTDATEI1       "CD.mpc"                                                      // ext2
-# define TESTDATEI2       "/Archive/CD.mpc"                                             // reiserFS
-# define TESTDATEIFRAMES  56056
-# define FLUSHCMD         "cat /Archive/Audio/Sting/Nada*.pac > /dev/null"              // should read RAM size of data
-# define RAMSIZE          128                                                           // RAM size in MByte
-#endif
-
-static void
-flushing ( void )
-{
-    size_t  len = 1048576L * RAMSIZE;
-    long*   p;
-    int     i;
-    int     j;
-    time_t  t1;
-    time_t  t2;
-
-    fprintf ( stderr, "Flushing system cache ...   ");
-    p = malloc ( len );
-    for ( i = 0; i <= 64; i++ ) {
-        fprintf ( stderr, "\b\b%2u", i );
-        time (&t1);
-        for ( j = 0; j < len/256*i; j += 1024 )
-            p[j] = i;
-        time (&t2);
-        if (t2-t1 > 8)
-            break;
-    }
-    free (p);
-    for ( i = 0; i < 2; i++ ) {
-        fprintf ( stderr, ".", i );
-        system  ( FLUSHCMD );
-    }
-    p = malloc ( len );
-    fprintf ( stderr, "  ");
-    for ( i = 0; i <= 64; i++ ) {
-        fprintf ( stderr, "\b\b%2u", i );
-        time (&t1);
-        for ( j = 0; j < len/256*i; j += 1024 )
-            p[j] = i;
-        time (&t2);
-        if (t2-t1 > 8)
-            break;
-    }
-    free (p);
-    fprintf ( stderr, "\n\n");
-}
-
-
-
-unsigned int  mask [33] = {
-    0x00000000, 0x00000001, 0x00000003, 0x00000007,
-    0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
-    0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF,
-    0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF,
-    0x0000FFFF, 0x0001FFFF, 0x0003FFFF, 0x0007FFFF,
-    0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF,
-    0x00FFFFFF, 0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF,
-    0x0FFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF,
-    0xFFFFFFFF
-};
-
-#define MEMSIZE   8192
-#define MEMSIZE2  (MEMSIZE/2)
-#define MEMMASK   (MEMSIZE-1)
-
-
-unsigned short  tab [137812];
-unsigned long   Speicher [MEMSIZE];
-unsigned long   dword;
-unsigned int    Zaehler;
-unsigned int    pos;
-
-
-static Uint32_t
-Bitstream_read ( Int bits )
-{
-    unsigned int  out = dword;
-
-    pos += bits;
-
-    if ( pos < 32 ) {
-        out >>= 32 - pos;
-    }
-    else {
-        dword = Speicher [Zaehler = (Zaehler+1) & MEMMASK];
-        pos  -= 32;
-        if ( pos ) {
-            out <<= pos;
-            out  |= dword >> (32-pos);
-        }
-    }
-
-    return out & mask [bits];
-}
-
-
-unsigned long
-test1 ( unsigned short* tab, unsigned int len )
-{
-    unsigned long  sum = 0;
-    unsigned int   i;
-
-    for ( i = 0; i < len; i++ )
-        if ( tab[i] != 0 )
-            sum += tab [i];
-        else
-            printf ("%u\n", i );
-    return sum;
-}
-
-
-unsigned long
-test2 ( unsigned short* tab, unsigned int len )
-{
-    unsigned long   sum1 = 0;
-    unsigned long   sum2 = 0;
-    int             i;
-    unsigned long*  p = (unsigned long*) tab;
-
-    i = len >> 1;
-
-    for ( ; i--; p++ ) {
-        sum1 += *p;
-        sum2 += *p >> 16;
-    }
-
-    sum2 += (sum1 - (sum2 << 16));
-
-    if (len & 1)
-        sum2 += tab[len-1];
-
-    return sum2;
-}
-
-
-static void
-Helper1 ( FILE* fp, unsigned long fpos )
-{
-    fseek ( fp, (fpos>>5) * 4, SEEK_SET );
-    fread ( Speicher, sizeof(int), 2, fp );
-    dword = Speicher [ Zaehler = 0];
-    pos   = fpos & 31;
-}
-
-
-unsigned long
-test3 ( FILE* fp, unsigned int len )
-{
-    unsigned long  fpos = 200;
-    unsigned int   i;
-
-    for ( i = 0; i < len; i++ ) {
-        Helper1 ( fp, fpos );
-        fpos += 20 + Bitstream_read (20);
-    }
-    return fpos;
-}
-
-
-static void
-Helper2 ( int fd, unsigned long fpos )
-{
-    lseek ( fd, (fpos>>5) * 4, SEEK_SET );
-    read ( fd, Speicher, sizeof(int)*2 );
-    dword = Speicher [ Zaehler = 0];
-    pos   = fpos & 31;
-}
-
-
-unsigned long
-test4 ( FILE* fp, unsigned int len )
-{
-    unsigned long  fpos = 200;
-    unsigned int   i;
-    int            fd = fileno(fp);
-
-    for ( i = 0; i < len; i++ ) {
-        Helper2 ( fd, fpos );
-        fpos += 20 + Bitstream_read (20);
-    }
-    return fpos;
-}
-
-
-static unsigned int  RING;
-
-
-static void
-Helper3 ( FILE* fp, unsigned long fpos )
-{
-    unsigned int  NEWRING = (fpos>>5) & MEMSIZE2;
-
-    if ( RING != NEWRING ) {
-        fread ( Speicher+RING, 1, sizeof(Speicher)/2, fp );
-        RING = NEWRING;
-    }
-
-    dword = Speicher [Zaehler = (fpos>>5) & MEMMASK];
-    pos   = fpos & 31;
-}
-
-
-unsigned long
-test5 ( FILE* fp, unsigned int len )
-{
-    unsigned long  fpos = 200;
-    unsigned int   i;
-
-    rewind (fp);
-    fread ( Speicher, 1, sizeof(Speicher), fp );
-    RING = 0;
-
-    for ( i = 0; i < len; i++ ) {
-        Helper3 ( fp, fpos );
-        fpos += 20 + Bitstream_read (20);
-    }
-
-    return fpos;
-}
-
-
-static void
-Helper4 ( int fd, unsigned long fpos )
-{
-    unsigned int  NEWRING = (fpos>>5) & MEMSIZE2;
-
-    if ( RING != NEWRING ) {
-        read ( fd, Speicher+RING, sizeof(Speicher)/2 );
-        RING = NEWRING;
-    }
-
-    dword = Speicher [Zaehler = (fpos>>5) & MEMMASK];
-    pos   = fpos & 31;
-}
-
-
-unsigned long
-test6 ( FILE* fp, unsigned int len )
-{
-    unsigned long  fpos = 200;
-    unsigned int   i;
-    int            fd = fileno(fp);
-
-    lseek (fd, 0l, SEEK_SET );
-    read ( fd, Speicher, sizeof(Speicher) );
-    RING = 0;
-
-    for ( i = 0; i < len; i++ ) {
-        Helper4 ( fd, fpos );
-        fpos += 20 + Bitstream_read (20);
-    }
-
-    return fpos;
-}
-
-
-int
-main ( void )
-{
-    Int64_t   t1;
-    Int64_t   t2;
-    int       i;
-    double    TIME1;
-    double    TIME2;
-    FILE*     fp;
-
-    fp = fopen ( TESTDATEI1, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI1 );
-        return 1;
-    }
-
-    for ( i = 0; i < sizeof(tab)/sizeof(*tab); i++ )
-        tab[i] = sqrt ( i+1 );
-    memset ( Speicher, 0, sizeof Speicher );
-
-    if ( test1 ( tab, sizeof(tab)/sizeof(*tab) ) != test2 ( tab, sizeof(tab)/sizeof(*tab) )) {
-        printf ("1=%lu 2=%lu\n", test1 ( tab, sizeof(tab)/sizeof(*tab) ), test2 ( tab, sizeof(tab)/sizeof(*tab) ) );
-    }
-
-    if ( test3 ( fp, TESTDATEIFRAMES ) != test4 ( fp, TESTDATEIFRAMES )) {
-        printf ("3=%lu 4=%lu\n", test3 ( fp, TESTDATEIFRAMES ), test4 ( fp, TESTDATEIFRAMES ) );
-    }
-
-    if ( test3 ( fp, TESTDATEIFRAMES ) != test5 ( fp, TESTDATEIFRAMES )) {
-        printf ("3=%lu 5=%lu\n", test3 ( fp, TESTDATEIFRAMES ), test5 ( fp, TESTDATEIFRAMES ) );
-    }
-
-    if ( test3 ( fp, TESTDATEIFRAMES ) != test6 ( fp, TESTDATEIFRAMES )) {
-        printf ("3=%lu 6=%lu\n", test3 ( fp, TESTDATEIFRAMES ), test6 ( fp, TESTDATEIFRAMES ) );
-    }
-
-    //--------------------------------------------------------------
-    test1 ( tab, sizeof(tab)/sizeof(*tab) );
-    rdtscll (t1);
-    for ( i = 0; i < 5000; i++ )
-        test1 ( tab, sizeof(tab)/sizeof(*tab) );
-    rdtscll (t2);
-    TIME1 = sizeof(tab)/sizeof(*tab)*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 5000;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test2 ( tab, sizeof(tab)/sizeof(*tab) );
-    rdtscll (t1);
-    for ( i = 0; i < 25000; i++ )
-        test2 ( tab, sizeof(tab)/sizeof(*tab) );
-    rdtscll (t2);
-    TIME1 = sizeof(tab)/sizeof(*tab)*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 25000;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test3 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 25; i++ )
-        test3 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 25;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test4 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test4 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test5 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test5 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test6 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test6 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    fclose (fp);
-    fp = fopen ( TESTDATEI2, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-
-    //---------------------------------------------------------------
-    test3 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 25; i++ )
-        test3 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 25;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test4 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test4 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test5 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test5 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //---------------------------------------------------------------
-    test6 ( fp, TESTDATEIFRAMES );
-    rdtscll (t1);
-    for ( i = 0; i < 50; i++ )
-        test6 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 50;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    fclose (fp);
-
-    //------------------------------------------------------------------
-    flushing ();
-    fp = fopen ( TESTDATEI1, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI1 );
-        return 1;
-    }
-    test3 ( fp, TESTDATEIFRAMES );
-    test3 ( fp, TESTDATEIFRAMES );
-    fclose (fp);
-    fp = fopen ( TESTDATEI2, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-    rdtscll (t1);
-    test3 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 1;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    fclose (fp);
-
-    //------------------------------------------------------------------
-    flushing ();
-    fp = fopen ( TESTDATEI1, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-    test4 ( fp, TESTDATEIFRAMES );
-    test4 ( fp, TESTDATEIFRAMES );
-    fclose (fp);
-    fp = fopen ( TESTDATEI2, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-    rdtscll (t1);
-    test4 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 1;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    fclose (fp);
-    //------------------------------------------------------------------
-    flushing ();
-    fp = fopen ( TESTDATEI1, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI1 );
-        return 1;
-    }
-    test5 ( fp, TESTDATEIFRAMES );
-    test5 ( fp, TESTDATEIFRAMES );
-    fclose (fp);
-    fp = fopen ( TESTDATEI2, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-    rdtscll (t1);
-    test5 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 1;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    //------------------------------------------------------------------
-    flushing ();
-    fp = fopen ( TESTDATEI1, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI1 );
-        return 1;
-    }
-    test6 ( fp, TESTDATEIFRAMES );
-    test6 ( fp, TESTDATEIFRAMES );
-    fclose (fp);
-    fp = fopen ( TESTDATEI2, "rb" );
-    if ( fp == NULL ) {
-        fprintf ( stderr, "\nCan't open '%s'\n\n", TESTDATEI2 );
-        return 1;
-    }
-    rdtscll (t1);
-    test6 ( fp, TESTDATEIFRAMES );
-    rdtscll (t2);
-    TIME1 = TESTDATEIFRAMES*1152. / 44100.;
-    TIME2 = (t2-t1) / 700.e6 / 1;
-    printf ("%6.1f s : %9.4f ms = %10.1fx\n", TIME1, 1.e3*TIME2, TIME1/TIME2 );
-
-    return 0;
-}
Index: penc/trunk/seekspeed.dsp
===================================================================
--- /mppenc/trunk/seekspeed.dsp	(revision 96)
+++ 	(revision )
@@ -1,102 +1,0 @@
-# Microsoft Developer Studio Project File - Name="seekspeed" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=seekspeed - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "seekspeed.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "seekspeed.mak" CFG="seekspeed - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "seekspeed - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "seekspeed - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "seekspeed - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "seekspeed - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "seekspeed___Win32_Debug"
-# PROP BASE Intermediate_Dir "seekspeed___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_DECODER" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "seekspeed - Win32 Release"
-# Name "seekspeed - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\seekspeed.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/seekspeed.vcproj
===================================================================
--- /mppenc/trunk/seekspeed.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="seekspeed"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/seekspeed.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/seekspeed.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/seekspeed.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/seekspeed.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_DECODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/seekspeed.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/seekspeed.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/seekspeed.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/seekspeed.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="seekspeed.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: /mppenc/trunk/src/CMakeLists.txt
===================================================================
--- /mppenc/trunk/src/CMakeLists.txt	(revision 97)
+++ /mppenc/trunk/src/CMakeLists.txt	(revision 97)
@@ -0,0 +1,4 @@
+add_definitions(-DMPP_ENCODER -DFAST_MATH -DCVD_FASTLOG)
+add_executable(mppenc analy_filter encode_sv7 huffsv7 profile stderr winmsg ans fastmath keyboard psy tags bitstream fft4g mppenc psy_tab tools cvd fft_routines pipeopen quant wave_in)
+target_link_libraries(mppenc m)
+install(TARGETS mppenc RUNTIME DESTINATION bin)
Index: /mppenc/trunk/src/analy_filter.c
===================================================================
--- /mppenc/trunk/src/analy_filter.c	(revision 97)
+++ /mppenc/trunk/src/analy_filter.c	(revision 97)
@@ -0,0 +1,345 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <string.h>
+#include "mppenc.h"
+
+#define FASTER
+
+/* C O N S T A N T S */
+
+#undef _
+#define _(value)  (float)(value##.##L / 0x200000)
+
+static float  Ci_opt [512] = {
+    _(   0), _(  213), _( 2037), _(  6574), _(75038), _( 6574), _(2037), _(213),
+    _(  -1), _(  218), _( 2000), _(  5959), _(74992), _( 7134), _(2063), _(208),
+    _(  -1), _(  222), _( 1952), _(  5288), _(74856), _( 7640), _(2080), _(202),
+    _(  -1), _(  225), _( 1893), _(  4561), _(74630), _( 8092), _(2087), _(196),
+    _(  -1), _(  227), _( 1822), _(  3776), _(74313), _( 8492), _(2085), _(190),
+    _(  -1), _(  228), _( 1739), _(  2935), _(73908), _( 8840), _(2075), _(183),
+    _(  -1), _(  228), _( 1644), _(  2037), _(73415), _( 9139), _(2057), _(176),
+    _(  -2), _(  227), _( 1535), _(  1082), _(72835), _( 9389), _(2032), _(169),
+    _(  -2), _(  224), _( 1414), _(    70), _(72169), _( 9592), _(2001), _(161),
+    _(  -2), _(  221), _( 1280), _(  -998), _(71420), _( 9750), _(1962), _(154),
+    _(  -2), _(  215), _( 1131), _( -2122), _(70590), _( 9863), _(1919), _(147),
+    _(  -3), _(  208), _(  970), _( -3300), _(69679), _( 9935), _(1870), _(139),
+    _(  -3), _(  200), _(  794), _( -4533), _(68692), _( 9966), _(1817), _(132),
+    _(  -4), _(  189), _(  605), _( -5818), _(67629), _( 9959), _(1759), _(125),
+    _(  -4), _(  177), _(  402), _( -7154), _(66494), _( 9916), _(1698), _(117),
+    _(  -5), _(  163), _(  185), _( -8540), _(65290), _( 9838), _(1634), _(111),
+    _(  -5), _(  146), _(  -45), _( -9975), _(64019), _( 9727), _(1567), _(104),
+    _(  -6), _(  127), _( -288), _(-11455), _(62684), _( 9585), _(1498), _( 97),
+    _(  -7), _(  106), _( -545), _(-12980), _(61289), _( 9416), _(1428), _( 91),
+    _(  -7), _(   83), _( -814), _(-14548), _(59838), _( 9219), _(1356), _( 85),
+    _(  -8), _(   57), _(-1095), _(-16155), _(58333), _( 8998), _(1283), _( 79),
+    _(  -9), _(   29), _(-1388), _(-17799), _(56778), _( 8755), _(1210), _( 73),
+    _( -10), _(   -2), _(-1692), _(-19478), _(55178), _( 8491), _(1137), _( 68),
+    _( -11), _(  -36), _(-2006), _(-21189), _(53534), _( 8209), _(1064), _( 63),
+    _( -13), _(  -72), _(-2330), _(-22929), _(51853), _( 7910), _( 991), _( 58),
+    _( -14), _( -111), _(-2663), _(-24694), _(50137), _( 7597), _( 919), _( 53),
+    _( -16), _( -153), _(-3004), _(-26482), _(48390), _( 7271), _( 848), _( 49),
+    _( -17), _( -197), _(-3351), _(-28289), _(46617), _( 6935), _( 779), _( 45),
+    _( -19), _( -244), _(-3705), _(-30112), _(44821), _( 6589), _( 711), _( 41),
+    _( -21), _( -294), _(-4063), _(-31947), _(43006), _( 6237), _( 645), _( 38),
+    _( -24), _( -347), _(-4425), _(-33791), _(41176), _( 5879), _( 581), _( 35),
+    _( -26), _( -401), _(-4788), _(-35640), _(39336), _( 5517), _( 519), _( 31),
+    _( -29), _( -459), _(-5153), _(-37489), _(37489), _( 5153), _( 459), _( 29),
+    _( -31), _( -519), _(-5517), _(-39336), _(35640), _( 4788), _( 401), _( 26),
+    _( -35), _( -581), _(-5879), _(-41176), _(33791), _( 4425), _( 347), _( 24),
+    _( -38), _( -645), _(-6237), _(-43006), _(31947), _( 4063), _( 294), _( 21),
+    _( -41), _( -711), _(-6589), _(-44821), _(30112), _( 3705), _( 244), _( 19),
+    _( -45), _( -779), _(-6935), _(-46617), _(28289), _( 3351), _( 197), _( 17),
+    _( -49), _( -848), _(-7271), _(-48390), _(26482), _( 3004), _( 153), _( 16),
+    _( -53), _( -919), _(-7597), _(-50137), _(24694), _( 2663), _( 111), _( 14),
+    _( -58), _( -991), _(-7910), _(-51853), _(22929), _( 2330), _(  72), _( 13),
+    _( -63), _(-1064), _(-8209), _(-53534), _(21189), _( 2006), _(  36), _( 11),
+    _( -68), _(-1137), _(-8491), _(-55178), _(19478), _( 1692), _(   2), _( 10),
+    _( -73), _(-1210), _(-8755), _(-56778), _(17799), _( 1388), _( -29), _(  9),
+    _( -79), _(-1283), _(-8998), _(-58333), _(16155), _( 1095), _( -57), _(  8),
+    _( -85), _(-1356), _(-9219), _(-59838), _(14548), _(  814), _( -83), _(  7),
+    _( -91), _(-1428), _(-9416), _(-61289), _(12980), _(  545), _(-106), _(  7),
+    _( -97), _(-1498), _(-9585), _(-62684), _(11455), _(  288), _(-127), _(  6),
+    _(-104), _(-1567), _(-9727), _(-64019), _( 9975), _(   45), _(-146), _(  5),
+    _(-111), _(-1634), _(-9838), _(-65290), _( 8540), _( -185), _(-163), _(  5),
+    _(-117), _(-1698), _(-9916), _(-66494), _( 7154), _( -402), _(-177), _(  4),
+    _(-125), _(-1759), _(-9959), _(-67629), _( 5818), _( -605), _(-189), _(  4),
+    _(-132), _(-1817), _(-9966), _(-68692), _( 4533), _( -794), _(-200), _(  3),
+    _(-139), _(-1870), _(-9935), _(-69679), _( 3300), _( -970), _(-208), _(  3),
+    _(-147), _(-1919), _(-9863), _(-70590), _( 2122), _(-1131), _(-215), _(  2),
+    _(-154), _(-1962), _(-9750), _(-71420), _(  998), _(-1280), _(-221), _(  2),
+    _(-161), _(-2001), _(-9592), _(-72169), _(  -70), _(-1414), _(-224), _(  2),
+    _(-169), _(-2032), _(-9389), _(-72835), _(-1082), _(-1535), _(-227), _(  2),
+    _(-176), _(-2057), _(-9139), _(-73415), _(-2037), _(-1644), _(-228), _(  1),
+    _(-183), _(-2075), _(-8840), _(-73908), _(-2935), _(-1739), _(-228), _(  1),
+    _(-190), _(-2085), _(-8492), _(-74313), _(-3776), _(-1822), _(-227), _(  1),
+    _(-196), _(-2087), _(-8092), _(-74630), _(-4561), _(-1893), _(-225), _(  1),
+    _(-202), _(-2080), _(-7640), _(-74856), _(-5288), _(-1952), _(-222), _(  1),
+    _(-208), _(-2063), _(-7134), _(-74992), _(-5959), _(-2000), _(-218), _(  1),
+};
+#undef _
+
+
+static float M [1024];
+
+void
+Klemm ( void )
+{
+    int    i;
+    int    k;
+    float  S [512];
+
+    for ( i=0; i<32; i++ ) {
+        for ( k=0; k<32; k++ ) {
+            M [i*32 + k] = (float) cos ( ((2*i+1)*k & 127) * M_PI/64 );
+        }
+    }
+
+#ifdef FASTER
+    for ( i = 0; i < 384; i++ )
+        S[i] = Ci_opt[i];
+    for ( i = 384; i < 392; i++ )
+        S[i] = 0;
+    for ( i = 392; i < 512; i++ )
+        S[i] = -Ci_opt[i];
+    for ( i = 0; i < 512; i++ )
+       Ci_opt[i] = S[i];
+    for ( i = 0; i < 128; i++ )
+       Ci_opt[i] = S[(i&7) + 120 - (i&120)];
+    for ( i = 128; i < 384; i++ )
+       Ci_opt[i] = S[i];
+    for ( i = 384; i < 512; i++ )
+       Ci_opt[i] = S[ 384 + (i&7) + 120 - (i&120)];
+#endif
+}
+
+ /* D E F I N E S */
+#define X_MEM    1152
+
+/* V A R I A B L E S */
+float  X_L [ X_MEM + 480 ];
+float  X_R [ X_MEM + 480 ];
+
+
+/* F U N C T I O N S */
+// vectoring & partial calculation
+
+static void
+Vectoring ( const float* x, float* y )
+{
+#ifdef FASTER
+    int           i = 0;
+    const float*  c1;
+    const float*  c2;
+    const float*  x1;
+    const float*  x2;
+
+# define EXPR(c,x)  (c[0]*x[0] + c[1]*x[64] + c[2]*x[128] + c[3]*x[192] + c[4]*x[256] + c[5]*x[320] + c[6]*x[384] + c[7]*x[448])
+
+    i++;
+    *y++ = EXPR ((Ci_opt+128),(x+31));
+
+    c1 = Ci_opt - 8;
+    c2 = Ci_opt + 128;
+    x1 = x + 16;
+    x2 = x + 31;
+    do {
+        x1--, x2--, i++;
+        c1 += 8, c2 += 8;
+        *y++ = EXPR (c1,x1) + EXPR (c2,x2);
+    } while ( i < 16 );
+
+    i++;
+    *y++ = EXPR ((Ci_opt+120),(x+0)) + EXPR ((Ci_opt+256),(x+32));
+
+    c1 = Ci_opt + 384 - 8;
+    c2 = Ci_opt + 256;
+    x1 = x + 47;
+    x2 = x + 32;
+
+    do {
+        x1++, x2++, i++;
+        c1 += 8, c2 += 8;
+        *y++ = EXPR (c1,x1) + EXPR (c2,x2);
+    } while ( i < 32 );
+#else
+    int           i;
+    const float*  c = Ci_opt;
+
+    for ( i = 0; i < 16; i++, c += 32, x += 4, y += 4 ) {
+        y[0] = c[ 0] * x[  0] + c[ 1] * x[ 64] + c[ 2] * x[128] + c[ 3] * x[192] + c[ 4] * x[256] + c[ 5] * x[320] + c[ 6] * x[384] + c[ 7] * x[448];
+        y[1] = c[ 8] * x[  1] + c[ 9] * x[ 65] + c[10] * x[129] + c[11] * x[193] + c[12] * x[257] + c[13] * x[321] + c[14] * x[385] + c[15] * x[449];
+        y[2] = c[16] * x[  2] + c[17] * x[ 66] + c[18] * x[130] + c[19] * x[194] + c[20] * x[258] + c[21] * x[322] + c[22] * x[386] + c[23] * x[450];
+        y[3] = c[24] * x[  3] + c[25] * x[ 67] + c[26] * x[131] + c[27] * x[195] + c[28] * x[259] + c[29] * x[323] + c[30] * x[387] + c[31] * x[451];
+    }
+#endif
+}
+
+// matrixing with Mi[32][32] = Mi[1024]
+
+static void
+Matrixing ( const int MaxBand, const float* mi, const float* y, float* samples )
+{
+    int  i;
+#ifdef FASTER
+    for ( i = 0; i <= MaxBand; i++, mi += 32, samples += 72 ) {                          // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
+        samples[0] =          y[ 0] + mi[ 1] * y[ 1] + mi[ 2] * y[ 2] + mi[ 3] * y[ 3]
+                   + mi[ 4] * y[ 4] + mi[ 5] * y[ 5] + mi[ 6] * y[ 6] + mi[ 7] * y[ 7]
+                   + mi[ 8] * y[ 8] + mi[ 9] * y[ 9] + mi[10] * y[10] + mi[11] * y[11]
+                   + mi[12] * y[12] + mi[13] * y[13] + mi[14] * y[14] + mi[15] * y[15]
+                   + mi[16] * y[16] + mi[17] * y[17] + mi[18] * y[18] + mi[19] * y[19]
+                   + mi[20] * y[20] + mi[21] * y[21] + mi[22] * y[22] + mi[23] * y[23]
+                   + mi[24] * y[24] + mi[25] * y[25] + mi[26] * y[26] + mi[27] * y[27]
+                   + mi[28] * y[28] + mi[29] * y[29] + mi[30] * y[30] + mi[31] * y[31];
+    }
+#else
+    for ( i = 0; i <= MaxBand; i++, mi += 32, samples += 72 ) {                          // 144 = sizeof(SubbandFloatTyp)/sizeof(float)
+        samples[0] =           y[16]        + mi[ 1] * (y[15]+y[17])
+                   + mi[ 2] * (y[14]+y[18]) + mi[ 3] * (y[13]+y[19])
+                   + mi[ 4] * (y[12]+y[20]) + mi[ 5] * (y[11]+y[21])
+                   + mi[ 6] * (y[10]+y[22]) + mi[ 7] * (y[ 9]+y[23])
+                   + mi[ 8] * (y[ 8]+y[24]) + mi[ 9] * (y[ 7]+y[25])
+                   + mi[10] * (y[ 6]+y[26]) + mi[11] * (y[ 5]+y[27])
+                   + mi[12] * (y[ 4]+y[28]) + mi[13] * (y[ 3]+y[29])
+                   + mi[14] * (y[ 2]+y[30]) + mi[15] * (y[ 1]+y[31])
+                   + mi[16] * (y[ 0]+y[32])
+                   + mi[31] * (y[47]-y[49]) + mi[30] * (y[46]-y[50])
+                   + mi[29] * (y[45]-y[51]) + mi[28] * (y[44]-y[52])
+                   + mi[27] * (y[43]-y[53]) + mi[26] * (y[42]-y[54])
+                   + mi[25] * (y[41]-y[55]) + mi[24] * (y[40]-y[56])
+                   + mi[23] * (y[39]-y[57]) + mi[22] * (y[38]-y[58])
+                   + mi[21] * (y[37]-y[59]) + mi[20] * (y[36]-y[60])
+                   + mi[19] * (y[35]-y[61]) + mi[18] * (y[34]-y[62])
+                   + mi[17] * (y[33]-y[63]);
+    }
+#endif
+}
+
+// Analysis-Filterbank
+void
+Analyse_Filter ( const PCMDataTyp* in, SubbandFloatTyp* out, const int MaxBand )
+{
+#ifdef FASTER
+    float         Y_L [32];
+    float         Y_R [32];
+#else
+    float         Y_L [64];
+    float         Y_R [64];
+#endif
+    float*        x;
+    const float*  pcm;
+    int           n;
+    int           i;
+
+    /************************* calculate L-signal ***************************/
+    ENTER(180);
+    memcpy ( X_L + X_MEM, X_L, 480*sizeof(*X_L) );
+    x      = X_L + X_MEM;
+    pcm    = in->L + 479;                               // 479 = CENTER + 31
+    for ( n = 0; n < 36; n++, pcm += 64 ) {
+        x  -= 32;                                       // updating vector x
+#ifdef FASTER
+        for ( i = 0; i < 16; i++ )
+            x[i] = *pcm--;
+        for ( i = 31; i >= 16; i-- )
+            x[i] = *pcm--;
+#else
+        for ( i = 0; i < 32; i++ )
+            x[i] = *pcm--;
+#endif
+        Vectoring ( x, Y_L );                           // vectoring & partial calculation
+        Matrixing ( MaxBand, M, Y_L, &out[0].L[n] );    // matrixing
+    }
+
+    /************************* calculate R-signal ***************************/
+    memcpy ( X_R + X_MEM, X_R, 480*sizeof(*X_R) );
+    x      = X_R + X_MEM;
+    pcm    = in->R + 479;                               // 479 = CENTER + 31
+    for ( n = 0; n < 36; n++, pcm += 64 ) {
+        x  -= 32;                                       // updating vector x
+#ifdef FASTER
+        for ( i = 0; i < 16; i++ )
+            x[i] = *pcm--;
+        for ( i = 31; i >= 16; i-- )
+            x[i] = *pcm--;
+#else
+        for ( i = 0; i < 32; i++ )
+            x[i] = *pcm--;
+#endif
+        Vectoring ( x, Y_R );                           // vectoring & partial calculation
+        Matrixing ( MaxBand, M, Y_R, &out[0].R[n] );    // matrixing
+    }
+    LEAVE(180);
+}
+
+void
+Analyse_Init ( float Left, float Right, SubbandFloatTyp* out, const int MaxBand )
+{
+#ifdef FASTER
+    float         Y_L [32];
+    float         Y_R [32];
+#else
+    float         Y_L [64];
+    float         Y_R [64];
+#endif
+    float*        x;
+    int           n;
+    int           i;
+
+    /************************* calculate L-signal ***************************/
+    ENTER(180);
+    memcpy ( X_L + X_MEM, X_L, 480*sizeof(*X_L) );
+    x      = X_L + X_MEM;
+
+    for ( n = 0; n < 36; n++ ) {
+        x  -= 32;                                       // updating vector x
+#ifdef FASTER
+        for ( i = 0; i < 16; i++ )
+            x[i] = Left;
+        for ( i = 31; i >= 16; i-- )
+            x[i] = Left;
+#else
+        for ( i = 0; i < 32; i++ )
+            x[i] = Left;
+#endif
+        Vectoring ( x, Y_L );                           // vectoring & partial calculation
+        Matrixing ( MaxBand, M, Y_L, &out[0].L[n] );    // matrixing
+    }
+
+    /************************* calculate R-signal ***************************/
+    memcpy ( X_R + X_MEM, X_R, 480*sizeof(*X_R) );
+    x      = X_R + X_MEM;
+    for ( n = 0; n < 36; n++ ) {
+        x  -= 32;                                       // updating vector x
+#ifdef FASTER
+        for ( i = 0; i < 16; i++ )
+            x[i] = Right;
+        for ( i = 31; i >= 16; i-- )
+            x[i] = Right;
+#else
+        for ( i = 0; i < 32; i++ )
+            x[i] = Right;
+#endif
+        Vectoring ( x, Y_R );                           // vectoring & partial calculation
+        Matrixing ( MaxBand, M, Y_R, &out[0].R[n] );    // matrixing
+    }
+    LEAVE(180);
+}
+
+/* end of analy_filter.c */
Index: /mppenc/trunk/src/ans.c
===================================================================
--- /mppenc/trunk/src/ans.c	(revision 97)
+++ /mppenc/trunk/src/ans.c	(revision 97)
@@ -0,0 +1,305 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *  Depending on how transient it is, it can be further reduced (up to 0=No ANS).
+ *  Estimate coefficient for feedback at Order=1 over Mask_fu - Mask_fo.
+ *  3 quantization routines: Order=0, Order=1, Order=2...6
+ *  Order doesn't specify the power of the noise shaping, but only the flexibility of the form.
+ *  Don't reset utilization of the "remains" at the frame borders;
+ *  "remains"-utilization as scalefactor-independent values,
+ *  so that a utilization beyond Subframe/Frame Borders is even possible.
+ */
+
+#include "mppenc.h"
+
+
+static float  InvFourier [MAX_NS_ORDER + 1] [16];
+static float  Cos_Tab    [16] [MAX_NS_ORDER + 1];
+static float  Sin_Tab    [16] [MAX_NS_ORDER + 1];
+unsigned int  NS_Order;                         // Maximum order for ANS
+unsigned int  NS_Order_L [32];
+unsigned int  NS_Order_R [32];                  // frame-wise order of the Noiseshaping (0: off, 1...5: on)
+float         FIR_L      [32] [MAX_NS_ORDER];
+float         FIR_R      [32] [MAX_NS_ORDER];   // contains FIR-Filter for NoiseShaping
+float         ANSspec_L  [MAX_ANS_LINES];
+float         ANSspec_R  [MAX_ANS_LINES];       // L/R-masking thresholds for ANS
+float         ANSspec_M  [MAX_ANS_LINES];
+float         ANSspec_S  [MAX_ANS_LINES];       // M/S-masking thresholds for ANS
+
+
+void
+Init_ANS ( void )
+{
+    int  n;
+    int  k;
+
+    // calculate Fourier tables
+    for ( k = 0; k <= MAX_NS_ORDER; k++ ) {
+        for ( n = 0; n < 16; n++ ) {
+            InvFourier [k] [n] = (float) cos ( +2*M_PI/64 * (2*n)   *  k    ) / 16.;
+            Cos_Tab    [n] [k] = (float) cos ( -2*M_PI/64 * (2*n+1) * (k+1) );
+            Sin_Tab    [n] [k] = (float) sin ( -2*M_PI/64 * (2*n+1) * (k+1) );
+        }
+    }
+}
+
+
+// calculates optimal reflection coefficients and time response of a prediction filter in LPC analysis
+static __inline void
+durbin_akf_to_kh1( float*        k,     // out: reflection coefficients
+                   float*        h,     // out: time response
+                   const float*  akf )  // in : autocorrelation function (0..1 used)
+{
+    h[0] = k[0] = akf [1] / akf [0];
+}
+
+static __inline void
+durbin_akf_to_kh2( float*        k,     // out: reflection coefficients
+                   float*        h,     // out: time response
+                   const float*  akf )  // in : autocorrelation function (0..2 used)
+{
+    float tk,e;
+
+    tk    = akf [1] / akf[0];
+    e     = akf[0] * (1. - tk*tk);
+    h[0]  = k[0] = tk;
+    h[0] *= 1. - (h[1]  = k[1] = tk = (akf[2] - h[0] * akf[1]) / e);
+}
+
+static __inline void
+durbin_akf_to_kh3( float*        k,     // out: reflection coefficients
+                   float*        h,     // out: time response
+                   const float*  akf )  // in : autocorrelation function (0..3 used)
+{
+    float a,b,tk,e;
+
+    tk    = akf[1] / akf[0];
+    e     = akf[0] * (1. - tk*tk);
+    h[0]  = k[0] = tk;
+
+    tk    = (akf[2] - h[0] * akf[1]) / e;
+    e    *= 1. - tk*tk;
+    h[0] *= 1. - (h[1] = k[1] = tk);
+    h[2]  = k[2] = tk = (akf[3] - h[0] * akf[2] - h[1] * akf[1]) / e;
+
+    h[0]  = (a=h[0]) - (b=h[1])*tk;
+    h[1]  = b - a*tk;
+}
+
+
+static __inline void
+durbin_akf_to_kh ( float*        k,     // out: reflection coefficients
+                   float*        h,     // out: time response
+                   float*  akf,   // in : autocorrelation function (0..n used)
+                   const int     n )    // in : number of parameters to calculate
+{
+    int    i,j;
+    float  s,a,b,tk,e;
+    float* p;
+    float* q;
+
+    e = akf [0];
+    for ( i = 0; i < n; i++ ) {
+        s = 0.f;
+        p = h;
+        q = akf+i;
+        j = i;
+        while ( j-- )
+            s += *p++ * *q--;
+
+        tk   = (akf[i+1] - s) / e;
+        e   *= 1. - tk*tk;
+        h[i] = k[i] = tk;
+        p = h;
+        q = h + i - 1;
+
+        for ( ; p < q; p++, q-- ) {
+            a  = *p;
+            b  = *q;
+            *p = a - b*tk;
+            *q = b - a*tk;
+        }
+        if ( p == q )
+            *p *= 1. - tk;
+    }
+}
+
+static const unsigned char  maxANSOrder [32] = {
+    6, 5, 4, 3, 2, 2, 2, 2,
+    2, 2, 2, 2, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static void
+FindOptimalANS ( const int             MaxBand,
+                 const unsigned char*  ms,
+                 const float*          spec0,
+                 const float*          spec1,
+                 unsigned int*         NS,
+                 float*                snr_comp,
+                 float                 fir [] [MAX_NS_ORDER],
+                 const float*          smr0,
+                 const float*          smr1,
+                 int                   scf [32] [3],
+                 const int             Transient [32] )
+{
+    int           Band;
+    int           n;
+    int           k;
+    int           order;
+    float         akf     [MAX_NS_ORDER + 1];
+    float         h       [MAX_NS_ORDER];
+    float         reflex  [MAX_NS_ORDER];
+    float         spec    [16];
+    float         invspec [16];
+    float         norm;
+    float         ns_loss;
+    float         min_spec;
+    float         min_diff;
+    float         re;
+    float         im;
+    float         ns_energy;
+    float         gain;
+    float         NS_Gain;
+    float         actSMR;
+    int           max;
+    const float*  tmp;
+
+    ENTER(235);
+    for ( Band = 0; Band <= MaxBand  &&  maxANSOrder[Band]; Band++ ) {
+
+        if ( scf[Band][0] != scf[Band][1]  ||  scf[Band][1] != scf[Band][2] )
+            continue;
+
+        if ( Transient[Band] )
+            continue;
+
+        max = maxANSOrder [Band];
+
+        if ( ms[Band] ) {                       // setting pointer and SMR in relation to the M/S-flag
+            tmp    = &spec1 [Band<<4];          // pointer to MS-data
+            actSMR = smr1   [Band];             // selecting SMR
+        }
+        else {
+            tmp    = &spec0 [Band<<4];          // pointer to LR-data
+            actSMR = smr0   [Band];             // selecting SMR
+        }
+
+        if ( actSMR >= 1. ) {
+            NS_Gain =     1.f;                  // reset gain
+            norm    = 1.e-30f;
+
+            // Selection of the masking threshold of the current subband, also considering frequency inversion in every 2nd subband
+            if ( Band & 1 )
+                for ( n = 0, tmp += 15; n < 16; n++ )
+                    norm += spec[n] = *tmp--;
+            else
+                for ( n = 0; n < 16; n++ )
+                    norm += spec[n] = *tmp++;
+
+            // Preprocessing: normalization of the the power of spec[] to 1, and search for minimum of masking threshold
+            norm     = 16.f / norm;
+            min_spec = 1.e+12f;
+            for ( n = 0; n < 16; n++ ) {
+                invspec[n] = 1.f / (spec[n] *= norm);
+                if ( spec[n] < min_spec )               // normalize spec[]
+                    min_spec = spec[n];
+            }
+
+            // Calculation of the auto-correlation function
+            tmp = InvFourier [0];
+            for ( k = 0; k <= max; k++, tmp += 16 ) {
+                akf[k] = tmp[ 0]*invspec[ 0] + tmp[ 1]*invspec[ 1] + tmp[ 2]*invspec[ 2] + tmp[ 3]*invspec[ 3] +
+                         tmp[ 4]*invspec[ 4] + tmp[ 5]*invspec[ 5] + tmp[ 6]*invspec[ 6] + tmp[ 7]*invspec[ 7] +
+                         tmp[ 8]*invspec[ 8] + tmp[ 9]*invspec[ 9] + tmp[10]*invspec[10] + tmp[11]*invspec[11] +
+                         tmp[12]*invspec[12] + tmp[13]*invspec[13] + tmp[14]*invspec[14] + tmp[15]*invspec[15];
+            }
+
+            // Searching for the noise-shaper with maximum gain
+            for ( order = 1; order <= max; order++ ) {
+                switch ( order ) {                                              // calculating best FIR-Filter for the return
+                case  1: durbin_akf_to_kh1 (reflex, h, akf);        break;
+                case  2: durbin_akf_to_kh2 (reflex, h, akf);        break;
+                case  3: durbin_akf_to_kh3 (reflex, h, akf);        break;
+                default: durbin_akf_to_kh  (reflex, h, akf, order); break;
+                }
+
+                ns_loss  = 1.e-30f;                             // estimating the gain
+                min_diff = 1.e+12f;
+                for ( n = 0; n < 16; n++ ) {
+                    re = 1.f;                                   // calculating the obtained noise shaping
+                    im = 0.f;
+                    for ( k = 0; k < order; k++ ) {
+                        re -= h[k] * Cos_Tab[n][k];
+                        im += h[k] * Sin_Tab[n][k];
+                    }
+
+                    ns_energy = re*re + im*im;                  // calculated spectral shaped noise
+                    ns_loss  += ns_energy;                      // noise energy increases with shaping
+
+                    if ( spec[n] < min_diff * ns_energy )       // Searching for minimum distance between the shaped noise and the masking threshold
+                        min_diff = spec[n] / ns_energy;
+                }
+
+                // Updating the Filter if new gain is bigger than old gain and if the extra noise power through shaping is smaller than the SMR of this band
+                gain = 16. * min_diff / (min_spec * ns_loss);
+                if ( gain > NS_Gain  &&  ns_loss < actSMR ) {
+                    NS [Band] = order;
+                    NS_Gain   = gain;
+                    memcpy ( fir [Band], h, order * sizeof(*h) );
+                }
+            }
+
+            if ( NS_Gain > 1.f ) {                      // Activation of ANS if there is gain
+                snr_comp[Band] *= NS_Gain;
+            }
+        }
+    }
+
+    LEAVE(235);
+    return;
+}
+
+
+// perform ANS-analysis (calculation of FIR-filter and gain)
+void
+NS_Analyse ( const int             MaxBand,
+             const unsigned char*  MSflag,
+             const SMRTyp          smr,
+             const int*            Transient )
+{
+    ENTER(10);
+
+    // for L or M, respectively
+    memset ( FIR_L,      0, sizeof FIR_L      );         // reset FIR
+    memset ( NS_Order_L, 0, sizeof NS_Order_L );         // reset Flags
+    FindOptimalANS ( MaxBand, MSflag, ANSspec_L, ANSspec_M, NS_Order_L, SNR_comp_L, FIR_L, smr.L, smr.M, SCF_Index_L, Transient );
+
+    // for R or S, respectively
+    memset ( FIR_R,      0, sizeof FIR_R      );         // reset FIR
+    memset ( NS_Order_R, 0, sizeof NS_Order_R );         // reset Flags
+    FindOptimalANS ( MaxBand, MSflag, ANSspec_R, ANSspec_S, NS_Order_R, SNR_comp_R, FIR_R, smr.R, smr.S, SCF_Index_R, Transient );
+
+    LEAVE(10);
+    return;
+}
+
+/* end of ans.c */
Index: /mppenc/trunk/src/bitstream.c
===================================================================
--- /mppenc/trunk/src/bitstream.c	(revision 97)
+++ /mppenc/trunk/src/bitstream.c	(revision 97)
@@ -0,0 +1,191 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+
+Uint32_t      Buffer [BUFFER_FULL];    // Buffer for bitstream-file
+Uint32_t      dword         =  0;      // 32-bit-Word for Bitstream-I/O
+int           filled        = 32;      // Position in the the 32-bit-word that's currently about to be filled
+unsigned int  Zaehler       =  0;      // Position pointer for the processed bitstream-word (32 bit)
+UintMax_t     BufferedBits  =  0;      // Counter for the number of written bits in the bitstream
+
+
+/*
+ *  Change_Endian32() changes the endianess of a 32-bit memory block in-place
+ *  by swapping the byte order. This is a little bit tricky, but a well
+ *  known method which is much much faster, especially on modern CPUs, than
+ *  byte picking, because it avoids memory aliasing. Note that this method
+ *  is poison for old 16-bit compilers!
+ */
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+
+static void
+Change_Endian32 ( unsigned int* dst, size_t words32bit )
+{
+    ENTER(160);
+
+    for ( ; words32bit--; dst++ ) {
+# if  INT_MAX >= 2147483647L
+        unsigned int  tmp = *dst;
+        tmp  = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
+        tmp  = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
+        *dst = tmp;
+# else
+        char  tmp;
+        tmp             = ((char*)dst)[0];
+        ((char*)dst)[0] = ((char*)dst)[3];
+        ((char*)dst)[3] = tmp;
+        tmp             = ((char*)dst)[1];
+        ((char*)dst)[1] = ((char*)dst)[2];
+        ((char*)dst)[2] = tmp;
+# endif
+    }
+    LEAVE(160);
+    return;
+}
+
+#endif /* ENDIAN == HAVE_BIG_ENDIAN */
+
+
+void
+FlushBitstream ( FILE* fp, const Uint32_t* buffer, size_t words32bit )
+{
+    size_t           WrittenDwords = 0;
+    const Uint32_t*  p             = buffer;
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+    size_t           CC            = words32bit;
+    Change_Endian32 ( (Uint32_t*)buffer, CC );
+#endif
+
+    // Write Buffer
+    do {
+        WrittenDwords = fwrite ( p, sizeof(*buffer), words32bit, fp );
+        if ( WrittenDwords == 0 ) {
+            stderr_printf ( "\b\n WARNING: Disk full?, retry after 10 sec ...\a" );
+            sleep (10);
+        }
+        if ( WrittenDwords > 0 ) {
+            p          += WrittenDwords;
+            words32bit -= WrittenDwords;
+        }
+    } while ( words32bit != 0 );
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+    Change_Endian32 ( (Uint32_t*)buffer, CC );
+#endif
+}
+
+
+void
+UpdateHeader ( FILE* fp, Uint32_t Frames, Uint ValidSamples )
+{
+    Uint8_t  buff [4];
+
+    // Write framecount to header
+    if ( fseek ( fp, 4L, SEEK_SET ) < 0 )
+        return;
+
+    buff [0] = (Uint8_t)(Frames >>  0);
+    buff [1] = (Uint8_t)(Frames >>  8);
+    buff [2] = (Uint8_t)(Frames >> 16);
+    buff [3] = (Uint8_t)(Frames >> 24);
+
+    fwrite ( buff, 1, 4, fp );
+
+    // Write ValidSamples to header
+    if ( fseek ( fp, 22L, SEEK_SET ) < 0 )
+        return;
+    fread ( buff, 1, 2, fp );
+    if ( ferror(fp) )
+        return;
+    if ( fseek ( fp, 22L, SEEK_SET ) < 0 )
+        return;
+
+    ValidSamples <<= 4;
+    ValidSamples  |= 0x800F & (((Uint) buff[1] << 8) | buff[0]);
+    buff [0] = (Uint8_t)(ValidSamples >>  0);
+    buff [1] = (Uint8_t)(ValidSamples >>  8);
+
+    fwrite ( buff, 1, 2, fp );
+
+
+    // Set filepointer to end of file (dirty method, should be old position!!)
+    fseek ( fp, 0L, SEEK_END );
+}
+
+
+void
+WriteBits ( const Uint32_t input, const unsigned int bits )
+{
+    BufferedBits += bits;
+    filled       -= bits;
+
+    if      ( filled > 0 ) {
+        dword  |= input << filled;
+    }
+    else if ( filled < 0 ) {
+        Buffer [Zaehler++] = dword | ( input >> -filled );
+        filled += 32;
+        dword   = input << filled;
+    }
+    else {
+        Buffer [Zaehler++] = dword | input;
+        filled  = 32;
+        dword   =  0;
+    }
+}
+
+// Bits in the original stream have to be 0, maximum X bits allowed to be set in input
+// Actual bitstream must have already written ptr[0] and ptr[1]
+void
+WriteBitsAt ( const Uint32_t input, const unsigned int bits, BitstreamPos const pos )
+{
+    Uint32_t*     ptr    = pos.ptr;
+    int           filled = pos.bit - bits;
+
+//    fprintf ( stderr, "%5u %2u %08lX %2u\n", input, bits, pos.ptr, pos.bit );
+
+    Buffer [Zaehler] = dword;
+
+    if      ( filled > 0 ) {
+        ptr [0] |= input << (  +filled);
+    }
+    else if ( filled < 0 ) {
+        ptr [0] |= input >> (  -filled);
+        ptr [1] |= input << (32+filled);
+    }
+    else {
+        ptr [0] |= input;
+    }
+
+    dword = Buffer [Zaehler];
+}
+
+
+void
+GetBitstreamPos ( BitstreamPos* const pos )
+{
+    pos -> ptr = Buffer + Zaehler;
+    pos -> bit = filled;
+}
+
+/* end of bitstream.c */
Index: /mppenc/trunk/src/config.h
===================================================================
--- /mppenc/trunk/src/config.h	(revision 97)
+++ /mppenc/trunk/src/config.h	(revision 97)
@@ -0,0 +1,45 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* Determine Endianess of the machine */
+
+#define HAVE_LITTLE_ENDIAN  1234
+#define HAVE_BIG_ENDIAN     4321
+
+#define ENDIAN              HAVE_LITTLE_ENDIAN
+
+
+/* Test the fast float-to-int rounding trick works */
+
+#define HAVE_IEEE754_FLOAT
+#define HAVE_IEEE754_DOUBLE
+
+
+/* Test the presence of a 80-bit floating point type for writing AIFF headers */
+
+#define HAVE_IEEE854_LONGDOUBLE
+
+
+#ifndef MPPENC_VERSION
+# define MPPENC_VERSION   "1.16"
+#endif
+
+#define MPPENC_BUILD  "--Stable--"
+
+/* end of config.h */
Index: /mppenc/trunk/src/cvd.c
===================================================================
--- /mppenc/trunk/src/cvd.c	(revision 97)
+++ /mppenc/trunk/src/cvd.c	(revision 97)
@@ -0,0 +1,267 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+/* C O N S T A N T S */
+// from MatLab-Simulation (Fourier-transforms of the Cos-Rolloff)
+#if 0
+static const float  Puls [11] = {
+    -0.02724753942504f, -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,
+     0.49549552704050f,  0.64201253447071f,  0.49549552704050f,  0.18006206051664f,
+    -0.06198987803623f, -0.10670808991329f, -0.02724753942504f
+};
+#endif
+
+static const float  Puls [ 9] = {
+    -0.10670808991329f, -0.06198987803623f,  0.18006206051664f,  0.49549552704050f,
+     0.64201253447071f,  0.49549552704050f,  0.18006206051664f, -0.06198987803623f,
+    -0.10670808991329f
+};
+
+/*
+// Generating the Cos-Rolloff of the Cepstral-analysis, Cos-Rolloff from 5512,5 Hz to 11025 Hz
+// for ( k = 0; k <= 1024; k++ ) {
+//     if      (k < 256) CosWin [k-256] = 1;
+//     else if (k < 512) CosWin [k-256] = 0.5 + 0.5*cos (M_PI*(k-256)/256);
+//     else              CosWin [k-256] = 0;
+// }
+*/
+static const float  CosWin [256] = {
+    1.0000000000000000f, 0.9999623298645020f, 0.9998494386672974f, 0.9996612071990967f, 0.9993977546691895f, 0.9990590810775757f, 0.9986452460289002f, 0.9981563091278076f, 0.9975923895835877f, 0.9969534873962402f, 0.9962397813796997f, 0.9954513311386108f, 0.9945882558822632f, 0.9936507344245911f, 0.9926388263702393f, 0.9915527701377869f, 0.9903926253318787f, 0.9891586899757385f, 0.9878510832786560f, 0.9864699840545654f, 0.9850156307220459f, 0.9834882616996765f, 0.9818880558013916f, 0.9802152514457703f, 0.9784701466560364f, 0.9766530394554138f, 0.9747641086578369f, 0.9728036522865295f, 0.9707720279693604f, 0.9686695337295532f, 0.9664964079856873f, 0.9642530679702759f, 0.9619397521018982f, 0.9595569372177124f, 0.9571048617362976f, 0.9545840024948120f, 0.9519946575164795f, 0.9493372440338135f, 0.9466121792793274f, 0.9438198208808899f, 0.9409606456756592f, 0.9380350708961487f, 0.9350435137748718f, 0.9319864511489868f, 0.9288643002510071f, 0.9256775975227356f, 0.9224267601966858f, 0.9191123247146606f, 0.9157348275184631f, 0.9122946262359619f, 0.9087924361228943f, 0.9052286148071289f, 0.9016037583351135f, 0.8979184627532959f, 0.8941732048988342f, 0.8903686404228210f, 0.8865052461624146f, 0.8825836181640625f, 0.8786044120788574f, 0.8745682239532471f, 0.8704755902290344f, 0.8663271069526672f, 0.8621235489845276f, 0.8578653931617737f,
+    0.8535534143447876f, 0.8491881489753723f, 0.8447702527046204f, 0.8403005003929138f, 0.8357794880867004f, 0.8312078714370728f, 0.8265864253044128f, 0.8219157457351685f, 0.8171966671943665f, 0.8124297261238098f, 0.8076158165931702f, 0.8027555346488953f, 0.7978496551513672f, 0.7928989529609680f, 0.7879040837287903f, 0.7828658819198608f, 0.7777851223945618f, 0.7726625204086304f, 0.7674987912178040f, 0.7622948288917542f, 0.7570513486862183f, 0.7517691850662231f, 0.7464491128921509f, 0.7410919070243835f, 0.7356983423233032f, 0.7302693724632263f, 0.7248056530952454f, 0.7193081378936768f, 0.7137775421142578f, 0.7082147598266602f, 0.7026206851005554f, 0.6969960331916809f, 0.6913416981697083f, 0.6856585741043091f, 0.6799474954605103f, 0.6742093563079834f, 0.6684449315071106f, 0.6626551747322083f, 0.6568408608436585f, 0.6510030031204224f, 0.6451423168182373f, 0.6392598152160645f, 0.6333563923835754f, 0.6274328231811523f, 0.6214900612831116f, 0.6155290603637695f, 0.6095505952835083f, 0.6035556793212891f, 0.5975451469421387f, 0.5915199518203735f, 0.5854809284210205f, 0.5794290900230408f, 0.5733652114868164f, 0.5672903656959534f, 0.5612053275108337f, 0.5551111102104187f, 0.5490085482597351f, 0.5428986549377441f, 0.5367822647094727f, 0.5306603908538818f, 0.5245338082313538f, 0.5184035897254944f, 0.5122706294059753f, 0.5061357617378235f,
+    0.5000000000000000f, 0.4938642382621765f, 0.4877294003963471f, 0.4815963804721832f, 0.4754661619663239f, 0.4693396389484406f, 0.4632177054882050f, 0.4571013450622559f, 0.4509914219379425f, 0.4448888897895813f, 0.4387946724891663f, 0.4327096343040466f, 0.4266347587108612f, 0.4205709397792816f, 0.4145190417766571f, 0.4084800481796265f, 0.4024548530578613f, 0.3964443206787109f, 0.3904493749141693f, 0.3844709396362305f, 0.3785099089145660f, 0.3725671768188477f, 0.3666436076164246f, 0.3607401549816132f, 0.3548576533794403f, 0.3489970266819000f, 0.3431591391563416f, 0.3373448550701141f, 0.3315550684928894f, 0.3257906734943390f, 0.3200524747371674f, 0.3143413960933685f, 0.3086582720279694f, 0.3030039668083191f, 0.2973793447017670f, 0.2917852103710175f, 0.2862224578857422f, 0.2806918919086456f, 0.2751943469047546f, 0.2697306573390961f, 0.2643016278743744f, 0.2589081227779388f, 0.2535509169101715f, 0.2482308149337769f, 0.2429486215114594f, 0.2377051562070847f, 0.2325011938810349f, 0.2273375093936920f, 0.2222148776054382f, 0.2171340882778168f, 0.2120959013700485f, 0.2071010768413544f, 0.2021503448486328f, 0.1972444802522659f, 0.1923841983079910f, 0.1875702589750290f, 0.1828033626079559f, 0.1780842244625092f, 0.1734135746955872f, 0.1687921136617661f, 0.1642205268144608f, 0.1596994996070862f, 0.1552297323942184f, 0.1508118808269501f,
+    0.1464466154575348f, 0.1421345919370651f, 0.1378764659166336f, 0.1336728632450104f, 0.1295244395732880f, 0.1254318058490753f, 0.1213955804705620f, 0.1174163669347763f, 0.1134947761893272f, 0.1096313893795013f, 0.1058267876505852f, 0.1020815446972847f, 0.0983962342143059f, 0.0947714000940323f, 0.0912075936794281f, 0.0877053514122963f, 0.0842651948332787f, 0.0808876454830170f, 0.0775732174515724f, 0.0743224024772644f, 0.0711356922984123f, 0.0680135712027550f, 0.0649565011262894f, 0.0619649514555931f, 0.0590393692255020f, 0.0561801902949810f, 0.0533878505229950f, 0.0506627671420574f, 0.0480053536593914f, 0.0454160086810589f, 0.0428951233625412f, 0.0404430739581585f, 0.0380602329969406f, 0.0357469581067562f, 0.0335035994648933f, 0.0313304923474789f, 0.0292279683053494f, 0.0271963365375996f, 0.0252359099686146f, 0.0233469791710377f, 0.0215298328548670f, 0.0197847411036491f, 0.0181119665503502f, 0.0165117643773556f, 0.0149843730032444f, 0.0135300243273377f, 0.0121489353477955f, 0.0108413146808743f, 0.0096073597669601f, 0.0084472559392452f, 0.0073611787520349f, 0.0063492907211185f, 0.0054117450490594f, 0.0045486823655665f, 0.0037602325901389f, 0.0030465149320662f, 0.0024076367262751f, 0.0018436938989908f, 0.0013547716662288f, 0.0009409435442649f, 0.0006022718735039f, 0.0003388077020645f, 0.0001505906548118f, 0.0000376490788767f,
+};
+
+
+/* F U N C T I O N S */
+// sets all the harmonics
+static void
+SetVoiceLines ( int* VoiceLine, const float base, int val )
+{
+    int    n;
+    int    max = (int) (MAX_CVD_LINE * base / 1024.f);  // harmonics up to Index MAX_CVD_LINE (spectral lines outside of that don't make sense)
+    int    line;
+    float  frq = 1024.f / base;                         // frq = 1024./i is the Index of the basic harmonic
+
+    // go through all harmonics
+    for ( n = 1; n <= max; n++ ) {
+        line = (int) (n * frq);
+        VoiceLine [line] = VoiceLine [line+1] = val;
+    }
+}
+
+
+// Analyze the Cepstrum, search for the basic harmonic
+static void
+CEP_Analyse2048 ( float* res1,
+                  float* res2,
+                  float* qual1,
+                  float* qual2,
+                  float* cep )
+{
+    int           n;
+    int           line;
+    float         cc [MAX_ANALYZED_IDX + 3];    // cross correlation
+    float         ref;
+    float         line_sum;
+    float         sum;
+    float         kkf;
+    float         norm;
+    const float*  x;
+
+    // cross-correlation with pulse shape
+    // Calculate idx = MIN_ANALYZED_IDX-2  to  MAX_ANALYZED_IDX+2,
+    // because they are read during search for maximum
+    // 50 -> 882 Hz, 700 -> 63 Hz base frequency
+
+    *res1 = *res2 = 0. ;
+    memset ( cc, 0, sizeof cc );
+
+    for ( n = MIN_ANALYZED_IDX - 2; n <= MAX_ANALYZED_IDX + 2; n++ ) {
+        x    = cep + n;
+        if ( x[0] > 0 ) {
+            norm = x[-4] * x[-4] +
+                   x[-3] * x[-3] +
+                   x[-2] * x[-2] +
+                   x[-1] * x[-1] +
+                   x[ 0] * x[ 0] +
+                   x[ 1] * x[ 1] +
+                   x[ 2] * x[ 2] +
+                   x[ 3] * x[ 3] +
+                   x[ 4] * x[ 4];
+            kkf  = x[-4] * Puls [0] +
+                   x[-3] * Puls [1] +
+                   x[-2] * Puls [2] +
+                   x[-1] * Puls [3] +
+                   x[ 0] * Puls [4] +
+                   x[ 1] * Puls [5] +
+                   x[ 2] * Puls [6] +
+                   x[ 3] * Puls [7] +
+                   x[ 4] * Puls [8];
+            cc [n] = kkf * kkf / norm;         // calculate the square of ncc to avoid sqrt()
+        }
+    }
+
+    // search for the (relative) maximum
+    ref  = 0.f;
+    line = MED_ANALYZED_IDX;
+    for ( n = MAX_ANALYZED_IDX; n >= MED_ANALYZED_IDX; n-- ) {
+        if (
+             cc[n] * cep[n] * cep[n] > ref      &&
+             cc[n]                   > 0.40f    &&      // e33 (02)     0.85
+             cep[n]                  > 0.00f    &&      // e33 (02)
+             cc[n  ]                >= cc[n+1]  &&
+             cc[n  ]                >= cc[n-1]  &&
+             cc[n+1]                >= cc[n+2]  &&
+             cc[n-1]                >= cc[n-2]
+           )
+        {
+            ref  = cc[n] * cep[n] * cep[n];
+            line = n;
+        }
+    }
+
+    // Calculating the center of the maximum (Interpolation)
+    x        = cep + line;
+    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
+    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
+
+    /* e33 (04) */
+    ref = cc[line  ] * cep[line  ] * cep[line  ]
+        + cc[line-1] * cep[line-1] * cep[line-1]
+        + cc[line+1] * cep[line+1] * cep[line+1];
+
+    //{
+    //    static unsigned int x = 0;
+    //
+    //    printf ("%7.3f s   ", (x/2)*1152./44100       );
+    //  x++;
+    //}
+
+    //printf ("ref=%5.3f *res1=%7.3f f=%8.3f    ", ref, line_sum / sum, 44100. / (line_sum / sum) );
+
+    *qual1 = ref;
+    if ( ref > 0.015f )
+        *res1 = line_sum / sum;
+
+    if ( CVD_used < 2 )
+        return;
+
+    // search for the (relative) maximum
+    ref  = 0.f;
+    line = MIN_ANALYZED_IDX;
+
+    for ( n = MED_ANALYZED_IDX + 1; n >= MIN_ANALYZED_IDX - 1; n-- ) {
+        cc  [2*n  ] += 0.5 * cc [n];
+        cc  [2*n+1] += 0.5 * (cc [n] + cc[n+1]);
+        cep [2*n  ] += 0.5 * cep [n];
+        cep [2*n+1] += 0.5 * (cep [n] + cep[n+1]);
+    }
+
+    for ( n = 2*MED_ANALYZED_IDX; n >= 2*MIN_ANALYZED_IDX; n-- ) {
+        if (
+             cc[n] * cep[n] * cep[n] > ref      &&
+             cc[n]                   > 0.85f    &&      /* e33 (02) */
+             cep[n]                  > 0.00f    &&      /* e33 (02) */
+             cc[n  ]                >= cc[n+1]  &&
+             cc[n  ]                >= cc[n-1]  &&
+             cc[n+1]                >= cc[n+2]  &&
+             cc[n-1]                >= cc[n-2]
+           )
+        {
+            ref  = cc[n] * cep[n] * cep[n];
+            line = n;
+        }
+    }
+
+    // Calculating the center of the maximum (Interpolation)
+    x        = cep + line;
+    sum      = x[-3] + x[-2] + x[-1] + x[0] + x[1] + x[2] + x[3] + 1.e-30f;
+    line_sum = (x[1]-x[-1]) + 2 * (x[2]-x[-2]) + 3 * (x[3]-x[-3]) + sum * line + 1.e-30f;
+
+    /* e33 (04) */
+    ref = cc[line  ] * cep[line  ] * cep[line  ]
+        + cc[line-1] * cep[line-1] * cep[line-1]
+        + cc[line+1] * cep[line+1] * cep[line+1];
+
+    //printf ("ref=%5.3f *res2=%8.3f f=%8.3f\n", ref, 0.5 * line_sum / sum, 44100. / (0.5 * line_sum / sum) );
+
+    *qual2 = ref;
+    if ( ref >= 0.1f )
+        *res2 = 0.5 * line_sum / sum;
+
+    return;
+}
+
+#ifndef CVD_FASTLOG
+# define logfast(x)     ((float) log (x))
+#else
+
+static __inline float   /* This is a rough estimation with an accuracy of |x|<0.0037 */
+logfast ( float x )
+{
+    double  y = x * x;
+    y *= y;
+    y *= y;
+    return (((int*)(&y))[1] + (45127.5 - 1072693248.)) * ( M_LN2 / (1L<<23) );
+}
+
+#endif
+
+// ClearVoiceDetection for spectrum *spec
+// input : Spectrum *spec
+// output: Array *vocal contains information if the FFT-Line is a harmonic component
+int
+CVD2048 ( const float* spec, int* vocal )
+{
+    static float  cep [4096];     // cep[4096] -- array, which is also used for the 2048 FFT
+    const float*  win = CosWin;   // pointer to cos-roll-off
+    float         res1;
+    float         res2;
+    float         qual1;
+    float         qual2;
+    int           n;
+
+    ENTER(20);
+    // Calculating logarithmated, windowed spectrum cep[]
+    // cep[512...1024] = 0 -- cep[1025...2047] doesn't matter, because the first have to be filled by fft
+    for ( n =   0; n < 256; n++ )
+        cep[n] = logfast (*spec++);
+    for ( n = 256; n < 512; n++ )
+        cep[n] = logfast (*spec++) * *win++;
+
+    memset ( cep+512, 0, 513*sizeof(*cep) );
+
+    // Calculating cepstrum of cep[] (the function Cepstrum() outputs the cepstrum in-place)
+    Cepstrum2048 ( cep, MAX_ANALYZED_IDX );
+
+    // search the harmonic
+    CEP_Analyse2048 ( &res1, &res2, &qual1, &qual2, cep );
+//#include "cvd.h"
+    if ( res1 > 0.f  ||  res2 > 0.f ) {
+        if ( res1 > 0. ) SetVoiceLines ( vocal, res1, 100 );
+        if ( res2 > 0. ) SetVoiceLines ( vocal, res2,  20 );
+        LEAVE(20);
+        return 1;
+    }
+    LEAVE(20);
+    return 0;
+}
Index: /mppenc/trunk/src/cvd.h
===================================================================
--- /mppenc/trunk/src/cvd.h	(revision 97)
+++ /mppenc/trunk/src/cvd.h	(revision 97)
@@ -0,0 +1,9 @@
+{
+    static FILE* fp = NULL;
+    static int   x = 0;
+
+    if ( fp == NULL ) fp = fopen ( "cvd.txt", "a" );
+    fprintf ( fp, "%7.3f  %6.2f %7.2f\n", (x>>1)*1152./44100, res1, res2 );
+
+    x++;
+}
Index: /mppenc/trunk/src/encode_sv7.c
===================================================================
--- /mppenc/trunk/src/encode_sv7.c	(revision 97)
+++ /mppenc/trunk/src/encode_sv7.c	(revision 97)
@@ -0,0 +1,455 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+/*
+ *  SV1:   DATE 13.12.1998
+ *  SV2:   DATE 12.06.1999
+ *  SV3:   DATE 19.10.1999
+ *  SV4:   DATE 20.10.1999
+ *  SV5:   DATE 18.06.2000
+ *  SV6:   DATE 10.08.2000
+ *  SV7:   DATE 23.08.2000
+ *  SV7.f: DATE 20.07.2002
+ */
+
+unsigned char         MS_Flag     [32];         // Flag to save if Subband was MS- or LR-coded
+int                   SCF_Last_L  [32];
+int                   SCF_Last_R  [32];         // Last coded SCF value
+static unsigned char  DSCF_RLL_L  [32];
+static unsigned char  DSCF_RLL_R  [32];         // Duration of the differential SCF-coding for RLL (run length limitation)
+int                   Res_L       [32];
+int                   Res_R       [32];         // Quantization precision of the subbands
+int                   SCF_Index_L [32] [3];
+int                   SCF_Index_R [32] [3];     // Scalefactor index for quantized subband values
+
+
+// initialize SV7
+void
+Init_SV7 ( void )
+{
+    Init_Huffman_Encoder_SV7 ();
+}
+
+
+// writes SV7-header
+void
+WriteHeader_SV7 ( const unsigned int  MaxBand,
+                  const unsigned int  Profile,
+                  const unsigned int  MS_on,
+                  const Uint32_t      TotalFrames,
+                  const unsigned int  SamplesRest,
+                  const unsigned int  StreamVersion,
+                  const unsigned int  SampleFreq )
+{
+    WriteBits ( StreamVersion,  8 );    // StreamVersion
+    WriteBits ( 0x2B504D     , 24 );    // Magic Number "MP+"
+
+    WriteBits ( TotalFrames  , 32 );    // # of frames
+
+    WriteBits ( 0            ,  1 );    // former IS-Flag (not supported anymore)
+    WriteBits ( MS_on        ,  1 );    // MS-Coding Flag
+    WriteBits ( MaxBand      ,  6 );    // Bandwidth
+
+#if 0
+    if ( MPPENC_VERSION [3] & 1 )
+        WriteBits ( 1        ,  4 );    // 1: Experimental profile
+    else
+#endif
+
+        WriteBits ( Profile  ,  4 );    // 5...15: below Telephone...above BrainDead
+    WriteBits ( 0            ,  2 );    // for future use
+    switch ( SampleFreq ) {
+        case 44100: WriteBits ( 0, 2 ); break;
+        case 48000: WriteBits ( 1, 2 ); break;
+        case 37800: WriteBits ( 2, 2 ); break;
+        case 32000: WriteBits ( 3, 2 ); break;
+        default   : stderr_printf ( "Internal error\n");
+                    exit (1);
+    }
+    WriteBits ( 0            , 16 );    // maximum input sample value, currently filled by replaygain
+
+    WriteBits ( 0            , 32 );    // title based gain controls, currently filled by replaygain
+
+    WriteBits ( 0            , 32 );    // album based gain controls, currently filled by replaygain
+
+    WriteBits ( 1            ,  1 );    // true gapless: used?
+    WriteBits ( SamplesRest  , 11 );    // true gapless: valid samples in last frame
+    WriteBits ( 1            , 1 );     // we now support fast seeking
+    WriteBits ( 0            , 19 );
+
+    WriteBits ( (MPPENC_VERSION[0]&15)*100 + (MPPENC_VERSION[2]&15)*10 + (MPPENC_VERSION[3]&15),
+                                8 );    // for future use
+}
+
+
+void
+FinishBitstream ( void )
+{
+    Buffer [Zaehler++] = dword;         // Assigning the "last" word
+}
+
+
+#define ENCODE_SCF1( new, old, rll )                         \
+        d = new - old + 7;                                   \
+        if ( d <= 14u  && rll < 32) {                        \
+            WriteBits ( Table[d].Code, Table[d].Length );    \
+        }                                                    \
+        else {                                               \
+            if ( new < 0 ) new = 0, Overflows++;             \
+            WriteBits ( Table[15].Code, Table[15].Length );  \
+            WriteBits ( (unsigned int)new, 6 );              \
+            rll = 0;                                         \
+        }
+
+#define ENCODE_SCFn( new, old, rll )                         \
+        d = new - old + 7;                                   \
+        if ( d <= 14u ) {                                    \
+            WriteBits ( Table[d].Code, Table[d].Length );    \
+        }                                                    \
+        else {                                               \
+            if ( new < 0 ) new = 0, Overflows++;             \
+            WriteBits ( Table[15].Code, Table[15].Length );  \
+            WriteBits ( (unsigned int)new, 6 );              \
+            rll = 0;                                         \
+        }
+
+
+static void
+test ( const int* const Res, const unsigned int* q )
+{
+#if 0
+    int  i;
+
+    switch ( *Res ) {
+    case 1:
+        for ( i = 0; i < 36; i ++ )
+            if ( q[i] != 1 )
+                return;
+        fprintf ( stderr, "Alles Nullsamples, aber Auflösung = %u\n", *Res );
+        *Res = 0;
+        break;
+    case 2:
+        for ( i = 0; i < 36; i ++ )
+            if ( q[i] != 2 )
+                return;
+        fprintf ( stderr, "Alles Nullsamples, aber Auflösung = %u\n", *Res );
+        *Res = 0;
+        break;
+    }
+#endif
+}
+
+
+// formatting and writing SV7-bitstream for one frame
+void
+WriteBitstream_SV7 ( const int               MaxBand,
+                     const SubbandQuantTyp*  Q )
+{
+    int                  n;
+    int                  k;
+    unsigned int         d;
+    unsigned int         idx;
+    unsigned int         book;
+    const Huffman_t*     Table;
+    const Huffman_t*     Table0;
+    const Huffman_t*     Table1;
+    int                  sum;
+    const unsigned int*  q;
+    unsigned char        SCFI_L [32];
+    unsigned char        SCFI_R [32];
+
+    ENTER(110);
+
+    /************************************ Resolution *********************************/
+    WriteBits ( (unsigned int)Res_L[0], 4 );                            // subband 0
+    WriteBits ( (unsigned int)Res_R[0], 4 );
+    if ( MS_Channelmode > 0  &&  !(Res_L[0]==0  &&  Res_R[0]==0) )
+         WriteBits ( MS_Flag[0] , 1 );
+
+    Table = HuffHdr;                                                    // subband 1...MaxBand
+    for ( n = 1; n <= MaxBand; n++ ) {
+        test ( Res_L+n, Q[n].L );
+
+        d = Res_L[n] - Res_L[n-1] + 5;
+        if ( d <= 8u ) {
+            WriteBits ( Table[d].Code, Table[d].Length );
+        }
+        else {
+            WriteBits ( Table[9].Code, Table[9].Length );
+            WriteBits ( Res_L[n]     , 4               );
+        }
+
+        test ( Res_R+n, Q[n].R );
+        d = Res_R[n] - Res_R[n-1] + 5;
+        if ( d <= 8u ) {
+            WriteBits ( Table[d].Code, Table[d].Length );
+        }
+        else {
+            WriteBits ( Table[9].Code, Table[9].Length );
+            WriteBits ( Res_R[n]     , 4               );
+        }
+        if ( MS_Channelmode > 0  &&  !(Res_L[n]==0 && Res_R[n]==0) )
+            WriteBits ( MS_Flag[n], 1 );
+    }
+
+    /************************************ SCF encoding type ***********************************/
+    Table = HuffSCFI;
+    for ( n = 0; n <= MaxBand; n++ ) {
+        if ( Res_L[n] ) {
+            SCFI_L[n] = 2 * (SCF_Index_L[n][0] == SCF_Index_L[n][1]) + (SCF_Index_L[n][1] == SCF_Index_L[n][2]);
+            WriteBits ( Table[SCFI_L[n]].Code, Table[SCFI_L[n]].Length );
+        }
+        if ( Res_R[n] ) {
+            SCFI_R[n] = 2 * (SCF_Index_R[n][0] == SCF_Index_R[n][1]) + (SCF_Index_R[n][1] == SCF_Index_R[n][2]);
+            WriteBits ( Table[SCFI_R[n]].Code, Table[SCFI_R[n]].Length );
+        }
+    }
+
+    /************************************* SCF **********************************/
+    Table = HuffDSCF;
+    for ( n = 0; n <= MaxBand; n++ ) {
+
+        if ( Res_L[n] ) {
+            switch ( SCFI_L[n] ) {
+            default:
+                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L [n]   , DSCF_RLL_L[n] );
+                ENCODE_SCFn ( SCF_Index_L[n][1], SCF_Index_L[n][0], DSCF_RLL_L[n] );
+                ENCODE_SCFn ( SCF_Index_L[n][2], SCF_Index_L[n][1], DSCF_RLL_L[n] );
+                SCF_Last_L[n] = SCF_Index_L[n][2];
+                break;
+            case 1:
+                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L [n]   , DSCF_RLL_L[n] );
+                ENCODE_SCFn ( SCF_Index_L[n][1], SCF_Index_L[n][0], DSCF_RLL_L[n] );
+                SCF_Last_L[n] = SCF_Index_L[n][1];
+                break;
+            case 2:
+                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L[n]    , DSCF_RLL_L[n] );
+                ENCODE_SCFn ( SCF_Index_L[n][2], SCF_Index_L[n][0], DSCF_RLL_L[n] );
+                SCF_Last_L[n] = SCF_Index_L[n][2];
+                break;
+            case 3:
+                ENCODE_SCF1 ( SCF_Index_L[n][0], SCF_Last_L[n]    , DSCF_RLL_L[n] );
+                SCF_Last_L[n] = SCF_Index_L[n][0];
+                break;
+            }
+        }
+        if (DSCF_RLL_L[n] <= 32)
+            DSCF_RLL_L[n]++;        // Increased counters for SCF that haven't been initialized again
+
+        if ( Res_R[n] ) {
+            switch ( SCFI_R[n] ) {
+            default:
+                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
+                ENCODE_SCFn ( SCF_Index_R[n][1], SCF_Index_R[n][0], DSCF_RLL_R[n] );
+                ENCODE_SCFn ( SCF_Index_R[n][2], SCF_Index_R[n][1], DSCF_RLL_R[n] );
+                SCF_Last_R[n] = SCF_Index_R[n][2];
+                break;
+            case 1:
+                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
+                ENCODE_SCFn ( SCF_Index_R[n][1], SCF_Index_R[n][0], DSCF_RLL_R[n] );
+                SCF_Last_R[n] = SCF_Index_R[n][1];
+                break;
+            case 2:
+                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
+                ENCODE_SCFn ( SCF_Index_R[n][2], SCF_Index_R[n][0], DSCF_RLL_R[n] );
+                SCF_Last_R[n] = SCF_Index_R[n][2];
+                break;
+            case 3:
+                ENCODE_SCF1 ( SCF_Index_R[n][0], SCF_Last_R[n]    , DSCF_RLL_R[n] );
+                SCF_Last_R[n] = SCF_Index_R[n][0];
+                break;
+            }
+        }
+        if (DSCF_RLL_R[n] <= 32)
+            DSCF_RLL_R[n]++;          // Increased counters for SCF that haven't been freshly initialized
+    }
+
+    /*********************************** Samples *********************************/
+    for ( n = 0; n <= MaxBand; n++ ) {
+
+        sum = 0;
+        q   = Q[n].L;
+
+        switch ( Res_L[n] ) {
+        case -1:
+        case  0:
+            break;
+        case  1:
+            Table0 = HuffQ [0][1];
+            Table1 = HuffQ [1][1];
+            for ( k = 0; k < 36; k += 3 ) {
+                idx  = q[k+0] + 3*q[k+1] + 9*q[k+2];
+                sum += Table0 [idx].Length;
+                sum -= Table1 [idx].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][1];
+            for ( k = 0; k < 36; k += 3 ) {
+                idx = q[k+0] + 3*q[k+1] + 9*q[k+2];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        case  2:
+            Table0 = HuffQ [0][2];
+            Table1 = HuffQ [1][2];
+            for ( k = 0; k < 36; k += 2 ) {
+                idx  = q[k+0] + 5*q[k+1];
+                sum += Table0 [idx].Length;
+                sum -= Table1 [idx].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][2];
+            for ( k = 0; k < 36; k += 2 ) {
+                idx = q[k+0] + 5*q[k+1];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        case  3:
+        case  4:
+        case  5:
+        case  6:
+        case  7:
+            Table0 = HuffQ [0][Res_L[n]];
+            Table1 = HuffQ [1][Res_L[n]];
+            for ( k = 0; k < 36; k++ ) {
+                sum += Table0 [q[k]].Length;
+                sum -= Table1 [q[k]].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][Res_L[n]];
+            for ( k = 0; k < 36; k++ ) {
+                idx = q[k];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        default:
+            for ( k = 0; k < 36; k++ )
+                WriteBits ( q[k], Res_L[n]-1 );
+            break;
+        }
+
+        sum = 0;
+        q   = Q[n].R;
+
+        switch ( Res_R[n] ) {
+        case -1:
+        case  0:
+            break;
+        case  1:
+            Table0 = HuffQ [0][1];
+            Table1 = HuffQ [1][1];
+            for ( k = 0; k < 36; k += 3 ) {
+                idx  = q[k+0] + 3*q[k+1] + 9*q[k+2];
+                sum += Table0 [idx].Length;
+                sum -= Table1 [idx].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][1];
+            for ( k = 0; k < 36; k += 3 ) {
+                idx = q[k+0] + 3*q[k+1] + 9*q[k+2];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        case  2:
+            Table0 = HuffQ [0][2];
+            Table1 = HuffQ [1][2];
+            for ( k = 0; k < 36; k += 2 ) {
+                idx  = q[k+0] + 5*q[k+1];
+                sum += Table0 [idx].Length;
+                sum -= Table1 [idx].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][2];
+            for ( k = 0; k < 36; k += 2 ) {
+                idx = q[k+0] + 5*q[k+1];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        case  3:
+        case  4:
+        case  5:
+        case  6:
+        case  7:
+            Table0 = HuffQ [0][Res_R[n]];
+            Table1 = HuffQ [1][Res_R[n]];
+            for ( k = 0; k < 36; k++ ) {
+                sum += Table0 [q[k]].Length;
+                sum -= Table1 [q[k]].Length;
+            }
+            book = sum >= 0;
+            WriteBits ( book, 1 );
+            Table = HuffQ [book][Res_R[n]];
+            for ( k = 0; k < 36; k++ ) {
+                idx = q[k];
+                WriteBits ( Table[idx].Code, Table[idx].Length );
+            }
+            break;
+        default:
+            for ( k = 0; k < 36; k++ )
+                WriteBits ( q[k], Res_R[n] - 1 );
+            break;
+        }
+
+    }
+
+    LEAVE(110);
+    return;
+}
+
+#undef ENCODE_SCF1
+#undef ENCODE_SCFn
+
+
+#if 0
+void
+Dump ( const unsigned int* q, const int Res )
+{
+    switch ( Res ) {
+    case  1:
+        for ( k = 0; k < 36; k++, q++ )
+            printf ("%2d%c", *q-1, k==35?'\n':' ');
+        break;
+    case  2:
+        for ( k = 0; k < 36; k++, q++ )
+            printf ("%2d%c", *q-2, k==35?'\n':' ');
+        break;
+    case  3: case  4: case  5: case  6: case  7:
+        if ( Res == 5 )
+            for ( k = 0; k < 36; k++, q++ )
+                printf ("%2d%c", *q-7, k==35?'\n':' ');
+        break;
+    case  8: case  9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17:
+        printf ("%2u: ", Res-1 );
+        for ( k = 0; k < 36; k++, q++ ) {
+            printf ("%6d", *q - (1 << (Res-2)) );
+        }
+        printf ("\n");
+        break;
+    }
+}
+#endif
+
+/* end of encode_sv7.c */
Index: /mppenc/trunk/src/fastmath.c
===================================================================
--- /mppenc/trunk/src/fastmath.c	(revision 97)
+++ /mppenc/trunk/src/fastmath.c	(revision 97)
@@ -0,0 +1,85 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+#ifdef FAST_MATH
+
+const float  tabatan2   [ 2*TABSTEP+1] [2];
+const float  tabcos     [26*TABSTEP+1] [2];
+const float  tabsqrt_ex [256];
+const float  tabsqrt_m  [   TABSTEP+1] [2];
+
+
+void   Init_FastMath ( void )
+{
+    int     i;
+    float   X;
+    float   Y;
+    double  xm;
+    double  x0;
+    double  xp;
+    double  x;
+    double  y;
+    float*  p;
+
+    p = (float*) tabatan2;
+    for ( i = -TABSTEP; i <= TABSTEP; i++ ) {
+        xm = atan ((i-0.5)/TABSTEP);
+        x0 = atan ((i+0.0)/TABSTEP);
+        xp = atan ((i+0.5)/TABSTEP);
+        x  = x0/2 + (xm + xp)/4;
+        y  = xp - xm;
+        *p++ = x;
+        *p++ = y;
+    }
+
+    p = (float*) tabcos;
+    for ( i = -13*TABSTEP; i <= 13*TABSTEP; i++ ) {
+        xm = cos ((i-0.5)/TABSTEP);
+        x0 = cos ((i+0.0)/TABSTEP);
+        xp = cos ((i+0.5)/TABSTEP);
+        x  = x0/2 + (xm + xp)/4;
+        y  = xp - xm;
+        *p++ = x;
+        *p++ = y;
+    }
+
+    p = (float*) tabsqrt_ex;
+    for ( i = 0; i < 255; i++ ) {
+        *(int*)&X = (i << 23);
+        *(int*)&Y = (i << 23) + (1<<23) - 1;
+        *p++ = sqrt(X);
+    }
+    *(int*)&X = (255 << 23) - 1;
+    *p++ = sqrt(X);
+
+    p = (float*) tabsqrt_m;
+    for ( i = 1*TABSTEP; i <= 2*TABSTEP; i++ ) {
+        xm = sqrt ((i-0.5)/TABSTEP);
+        x0 = sqrt ((i+0.0)/TABSTEP);
+        xp = sqrt ((i+0.5)/TABSTEP);
+        x  = x0/2 + (xm + xp)/4;
+        y  = xp - xm;
+        *p++ = x;
+        *p++ = y;
+    }
+}
+
+#endif
Index: /mppenc/trunk/src/fastmath.h
===================================================================
--- /mppenc/trunk/src/fastmath.h	(revision 97)
+++ /mppenc/trunk/src/fastmath.h	(revision 97)
@@ -0,0 +1,94 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#if 1
+# define ROUND32(x)   ( floattmp = (x) + (int)0x00FD8000L, *(int*)(&floattmp) - (int)0x4B7D8000L )
+#else
+# define ROUND32(x)   ( (int) floor ((x) + 0.5) )
+#endif
+
+#ifdef FAST_MATH
+
+static __inline float
+my_atan2 ( float x, float y )
+{
+    float  t;
+    int    i;
+    float  ret;
+    float  floattmp;
+
+    if ( (*(int*)&x & 0x7FFFFFFF) < (*(int*)&y & 0x7FFFFFFF) ) {
+        i   = ROUND32 (t = TABSTEP * (x / y));
+        ret = tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (t-i);
+        if ( *(int*)&y < 0 )
+           ret = (float)(ret - M_PI);
+    }
+    else if ( *(int*)&x < 0) {
+        i   = ROUND32 (t = TABSTEP * (y / x));
+        ret = - M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
+    }
+    else if ( *(int*)&x > 0) {
+        i   = ROUND32 (t = TABSTEP * (y / x));
+        ret = + M_PI/2 - tabatan2 [1*TABSTEP+i][0] + tabatan2 [1*TABSTEP+i][1] * (i-t);
+    }
+    else {
+        ret = 0.;
+    }
+    return ret;
+}
+
+
+static __inline float
+my_cos ( float x )
+{
+    float  t;
+    int    i;
+    float  ret;
+    float  floattmp;
+
+    i   = ROUND32 (t = TABSTEP * x);
+    ret = tabcos [13*TABSTEP+i][0] + tabcos [13*TABSTEP+i][1] * (t-i);
+    return ret;
+}
+
+
+static __inline int
+my_ifloor ( float x )
+{
+    x = x + (0x0C00000L + 0.500000001);
+    return *(int*)&x - 1262485505;
+}
+
+
+static __inline float
+my_sqrt ( float x )
+{
+    float  ret;
+    int    i;
+    int    ex = *(int*)&x >> 23;                                // get the exponent
+    float  floattmp;
+
+    *(int*)&x = (*(int*)&x & 0x7FFFFF) | 0x42800000;            // delete the exponent
+    i    = ROUND32 (x);                                         // Integer-part of the mantissa  (round ????????????)
+    ret  = tabsqrt_m [i-TABSTEP][0] + tabsqrt_m [i-TABSTEP][1] * (x-i); // calculate value
+    ret *= tabsqrt_ex [ex];
+    return ret;
+}
+
+#endif
Index: /mppenc/trunk/src/fft4g.c
===================================================================
--- /mppenc/trunk/src/fft4g.c	(revision 97)
+++ /mppenc/trunk/src/fft4g.c	(revision 97)
@@ -0,0 +1,670 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+/* F U N C T I O N S */
+static          void  makewt       ( const int nw, int* ip, float* w );
+static          void  makect       ( const int nc, int* ip, float* c );
+static __inline void  bitrv2       ( const int n, int* ip, float* a );                   //
+static __inline void  cftfsub      ( const int n, float* a, float* w );                  //
+static __inline void  rftfsub      ( const int n, float* a, int nc, float* c );          //
+static __inline void  cft1st       ( const int n, float* a, float* w );                  //
+static __inline void  cftmdl_i386  ( const int n, const int l, float* a, float* w );     // 5648
+static __inline void  cftmdl_3DNow ( const int n, const int l, float* a, float* w );     // 4954
+
+#if 0
+# define cftmdl(n,l,a,w)   cftmdl_3DNow ( n, l, a, w )
+#else
+# define cftmdl(n,l,a,w)   cftmdl_i386  ( n, l, a, w )
+#endif
+
+// generates lookup-tables
+void
+Generate_FFT_Tables ( const int n, int* ip, float* w )
+{
+    int  nw;
+    int  nc;
+
+    nw = n >> 2;
+    makewt ( nw, ip, w );
+
+    nc = n >> 2;
+    makect ( nc, ip, w + nw );
+}
+
+
+// patched to only-forward
+void
+rdft ( const int n, float* a, int* ip, float* w )
+{
+    float  xi;
+
+    ENTER(30);
+    if ( n > 4) {
+        bitrv2  ( n, ip + 2, a );
+        cftfsub ( n, a, w );
+        rftfsub ( n, a, ip[1], w + ip[0] );
+    }
+    else if ( n == 4 ) {
+        cftfsub ( n, a, w );
+    }
+    xi    = a[0] - a[1];
+    a[0] += a[1];
+    a[1]  = xi;
+    LEAVE(30);
+    return;
+}
+
+
+/* -------- initializing routines -------- */
+static void
+makewt ( const int nw, int* ip, float* w )
+{
+    int     j;
+    int     nwh;
+    float   x;
+    float   y;
+    double  delta;
+
+    ENTER(31);
+    ip[0] = nw;
+    ip[1] = 1;
+    if ( nw > 2 ) {
+        nwh        = nw >> 1;
+        delta      = (M_PI/4) / nwh;
+        w[0]       = 1.;
+        w[1]       = 0.;
+        w[nwh]     = COS (delta * nwh);
+        w[nwh + 1] = w[nwh];
+        if ( nwh > 2 ) {
+            for ( j = 2; j < nwh; j += 2 ) {
+                x             = COS (delta * j);
+                y             = SIN (delta * j);
+                w[j]          = x;
+                w[j + 1]      = y;
+                w[nw - j]     = y;
+                w[nw - j + 1] = x;
+            }
+            bitrv2 ( nw, ip + 2, w );
+        }
+    }
+    LEAVE(31);
+    return;
+}
+
+
+static void
+makect ( const int nc, int* ip, float* c )
+{
+    int     j;
+    int     nch;
+    double  delta;
+
+    ENTER(32);
+    ip[1] = nc;
+    if ( nc > 1 ) {
+        nch    = nc >> 1;
+        delta  = (M_PI/4) / nch;
+        c[0]   = COS (delta * nch);
+        c[nch] = 0.5f * c[0];
+        for ( j = 1; j < nch; j++ ) {
+            c[j]      = 0.5f * COS (delta * j);
+            c[nc - j] = 0.5f * SIN (delta * j);
+        }
+    }
+    LEAVE(32);
+    return;
+}
+
+
+/* -------- child routines -------- */
+static void
+bitrv2 ( const int n, int* ip, float* a )
+{
+    int    j, j1, k, k1, l, m, m2;
+    float  xr, xi, yr, yi;
+
+    ENTER(33);
+    ip[0] = 0;
+    l     = n;
+    m     = 1;
+    while ( (m << 3) < l ) {
+        l >>= 1;
+        for ( j = 0; j < m; j++ ) {
+            ip[m + j] = ip[j] + l;
+        }
+        m <<= 1;
+    }
+    m2 = 2 * m;
+    if ( (m << 3) == l ) {
+        for ( k = 0; k < m; k++ ) {
+            for ( j = 0; j < k; j++ ) {
+                j1        = 2 * j + ip[k];
+                k1        = 2 * k + ip[j];
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+                j1       += m2;
+                k1       += 2 * m2;
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+                j1       += m2;
+                k1       -= m2;
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+                j1       += m2;
+                k1       += 2 * m2;
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+            }
+            j1        = 2 * k + m2 + ip[k];
+            k1        = j1 + m2;
+            xr        = a[j1];
+            xi        = a[j1 + 1];
+            yr        = a[k1];
+            yi        = a[k1 + 1];
+            a[j1]     = yr;
+            a[j1 + 1] = yi;
+            a[k1]     = xr;
+            a[k1 + 1] = xi;
+        }
+    } else {
+        for ( k = 1; k < m; k++ ) {
+            for ( j = 0; j < k; j++ ) {
+                j1        = 2 * j + ip[k];
+                k1        = 2 * k + ip[j];
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+                j1       += m2;
+                k1       += m2;
+                xr        = a[j1];
+                xi        = a[j1 + 1];
+                yr        = a[k1];
+                yi        = a[k1 + 1];
+                a[j1]     = yr;
+                a[j1 + 1] = yi;
+                a[k1]     = xr;
+                a[k1 + 1] = xi;
+            }
+        }
+    }
+    LEAVE(33);
+    return;
+}
+
+
+static void
+cftfsub ( const int n, float* a, float* w )
+{
+    int    j, j1, j2, j3, l;
+    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+    ENTER(34);
+    l = 2;
+    if ( n > 8 ) {
+        cft1st ( n, a, w );
+        l = 8;
+        while ( (l << 2) < n ) {
+            cftmdl ( n, l, a, w );
+            l <<= 2;
+        }
+    }
+    if ( (l << 2) == n ) {
+        j = 0;
+        do {
+            j1        = j  + l;
+            j2        = j1 + l;
+            j3        = j2 + l;
+            x0r       = a[j]      + a[j1];
+            x0i       = a[j + 1]  + a[j1 + 1];
+            x1r       = a[j]      - a[j1];
+            x1i       = a[j + 1]  - a[j1 + 1];
+            x2r       = a[j2]     + a[j3];
+            x2i       = a[j2 + 1] + a[j3 + 1];
+            x3r       = a[j2]     - a[j3];
+            x3i       = a[j2 + 1] - a[j3 + 1];
+            a[j]      = x0r + x2r;
+            a[j + 1]  = x0i + x2i;
+            a[j2]     = x0r - x2r;
+            a[j2 + 1] = x0i - x2i;
+            a[j1]     = x1r - x3i;
+            a[j1 + 1] = x1i + x3r;
+            a[j3]     = x1r + x3i;
+            a[j3 + 1] = x1i - x3r;
+        } while ( j += 2, j < l );
+    } else {
+        j = 0;
+        do {
+            j1        = j + l;
+            x0r       = a[j]     - a[j1];
+            x0i       = a[j + 1] - a[j1 + 1];
+            a[j]     += a[j1];
+            a[j + 1] += a[j1 + 1];
+            a[j1]     = x0r;
+            a[j1 + 1] = x0i;
+        } while ( j += 2, j < l );
+    }
+    LEAVE(34);
+    return;
+}
+
+
+static void
+cft1st ( const int n, float* a, float* w )
+{
+    int    j, k1;
+    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+    ENTER(35);
+    x0r   = a[ 0] + a[ 2];
+    x0i   = a[ 1] + a[ 3];
+    x1r   = a[ 0] - a[ 2];
+    x1i   = a[ 1] - a[ 3];
+    x2r   = a[ 4] + a[ 6];
+    x2i   = a[ 5] + a[ 7];
+    x3r   = a[ 4] - a[ 6];
+    x3i   = a[ 5] - a[ 7];
+    a[ 0] = x0r + x2r;
+    a[ 1] = x0i + x2i;
+    a[ 4] = x0r - x2r;
+    a[ 5] = x0i - x2i;
+    a[ 2] = x1r - x3i;
+    a[ 3] = x1i + x3r;
+    a[ 6] = x1r + x3i;
+    a[ 7] = x1i - x3r;
+    wk1r  = w[ 2];
+    x0r   = a[ 8] + a[10];
+    x0i   = a[ 9] + a[11];
+    x1r   = a[ 8] - a[10];
+    x1i   = a[ 9] - a[11];
+    x2r   = a[12] + a[14];
+    x2i   = a[13] + a[15];
+    x3r   = a[12] - a[14];
+    x3i   = a[13] - a[15];
+    a[ 8] = x0r + x2r;
+    a[ 9] = x0i + x2i;
+    a[12] = x2i - x0i;
+    a[13] = x0r - x2r;
+    x0r   = x1r - x3i;
+    x0i   = x1i + x3r;
+    a[10] = wk1r * (x0r - x0i);
+    a[11] = wk1r * (x0r + x0i);
+    x0r   = x3i + x1r;
+    x0i   = x3r - x1i;
+    a[14] = wk1r * (x0i - x0r);
+    a[15] = wk1r * (x0i + x0r);
+
+    k1 = 0;
+    j  = 16;
+    do {
+        k1       += 2;
+        wk2r      = w[k1];
+        wk2i      = w[k1 + 1];
+        wk1r      = w[2*k1];
+        wk1i      = w[2*k1 + 1];
+        wk3r      = wk1r - 2 * wk2i * wk1i;
+        wk3i      = 2 * wk2i * wk1r - wk1i;
+        x0r       = a[j]     + a[j + 2];
+        x0i       = a[j + 1] + a[j + 3];
+        x1r       = a[j]     - a[j + 2];
+        x1i       = a[j + 1] - a[j + 3];
+        x2r       = a[j + 4] + a[j + 6];
+        x2i       = a[j + 5] + a[j + 7];
+        x3r       = a[j + 4] - a[j + 6];
+        x3i       = a[j + 5] - a[j + 7];
+        a[j]      = x0r + x2r;
+        a[j + 1]  = x0i + x2i;
+        x0r      -= x2r;
+        x0i      -= x2i;
+        a[j + 4]  = wk2r * x0r - wk2i * x0i;
+        a[j + 5]  = wk2r * x0i + wk2i * x0r;
+        x0r       = x1r - x3i;
+        x0i       = x1i + x3r;
+        a[j + 2]  = wk1r * x0r - wk1i * x0i;
+        a[j + 3]  = wk1r * x0i + wk1i * x0r;
+        x0r       = x1r + x3i;
+        x0i       = x1i - x3r;
+        a[j + 6]  = wk3r * x0r - wk3i * x0i;
+        a[j + 7]  = wk3r * x0i + wk3i * x0r;
+        wk1r      = w[2*k1 + 2];
+        wk1i      = w[2*k1 + 3];
+        wk3r      = wk1r - 2 * wk2r * wk1i;
+        wk3i      = 2 * wk2r * wk1r - wk1i;
+        x0r       = a[j +  8] + a[j + 10];
+        x0i       = a[j +  9] + a[j + 11];
+        x1r       = a[j +  8] - a[j + 10];
+        x1i       = a[j +  9] - a[j + 11];
+        x2r       = a[j + 12] + a[j + 14];
+        x2i       = a[j + 13] + a[j + 15];
+        x3r       = a[j + 12] - a[j + 14];
+        x3i       = a[j + 13] - a[j + 15];
+        a[j + 8]  = x0r + x2r;
+        a[j + 9]  = x0i + x2i;
+        x0r      -= x2r;
+        x0i      -= x2i;
+        a[j + 12] = -wk2i * x0r - wk2r * x0i;
+        a[j + 13] = -wk2i * x0i + wk2r * x0r;
+        x0r       = x1r - x3i;
+        x0i       = x1i + x3r;
+        a[j + 10] = wk1r * x0r - wk1i * x0i;
+        a[j + 11] = wk1r * x0i + wk1i * x0r;
+        x0r       = x1r + x3i;
+        x0i       = x1i - x3r;
+        a[j + 14] = wk3r * x0r - wk3i * x0i;
+        a[j + 15] = wk3r * x0i + wk3i * x0r;
+    } while ( j += 16, j < n );
+    LEAVE(35);
+    return;
+}
+
+extern void Cdecl cftmdl_3DNow_1 ( const int n, const int l, float* a, float* w );
+extern void Cdecl cftmdl_3DNow_2 ( const int n, const int l, float* a, float* w );
+
+
+static void
+cftmdl_i386 ( const int n, const int l, float* a, float* w )
+{
+    int    j, j1, j2, j3, k, k1, m, m2;
+    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+    ENTER(36);
+    m = l << 2;
+
+    for ( j = 0; j < l; j += 2 ) {
+        j1        = j  + l;
+        j2        = j1 + l;
+        j3        = j2 + l;
+        x0r       = a[j]      + a[j1];
+        x0i       = a[j + 1]  + a[j1 + 1];
+        x1r       = a[j]      - a[j1];
+        x1i       = a[j + 1]  - a[j1 + 1];
+        x2r       = a[j2]     + a[j3];
+        x2i       = a[j2 + 1] + a[j3 + 1];
+        x3r       = a[j2]     - a[j3];
+        x3i       = a[j2 + 1] - a[j3 + 1];
+        a[j]      = x0r + x2r;
+        a[j + 1]  = x0i + x2i;
+        a[j2]     = x0r - x2r;
+        a[j2 + 1] = x0i - x2i;
+        a[j1]     = x1r - x3i;
+        a[j1 + 1] = x1i + x3r;
+        a[j3]     = x1r + x3i;
+        a[j3 + 1] = x1i - x3r;
+    }
+
+    wk1r = w[2];
+    for ( j = m; j < l + m; j += 2 ) {
+        j1        = j  + l;
+        j2        = j1 + l;
+        j3        = j2 + l;
+        x0r       = a[j]      + a[j1];
+        x0i       = a[j + 1]  + a[j1 + 1];
+        x1r       = a[j]      - a[j1];
+        x1i       = a[j + 1]  - a[j1 + 1];
+        x2r       = a[j2]     + a[j3];
+        x2i       = a[j2 + 1] + a[j3 + 1];
+        x3r       = a[j2]     - a[j3];
+        x3i       = a[j2 + 1] - a[j3 + 1];
+        a[j]      = x0r + x2r;
+        a[j + 1]  = x0i + x2i;
+        a[j2]     = x2i - x0i;
+        a[j2 + 1] = x0r - x2r;
+        x0r       = x1r - x3i;
+        x0i       = x1i + x3r;
+        a[j1]     = wk1r * (x0r - x0i);
+        a[j1 + 1] = wk1r * (x0r + x0i);
+        x0r       = x3i + x1r;
+        x0i       = x3r - x1i;
+        a[j3]     = wk1r * (x0i - x0r);
+        a[j3 + 1] = wk1r * (x0i + x0r);
+    }
+    LEAVE(36);
+
+    ENTER(39);
+    k1 = 0;
+    m2 = 2 * m;
+    for ( k = m2; k < n; k += m2 ) {
+        k1  += 2;
+        wk2r = w[k1];
+        wk2i = w[k1 + 1];
+        wk1r = w[2*k1];
+        wk1i = w[2*k1 + 1];
+        wk3r = wk1r - 2 * wk2i * wk1i;
+        wk3i = 2 * wk2i * wk1r - wk1i;
+        j    = k;
+        do {
+            j1        = j  + l;
+            j2        = j1 + l;
+            j3        = j2 + l;
+            x0r       = a[j]      + a[j1];
+            x0i       = a[j + 1]  + a[j1 + 1];
+            x1r       = a[j]      - a[j1];
+            x1i       = a[j + 1]  - a[j1 + 1];
+            x2r       = a[j2]     + a[j3];
+            x2i       = a[j2 + 1] + a[j3 + 1];
+            x3r       = a[j2]     - a[j3];
+            x3i       = a[j2 + 1] - a[j3 + 1];
+            a[j]      = x0r + x2r;
+            a[j + 1]  = x0i + x2i;
+            x0r      -= x2r;
+            x0i      -= x2i;
+            a[j2]     = wk2r * x0r - wk2i * x0i;
+            a[j2 + 1] = wk2r * x0i + wk2i * x0r;
+            x0r       = x1r - x3i;
+            x0i       = x1i + x3r;
+            a[j1]     = wk1r * x0r - wk1i * x0i;
+            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+            x0r       = x1r + x3i;
+            x0i       = x1i - x3r;
+            a[j3]     = wk3r * x0r - wk3i * x0i;
+            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+        } while ( j += 2, j < l + k );
+
+        wk1r = w[2*k1 + 2];
+        wk1i = w[2*k1 + 3];
+        wk3r = wk1r - 2 * wk2r * wk1i;
+        wk3i = 2 * wk2r * wk1r - wk1i;
+        j    = k + m;
+        do {
+            j1        = j  + l;
+            j2        = j1 + l;
+            j3        = j2 + l;
+            x0r       = a[j]      + a[j1];
+            x0i       = a[j + 1]  + a[j1 + 1];
+            x1r       = a[j]      - a[j1];
+            x1i       = a[j + 1]  - a[j1 + 1];
+            x2r       = a[j2]     + a[j3];
+            x2i       = a[j2 + 1] + a[j3 + 1];
+            x3r       = a[j2]     - a[j3];
+            x3i       = a[j2 + 1] - a[j3 + 1];
+            a[j]      = x0r + x2r;
+            a[j + 1]  = x0i + x2i;
+            x0r      -= x2r;
+            x0i      -= x2i;
+            a[j2]     = -wk2i * x0r - wk2r * x0i;
+            a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
+            x0r       = x1r - x3i;
+            x0i       = x1i + x3r;
+            a[j1]     = wk1r * x0r - wk1i * x0i;
+            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+            x0r       = x1r + x3i;
+            x0i       = x1i - x3r;
+            a[j3]     = wk3r * x0r - wk3i * x0i;
+            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+        } while ( j += 2, j < l+k+m );
+    }
+    LEAVE(39);
+    return;
+}
+
+
+static void
+cftmdl_3DNow ( const int n, const int l, float* a, float* w )
+{
+    int    j, j1, j2, j3, k, k1, m, m2;
+    float  wk1r, wk1i, wk2r, wk2i, wk3r, wk3i;
+    float  x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+
+    ENTER(36);
+    cftmdl_3DNow_1 (n,l,a,w);
+    LEAVE(36);
+
+    ENTER(39);
+    m  = l << 2;
+    k1 = 0;
+    m2 = 2 * m;
+    for ( k = m2; k < n; k += m2 ) {
+        k1  += 2;
+        wk2r = w[k1];
+        wk2i = w[k1 + 1];
+        wk1r = w[2*k1];
+        wk1i = w[2*k1 + 1];
+        wk3r = wk1r - 2 * wk2i * wk1i;
+        wk3i = 2 * wk2i * wk1r - wk1i;
+        j    = k;
+        do {
+            j1        = j  + l;
+            j2        = j1 + l;
+            j3        = j2 + l;
+            x0r       = a[j]      + a[j1];
+            x0i       = a[j + 1]  + a[j1 + 1];
+            x1r       = a[j]      - a[j1];
+            x1i       = a[j + 1]  - a[j1 + 1];
+            x2r       = a[j2]     + a[j3];
+            x2i       = a[j2 + 1] + a[j3 + 1];
+            x3r       = a[j2]     - a[j3];
+            x3i       = a[j2 + 1] - a[j3 + 1];
+            a[j]      = x0r + x2r;
+            a[j + 1]  = x0i + x2i;
+            x0r      -= x2r;
+            x0i      -= x2i;
+            a[j2]     = wk2r * x0r - wk2i * x0i;
+            a[j2 + 1] = wk2r * x0i + wk2i * x0r;
+            x0r       = x1r - x3i;
+            x0i       = x1i + x3r;
+            a[j1]     = wk1r * x0r - wk1i * x0i;
+            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+            x0r       = x1r + x3i;
+            x0i       = x1i - x3r;
+            a[j3]     = wk3r * x0r - wk3i * x0i;
+            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+        } while ( j += 2, j < l + k );
+
+        wk1r = w[2*k1 + 2];
+        wk1i = w[2*k1 + 3];
+        wk3r = wk1r - 2 * wk2r * wk1i;
+        wk3i = 2 * wk2r * wk1r - wk1i;
+        j    = k + m;
+        do {
+            j1        = j + l;
+            j2        = j1 + l;
+            j3        = j2 + l;
+            x0r       = a[j]      + a[j1];
+            x0i       = a[j + 1]  + a[j1 + 1];
+            x1r       = a[j]      - a[j1];
+            x1i       = a[j + 1]  - a[j1 + 1];
+            x2r       = a[j2]     + a[j3];
+            x2i       = a[j2 + 1] + a[j3 + 1];
+            x3r       = a[j2]     - a[j3];
+            x3i       = a[j2 + 1] - a[j3 + 1];
+            a[j]      = x0r + x2r;
+            a[j + 1]  = x0i + x2i;
+            x0r      -= x2r;
+            x0i      -= x2i;
+            a[j2]     = -wk2i * x0r - wk2r * x0i;
+            a[j2 + 1] = -wk2i * x0i + wk2r * x0r;
+            x0r       = x1r - x3i;
+            x0i       = x1i + x3r;
+            a[j1]     = wk1r * x0r - wk1i * x0i;
+            a[j1 + 1] = wk1r * x0i + wk1i * x0r;
+            x0r       = x1r + x3i;
+            x0i       = x1i - x3r;
+            a[j3]     = wk3r * x0r - wk3i * x0i;
+            a[j3 + 1] = wk3r * x0i + wk3i * x0r;
+        } while ( j += 2, j < l+k+m );
+    }
+    LEAVE(39);
+    return;
+}
+
+
+static void
+rftfsub ( const int n, float* a, int nc, float* c )
+{
+    int    j, k, kk, ks, m;
+    float  wkr, wki, xr, xi, yr, yi;
+
+    ENTER(37);
+    m  = n >> 1;
+    ks = 2 * nc / m;
+    kk = ks;
+    j  = 2;
+    k  = n;
+    do {
+        k        -= 2;
+        nc       -= ks;
+        wkr       = 0.5f - c[nc];
+        wki       = c[kk];
+        xr        = a[j]     - a[k];
+        xi        = a[j + 1] + a[k + 1];
+        yr        = wkr * xr - wki * xi;
+        yi        = wkr * xi + wki * xr;
+        a[j]     -= yr;
+        a[j + 1] -= yi;
+        a[k]     += yr;
+        a[k + 1] -= yi;
+        kk       += ks;
+    } while ( j += 2, j < m );
+    LEAVE(37);
+    return;
+}
+
+/* end of fft4g.c */
Index: /mppenc/trunk/src/fft_routines.c
===================================================================
--- /mppenc/trunk/src/fft_routines.c	(revision 97)
+++ /mppenc/trunk/src/fft_routines.c	(revision 97)
@@ -0,0 +1,337 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+#define CX0     -1.
+#define CX1      0.5
+
+#define SX1     -1.
+#define SX2      (2./9/  1)
+#define SX3      (2./9/  4)
+#define SX4      (2./9/ 10)
+#define SX5      (2./9/ 20)
+#define SX6      (2./9/ 35)
+#define SX7      (2./9/ 56)
+#define SX8      (2./9/ 84)
+#define SX9      (2./9/120)
+#define SX10     (2./9/165)
+
+
+#ifdef EXTRA_DECONV
+# define DECONV \
+    {  \
+    tmp      = (CX0*aix[0] + CX1*aix[2]) * (1./(CX0*CX0+CX1*CX1)); \
+    aix[ 0] -= CX0*tmp; \
+    aix[ 2] -= CX1*tmp; \
+    tmp      = (SX1*aix[3] + SX2*aix[5] + SX3*aix[7] + SX4*aix[9] + SX5*aix[11]) * (1./(SX1*SX1+SX2*SX2+SX3*SX3+SX4*SX4+SX5*SX5)); \
+    aix[ 3] -= SX1*tmp; \
+    aix[ 5] -= SX2*tmp; \
+    aix[ 7] -= SX3*tmp; \
+    aix[ 9] -= SX4*tmp; \
+    aix[11] -= SX5*tmp; \
+    }
+#elif 0
+# define DECONV \
+    {  \
+    float A[20]; \
+    int   i; \
+    memcpy (A, aix, 20*sizeof(aix)); \
+    tmp      = (CX0*aix[0] + CX1*aix[2]) * (1./(CX0*CX0+CX1*CX1)); \
+    aix[ 0] -= CX0*tmp; \
+    aix[ 2] -= CX1*tmp; \
+    tmp      = (SX1*aix[3] + SX2*aix[5] + SX3*aix[7] + SX4*aix[9] + SX5*aix[11]) * (1./(SX1*SX1+SX2*SX2+SX3*SX3+SX4*SX4+SX5*SX5)); \
+    aix[ 3] -= SX1*tmp; \
+    aix[ 5] -= SX2*tmp; \
+    aix[ 7] -= SX3*tmp; \
+    aix[ 9] -= SX4*tmp; \
+    aix[11] -= SX5*tmp; \
+    for ( i=0; i<10; i++) \
+        printf ("%u%9.0f%7.0f%9.0f%7.0f\n",i, A[i+i], A[i+i+1], aix[i+i], aix[i+i+1] ); \
+    }
+#else
+# define DECONV
+#endif
+
+
+/* V A R I A B L E S */
+static int    ip [4096];   // bitinverse for maximum 2048 FFT
+static float  w  [4096];   // butterfly-coefficient for maximum 2048 FFT
+static float  a  [4096];   // holds real input for FFT
+static float  Hann_256  [ 256];
+static float  Hann_1024 [1024];
+static float  Hann_1600 [1600];
+
+
+//////////////////////////////
+//
+// BesselI0 -- Regular Modified Cylindrical Bessel Function (Bessel I).
+//
+
+static double
+Bessel_I_0 ( double x )
+{
+    double  denominator;
+    double  numerator;
+    double  z;
+
+    if (x == 0.)
+        return 1.;
+
+    z = x * x;
+    numerator = z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z*
+                   0.210580722890567e-22  + 0.380715242345326e-19 ) +
+                   0.479440257548300e-16) + 0.435125971262668e-13 ) +
+                   0.300931127112960e-10) + 0.160224679395361e-07 ) +
+                   0.654858370096785e-05) + 0.202591084143397e-02 ) +
+                   0.463076284721000e+00) + 0.754337328948189e+02 ) +
+                   0.830792541809429e+04) + 0.571661130563785e+06 ) +
+                   0.216415572361227e+08) + 0.356644482244025e+09 ) +
+                   0.144048298227235e+10;
+
+    denominator = z* (z* (z - 0.307646912682801e+04) + 0.347626332405882e+07) - 0.144048298227235e+10;
+
+    return - numerator / denominator;
+}
+
+static double
+residual ( double x )
+{
+    return sqrt ( 1. - x*x );
+}
+
+//////////////////////////////
+//
+// KBDWindow -- Kaiser Bessel Derived Window
+//      fills the input window array with size samples of the
+//      KBD window with the given tuning parameter alpha.
+//
+
+
+static void
+KBDWindow ( float* window, unsigned int size, float alpha )
+{
+    double  sumvalue = 0.;
+    double  scale;
+    int     i;
+
+    scale = 0.25 / sqrt (size);
+    for ( i = 0; i < (int)size/2; i++ )
+        window [i] = sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*i/size - 1.) );
+
+    // need to add one more value to the nomalization factor at size/2:
+    sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*(size/2)/size-1.) );
+
+    // normalize the window and fill in the righthand side of the window:
+    for ( i = 0; i < (int)size/2; i++ )
+        window [size-1-i] = window [i] = /*sqrt*/ ( window [i] / sumvalue ) * scale;
+}
+
+static void
+CosWindow ( float* window, unsigned int size )
+{
+    double  x;
+    double  scale;
+    int     i;
+
+    scale = 0.25 / sqrt (size);
+    for ( i = 0; i < (int)size/2; i++ ) {
+        x = cos ( (i+0.5) * (M_PI / size) );
+        window [size/2-1-i] = window [size/2+i] = scale * x * x;
+    }
+}
+
+static void
+Window ( float* window, unsigned int size, float alpha )
+{
+    if ( alpha < 0. )
+        CosWindow ( window, size ) ;
+    else
+        KBDWindow ( window, size, alpha );
+}
+
+
+/* F U N C T I O N S */
+// generates FFT lookup-tables
+void
+Init_FFT ( void )
+{
+    int     n;
+    double  x;
+    double  scale;
+
+    // normalized hann functions
+    Window ( Hann_256 ,  256, KBD1 );
+    Window ( Hann_1024, 1024, KBD2 );
+    scale = 0.25 / sqrt (2048.);
+    for ( n = 0; n < 800; n++ )
+        x = cos ((n+0.5) * (M_PI/1600)), Hann_1600 [799-n] = Hann_1600 [800+n] = (float)(x * x * scale);
+
+    Generate_FFT_Tables ( 2048, ip, w );
+}
+
+// input : Signal *x
+// output: energy spectrum *erg
+void
+PowSpec256 ( const float* x, float* erg )
+{
+    const float*  win = Hann_256;
+    float*        aix = a;
+    int           i;
+
+    ENTER(40);
+    // windowing
+    i = 256;
+    while (i--)
+        *aix++ = *x++ * *win++;
+
+    // perform FFT
+    rdft ( 256, a, ip, w );
+
+    // calculate power
+    aix = a;    // reset pointer
+    i   = 128;
+    while (i--) {
+        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
+        aix += 2;
+    }
+    LEAVE(40);
+}
+
+// input : Signal *x
+// output: energy spectrum *erg
+void
+PowSpec1024 ( const float* x, float* erg )
+{
+    const float*  win = Hann_1024;
+    float*        aix = a;
+    int           i;
+
+    ENTER(41);
+    i = 1024;                   // windowing
+    while (i--)
+        *aix++ = *x++ * *win++;
+
+//    for (i=0; i<1024; i++)
+//        a[i] = Hann_1024[i] * ((i==0 ? 0 : i-512) + 1000);
+
+    rdft ( 1024, a, ip, w );    // perform FFT
+
+    aix = a;                    // calculate power
+    i   = 512;
+
+
+    DECONV;
+//    for (i = 0; i <= 512; i++ )
+//        printf ("%3u %12.6f %12.6f\n", i, a[i+i], a[i+i+1]);
+//    exit(1);
+    while (i--) {
+        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
+        aix += 2;
+    }
+    LEAVE(41);
+}
+
+// input : Signal *x
+// output: energy spectrum *erg
+void
+PowSpec2048 ( const float* x, float* erg )
+{
+    const float*  win = Hann_1600;
+    float*        aix = a;
+    int           i;
+
+    ENTER(42);
+    // windowing (only 1600 samples available -> centered in 2048!)
+    memset ( a     , 0, 224*sizeof(*a) );
+    aix = a + 224;
+    i   = 1600;
+    while (i--)
+        *aix++ = *x++ * *win++;
+    memset ( a+1824, 0, 224*sizeof(*a) );
+
+    rdft ( 2048, a, ip, w );    // perform FFT
+
+    aix = a;                    // calculate power
+    i   = 1024;
+    while (i--) {
+        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
+        aix += 2;
+    }
+    LEAVE(42);
+}
+
+#include "fastmath.h"
+
+// input : Signal *x
+// output: energy spectrum *erg and phase spectrum *phs
+void
+PolarSpec1024 ( const float* x, float* erg, float* phs )
+{
+    const float*  win = Hann_1024;
+    float*        aix = a;
+    int           i;
+
+    ENTER(43);
+    i = 1024;                   // windowing
+    while (i--)
+        *aix++ = *x++ * *win++;
+
+    rdft ( 1024, a, ip, w );    // perform FFT
+
+    // calculate power and phase
+    aix = a;    // reset pointer
+    i   = 512;
+    while (i--) {
+        *erg++ = aix[0]*aix[0] + aix[1]*aix[1];
+        *phs++ = ATAN2F (aix[1], aix[0]);
+        aix += 2;
+    }
+    LEAVE(43);
+}
+
+// input : logarithmized energy spectrum *cep
+// output: Cepstrum *cep (in-place)
+void
+Cepstrum2048 ( float* cep, const int MaxLine )
+{
+    float*  aix = cep;
+    float*  bix = cep + 2048;
+    int     i;
+
+    ENTER(44);
+    // generate real, even spectrum (symmetric around 1024, cep[2048-i] = cep[i])
+    for ( i = 0; i < 1024; i++ )
+        *bix-- = *aix++;
+
+    // perform IFFT
+    rdft ( 2048, cep, ip, w );
+
+    // only real part as outcome (all even indexes of cep[])
+    aix = cep;
+    bix = cep;
+    i   = MaxLine + 1;
+    while (i--) {
+        *aix = *bix * (float) (0.9888 / 2048.);
+//      *aix = *bix * 0.0004828125f;
+        aix ++;
+        bix += 2;
+    }
+    LEAVE(44);
+}
Index: /mppenc/trunk/src/huffsv7.c
===================================================================
--- /mppenc/trunk/src/huffsv7.c	(revision 97)
+++ /mppenc/trunk/src/huffsv7.c	(revision 97)
@@ -0,0 +1,444 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppdec.h"
+
+Huffman_t   HuffHdr    [10];            // 9 bit
+Huffman_t   HuffSCFI   [ 4];            // 3 bit
+Huffman_t   HuffDSCF   [16];            // 6 bit
+Huffman_t   HuffQ1 [2] [ 3*3*3];        // 6+ 9 bit
+Huffman_t   HuffQ2 [2] [ 5*5];          // 7+10 bit
+Huffman_t   HuffQ3 [2] [ 7];            // 4+ 5 bit
+Huffman_t   HuffQ4 [2] [ 9];            // 4+ 5 bit
+Huffman_t   HuffQ5 [2] [15];            // 6+ 8 bit
+Huffman_t   HuffQ6 [2] [31];            // 7+13 bit
+Huffman_t   HuffQ7 [2] [63];            // 8+14 bit
+                                        // 4608 Bytes
+Uint8_t     LUT1_0  [1<< 6];
+Uint8_t     LUT1_1  [1<< 9];            //  576 Bytes
+Uint8_t     LUT2_0  [1<< 7];
+Uint8_t     LUT2_1  [1<<10];            // 1152 Bytes
+Uint8_t     LUT3_0  [1<< 4];
+Uint8_t     LUT3_1  [1<< 5];            //   48 Bytes
+Uint8_t     LUT4_0  [1<< 4];
+Uint8_t     LUT4_1  [1<< 5];            //   48 Bytes
+Uint8_t     LUT5_0  [1<< 6];
+Uint8_t     LUT5_1  [1<< 8];            //  320 Bytes
+Uint8_t     LUT6_0  [1<< 7];
+Uint8_t     LUT6_1  [1<< 7];            //  256 Bytes
+Uint8_t     LUT7_0  [1<< 8];
+Uint8_t     LUT7_1  [1<< 8];            //  512 Bytes
+Uint8_t     LUTDSCF [1<< 6];            //   64 Bytes = 2976 Bytes
+
+const Huffman_t* HuffQ [2] [8] = {
+    { NULL, HuffQ1[0], HuffQ2[0], HuffQ3[0], HuffQ4[0], HuffQ5[0], HuffQ6[0], HuffQ7[0] },
+    { NULL, HuffQ1[1], HuffQ2[1], HuffQ3[1], HuffQ4[1], HuffQ5[1], HuffQ6[1], HuffQ7[1] }
+};
+
+#ifdef USE_SV8
+Huffman_t   HuffN3 [2] [ 7*7];          // 8+ 9 bit
+Huffman_t   HuffN8 [2][127];            //13+12 bit
+
+const Huffman_t* HuffN [2] [9] = {
+    { NULL, HuffQ1[0], HuffQ2[0], HuffN3[0], HuffQ4[0], HuffQ5[0], HuffQ6[0], HuffQ7[0], HuffN8[0] },
+    { NULL, HuffQ1[1], HuffQ2[1], HuffN3[1], HuffQ4[1], HuffQ5[1], HuffQ6[1], HuffQ7[1], HuffN8[1] }
+};
+#endif
+
+static const HuffSrc_t   HuffSCFI_src [4] = {
+    { 2, 3 }, { 1, 1 }, { 3, 3 }, { 0, 2 }
+};
+
+static const HuffSrc_t   HuffDSCF_src [16] = {
+    { 32, 6 }, {  4, 5 }, { 17, 5 }, { 30, 5 }, { 13, 4 }, {  0, 3 }, {  3, 3 }, {  9, 4 },
+    {  5, 3 }, {  2, 3 }, { 14, 4 }, {  3, 4 }, { 31, 5 }, {  5, 5 }, { 33, 6 }, { 12, 4 }
+};
+
+static const HuffSrc_t   HuffHdr_src [10] = {
+    {  92, 8 }, {  47, 7 }, {  10, 5 }, {   4, 4 }, {   0, 2 },
+    {   1, 1 }, {   3, 3 }, {  22, 6 }, { 187, 9 }, { 186, 9 }
+};
+
+static const HuffSrc_t   HuffQ1_src [2] [3*3*3] = { {
+    { 54, 6 }, {  9, 5 }, { 32, 6 }, {  5, 5 }, { 10, 4 }, {  7, 5 }, { 52, 6 }, {  0, 5 }, { 35, 6 },
+    { 10, 5 }, {  6, 4 }, {  4, 5 }, { 11, 4 }, {  7, 3 }, { 12, 4 }, {  3, 5 }, {  7, 4 }, { 11, 5 },
+    { 34, 6 }, {  1, 5 }, { 53, 6 }, {  6, 5 }, {  9, 4 }, {  2, 5 }, { 33, 6 }, {  8, 5 }, { 55, 6 }
+}, {
+    { 103, 8 }, {  62, 7 }, { 225, 9 }, {  55, 7 }, {   3, 4 }, {  52, 7 }, { 101, 8 }, {  60, 7 }, { 227, 9 },
+    {  24, 6 }, {   0, 4 }, {  61, 7 }, {   4, 4 }, {   1, 1 }, {   5, 4 }, {  63, 7 }, {   1, 4 }, {  59, 7 },
+    { 226, 9 }, {  57, 7 }, { 100, 8 }, {  53, 7 }, {   2, 4 }, {  54, 7 }, { 224, 9 }, {  58, 7 }, { 102, 8 }
+} };
+
+static const HuffSrc_t   HuffQ2_src [2] [5*5] = { {
+    {  89,  7 }, {  47,  6 }, { 15, 5 }, {   0, 5 }, {  91,  7 },
+    {   4,  5 }, {   6,  4 }, { 13, 4 }, {   4, 4 }, {   5,  5 },
+    {  20,  5 }, {  12,  4 }, {  4, 3 }, {  15, 4 }, {  14,  5 },
+    {   3,  5 }, {   3,  4 }, { 14, 4 }, {   5, 4 }, {   1,  5 },
+    {  90,  7 }, {   2,  5 }, { 21, 5 }, {  46, 6 }, {  88,  7 }
+}, {
+    { 921, 10 }, { 113,  7 }, { 51, 6 }, { 231, 8 }, { 922, 10 },
+    { 104,  7 }, {  30,  5 }, {  0, 3 }, {  29, 5 }, { 105,  7 },
+    {  50,  6 }, {   1,  3 }, {  2, 2 }, {   3, 3 }, {  49,  6 },
+    { 107,  7 }, {  27,  5 }, {  2, 3 }, {  31, 5 }, { 112,  7 },
+    { 920, 10 }, { 106,  7 }, { 48, 6 }, { 114, 7 }, { 923, 10 }
+} };
+
+#ifdef USE_SV8
+static const HuffSrc_t   HuffN3_src [2] [7*7] = { {
+    {  78, 7 }, {  20, 6 }, {  36, 6 }, {  51, 6 }, {  21, 6 }, { 101, 7 }, { 255, 8 },
+    {  37, 6 }, {   0, 5 }, {  62, 6 }, {   7, 5 }, {  60, 6 }, {  49, 6 }, { 100, 7 },
+    {  30, 6 }, {  53, 6 }, {   8, 5 }, {  14, 5 }, {   5, 5 }, {  54, 6 }, {  26, 6 },
+    {  43, 6 }, {   1, 5 }, {  20, 5 }, {  14, 4 }, {  22, 5 }, {   9, 5 }, {  46, 6 },
+    {  47, 6 }, {  61, 6 }, {  17, 5 }, {  16, 5 }, {  11, 5 }, {   4, 5 }, {  38, 6 },
+    {   6, 6 }, {  52, 6 }, {   6, 5 }, {  12, 5 }, {   2, 5 }, {  55, 6 }, {  27, 6 },
+    { 254, 8 }, { 126, 7 }, {  31, 6 }, {  48, 6 }, {  42, 6 }, {   7, 6 }, {  79, 7 }
+}, {
+    {  65, 9 }, { 161, 8 }, { 109, 7 }, {  11, 6 }, { 116, 7 }, { 160, 8 }, {  71, 9 },
+    {  34, 8 }, {  97, 7 }, {  56, 6 }, {   8, 5 }, {  55, 6 }, {  85, 7 }, { 166, 8 },
+    {  84, 7 }, {  52, 6 }, {   3, 4 }, {  11, 4 }, {   5, 4 }, {  59, 6 }, {  86, 7 },
+    {  10, 6 }, {  13, 5 }, {   9, 4 }, {   0, 3 }, {   8, 4 }, {  12, 5 }, {   9, 6 },
+    {  98, 7 }, {  51, 6 }, {  31, 5 }, {   7, 4 }, {  30, 5 }, {  53, 6 }, {  99, 7 },
+    { 162, 8 }, { 108, 7 }, {  50, 6 }, {   9, 5 }, {  57, 6 }, {  82, 7 }, { 163, 8 },
+    {  64, 9 }, { 167, 8 }, {  87, 7 }, { 117, 7 }, {  96, 7 }, {  33, 8 }, {  70, 9 }
+} };
+#endif
+
+static const HuffSrc_t   HuffQ3_src [2] [ 7] = { {
+    { 12, 4 }, { 4, 3 }, { 0, 2 }, { 1, 2 }, { 7, 3 }, { 5, 3 }, { 13, 4 }
+}, {
+    {  4, 5 }, { 3, 4 }, { 2, 2 }, { 3, 2 }, { 1, 2 }, { 0, 3 }, {  5, 5 }
+} };
+
+static const HuffSrc_t   HuffQ4_src [2] [ 9] = { {
+    { 5, 4 }, {  0, 3 }, { 4, 3 }, { 6, 3 }, { 7, 3 }, { 5, 3 }, {  3, 3 }, { 1, 3 }, { 4, 4 }
+}, {
+    { 9, 5 }, { 12, 4 }, { 3, 3 }, { 0, 2 }, { 2, 2 }, { 7, 3 }, { 13, 4 }, { 5, 4 }, { 8, 5 }
+} };
+
+static const HuffSrc_t   HuffQ5_src [2] [15] = { {
+    {  57, 6 }, { 23, 5 }, {  8, 4 }, { 10, 4 }, { 13, 4 }, {   0, 3 }, {   2, 3 }, { 3, 3 },
+    {   1, 3 }, { 15, 4 }, { 12, 4 }, {  9, 4 }, { 29, 5 }, {  22, 5 }, {  56, 6 }
+}, {
+    { 229, 8 }, { 56, 6 }, {  7, 5 }, {  2, 4 }, {  0, 3 }, {   3, 3 }, {   5, 3 }, { 6, 3 },
+    {   4, 3 }, {  2, 3 }, { 15, 4 }, { 29, 5 }, {  6, 5 }, { 115, 7 }, { 228, 8 },
+} };
+
+static const HuffSrc_t   HuffQ6_src [2] [31] = { {
+    {   65,  7 }, {    6,  6 }, {  44,  6 }, {  45, 6 }, {   59,  6 }, {   13,  5 }, {   17,  5 }, { 19, 5 },
+    {   23,  5 }, {   21,  5 }, {  26,  5 }, {  30, 5 }, {    0,  4 }, {    2,  4 }, {    5,  4 }, {  7, 4 },
+    {    3,  4 }, {    4,  4 }, {  31,  5 }, {  28, 5 }, {   25,  5 }, {   27,  5 }, {   24,  5 }, { 20, 5 },
+    {   18,  5 }, {   12,  5 }, {   2,  5 }, {  58, 6 }, {   33,  6 }, {    7,  6 }, {   64,  7 },
+}, {
+    { 6472, 13 }, { 6474, 13 }, { 808, 10 }, { 405, 9 }, {  203,  8 }, {  102,  7 }, {   49,  6 }, {  9, 5 },
+    {   15,  5 }, {   31,  5 }, {   2,  4 }, {   6, 4 }, {    8,  4 }, {   11,  4 }, {   13,  4 }, {  0, 3 },
+    {   14,  4 }, {   10,  4 }, {   9,  4 }, {   5, 4 }, {    3,  4 }, {   30,  5 }, {   14,  5 }, {  8, 5 },
+    {   48,  6 }, {  103,  7 }, { 201,  8 }, { 200, 8 }, { 1619, 11 }, { 6473, 13 }, { 6475, 13 },
+} };
+
+static const HuffSrc_t   HuffQ7_src [2] [63] = { {
+    { 103, 8 },    // 0.3338   01100111
+    { 153, 8 },    // 0.3766   10011001
+    { 181, 8 },    // 0.4715   10110101
+    { 233, 8 },    // 0.5528   11101001
+    {  64, 7 },    // 0.6677    1000000
+    {  65, 7 },    // 0.7041    1000001
+    {  77, 7 },    // 0.7733    1001101
+    {  81, 7 },    // 0.8296    1010001
+    {  91, 7 },    // 0.9295    1011011
+    { 113, 7 },    // 1.0814    1110001
+    { 112, 7 },    // 1.0807    1110000
+    {  24, 6 },    // 1.2748     011000
+    {  29, 6 },    // 1.3390     011101
+    {  35, 6 },    // 1.4224     100011
+    {  37, 6 },    // 1.5201     100101
+    {  41, 6 },    // 1.6642     101001
+    {  44, 6 },    // 1.7292     101100
+    {  46, 6 },    // 1.8647     101110
+    {  51, 6 },    // 2.0473     110011
+    {  49, 6 },    // 2.0152     110001
+    {  54, 6 },    // 2.1315     110110
+    {  55, 6 },    // 2.1358     110111
+    {  57, 6 },    // 2.1700     111001
+    {  60, 6 },    // 2.2449     111100
+    {   0, 5 },    // 2.3063      00000
+    {   2, 5 },    // 2.3854      00010
+    {  10, 5 },    // 2.5481      01010
+    {   5, 5 },    // 2.4867      00101
+    {   9, 5 },    // 2.5352      01001
+    {   6, 5 },    // 2.5074      00110
+    {  13, 5 },    // 2.5745      01101
+    {   7, 5 },    // 2.5195      00111
+    {  11, 5 },    // 2.5502      01011
+    {  15, 5 },    // 2.6251      01111
+    {   8, 5 },    // 2.5260      01000
+    {   4, 5 },    // 2.4418      00100
+    {   3, 5 },    // 2.3983      00011
+    {   1, 5 },    // 2.3697      00001
+    {  63, 6 },    // 2.3041     111111
+    {  62, 6 },    // 2.2656     111110
+    {  61, 6 },    // 2.2549     111101
+    {  53, 6 },    // 2.1151     110101
+    {  59, 6 },    // 2.2042     111011
+    {  52, 6 },    // 2.0837     110100
+    {  48, 6 },    // 1.9446     110000
+    {  47, 6 },    // 1.9189     101111
+    {  43, 6 },    // 1.7177     101011
+    {  42, 6 },    // 1.7035     101010
+    {  39, 6 },    // 1.5287     100111
+    {  36, 6 },    // 1.4559     100100
+    {  33, 6 },    // 1.4117     100001
+    {  28, 6 },    // 1.2776     011100
+    { 117, 7 },    // 1.1107    1110101
+    { 101, 7 },    // 1.0636    1100101
+    { 100, 7 },    // 0.9751    1100100
+    {  80, 7 },    // 0.8132    1010000
+    {  69, 7 },    // 0.7091    1000101
+    {  68, 7 },    // 0.7084    1000100
+    {  50, 7 },    // 0.6277    0110010
+    { 232, 8 },    // 0.5386   11101000
+    { 180, 8 },    // 0.4408   10110100
+    { 152, 8 },    // 0.3759   10011000
+    { 102, 8 },    // 0.3160   01100110
+}, {
+    { 14244, 14 },    // 0.0059   11011110100100
+    { 14253, 14 },    // 0.0098   11011110101101
+    { 14246, 14 },    // 0.0078   11011110100110
+    { 14254, 14 },    // 0.0111   11011110101110
+    {  3562, 12 },    // 0.0320     110111101010
+    {   752, 10 },    // 0.0920       1011110000
+    {   753, 10 },    // 0.1057       1011110001
+    {   160,  9 },    // 0.1403        010100000
+    {   162,  9 },    // 0.1579        010100010
+    {   444,  9 },    // 0.2486        110111100
+    {   122,  8 },    // 0.3772         01111010
+    {   223,  8 },    // 0.5710         11011111
+    {    60,  7 },    // 0.6858          0111100
+    {    73,  7 },    // 0.8033          1001001
+    {   110,  7 },    // 0.9827          1101110
+    {    14,  6 },    // 1.2601           001110
+    {    24,  6 },    // 1.3194           011000
+    {    25,  6 },    // 1.3938           011001
+    {    34,  6 },    // 1.5693           100010
+    {    37,  6 },    // 1.7846           100101
+    {    54,  6 },    // 2.0078           110110
+    {     3,  5 },    // 2.2975            00011
+    {     9,  5 },    // 2.5631            01001
+    {    11,  5 },    // 2.7021            01011
+    {    16,  5 },    // 3.1465            10000
+    {    19,  5 },    // 3.4244            10011
+    {    21,  5 },    // 3.5921            10101
+    {    24,  5 },    // 3.7938            11000
+    {    26,  5 },    // 3.9595            11010
+    {    29,  5 },    // 4.1546            11101
+    {    31,  5 },    // 4.2623            11111
+    {     2,  4 },    // 4.5180             0010
+    {     0,  4 },    // 4.3151             0000
+    {    30,  5 },    // 4.2538            11110
+    {    28,  5 },    // 4.1422            11100
+    {    25,  5 },    // 3.9145            11001
+    {    22,  5 },    // 3.6691            10110
+    {    20,  5 },    // 3.4955            10100
+    {    14,  5 },    // 2.9155            01110
+    {    13,  5 },    // 2.7921            01101
+    {     8,  5 },    // 2.5553            01000
+    {     6,  5 },    // 2.3093            00110
+    {     2,  5 },    // 2.1200            00010
+    {    46,  6 },    // 1.8134           101110
+    {    35,  6 },    // 1.5824           100011
+    {    31,  6 },    // 1.4701           011111
+    {    21,  6 },    // 1.3187           010101
+    {    15,  6 },    // 1.2776           001111
+    {    95,  7 },    // 0.9664          1011111
+    {    72,  7 },    // 0.7922          1001000
+    {    41,  7 },    // 0.6838          0101001
+    {   189,  8 },    // 0.5024         10111101
+    {   123,  8 },    // 0.3830         01111011
+    {   377,  9 },    // 0.2232        101111001
+    {   161,  9 },    // 0.1566        010100001
+    {   891, 10 },    // 0.1383       1101111011
+    {   327, 10 },    // 0.0900       0101000111
+    {   326, 10 },    // 0.0790       0101000110
+    {  3560, 12 },    // 0.0254     110111101000
+    { 14255, 14 },    // 0.0117   11011110101111
+    { 14247, 14 },    // 0.0085   11011110100111
+    { 14252, 14 },    // 0.0085   11011110101100
+    { 14245, 14 },    // 0.0065   11011110100101
+} };
+
+#ifdef USE_SV8
+static const HuffSrc_t   HuffN8_src [2] [127] = { {
+    { 2426, 13 }, { 4943, 13 }, {  787, 12 }, { 2470, 12 }, { 7270, 13 }, { 1764, 12 },
+    { 3632, 12 }, { 3633, 12 }, { 2486, 12 }, {  395, 11 }, {  607, 11 }, { 1242, 11 },
+    {  108, 10 }, {  300, 10 }, {  199, 10 }, {  440, 10 }, {  442, 10 }, {  616, 10 },
+    {  909, 10 }, {  897, 10 }, {  178,  9 }, {  309,  9 }, {  311,  9 }, {  451,  9 },
+    {  449,  9 }, {   26,  8 }, {   74,  8 }, {   94,  8 }, {  122,  8 }, {  136,  8 },
+    {   12,  7 }, {   29,  7 }, {   28,  7 }, {   36,  7 }, {   39,  7 }, {   46,  7 },
+    {   60,  7 }, {   69,  7 }, {   76,  7 }, {   92,  7 }, {  126,  7 }, {   11,  6 },
+    {   15,  6 }, {   10,  6 }, {   16,  6 }, {   21,  6 }, {   25,  6 }, {   28,  6 },
+    {   32,  6 }, {   31,  6 }, {   37,  6 }, {   47,  6 }, {   43,  6 }, {   35,  6 },
+    {   45,  6 }, {   48,  6 }, {   52,  6 }, {   53,  6 }, {   54,  6 }, {   62,  6 },
+    {   59,  6 }, {    0,  5 }, {   61,  6 }, {   51,  6 }, {    2,  5 }, {    1,  5 },
+    {   60,  6 }, {   57,  6 }, {   58,  6 }, {   55,  6 }, {   50,  6 }, {   49,  6 },
+    {   42,  6 }, {   40,  6 }, {   44,  6 }, {   41,  6 }, {   39,  6 }, {   33,  6 },
+    {   29,  6 }, {   26,  6 }, {   24,  6 }, {   20,  6 }, {   17,  6 }, {   13,  6 },
+    {    8,  6 }, {    9,  6 }, {  127,  7 }, {   93,  7 }, {   73,  7 }, {   72,  7 },
+    {   54,  7 }, {   38,  7 }, {   45,  7 }, {   14,  7 }, {   25,  7 }, {   15,  7 },
+    {  226,  8 }, {  137,  8 }, {  111,  8 }, {   95,  8 }, {   88,  8 }, {   48,  8 },
+    {  455,  9 }, {  450,  9 }, {  246,  9 }, {  247,  9 }, {  179,  9 }, {   55,  9 },
+    {  896, 10 }, {  620, 10 }, {  443, 10 }, {  302, 10 }, {  301, 10 }, {  198, 10 },
+    {  109, 10 }, { 1234, 11 }, {  883, 11 }, {  392, 11 }, {  394, 11 }, { 3634, 12 },
+    { 2487, 12 }, {  786, 12 }, { 1765, 12 }, { 1212, 12 }, { 7271, 13 }, { 2427, 13 },
+    { 4942, 13 }
+}, {
+    { 3728, 12 }, { 4005, 12 }, {  264, 11 }, { 4004, 12 }, { 4044, 12 }, { 4045, 12 },
+    { 4046, 12 }, { 1424, 11 }, {  449, 11 }, {  448, 11 }, {  139, 10 }, {  231, 10 },
+    {  133, 10 }, {  719, 10 }, {  641, 10 }, {  676, 10 }, {  225, 10 }, {  677, 10 },
+    {  620, 10 }, {   72,  9 }, {   23,  9 }, {   67,  9 }, {   75,  9 }, {  113,  9 },
+    {  311,  9 }, {   68,  9 }, {  316,  9 }, {  467,  9 }, {   10,  8 }, {  468,  9 },
+    {   35,  8 }, {   27,  8 }, {  358,  9 }, {   32,  8 }, {   26,  8 }, {  501,  9 },
+    {   44,  8 }, {   45,  8 }, {  142,  8 }, {  173,  8 }, {  161,  8 }, {  188,  8 },
+    {  189,  8 }, {  190,  8 }, {  191,  8 }, {  254,  8 }, {  251,  8 }, {  255,  8 },
+    {   19,  7 }, {   26,  7 }, {   70,  7 }, {   76,  7 }, {   87,  7 }, {   85,  7 },
+    {  124,  7 }, {    7,  6 }, {   15,  6 }, {   41,  6 }, {   46,  6 }, {    2,  5 },
+    {   16,  5 }, {   28,  5 }, {   12,  4 }, {    1,  2 }, {   13,  4 }, {   30,  5 },
+    {   18,  5 }, {    0,  5 }, {   45,  6 }, {   34,  6 }, {   12,  6 }, {    3,  6 },
+    {  118,  7 }, {   88,  7 }, {   81,  7 }, {   29,  7 }, {   78,  7 }, {   23,  7 },
+    {   27,  7 }, {  253,  8 }, {   12,  7 }, {  232,  8 }, {  235,  8 }, {  159,  8 },
+    {  238,  8 }, {  172,  8 }, {  168,  8 }, {  143,  8 }, {  154,  8 }, {   40,  8 },
+    {    8,  8 }, {  478,  9 }, {    9,  8 }, {  479,  9 }, {  469,  9 }, {   42,  8 },
+    {   43,  8 }, {  504,  9 }, {  357,  9 }, {  321,  9 }, {  339,  9 }, {  317,  9 },
+    {  114,  9 }, {   82,  9 }, {   83,  9 }, {   73,  9 }, {   74,  9 }, { 1000, 10 },
+    {  933, 10 }, {  621, 10 }, {  718, 10 }, { 2003, 11 }, {  713, 10 }, { 2020, 11 },
+    {  230, 10 }, { 1865, 11 }, {   44, 10 }, {  138, 10 }, { 1280, 11 }, { 2021, 11 },
+    { 3729, 12 }, { 4047, 12 }, {   90, 11 }, {  265, 11 }, { 1281, 11 }, { 1425, 11 },
+    {   91, 11 }
+} };
+#endif
+
+#define MAKE(d,s)     Make_HuffTable   ( (d), (s), sizeof(s)/sizeof(*(s)) )
+#define SORT(x,o)     Resort_HuffTable ( (x), sizeof(x)/sizeof(*(x)), -(Int)(o) )
+#define LOOKUP(x,q)   Make_LookupTable ( (q), sizeof(q), (x), sizeof(x)/sizeof(*(x)) )
+
+
+void
+Init_Huffman_Encoder_SV7 ( void )
+{
+    // Splitting of the 36 Samples
+    MAKE ( HuffSCFI, HuffSCFI_src );
+
+    // Differential Scalefactors
+    MAKE ( HuffDSCF, HuffDSCF_src );
+
+    // resolution, differential quantizer indizes
+    MAKE ( HuffHdr, HuffHdr_src );
+
+    // 3-step quantizer, 3 bundled samples
+    MAKE ( HuffQ1[0], HuffQ1_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ1[1], HuffQ1_src[1] );          // more shaped, book 1
+
+    // 5-step quantizer, 2 bundled samples
+    MAKE ( HuffQ2[0], HuffQ2_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ2[1], HuffQ2_src[1] );          // more shaped, book 1
+
+    // 7-step quantizer, single samples
+    MAKE ( HuffQ3[0], HuffQ3_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ3[1], HuffQ3_src[1] );          // more shaped, book 1
+
+#ifdef USE_SV8
+    // 7-step quantizer, 2 bundled samples
+    MAKE ( HuffN3[0], HuffN3_src[0] );          // less shaped, book 0
+    MAKE ( HuffN3[1], HuffN3_src[1] );          // more shaped, book 1
+#endif
+
+    // 9-step quantizer, single samples
+    MAKE ( HuffQ4[0], HuffQ4_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ4[1], HuffQ4_src[1] );          // more shaped, book 1
+
+    // 15-step quantizer, single samples
+    MAKE ( HuffQ5[0], HuffQ5_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ5[1], HuffQ5_src[1] );          // more shaped, book 1
+
+    // 31-step quantizer, single samples
+    MAKE ( HuffQ6[0], HuffQ6_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ6[1], HuffQ6_src[1] );          // more shaped, book 1
+
+    // 63-step quantizer, single samples
+    MAKE ( HuffQ7[0], HuffQ7_src[0] );          // less shaped, book 0
+    MAKE ( HuffQ7[1], HuffQ7_src[1] );          // more shaped, book 1
+
+#ifdef USE_SV8
+    // 127-step quantizer, single samples
+    MAKE ( HuffN8[0], HuffN8_src[0] );          // book 0
+    MAKE ( HuffN8[1], HuffN8_src[1] );          // book 1
+#endif
+}
+
+#ifndef MPP_ENCODER
+
+void
+Init_Huffman_Decoder_SV7 ( void )
+{
+    Init_Huffman_Encoder_SV7 ();
+
+    SORT ( HuffHdr  ,    5  );
+    SORT ( HuffSCFI ,    0  );
+    SORT ( HuffDSCF ,    7  );
+    SORT ( HuffQ1[0],    0  );
+    SORT ( HuffQ1[1],    0  );
+    SORT ( HuffQ2[0],    0  );
+    SORT ( HuffQ2[1],    0  );
+#ifdef USE_SV8
+    SORT ( HuffN3[0],    0  );
+    SORT ( HuffN3[1],    0  );
+#endif
+    SORT ( HuffQ3[0], Dc[3] );
+    SORT ( HuffQ3[1], Dc[3] );
+    SORT ( HuffQ4[0], Dc[4] );
+    SORT ( HuffQ4[1], Dc[4] );
+    SORT ( HuffQ5[0], Dc[5] );
+    SORT ( HuffQ5[1], Dc[5] );
+    SORT ( HuffQ6[0], Dc[6] );
+    SORT ( HuffQ6[1], Dc[6] );
+    SORT ( HuffQ7[0], Dc[7] );
+    SORT ( HuffQ7[1], Dc[7] );
+#ifdef USE_SV8
+    SORT ( HuffN8[0], Dc[8] );
+    SORT ( HuffN8[1], Dc[8] );
+#endif
+
+    LOOKUP ( HuffQ1[0], LUT1_0  );
+    LOOKUP ( HuffQ1[1], LUT1_1  );
+    LOOKUP ( HuffQ2[0], LUT2_0  );
+    LOOKUP ( HuffQ2[1], LUT2_1  );
+    LOOKUP ( HuffQ3[0], LUT3_0  );
+    LOOKUP ( HuffQ3[1], LUT3_1  );
+    LOOKUP ( HuffQ4[0], LUT4_0  );
+    LOOKUP ( HuffQ4[1], LUT4_1  );
+    LOOKUP ( HuffQ5[0], LUT5_0  );
+    LOOKUP ( HuffQ5[1], LUT5_1  );
+    LOOKUP ( HuffQ6[0], LUT6_0  );
+    LOOKUP ( HuffQ6[1], LUT6_1  );
+    LOOKUP ( HuffQ7[0], LUT7_0  );
+    LOOKUP ( HuffQ7[1], LUT7_1  );
+    LOOKUP ( HuffDSCF , LUTDSCF );
+}
+
+#endif
+
+/* end of huffsv7.c */
Index: /mppenc/trunk/src/keyboard.c
===================================================================
--- /mppenc/trunk/src/keyboard.c	(revision 97)
+++ /mppenc/trunk/src/keyboard.c	(revision 97)
@@ -0,0 +1,128 @@
+/*
+ *  Keyboard input functions
+ *
+ *  (C) Frank Klemm 2002. All rights reserved.
+ *
+ *  Principles:
+ *
+ *  History:
+ *    ca. 1998    created
+ *    2002
+ *
+ *  Global functions:
+ *    -
+ *
+ *  TODO:
+ *    -
+ */
+
+#include "mppenc.h"
+
+#if defined _WIN32  ||  defined __TURBOC__
+
+# include <conio.h>
+
+int
+WaitKey ( void )
+{
+    return getch ();
+}
+
+int
+CheckKeyKeep ( void )
+{
+    int  ch;
+
+    if ( !kbhit () )
+        return -1;
+
+    ch = getch ();
+    ungetch (ch);
+    return ch;
+}
+
+int
+CheckKey ( void )
+{
+    if ( !kbhit () )
+        return -1;
+
+    return getch ();
+}
+
+#else
+
+# ifdef USE_TERMIOS
+#  include <termios.h>
+
+static struct termios  stored_settings;
+
+static void
+echo_on ( void )
+{
+    tcsetattr ( 0, TCSANOW, &stored_settings );
+}
+
+static void
+echo_off ( void )
+{
+    struct termios  new_settings;
+
+    tcgetattr ( 0, &stored_settings );
+    new_settings = stored_settings;
+
+    new_settings.c_lflag     &= ~ECHO;
+    new_settings.c_lflag     &= ~ICANON;        // Disable canonical mode, and set buffer size to 1 byte
+    new_settings.c_cc[VTIME]  = 0;
+    new_settings.c_cc[VMIN]   = 1;
+
+    tcsetattr ( 0, TCSANOW, &new_settings );
+}
+
+# else
+#  define echo_off()  (void)0
+#  define echo_on()   (void)0
+# endif
+
+int
+WaitKey ( void )
+{
+    unsigned char  buff [1];
+    int            ret;
+
+    echo_off ();
+    ret = read ( 0, buff, 1 );
+    echo_on ();
+    return ret == 1  ?  buff[0]  :  -1;
+}
+
+int
+CheckKeyKeep ( void )
+{
+    struct timeval  tv = { 0, 0 };      // Do not wait at all, not even a microsecond
+    fd_set          read_fd;
+
+    FD_ZERO ( &read_fd );               // Must be done first to initialize read_fd
+    FD_SET ( 0, &read_fd );             // Makes select() ask if input is ready;  0 is file descriptor for stdin
+
+    if ( -1 == select ( 1,              // number of the largest fd to check + 1
+                        &read_fd,
+                        NULL,           // No writes
+                        NULL,           // No exceptions
+                        &tv ) )
+        return -1;                      // an error occured
+
+    return FD_ISSET (0, &read_fd)  ?  0xFF  :  -1;   // read_fd now holds a bit map of files that are readable. We test the entry for the standard input (file 0).
+}
+
+int
+CheckKey ( void )
+{
+    if ( CheckKeyKeep () < 0 )
+        return -1;
+    return WaitKey ();
+}
+
+#endif
+
+/* end of keyboard.c */
Index: /mppenc/trunk/src/minimax.h
===================================================================
--- /mppenc/trunk/src/minimax.h	(revision 97)
+++ /mppenc/trunk/src/minimax.h	(revision 97)
@@ -0,0 +1,64 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef MPP_MINIMAX_H
+#define MPP_MINIMAX_H
+
+#if   defined __GNUC__  &&  defined __cplusplus
+
+# define maxi(A,B)  ( (A) >? (B) )
+# define mini(A,B)  ( (A) <? (B) )
+# define maxd(A,B)  ( (A) >? (B) )
+# define mind(A,B)  ( (A) <? (B) )
+# define maxf(A,B)  ( (A) >? (B) )
+# define minf(A,B)  ( (A) <? (B) )
+
+# define absi(A)    abs   (A)
+# define absf(A)    fabsf (A)
+# define absd(A)    fabs  (A)
+
+#elif defined __GNUC__
+
+# define maxi(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
+# define mini(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
+# define maxd(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
+# define mind(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
+# define maxf(A,B)  ( (A) > (B)  ?  (A)  :  (B) )
+# define minf(A,B)  ( (A) < (B)  ?  (A)  :  (B) )
+
+# define absi(A)    abs   (A)
+# define absf(A)    fabsf (A)
+# define absd(A)    fabs  (A)
+
+#else
+
+# define maxi(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
+# define mini(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
+# define maxd(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
+# define mind(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
+# define maxf(A,B)  ( (A) >  (B)  ?  (A)  :  (B) )
+# define minf(A,B)  ( (A) <  (B)  ?  (A)  :  (B) )
+
+# define absi(A)    ( (A) >= 0    ?  (A)  : -(A) )
+# define absf(A)    ( (A) >= 0.f  ?  (A)  : -(A) )
+# define absd(A)    ( (A) >= 0.   ?  (A)  : -(A) )
+
+#endif /* GNUC && C++ */
+
+#endif /* MPP_MINIMAX_H */
Index: /mppenc/trunk/src/mpp.h
===================================================================
--- /mppenc/trunk/src/mpp.h	(revision 97)
+++ /mppenc/trunk/src/mpp.h	(revision 97)
@@ -0,0 +1,194 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/******************************************************
+ *                                                    *
+ *            Source Compile configuration            *
+ *                                                    *
+ ******************************************************/
+
+
+#if !defined(__APPLE__)
+// use optimized assembler routines for Pentium III/K6-2/Athlon (only 32 bit OS, Intel x86 and no MAKE_xxBITS)
+// you need the NASM assembler on your system, the program becomes a little bit larger and decoding
+// on AMD K6-2 (x3), AMD K6-III (x3), AMD Duron (x1.7), AMD Athlon (x1.7), Pentium III (x2) and Pentium 4 (x1.8) becomes faster
+#define USE_ASM
+
+// Open Sound System support (only Unix with OSS support)
+// If your Operating System supports the Open Sound System, you can output to /dev/dsp* and
+// instead of writing a file the program plays the file via this sound device.
+// on some systems you also must link the libossaudio library, so maybe you also must edit the Makefile
+#define USE_OSS_AUDIO
+
+// Enlightenment Sound Daemon support (only Unix with ESD support)
+// If your Operating System supports the Enlightenment Sound Daemon you can output to /dev/esd and
+// instead of writing a file the program plays the file via this sound device.
+// you also must link the libesd library, so maybe you also must edit the Makefile
+//#define USE_ESD_AUDIO
+
+#endif
+
+// native Sun Onboard-Audio support (only SunOS)
+// If you have a Sun Workstation with Onboard-Audio, you can output to /dev/audio and
+// instead of writing a file the program plays the file via this sound device.
+// Some machines lacking librt.a so you are unable to link a static executable with realtime-support.
+// Although you can still perfectly use the dynamic executable.
+//#define USE_SUN_AUDIO
+
+// Sound support for SGI Irix
+// If you have a SGI Workstation running IRIX, you can output to /dev/audio and
+// instead of writing a file the program plays the file via this sound device.
+//#define USE_IRIX_AUDIO
+
+// Audio support for Windows (WAVE OUT) (only Windows)
+// If you have a Windows based system and if you also want to play files directly instead of only writing audio files,
+// then define the next item
+#define USE_WIN_AUDIO
+
+// Buffersize for Windows Audio in 4.5 KByte units
+// Only needed for Windows+USE_WIN_AUDIO
+// Good values are 8...32 for fast machines and 128...512 for slow machines
+// large values decrease average performance a little bit, increase memory
+// consumption (1 Block = 4.5 KByte), but increase buffering, so it takes a
+// longer time to get a dropout. Note that I don't have a 486/80...133, so
+// I don't know anything about their performance.
+// (Attention: 512 = additional 2.3 MByte of memory)
+#define MAX_WAVEBLOCKS    40
+
+// increase priority if destination is an audio device
+// this increases the priority of the decoder when playing the file directly to a sound card to reduce/prevent
+// dropouts during the playback due to CPU time shortage
+#define USE_NICE
+
+// use realtime scheduling if destination is an audio device
+// This sets the program to real time priority when playing the file directly to a sound card.
+// Now it should be really difficult to get dropouts (file IO and other realtime programs are the remaining weak points)
+#define USE_REALTIME
+
+// use ANSI-Escape sequences to structure output
+#define USE_ANSI_ESCAPE
+
+// Use termios for reading values from keyboard without echo and ENTER
+#define USE_TERMIOS
+
+// if none of the next three macros MAKE_xxBIT is defined,
+// normal non-dithered and non-shaped 16 bit PCM output is generated
+
+// create 16 bit Output
+// output is 16 bit wide, you can also dither and noise shape
+//#define MAKE_16BIT
+
+// create 24 bit Output
+// output is 24 bit wide instead of 16 bit wide, you can also dither and noise shape
+//#define MAKE_24BIT
+
+// create 32 bit Output
+// output is 32 bit wide instead of 16 bit wide, you can also dither and noise shape
+//#define MAKE_32BIT
+
+// Select subset of function used for file I/O:
+//   1: ANSI via file pointer (FILE*)
+//   2: POSIX via file handle (int or HANDLE)
+//   3: POSIX like lowest level function of Turbo/Borland C
+//   4: WinAMP 3: running inside WinAMP
+// Try to use '2', if this doesn't work, try '1'. '3' is for Borland compilers.
+#ifndef FILEIO
+# if   defined MPP_ENCODER
+#  define FILEIO      1             // mppenc still uses buffered ANSI-I/O
+# elif defined MPP_DECODER
+#  define FILEIO      2
+# else
+#   error Neigher MPP_DECODER nor MPP_ENCODER is defined. Abort.
+# endif
+#endif
+
+// the POSIX function read() can return less bytes than requested not only at the end of the file.
+// if this happens, the following macro must be defined:
+#define HAVE_INCOMPLETE_READ
+
+// use a shorter Huffman_t  representation, may be faster
+// use for performance tuning
+#define USE_HUFF_PACK
+
+// use shorter representation for SCF_Index[][] and Res[], may be faster
+// use for performance tuning
+#define USE_ARRAY_PACK
+
+// use the System 5 timer for profiling
+// otherwise a special piece of code for Turbo-C is used or the Timestamp Counter on Intel IA32/gcc systems.
+// Both is highly non-portable. This solution is more portable (you only need a SYS 5 compatible system,
+// but also much much more inaccurate.
+//#define USE_SYSV_TIMER
+
+// do a memory shift every n subband samples, otherwise only increment pointer (6, 12, 18 and 36 are good values)
+// use for performance tuning
+#define VIRT_SHIFT    18
+
+// selects InputBuff size, size is 4 * 2^IBUFLOG2 bytes (11...14 are good values)
+// use for performance tuning
+// can also be used to eliminate disk performance issue while tuning the program
+// (set to a value, so the test cases are fully read before decoding
+#define IBUFLOG2      14
+
+// Dump contents of MPEGplus files (only for development), 0x00 no dump
+// Bit 0: maxband, Bit 1: msbits, Bit 2: allocation/resolution, Bit 3: SCF
+// Bit 4: Subsamples, Bit 5: Datenrate, Bit 6: Bitusage der Sektionen
+//#define DUMPSELECT    0xFF
+
+// 16 bit and 32 bit accesses must be aligned, otherwise a bus error occures.
+// try this if you get bus errors
+//#define MUST_ALIGNED
+
+// Experimental: use http/ftp streaming
+#define USE_HTTP
+
+// _use setargv module
+#define USE_ARGV
+
+
+// Use IPv4 and IPv6
+//#define USE_IPv4_6
+// Use only IPv6
+//#define USE_IPv6
+
+// compile StreamVersion 8 decoding (always disable, no usabiltity)
+// do not edit
+//#define USE_SV8
+
+// disables assert()
+// assert() is for development only and decreases speed and increases the size of the program
+#ifndef NDEBUG
+# define NDEBUG
+#endif
+
+// Some other tracing (only for development)
+// do not edit
+//#define DEBUG
+
+// Some tracings of popen()
+// do not edit
+//#define DEBUG2
+
+// activate simple profiler
+//#define PROFILE
+
+// make debug output in tags.c stfu
+#define STFU
+
+/* end of mpp.h */
Index: /mppenc/trunk/src/mppdec.h
===================================================================
--- /mppenc/trunk/src/mppdec.h	(revision 97)
+++ /mppenc/trunk/src/mppdec.h	(revision 97)
@@ -0,0 +1,1170 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+//// Macros typical for Compilers:
+//
+//  __TURBOC__          Turbo-C, Borland-C
+//  __BORLANDC__        Borland-C
+//  __ZTC__             Zortech-C
+//  _MSC_VER            Microsoft-C
+//  __EMX__             Eberhard Mattes EMX (GNU based)
+//  __GNUC__            GNU C based compiler (also Cygwin)
+//  __CYGWIN__          Cygnus Windows C-Compiler (GNU based)
+//  __APPLE_CC__        Apple GCC (GNU based)
+
+
+//// Macros typical for Operating Systems
+//
+//  __linux__           Linux
+//  __bsdi__            BSDi
+//  __FreeBSD__         FreeBSD
+//  __NetBSD__          NetBSD
+//  __OpenBSD__         OpenBSD
+//  __unix__            Unix ????????
+//  _WIN16              16 bit-Windows
+//  _WIN32              32 bit-Windows (WIN32 is wrong, not defined by not MSC) (also __GNUC__ + _WIN32 is possible)
+//  _HPUX_SOURCE        HP-UX
+//  __BEOS__            BeOS
+//  __APPLE__           Apple Mac OS X (only when using Apple GCC)
+//  ???????             MS-DOS and relatives
+
+
+//// Macros typical for special conformances
+//                      System 5 Release 4 (SVr4)
+//                      System 5 ID     (SVID)
+//                      POSIX 1.0
+//                      POSIX 1.0b
+//                      X/OPEN
+//                      BSD 4.3
+//                      BSD 4.4
+//                      ANSI
+
+
+// Macros to manipulate Sockets + Files in one, in (+0x4000)
+// output times TIME/TIME_T/DTIME
+
+#ifndef MPPDEC_MPPDEC_H
+#define MPPDEC_MPPDEC_H
+
+//// optimization/feature defines //////////////////////////////////
+#ifndef NOT_INCLUDE_CONFIG_H
+# include "config.h"
+#endif
+#include "./mpp.h"
+
+
+//// portable system includes //////////////////////////////////////
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <limits.h>
+#include <assert.h>
+#include <math.h>
+
+
+//// system dependent system includes //////////////////////////////
+// low level I/O, where are prototypes and constants?
+#if   defined _WIN32  ||  defined __TURBOC__  ||  defined __ZTC__  ||  defined _MSC_VER
+# include <io.h>
+# include <fcntl.h>
+# include <time.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+#elif defined __unix__  ||  defined __linux__  ||  defined __APPLE__
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/time.h>
+# include <sys/ioctl.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+#else
+// .... add Includes for new Operating System here (with prefix: #elif defined)
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/ioctl.h>
+# include <sys/stat.h>
+#endif
+
+
+#if   defined __linux__
+#  include <fpu_control.h>
+#elif defined __FreeBSD__
+# include <machine/floatingpoint.h>
+#elif defined _MSC_VER
+# include <float.h>
+#endif
+
+
+#if defined _WIN32
+# undef USE_OSS_AUDIO
+# undef USE_ESD_AUDIO
+# undef USE_SUN_AUDIO
+#else
+# undef USE_WIN_AUDIO
+#endif
+
+#if defined __APPLE__
+# undef USE_OSS_AUDIO
+# undef USE_SUN_AUDIO
+# undef USE_WIN_AUDIO
+# undef USE_NICE
+# undef USE_REALTIME
+# undef USE_ASM
+# undef USE_ESD_AUDIO
+# define NO_DEV_AUDIO
+# undef ENDIAN
+# define ENDIAN HAVE_BIG_ENDIAN
+#endif
+
+#if defined __TURBOC__
+# undef USE_OSS_AUDIO
+# undef USE_ESD_AUDIO
+# undef USE_SUN_AUDIO
+# undef USE_NICE
+# undef USE_REALTIME
+#endif
+
+#if defined USE_DIET  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
+# undef USE_ESD_AUDIO
+#endif
+
+#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
+# undef USE_ASM
+#endif
+
+#if INT_MAX < 2147483647L
+# undef USE_ASM
+#endif
+
+// sound card
+#if defined USE_OSS_AUDIO
+# include <sys/ioctl.h>
+# include <sys/time.h>
+# if   defined __linux__        // the standard is that this file is stored somewhere on the hard disk
+#  include <linux/soundcard.h>
+# elif defined __bsdi_  ||  defined __FreeBSD__
+#  include <sys/soundcard.h>
+# elif defined __NetBSD__  ||  defined __OpenBSD__
+#  include <soundcard.h>
+# elif defined __APPLE__  &&  defined __MACH__
+#  include <pleasepatchheretherightpathofsoundcard.hforMacOSX/soundcard.h>
+# else
+#  include <pleasepatchheretherightpathof/soundcard.h>
+# endif
+#endif /* USE_OSS_AUDIO */
+
+#if defined USE_ESD_AUDIO
+# include <esd.h>
+#endif
+
+#if defined USE_SUN_AUDIO
+# include <sys/audioio.h>
+#endif
+
+#ifdef MPP_ENCODER
+# undef USE_HTTP
+#endif
+
+#ifdef USE_HTTP
+# ifdef _WIN32
+#  include <winsock2.h>
+# else
+#  include <sys/socket.h>
+# endif
+#endif
+
+#if   defined USE_WIN_AUDIO
+# include <windows.h>
+# define WINAUDIO_FD            ((FILE_T)-128)
+#elif defined USE_IRIX_AUDIO
+# define IRIXAUDIO_FD           ((FILE_T)-127)
+#endif
+#define  NULL_FD                ((FILE_T)-126)
+
+#if defined USE_NICE  &&  !defined _WIN32
+# include <sys/resource.h>
+#endif
+
+// scheduler stuff
+#if defined USE_REALTIME  &&  !defined _WIN32
+# include <sched.h>
+#endif
+
+#ifndef O_BINARY
+# ifdef _O_BINARY
+#  define O_BINARY              _O_BINARY
+# else
+#  define O_BINARY              0
+# endif
+#endif
+
+#if defined _WIN32  ||  defined __TURBOC__
+# define strncasecmp(__s1,__s2,__n) strnicmp ((__s1), (__s2), (__n))
+# define strcasecmp(__s1,__s2)      stricmp  ((__s1), (__s2))
+# define MKDIR(__dir,__attr)        mkdir ((__dir))
+#else
+# define MKDIR(__dir,__attr)        mkdir ((__dir), (__attr))
+#endif
+
+#if defined _WIN32
+# include <direct.h>
+# define snprintf                   _snprintf
+# define getcwd(__buff,__len)       _getcwd ((__buff), (__len))
+# define sleep(__sec)               Sleep ((__sec) * 1000)
+#endif
+
+#if defined _WIN32
+# define TIME_T                     long
+# define TIME(__x)                  time ( &(__x) )
+# define DTIME(__x,__y)             ( (double)(__y) - (__x) )
+#else
+# define TIME_T                     struct timeval
+# define TIME(__x)                  gettimeofday ( &(__x), NULL )
+# define DTIME(__x,__y)             ( ((double)(__y).tv_sec - (__x).tv_sec) + 1.e-6 * ((double)(__y).tv_usec - (__x).tv_usec) )
+#endif
+
+#if   defined __GNUC__
+# define inline                 __inline__
+# define restrict
+#elif defined _WIN32
+# define inline                 __inline
+# define restrict
+#else
+# define inline
+# define restrict
+#endif
+
+
+//// Binary/Low-Level-IO ///////////////////////////////////////////
+//
+// All file I/O is basicly handled via an ANSI file pointer (type: FILE*) in
+// FILEIO-Mode 1 and via a POSIX file descriptor (type: int) in
+// FILEIO-Mode 2 and 3.
+//
+// Some operations are only available via the POSIX interface (fcntl, setmode,
+// ...) so we need a function to get the file descriptor from a file pointer.
+// In FILEIO-Mode 2 and 3 this is a dummy function because we are always working
+// with these file descriptors.
+//
+
+#if  FILEIO == 1
+# if   defined __BORLANDC__  ||  defined _WIN32
+#  define FILENO(__fp)          _fileno ((__fp))
+# elif defined __CYGWIN__  ||  defined __TURBOC__  ||  defined __unix__  ||  defined __EMX__  ||  defined _MSC_VER
+#  define FILENO(__fp)          fileno  ((__fp))
+# else
+#  define FILENO(__fp)          fileno  ((__fp))
+# endif
+#else
+#  define FILENO(__fd)          (__fd)
+#endif
+
+
+//
+// If we have access to a file via file name, we can open the file with an
+// additional "b" or a O_BINARY within the (f)open function to get a
+// transparent untranslated data stream which is necessary for audio bitstream
+// data and also for PCM data. If we are working with
+// stdin/stdout/FILENO_STDIN/FILENO_STDOUT we can't open the file with these
+// attributes, because the files are already open. So we need a non
+// standardized sequence to switch to this mode (not necessary for Unix).
+// Mostly the sequence is the same for incoming and outgoing streams, but only
+// mostly so we need one for IN and one for OUT.
+// Macros are called with the file pointer and you get back the untransalted file
+// pointer which can be equal or different from the original.
+//
+
+#if   defined __EMX__
+# define SETBINARY_IN(__fp)     (_fsetmode ( (__fp), "b" ), (__fp))
+# define SETBINARY_OUT(__fp)    (_fsetmode ( (__fp), "b" ), (__fp))
+#elif defined __TURBOC__ || defined __BORLANDC__
+# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
+# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
+#elif defined __CYGWIN__
+# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)), _O_BINARY ), (__fp))
+# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)), _O_BINARY ), (__fp))
+#elif defined _WIN32
+# define SETBINARY_IN(__fp)     (_setmode  ( FILENO ((__fp)), _O_BINARY ), (__fp))
+# define SETBINARY_OUT(__fp)    (_setmode  ( FILENO ((__fp)), _O_BINARY ), (__fp))
+#elif defined _MSC_VER
+# define SETBINARY_IN(__fp)     (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
+# define SETBINARY_OUT(__fp)    (setmode   ( FILENO ((__fp)),  O_BINARY ), (__fp))
+#elif defined __unix__
+# define SETBINARY_IN(__fp)     (__fp)
+# define SETBINARY_OUT(__fp)    (__fp)
+#elif 0
+# define SETBINARY_IN(__fp)     (freopen   ( NULL, "rb", (__fp) ), (__fp))
+# define SETBINARY_OUT(__fp)    (freopen   ( NULL, "wb", (__fp) ), (__fp))
+#else
+# define SETBINARY_IN(__fp)     (__fp)
+# define SETBINARY_OUT(__fp)    (__fp)
+#endif
+
+// file I/O using ANSI buffered file I/O via file pointer FILE* (fopen, fread, fwrite, fclose)
+#if  FILEIO == 1
+# define OFF_T                  signed long
+# define FILE_T                 FILE*
+# define OPEN(name)             fopen  (name, "rb" )
+# define OPENRW(name)           fopen  (name, "r+b")
+# define CREATE(name)           fopen  (name, "wb" )
+# define INVALID_FILEDESC       NULL
+# define CLOSE(fp)              fclose (fp)                  // CLOSE   returns -1 on error, otherwise 0
+# define READ(fp,ptr,len)       fread  (ptr, 1, len, fp)     // READ    returns -1 or 0 on error/EOF, otherwise > 0
+# define READ1(fp,ptr)          fread  (ptr, 1, 1, fp)       // READ    returns -1 or 0 on error/EOF, otherwise > 0
+# define WRITE(fp,ptr,len)      fwrite (ptr, 1, len, fp)     // WRITE   returns -1 or 0 on error/EOF, otherwise > 0
+# define SEEK(fp,offs,lbl)      fseek  (fp, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
+# define FILEPOS(fp)            ftell  (fp)                  // FILEPOS returns -1 on error, otherwise >= 0
+# define STDIN                  stdin
+# define STDOUT                 stdout
+# define STDERR                 stderr
+# define FDOPEN(fd,mode)        fdopen (fd, mode)
+# define UNBUFFER(fp)           setvbuf(fp, NULL, _IONBF, 0 )
+# define FLUSH(fp)              fflush (fp)
+#endif /* FILEIO==1 */
+
+// file I/O using POSIX unbuffered file I/O via file descriptors (open, read, write, close)
+#if  FILEIO == 2
+# ifdef WIN32
+#  define OFF_T                 _off_t
+# else
+#  define OFF_T                 off_t
+# endif
+# define FILE_T                 int
+# define OPEN(name)             open  (name, O_RDONLY|O_BINARY)
+# define OPENRW(name)           open  (name, O_RDWR  |O_BINARY)
+# define CREATE(name)           open  (name, O_WRONLY|O_BINARY|O_TRUNC|O_CREAT, 0644)
+# define INVALID_FILEDESC       (-1)
+# define CLOSE(fd)              close (fd)                   // CLOSE   returns -1 on error, otherwise 0
+# if defined HAVE_INCOMPLETE_READ
+#  define READ(fd,ptr,len)      complete_read (fd, ptr, len) // READ    returns -1 or 0 on error/EOF, otherwise > 0
+# else
+#  define READ(fd,ptr,len)      (size_t)read   (fd, ptr, len)// READ    returns -1 or 0 on error/EOF, otherwise > 0
+# endif
+# define READ1(fd,ptr)          (size_t)read   (fd, ptr, 1)  // READ    returns -1 or 0 on error/EOF, otherwise > 0
+# define WRITE(fd,ptr,len)      (size_t)write  (fd, ptr, len)// WRITE   returns -1 or 0 on error/EOF, otherwise > 0
+# define SEEK(fd,offs,lbl)      lseek  (fd, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
+# define FILEPOS(fd)            lseek  (fd, 0L, SEEK_CUR)    // FILEPOS returns -1 on error, otherwise >= 0
+# define STDIN                  0
+# define STDOUT                 1
+# define STDERR                 2
+# define FDOPEN(fd,mode)        (fd)
+# define UNBUFFER(fd)           (void)(fd)
+# define FLUSH(fd)              (void)(fd)
+#endif /* FILEIO==2 */
+
+// file I/O using Turbo-C lowest level unbuffered file I/O via file descriptors (_open, _read, _write, _close)
+#if  FILEIO == 3
+# define OFF_T                  signed long
+# define FILE_T                 int
+# define OPEN(name)             _open (name, O_RDONLY)
+# define OPENRW(name)           _open (name, O_RDWR  )
+# define CREATE(name)           _creat(name, 0)
+# define INVALID_FILEDESC       (-1)
+# define CLOSE(fd)              _close (fd)                  // CLOSE   returns -1 on error, otherwise 0
+# define READ(fd,ptr,len)       (size_t)_read  (fd, ptr, len)// READ    returns -1 or 0 on error/EOF, otherwise > 0
+# define READ1(fd,ptr)          (size_t)_read  (fd, ptr, 1)  // READ    returns -1 or 0 on error/EOF, otherwise > 0
+# define WRITE(fd,ptr,len)      (size_t)_write (fd, ptr, len)// WRITE   returns -1 or 0 on error/EOF, otherwise > 0
+# define SEEK(fd,offs,lbl)      lseek  (fd, offs, lbl)       // SEEK    returns -1 on error, otherwise >= 0
+# define FILEPOS(fd)            lseek  (fd, 0L, SEEK_CUR)    // FILEPOS returns -1 on error, otherwise >= 0
+# define STDIN                  0
+# define STDOUT                 1
+# define STDERR                 2
+# undef  SETBINARY_IN
+# undef  SETBINARY_OUT
+# define SETBINARY_IN(fd)       (fd)
+# define SETBINARY_OUT(fd)      (fd)
+# define FDOPEN(fd,mode)        (fd)
+# define UNBUFFER(fd)           (void)(fd)
+# define FLUSH(fd)              (void)(fd)
+#endif /* FILEIO==3 */
+
+#if FILEIO != 2  &&  defined USE_HTTP
+# error HTTP can only be used by FILEIO==2
+#endif
+
+#if defined _WIN32  ||  defined __BEOS__
+# define WRITE_SOCKET(sock,ptr,len)     send (sock, ptr, len, 0)
+# define READ_SOCKET(sock,ptr,len)      recv (sock, ptr, len, 0)
+#else
+# define WRITE_SOCKET(sock,ptr,len)     write (sock, ptr, len)
+# define READ_SOCKET(sock,ptr,len)      read  (sock, ptr, len)
+#endif
+
+#ifdef _WIN32
+# define POPEN_READ_BINARY_OPEN(cmd)    _popen ((cmd), "rb")
+# define POPEN_WRITE_BINARY_OPEN(cmd)   _popen ((cmd), "wb")
+# define PCLOSE(fp)                     _pclose(fp)
+#else
+# define POPEN_READ_BINARY_OPEN(cmd)    popen ((cmd), "r")
+# define POPEN_WRITE_BINARY_OPEN(cmd)   popen ((cmd), "w")
+# define PCLOSE(fp)                     pclose(fp)
+#endif
+
+#if defined _WIN32
+# define STRUCT_STAT            struct _stat
+# define STAT_CMD(f,s)          _stat (f, s)
+#else
+# define STRUCT_STAT            struct stat
+# define STAT_CMD(f,s)          stat (f, s)
+#endif /* WIN32 */
+
+#ifndef S_ISDIR
+# if   defined S_IFDIR
+#  define S_ISDIR(x)            ((x) &   S_IFDIR)
+# elif defined _S_IFDIR
+#  define S_ISDIR(x)            ((x) &  _S_IFDIR)
+# elif defined __S_IFDIR
+#  define S_ISDIR(x)            ((x) & __S_IFDIR)
+# else
+#  error Cannot find a way to test for a directory
+# endif
+#endif /* !S_ISDIR */
+
+#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __TURBOC__  ||  defined _WIN32  ||  defined __APPLE__
+# define ISATTY(fd)             isatty (fd)
+#else
+# define ISATTY(fd)             0
+#endif
+
+// Path separator
+#if defined __unix__  ||  defined __bsdi__  ||  defined __FreeBSD__  ||  defined __OpenBSD__  ||  defined __NetBSD__  ||  defined __APPLE__
+# define PATH_SEP               '/'
+# define DRIVE_SEP              '\0'
+# define EXE_EXT                ""
+# define DEV_NULL               "/dev/null"
+# define ENVPATH_SEP            ':'
+#elif defined _WIN32  ||  defined __TURBOC__  ||  defined __ZTC__  ||  defined _MSC_VER
+# define PATH_SEP               '\\'
+# define DRIVE_SEP              ':'
+# define EXE_EXT                ".exe"
+# define DEV_NULL               "\\nul"
+# define ENVPATH_SEP            ';'
+#else
+# define PATH_SEP               '/'         // Amiga: C:/
+# define DRIVE_SEP              ':'
+# define EXE_EXT                ""
+# define DEV_NULL               "nul"
+# define ENVPATH_SEP            ';'
+#endif
+
+// maximum length of file names
+#ifndef PATHLEN_MAX
+# if   defined FILENAME_MAX
+#  define PATHLEN_MAX           FILENAME_MAX
+# elif INT_MAX < 2147483647L
+#  define PATHLEN_MAX            128
+# else
+#  define PATHLEN_MAX           1024
+# endif
+#endif /* !PATHLEN_MAX */
+
+#ifdef _WIN32
+# define TitleBar(text)   SetConsoleTitle (text)
+#else
+# define TitleBar(text)   (void) (text)
+#endif
+
+
+//// constants /////////////////////////////////////////////////////
+#ifdef USE_SV8
+# define MAX_SV          "SV8"
+#else
+# define MAX_SV          "SV7"
+#endif
+
+#ifdef USE_ASM
+# define BUILD           "3DNOW!/SSE"
+#else
+# define BUILD           ""
+#endif
+
+
+#define COPYRIGHT        "(C) 1999-2003 Buschmann/Klemm/Piecha/Wolf"
+
+#define DECODER_DELAY    (512 - 32 + 1)
+#define BLK_SIZE         (36 * 32)
+
+
+//// logging defines, for development only /////////////////////////
+#if defined _WIN32  ||  defined __TURBOC__
+# define LOGPATH         ".\\"
+# define MUSICPATH       "D:\\AUDIO\\"
+#else
+# define LOGPATH         "./"
+# define MUSICPATH       "/Archive/Audio/"
+#endif
+#define _(x)             (void)(fprintf(stderr,"<%d>\n",(x)),fflush(stderr))
+
+#ifdef DEBUG
+# define REP(x)          (void)(x)
+#else
+# define REP(x)
+#endif
+
+
+//// numerical constants ///////////////////////////////////////////
+#define C00              (Float) 0.500000000000000000000000L    // Cxx = 0.5 / cos (xx*M_PI/64)
+#define C01              (Float) 0.500602998235196301334178L
+#define C02              (Float) 0.502419286188155705518560L
+#define C03              (Float) 0.505470959897543659956626L
+#define C04              (Float) 0.509795579104159168925062L
+#define C05              (Float) 0.515447309922624546962323L
+#define C06              (Float) 0.522498614939688880640101L
+#define C07              (Float) 0.531042591089784174473998L
+#define C08              (Float) 0.541196100146196984405269L
+#define C09              (Float) 0.553103896034444527838540L
+#define C10              (Float) 0.566944034816357703685831L
+#define C11              (Float) 0.582934968206133873665654L
+#define C12              (Float) 0.601344886935045280535340L
+#define C13              (Float) 0.622504123035664816182728L
+#define C14              (Float) 0.646821783359990129535794L
+#define C15              (Float) 0.674808341455005746033820L
+#define C16              (Float) 0.707106781186547524436104L
+#define C17              (Float) 0.744536271002298449773679L
+#define C18              (Float) 0.788154623451250224773056L
+#define C19              (Float) 0.839349645415527038721463L
+#define C20              (Float) 0.899976223136415704611808L
+#define C21              (Float) 0.972568237861960693780520L
+#define C22              (Float) 1.060677685990347471323668L
+#define C23              (Float) 1.169439933432884955134476L
+#define C24              (Float) 1.306562964876376527851784L
+#define C25              (Float) 1.484164616314166277319733L
+#define C26              (Float) 1.722447098238333927796261L
+#define C27              (Float) 2.057781009953411550808880L
+#define C28              (Float) 2.562915447741506178719328L
+#define C29              (Float) 3.407608418468718785698107L
+#define C30              (Float) 5.101148618689163857960189L
+#define C31              (Float)10.190008123548056810994678L
+
+#define SS05             (Float) 0.840896415253714543018917L      // 0.5^0.25
+
+
+#ifndef M_PI
+# define M_PI            3.1415926535897932384626433832795029     // 4*atan(1)
+# define M_PIl           3.1415926535897932384626433832795029L
+# define M_LN2           0.6931471805599453094172321214581766     // ln(2)
+# define M_LN2l          0.6931471805599453094172321214581766L
+# define M_LN10          2.3025850929940456840179914546843642     // ln 10 */
+# define M_LN10l         2.3025850929940456840179914546843642L
+#endif
+
+
+//// 'Cdecl' forces the use of standard C/C++ calling convention ///////
+#if   defined _WIN32
+# define Cdecl           __cdecl
+#elif defined __ZTC__
+# define Cdecl           _cdecl
+#elif defined __TURBOC__
+# define Cdecl           cdecl
+#else
+# define Cdecl
+#endif
+
+//// expect handling of GCC ////////////////////////////////////////
+#ifdef __GNUC__
+# if __GNUC__ < 3
+#  define __builtin_expect(cond,exp)  (cond)
+#  ifndef expect
+#    define expect(cond,exp)          __builtin_expect(cond,exp)
+#  endif
+# else
+#  ifndef expect
+#   define expect(cond,exp)           __builtin_expect(cond,exp)
+#  endif
+# endif
+#else
+# define __builtin_expect(cond,exp)   (cond)
+# ifndef expect
+#  define expect(cond,exp)            __builtin_expect(cond,exp)
+# endif
+#endif
+
+#define if0(x)                        if (expect(x,0))
+#define if1(x)                        if (expect(x,1))
+#define while0(x)                     while (expect(x,0))
+#define while1(x)                     while (expect(x,1))
+
+#ifndef __GNUC__
+# define __attribute__(x)
+#else
+# define __attribute__(x)
+#endif
+
+//// Remaining macros //////////////////////////////////////////////
+// selects input buffer size and some constants needed for input buffer handling
+#ifndef IBUFLOG2                 // must be at least 10 (bitrate always <626 kbps) or better 11 ( <1253 kbps)
+# if INT_MAX < 2147483647L
+#  define IBUFLOG2       11      // 8 KByte buffer, possible 11...13 (32 KByte limit)
+# else
+#  define IBUFLOG2       21      // 8 MByte buffer, possible 11...29 ( 2 GByte limit)
+# endif
+#endif
+#define IBUFSIZE         ((size_t)(1LU<<(IBUFLOG2)))
+#define IBUFSIZE2        ((size_t)((IBUFSIZE)/2))
+#define IBUFMASK         ((size_t)((IBUFSIZE)-1))
+
+// save memory space for 16 bit compiler (data + stack < 64 KByte)
+#if INT_MAX < 2147483647L
+# if VIRT_SHIFT     >  6
+#  undef  VIRT_SHIFT
+#  define VIRT_SHIFT   6
+# endif
+# if      IBUFLOG2  > 11
+#  undef  IBUFLOG2
+#  define IBUFLOG2    11
+# endif
+# define USE_HUFF_PACK
+# define USE_ARRAY_PACK
+#endif
+
+// generate a macro which contains information about compile time settings
+#define STR(x)   _STR(x)
+#define _STR(x)  #x
+#ifdef NDEBUG
+# define T1  ""
+#else
+# define T1  "DEBUG "
+#endif
+#if  defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO  ||  defined USE_WIN_AUDIO
+# define T2  "SND "
+#else
+# define T2  ""
+#endif
+#ifdef USE_NICE
+# define T3  "NICE "
+#else
+# define T3  ""
+#endif
+#if defined USE_REALTIME
+# define T4  "RT "
+#else
+# define T4  ""
+#endif
+#ifdef HAVE_IEEE754_FLOAT
+# define T5  "IEEE "
+#else
+# define T5  ""
+#endif
+#define T6  "IO=" STR(FILEIO) " "
+#ifdef USE_HUFF_PACK
+# define T7  "H-PCK "
+#else
+# define T7  ""
+#endif
+#ifdef USE_ARRAY_PACK
+# define T8  "A-PCK "
+#else
+# define T8  ""
+#endif
+#define T9  "SHFT=" STR(VIRT_SHIFT) " "
+#define T10 "IBUF=" STR(IBUFLOG2) " "
+
+#define COMPILER_FLAGS  T1 T2 T3 T4 T5 T6 T7 T8 T9 T10
+
+// align a pointer by maybe incrementing it
+#define ALIGN(ptr,alignment) \
+                    (void*)((((ptrdiff_t)(ptr)) & (-(ptrdiff_t)(alignment))) + (alignment))   // aligns a pointer with alignment, the source array should be at least alignment-1 Bytes longer than the needed length
+
+
+//// Simple types //////////////////////////////////////////////////
+
+#if   CHAR_BIT == 8  &&  SCHAR_MAX == 127L
+typedef unsigned char       Uint8_t;    // guaranteed  8 bit unsigned integer type with range 0...255
+typedef signed   char       Int8_t;     // guaranteed  8 bit signed   integer type with range -128...127
+#else
+# error No  8 bit int type found. Tested: char
+#endif
+
+#if   SHRT_MAX == 32767L
+typedef unsigned short int  Uint16_t;   // guaranteed 16 bit unsigned integer type with range 0...65535
+typedef signed   short int  Int16_t;    // guaranteed 16 bit signed   integer type with range -32768...32767
+#else
+# error No 16 bit int type found. Tested: short
+#endif
+
+#if   INT_MAX == 2147483647L
+typedef unsigned int        Uint32_t;   // guaranteed 32 bit unsigned integer type with range 0...4294967295
+typedef signed   int        Int32_t;    // guaranteed 32 bit signed   integer type with range -2147483648...2147483647
+#elif LONG_MAX == 2147483647L
+typedef unsigned long int   Uint32_t;   // guaranteed 32 bit unsigned integer type with range 0...4294967295
+typedef signed   long int   Int32_t;    // guaranteed 32 bit signed   integer type with range -2147483648...2147483647
+#else
+# error No 32 bit int type found. Tested: int, long
+#endif
+
+#if    defined __C99__                 // C9x has a type which is exact 64 bit
+typedef int64_t             Int64_t;
+typedef uint64_t            Uint64_t;
+typedef intmax_t            IntMax_t;
+typedef uintmax_t           UintMax_t;
+# define IntMax_MIN        -9223372036854775808
+# define IntMax_MAX         9223372036854775807
+# define UintMax_MAX       18446744073709551615
+# define UintMAX_FP(x)      (long double)(x)
+#elif  defined __GNUC__                // GCC uses long long as 64 bit
+typedef signed   long long  Int64_t;
+typedef unsigned long long  Uint64_t;
+typedef signed   long long  IntMax_t;
+typedef unsigned long long  UintMax_t;
+# define IntMax_MIN        -9223372036854775808LL
+# define IntMax_MAX         9223372036854775807LL
+# define UintMax_MAX       18446744073709551615LLU
+# define UintMAX_FP(x)      (long double)(x)
+#elif defined _MSC_VER
+typedef signed   __int64    Int64_t;
+typedef unsigned __int64    Uint64_t;
+typedef signed   __int64    IntMax_t;
+typedef unsigned __int64    UintMax_t;
+# define IntMax_MIN        -9223372036854775808I64
+# define IntMax_MAX         9223372036854775807I64
+# define UintMax_MAX       18446744073709551615UI64
+# define UintMAX_FP(x)      (long double)(IntMax_t)(x)
+#elif defined LLONG_MAX               // long long (when existing) is normally 64 bit
+typedef signed   long long  Int64_t;
+typedef unsigned long long  Uint64_t;
+typedef signed   long long  IntMax_t;
+typedef unsigned long long  UintMax_t;
+# define IntMax_MIN        -9223372036854775808LL
+# define IntMax_MAX         9223372036854775807LL
+# define UintMax_MAX       18446744073709551615LLU
+# define UintMAX_FP(x)      (long double)(x)
+#elif  LONG_MAX > 0xFFFFFFFFLU         // long is longer than 33 bit, assume 64 bit
+typedef signed   long       Int64_t;
+typedef unsigned long       Uint64_t;
+typedef signed   long       IntMax_t;
+typedef unsigned long       UintMax_t;
+# define IntMax_MIN        -9223372036854775808L
+# define IntMax_MAX         9223372036854775807L
+# define UintMax_MAX       18446744073709551615LU
+# define UintMAX_FP(x)      (long double)(x)
+#elif  defined _WIN32                  // Microsoft and Intel call it __int64
+typedef signed   __int64    Int64_t;
+typedef unsigned __int64    Uint64_t;
+typedef signed   __int64    IntMax_t;
+typedef unsigned __int64    UintMax_t;
+# define IntMax_MIN        -9223372036854775808I64
+# define IntMax_MAX         9223372036854775807I64
+# define UintMax_MAX       18446744073709551615UI64
+# define UintMAX_FP(x)      (long double)(IntMax_t)(x)
+#else
+# define NO_INT64_T                    // no type mapped to 64 bit integer
+typedef signed   long       IntMax_t;
+typedef unsigned long       UintMax_t;
+# define IntMax_MIN        -2147483648L
+# define IntMax_MAX         2147483647L
+# define UintMax_MAX        4294967295LU
+# define UintMAX_FP(x)      (long double)(x)
+#endif
+
+
+#if defined _WIN32  &&  !defined __GNUC__  &&  !defined __C99__
+typedef signed long         ssize_t;
+#endif
+
+#ifdef USE_ARRAY_PACK
+typedef signed char         Bool_t;     // ==0: false, !=0: true
+#else
+typedef signed int          Bool_t;     // ==0: false, !=0: true
+#endif
+typedef Uint32_t            Ibuf_t;     // type for input buffer, currently this type must be 32 bit
+typedef signed   char       Schar;      // at least -127...+127
+typedef unsigned char       Uchar;      // at least 0...255
+typedef signed   short int  Short;      // at least -32767...+32767, memory economic type
+typedef unsigned short int  Ushort;     // at least 0...65535, memory economic type
+typedef signed   int        Int;        // at least -32767...+32767, fast type
+typedef unsigned int        Uint;       // at least 0...65535, fast type
+typedef signed   long int   Long;       // at least -2147483647...+2147483647, but more is better
+typedef unsigned long int   Ulong;      // at least 0...4294967295, but more is better
+//                          size_t;     // size of memory objects
+//                          ptrdiff_t;  // pointer differences, may be larger than size_t
+typedef float               Float32_t;  // guaranteed 32 bit floating point type
+typedef double              Float64_t;  // guaranteed 64 bit floating point type
+typedef float               Float;      // fastest floating point type, memory economic (used for all PCM calculations)
+#define SIZEOF_Float  4                 // size of the type 'Float' in sizeof units
+typedef double              Double;     // floating point with extended precision (more than 32 bit mantissa)
+typedef long double         Ldouble;    // most exact floating point format
+typedef Int16_t             Int2x16_t [2];
+typedef Int32_t             Int2x32_t [2];
+
+#if   defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
+# ifdef NO_INT64_T
+#   error No 64 bit int type found, needed for HQ 16...32 bit output
+# endif
+typedef Int2x32_t           Int2xSample_t;
+# if defined MAKE_32BIT
+#  define SAMPLE_SIZE        32
+#  define PROG_NAME          "mppdec32"
+#  define SAMPLE_SIZE_STRING " (32 bit HQ)"
+#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x32bit ( fd, p, b )
+#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
+                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
+#  undef  USE_ESD_AUDIO
+# elif defined MAKE_24BIT
+#  define SAMPLE_SIZE        24
+#  define PROG_NAME          "mppdec24"
+#  define SAMPLE_SIZE_STRING " (24 bit HQ)"
+#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x24bit ( fd, p, b )
+#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
+                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
+#  undef  USE_ESD_AUDIO
+# elif defined MAKE_16BIT
+#  define SAMPLE_SIZE        16
+#  define PROG_NAME          "mppdec16"
+#  define SAMPLE_SIZE_STRING " (16 bit HQ)"
+#  define Write_PCM(fd,p,b)  Write_PCM_HQ_2x16bit ( fd, p, b )
+#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
+                            Synthese_Filter_32_C ( Stream, offset, Vi, Yi, ch )
+# endif
+#else
+typedef Int2x16_t           Int2xSample_t;
+# define SAMPLE_SIZE        16
+# define PROG_NAME          "mppdec"
+# define SAMPLE_SIZE_STRING ""
+# define Write_PCM(fd,p,b)  Write_PCM_2x16bit ( fd, p, b )
+# ifdef USE_ASM
+#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
+                            Synthese_Filter_16 ( Stream, offset, Vi, Yi )
+# else
+#  define Synthese_Filter(Stream,offset,Vi,Yi,ch) \
+                            Synthese_Filter_16_C ( Stream, offset, Vi, Yi )
+# endif /* USE_ASM */
+#endif
+
+
+//// More complex types ////////////////////////////////////////////
+typedef struct {
+    Int    L [36];
+    Int    R [36];
+} Quant_t ;
+
+typedef struct {
+    Uint   L;
+    Uint   R;
+} UPair_t ;
+
+typedef struct {
+    Int    L;
+    Int    R;
+} Pair_t ;
+
+typedef struct {
+#ifdef USE_ARRAY_PACK
+    Schar  L;
+    Schar  R;
+#else
+    Int    L;
+    Int    R;
+#endif
+} CPair_t ;
+
+typedef Float     FloatArray [32];
+typedef UPair_t   UPairArray [32];
+typedef Pair_t    PairArray  [32];
+typedef CPair_t   CPairArray [32];
+typedef Float     SCFTriple   [3];
+typedef struct {
+#ifndef MPP_ENCODER
+    Uint32_t      Code;         // >=32 bit
+# ifdef USE_HUFF_PACK
+    Schar         Value;        // >= 7 bit
+    Uchar         Length;       // >= 4 bit
+# else
+    Int           Value;
+    Uint          Length;
+# endif
+#else
+# ifdef USE_HUFF_PACK
+    Uint8_t       Length;      // >=  4 bit
+    Uint8_t       ___;
+    Uint16_t      Code;        // >= 14 bit
+# else
+    Uint          Code;
+    Uint          Length;
+# endif
+#endif
+} Huffman_t ;
+
+typedef struct {
+    Uint          Code   : 16;  // >= 14 bit
+    Uint          Length :  8;  // >=  4 bit
+} HuffSrc_t ;
+
+typedef struct {
+    OFF_T         FileSize;
+    Int           GenreNo;
+    Int           TrackNo;
+    char          Genre   [128];
+    char          Year    [ 20];
+    char          Track   [  8];
+    char          Title   [256];
+    char          Artist  [256];
+    char          Album   [256];
+    char          Comment [512];
+} TagInfo_t ;
+
+typedef void  (*SyntheseFilter16_t) ( Int2x16_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi );
+typedef void  (*SyntheseFilter32_t) ( Int2x32_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi, int ch );
+typedef Int   (*HeaderWriter_t)     ( FILE_T outputFile, Ldouble  SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
+
+#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
+typedef struct {
+    const Float*  FilterCoeff;
+    Uint64_t      Mask;
+    Float64_t     Add;
+    Float         Dither;
+    Uint32_t      Overdrives;
+    Int64_t       MaxLevel;
+    Bool_t        NoShaping;
+    Float         ErrorHistory     [2] [16];       // max. 2 channels, 16th order Noise shaping
+    Float         DitherHistory    [2] [16];
+    Int32_t       LastRandomNumber [2];
+} dither_t;
+#else
+typedef struct {
+    Uint32_t      Overdrives;
+    Int32_t       MaxLevel;
+} dither_t;
+#endif
+
+
+//// Variables /////////////////////////////////////////////////////
+
+// decode.c
+extern Ibuf_t             InputBuff [IBUFSIZE]; // read buffer for the MP+ data stream
+extern size_t             InputCnt;             // current offset in this buffer
+
+// huffsv7.c
+extern Huffman_t          HuffHdr    [10];
+extern Huffman_t          HuffSCFI   [ 4];
+extern Huffman_t          HuffDSCF   [16];
+extern Huffman_t          HuffQ1 [2] [ 3*3*3];
+extern Huffman_t          HuffQ2 [2] [ 5*5];
+extern Huffman_t          HuffQ3 [2] [ 7];
+extern Huffman_t          HuffN3 [2] [ 7*7];
+extern Huffman_t          HuffQ4 [2] [ 9];
+extern Huffman_t          HuffQ5 [2] [15];
+extern Huffman_t          HuffQ6 [2] [31];
+extern Huffman_t          HuffQ7 [2] [63];
+extern Huffman_t          HuffN8 [2][127];
+extern const Huffman_t*   HuffQ  [2] [ 8];
+extern const Huffman_t*   HuffN  [2] [ 9];
+extern Uint8_t            LUT1_0  [1<< 6];
+extern Uint8_t            LUT1_1  [1<< 9];
+extern Uint8_t            LUT2_0  [1<< 7];
+extern Uint8_t            LUT2_1  [1<<10];
+extern Uint8_t            LUT3_0  [1<< 4];
+extern Uint8_t            LUT3_1  [1<< 5];
+extern Uint8_t            LUT4_0  [1<< 4];
+extern Uint8_t            LUT4_1  [1<< 5];
+extern Uint8_t            LUT5_0  [1<< 6];
+extern Uint8_t            LUT5_1  [1<< 8];
+extern Uint8_t            LUT6_0  [1<< 7];
+extern Uint8_t            LUT6_1  [1<< 7];
+extern Uint8_t            LUT7_0  [1<< 8];
+extern Uint8_t            LUT7_1  [1<< 8];
+extern Uint8_t            LUTDSCF [1<< 6];
+
+// huffsv46.c
+extern const Huffman_t*   Entropie      [18];
+extern const Huffman_t*   Region        [32];
+extern Huffman_t          SCFI_Bundle   [ 8];
+extern Huffman_t          DSCF_Entropie [13];
+
+// mppdec.c
+extern Float              Y_L      [36] [32];
+extern Float              Y_R      [36] [32];
+extern CPair_t            SCF_Index [3] [32];      // Scalefactor
+extern CPair_t            Res           [32];      // resolution steps of the subbands
+extern Quant_t            Q             [32];      // quantized samples
+extern CPair_t            SCFI          [32];      // transfer order of the SCF
+extern Bool_t             MS_Band       [32];      // subband-wise flag for M/S-signal guidance
+extern Bool_t             MS_used;                 // global flag for M/S-signal guidance
+extern Bool_t             IS_used;
+
+#define LITTLE                  0
+#define BIG                     1
+extern Bool_t                   output_endianess;
+#if   ENDIAN == HAVE_LITTLE_ENDIAN
+# define machine_endianess      LITTLE
+#elif ENDIAN == HAVE_BIG_ENDIAN
+# define machine_endianess      BIG
+#endif
+
+// requant.c
+extern Float              __SCF    [6 + 128];       // tabulated Scalefactors from -6 to +127
+#define SCF             ( __SCF + 6 )
+extern Int8_t             Q_bit         [32];       // number of bits to save the resolution (SV6)
+extern Int8_t             Q_res         [32] [16];  // Index -> resolution (SV6)
+extern Uint               Bitrate;
+extern Int                Min_Band;
+extern Int                Max_Band;
+extern Float              __Cc          [1 + 18];
+extern const Uint         __Dc          [1 + 18];
+#define Cc              ( __Cc + 1 )
+#define Dc              ( __Dc + 1 )
+
+// synthtab.c
+extern const Float        Cos64         [32];
+extern const Float        Di_opt        [32] [16];
+
+// stderr.c
+
+
+//// procedures/functions //////////////////////////////////////////
+// cpu_feat.c
+Bool_t Cdecl  Has_MMX                 ( void );
+Bool_t Cdecl  Has_SIMD                ( void );
+Bool_t Cdecl  Has_SIMD2               ( void );
+Bool_t Cdecl  Has_3DNow               ( void );
+
+// decode.c
+void       Bitstream_init             ( void );
+Ulong      BitsRead                   ( void );
+Uint32_t   Bitstream_read             ( Int  bits );
+Uint32_t   Bitstream_peek             ( Uint pos, Int bits );
+void       Bitstream_skip             ( Uint bits );
+Uint32_t   Bitstream_preview          ( Int  bits );  // same as above, but data doesn't get receipted yet
+void       Read_Bitstream_SV6         ( void );
+void       Read_Bitstream_SV7         ( void );
+void       Read_Bitstream_SV8         ( void );
+
+// http.c
+int        http_open                  ( const char* URL );
+
+// huffsv7.c
+void       Init_Huffman_Decoder_SV7   ( void );
+void       Init_Huffman_Encoder_SV7   ( void );
+
+// huffsv46.c
+void       Init_Huffman_Decoder_SV4_6 ( void );
+
+// id3tag.c
+Int        Read_ID3V1_Tags            ( FILE_T fp, TagInfo_t* tip );
+Int        Read_APE_Tags              ( FILE_T fp, TagInfo_t* tip );
+
+// requant.c
+void       Init_QuantTab              ( Int maximum_Band, Bool_t used_IS, Double amplification, Uint StreamVersion );
+
+// synth.c
+Uint32_t   random_int                 ( void );
+
+void Cdecl Calculate_New_V_i387       ( const Float* Sample, Float* V );
+void Cdecl Calculate_New_V_3DNow      ( const Float* Sample, Float* V );
+void Cdecl New_V_Helper2              ( Float* A, const Float* Sample );
+void Cdecl New_V_Helper3              ( Float* A, const Float* Sample );
+void Cdecl New_V_Helper4              ( Float* V );
+
+void Cdecl VectorMult_i387            ( void* buff, const Float* V );
+void Cdecl VectorMult_3DNow           ( void* buff, const Float* V );
+void Cdecl VectorMult_SIMD            ( void* buff, const Float* V );
+
+void       Synthese_Filter_16_C       ( Int2x16_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi );
+void       Synthese_Filter_32_C       ( Int2x32_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi, Uint channel );
+
+void Cdecl Reset_FPU                  ( void );
+void Cdecl Reset_FPU_3DNow            ( void );
+void Cdecl memcpy_dn_MMX              ( void* dst, const void* src, size_t words64byte  );
+void Cdecl memcpy_dn_SIMD             ( void* dst, const void* src, size_t words128byte );
+
+void       Init_Dither                ( Int bits, int shapingtype, Double dither );
+void       OverdriveReport            ( void );
+SyntheseFilter16_t
+           Get_Synthese_Filter        ( void );
+
+// tools.c
+size_t     Read_LittleEndians         ( FILE_T fp, Uint32_t* dst, size_t words32bit );
+void       Requantize_MidSideStereo   ( Int Stop_Band, const Bool_t* used_MS );
+void       Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band );
+void       Resort_HuffTable           ( Huffman_t* const Table, const size_t elements, Int offset );
+void       Make_HuffTable             ( Huffman_t* dst, const HuffSrc_t* src, size_t len );
+void       Make_LookupTable           ( Uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements );
+size_t     complete_read              ( int fd, void* dest, size_t bytes );
+int        isdir                      ( const char* Name );
+void       Init_FPU                   ( void );
+
+// wave_out.c
+Int        Write_WAVE_Header          ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
+Int        Write_AIFF_Header          ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
+Int        Write_Raw_Header           ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels, Ulong SamplesPerChannel );
+Int        Set_DSP_OSS_Params         ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
+Int        Set_DSP_Sun_Params         ( FILE_T outputFile, Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
+Int        Set_ESD_Params             ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
+Int        Set_WIN_Params             ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
+Int        Set_IRIX_Params            ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
+size_t     Write_PCM_2x16bit          ( FILE_T outputFile, Int2x16_t* data, size_t len );
+size_t     Write_PCM_HQ_2x16bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
+size_t     Write_PCM_HQ_2x24bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
+size_t     Write_PCM_HQ_2x32bit       ( FILE_T outputFile, Int2x32_t* data, size_t len );
+int        WIN_Play_Samples           ( const void* buff, size_t len );
+int        IRIX_Play_Samples          ( const void* buff, size_t len );
+int        WIN_Audio_close            ( void );
+int        IRIX_Audio_close           ( void );
+void       DisableSUID                ( void );
+void       EnableSUID                 ( void );
+
+// pipeopen.c
+FILE*      pipeopen                   ( const char* command, const char* filename );
+
+// stderr.c
+void       SetStderrSilent            ( Bool_t state );
+Bool_t     GetStderrSilent            ( void );
+int Cdecl  stderr_printf              ( const char* format, ... );
+
+// _setargv.c
+long       treewalk                   ( const char* start, const char** mask, int (*fn)(const char* filename, void* aux), void* aux );
+void       mysetargv                  ( int* argc, char*** argv, const char** extentions );
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+
+# define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
+# define ReadBE32(dst,psrc)                           \
+       ((Uint8_t*)&(dst))[0] = ((Uint8_t*)(psrc))[3], \
+       ((Uint8_t*)&(dst))[1] = ((Uint8_t*)(psrc))[2], \
+       ((Uint8_t*)&(dst))[2] = ((Uint8_t*)(psrc))[1], \
+       ((Uint8_t*)&(dst))[3] = ((Uint8_t*)(psrc))[0]
+
+
+#elif defined __i386__           /* 486+ */
+
+#  define ReadBE32(dst,psrc)      __asm__ ( "bswap %0" : "=r" (dst) : "0" (*(Uint32_t*)(psrc)) )
+#  define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
+
+# else
+
+#  define ReadBE32(dst,psrc)                          \
+       ((Uint8_t*)&(dst))[0] = ((Uint8_t*)(psrc))[3], \
+       ((Uint8_t*)&(dst))[1] = ((Uint8_t*)(psrc))[2], \
+       ((Uint8_t*)&(dst))[2] = ((Uint8_t*)(psrc))[1], \
+       ((Uint8_t*)&(dst))[3] = ((Uint8_t*)(psrc))[0]
+#  define ReadLE32(dst,psrc)       dst = *(Uint32_t*)(psrc)
+
+# endif
+
+//// Profiler include //////////////////////////////////////////////
+#include "profile.h"
+
+#ifdef _MSC_VER
+#pragma warning ( disable : 4244 )
+#endif
+
+#endif /* MPPDEC_MPPDEC_H */
+
+/* end of mppdec.h */
Index: /mppenc/trunk/src/mppenc.c
===================================================================
--- /mppenc/trunk/src/mppenc.c	(revision 97)
+++ /mppenc/trunk/src/mppenc.c	(revision 97)
@@ -0,0 +1,1984 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/* overflow of subband-samples */
+
+#include <memory.h>
+#include <time.h>
+#include <errno.h>
+#include "mppenc.h"
+
+/* G L O B A L  V A R I A B L E S */
+float         SNR_comp_L [32];
+float         SNR_comp_R [32];             // SNR-compensation after SCF-combination and ANS-gain
+float         Power_L    [32] [3];
+float         Power_R    [32] [3];
+float         PNS = 0.;
+int           Max_Band;                    // maximum bandwidth
+
+/* MS-Coding */
+unsigned int  MS_Channelmode;              // global flag for enhanced functionality
+float         SampleFreq      =  0.;
+float         Bandwidth       =  0.;
+int           PredictionBands =  0;
+int           CombPenalities  = -1;
+float         KBD1            =  2;
+float         KBD2            = -1.;
+int           DisplayUpdateTime = 1;
+int           APE_Version     = 2000;
+int           LowDelay        = 0;
+Bool_t        EnableTags      = 0;
+Bool_t        IsEndBeep       = 0;
+
+#define MODE_OVERWRITE          0
+#define MODE_NEVER_OVERWRITE    1
+#define MODE_ASK_FOR_OVERWRITE  2
+
+/* other general global variables */
+unsigned int  DelInput        = 0;      // deleting the input file after encoding
+unsigned int  WriteMode       = MODE_ASK_FOR_OVERWRITE;      // overwriting a possibly existing MPC file
+int           MainQual;                 // Profiles
+unsigned int  verbose         = 0;      // more information during output
+unsigned int  NoUnicode       = 1;      // console is unicode or not (tag translation)
+UintMax_t     SamplesInWAVE   = 0;      // number of samples per channel in the WAV file
+unsigned int  Overflows       = 0;      // number of internal (filterbank) clippings
+float         MaxOverFlow     = 0.f;    // maximum overflow
+float         ScalingFactorl  = 1.f;    // Scaling the input signal
+float         ScalingFactorr  = 1.f;    // Scaling the input signal
+float         FadeShape       = 1.f;    // Shape of the fade
+float         FadeInTime      = 0.f;    // Duration of FadeIn in secs
+float         FadeOutTime     = 0.f;    // Duration of FadeOut in secs
+float         SkipTime        = 0.f;    // Skip the beginning of the file (sec)
+double        Duration        = 1.e+99; // Maximum encoded audio length
+Bool_t        FrontendPresent = 0;      // Flag for frontend-detection
+Bool_t        XLevel          = 1;      // Encode extreme levels with relative SCFs
+const char    About []        = "MPC Encoder  " MPPENC_VERSION "  " MPPENC_BUILD "   (C) 1999-2006 Buschmann/Klemm/Piecha/MDT";
+
+
+#if defined _WIN32  ||  defined __TURBOC__
+# include <conio.h>
+#else
+
+# ifdef USE_TERMIOS
+#  include <termios.h>
+
+static struct termios  stored_settings;
+
+static void
+echo_on ( void )
+{
+    tcsetattr ( 0, TCSANOW, &stored_settings );
+}
+
+static void
+echo_off ( void )
+{
+    struct termios  new_settings;
+
+    tcgetattr ( 0, &stored_settings );
+    new_settings = stored_settings;
+
+    new_settings.c_lflag     &= ~ECHO;
+    new_settings.c_lflag     &= ~ICANON;        /* Disable canonical mode, and set buffer size to 1 byte */
+    new_settings.c_cc[VTIME]  = 0;
+    new_settings.c_cc[VMIN]   = 1;
+
+    tcsetattr ( 0, TCSANOW, &new_settings );
+}
+
+# else
+#  define echo_off()  (void)0
+#  define echo_on()   (void)0
+# endif
+
+static int
+getch ( void )
+{
+    unsigned char  buff [1];
+    int            ret;
+
+    echo_off ();
+    ret = READ1 ( STDIN, buff );
+    echo_on ();
+    return ret == 1  ?  buff[0]  :  -1;
+}
+
+#endif
+
+
+static int
+waitkey ( void )
+{
+    int  c;
+
+    fflush (stdout);
+    while ( (c = getch() ) <= ' ' )
+        ;
+    return c;
+}
+
+
+
+
+static void
+longhelp ( void )
+{
+    stderr_printf (
+             "\n"
+             "\033[1m\rUsage:\033[0m\n"
+             "  mppenc [--options] <Input_File>\n"
+             "  mppenc [--options] <Input_File> <Output_File>\n"
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rInput_File must be of the following:\033[0m\n"
+             "  -                stdin                 (only RIFF WAVE files)\n"
+             "  /dev/audio       soundcard             (using OSS, 44.1 kHz)\n"
+             "  *.wav            RIFF WAVE file\n"
+             "  *.raw/cdr        Raw PCM               (2ch, 16bit, 44.1kHz)\n"
+             "  *.pac/lpac       LPAC file             (Windows Only)\n"
+             "  *.fla/flac       FLAC file\n"
+             "  *.ape            Monkey's Audio file   (APE extension only)\n"
+             "  *.rka/rkau       RK Audio file         (Windows Only)\n"
+             "  *.sz             SZIP file\n"
+             "  *.shn            Shorten file\n"
+             "  *.wv             Wavpack File\n"
+             "  *.ofr            OptimFROG file        (Windows Only)\n"
+             "\n"
+             "  Currently only 32, 37.8, 44.1 and 48 kHz, 1-8 channels, 8-32 bit linear PCM\n"
+             "  is supported. When using one of the lossless compressed formats, a proper\n"
+             "  binary must be installed within the system's $PATH.\n"
+             "\n"
+             "\033[1m\rOutput_File must be of the following: (or generated from Input_File)\033[0m\n"
+             "  *.mpc            Musepack file\n"
+             "  *.mp+/mpp        MPEGplus file         (Deprecated)\n"
+             "  -                stdout\n"
+             "  /dev/null        trash can\n"
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rProfiles and Quality Scale:\033[0m\n"
+             "\n"
+             "  Option of using a profile (--radio) or mapped quality scale (--quality 4.0).\n"
+             "  In addition, quality scale is effective centesimally. (i.e. --quality 4.25)\n"
+             "  Available options are as follows:\n"
+             "\n"
+             "  below telephone  (--quality 0.00)   poor quality          (~  20 kbps)\n"
+             "  below telephone  (--quality 1.00)   poor quality          (~  30 kbps)\n"
+             "  --telephone      (--quality 2.00)   low quality           (~  60 kbps)\n"
+             "  --thumb          (--quality 3.00)   low/medium quality    (~  90 kbps)\n"
+             "  --radio          (--quality 4.00)   medium quality        (~ 130 kbps)\n"
+             "  --standard       (--quality 5.00)   high quality, (dflt)  (~ 180 kbps)\n"
+             "   (or --normal)\n"
+             "  --extreme        (--quality 6.00)   excellent quality     (~ 210 kbps)\n"
+             "   (or --xtreme)\n"
+             "  --insane         (--quality 7.00)   excellent quality     (~ 240 kbps)\n"
+             "  --braindead      (--quality 8.00)   excellent quality     (~ 270 kbps)\n"
+             "  above braindead  (--quality 9.00)   excellent quality     (~ 300 kbps)\n"
+             "  above braindead  (--quality 10.00)  excellent quality     (~ 350 kbps)\n"
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rFile/Message handling:\033[0m\n"
+             "  --silent         repress console messages                 (dflt: off)\n"
+             "  --verbose        increase verbosity                       (dflt: off)\n"
+             "  --longhelp       print this help text\n"
+             "  --stderr foo     append messages to file 'foo'\n"
+             "  --neveroverwrite never overwrite existing Output_File     (dflt: off)\n"
+             "  --interactive    ask to overwrite an existing Output_File (dflt: on)\n"
+             "  --overwrite      overwrite existing Output_File           (dflt: off)\n"
+             "  --deleteinput    delete Input_File after encoding         (dflt: off)\n"
+             "  --beep           beep when encoding is finished           (dflt: off)\n"
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rTagging (uses APE 2.0 tags):\033[0m\n"
+             "  --tag key=value  Add tag \"key\" with \"value\" as contents\n"
+             "  --tagfile key=f  dto., take value from a file 'f'\n"
+             "  --tagfile key    dto., take value from console\n"
+             "  --artist 'value' shortcut for --tag 'Artist=value'\n"
+             "  --album 'value'  shortcut for --tag 'Album=value'\n"
+             "                   other possible keys are: debutalbum, publisher, conductor,\n"
+             "                   title, subtitle, track, comment, composer, copyright,\n"
+             "                   publicationright, filename, recordlocation, recorddate,\n"
+             "                   ean/upc, year, releasedate, genre, media, index, isrc,\n"
+             "                   abstract, bibliography, introplay, media, language, ...\n"
+             "  --unicode        unicode input from console\n"
+             "  --writetags      enable tags                              (dflt: off)\n"
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rAudio processing:\033[0m\n" );
+    stderr_printf (
+             "  --skip x         skip the first x seconds  (dflt: %3.1f)\n",   SkipTime );
+    stderr_printf (
+             "  --dur x          stop encoding after at most x seconds of encoded audio\n" );
+    stderr_printf (
+             "  --fade x         fadein+out in seconds\n" );
+    stderr_printf (
+             "  --fadein x       fadein  in seconds (dflt: %3.1f)\n",                   FadeInTime );
+    stderr_printf (
+             "  --fadeout x      fadeout in seconds (dflt: %3.1f)\n",                   FadeOutTime );
+    stderr_printf (
+             "  --fadeshape x    fade shape (dflt: %3.1f),\n"
+             "                   see http://www.uni-jena.de/~pfk/mpc/img/fade.png\n",   FadeShape );
+    stderr_printf (
+             "  --scale x        scale input signal by x (dflt: %7.5f)\n",              ScalingFactorl );
+    stderr_printf (
+             "  --scale x,y      scale input signal, separate for each channel\n" );
+
+    stderr_printf (
+             "\033[1m\rExpert settings:\033[0m\n" );
+    stderr_printf (
+             "==Masking thresholds======\n" );
+    stderr_printf (
+             "  --quality x      set Quality to x (dflt: 5)\n" );
+    stderr_printf (
+             "  --nmt x          set NMT value to x dB (dflt: %4.1f)\n", NMT );
+    stderr_printf (
+             "  --tmn x          set TMN value to x dB (dflt: %4.1f)\n", TMN );
+    stderr_printf (
+             "  --pns x          set PNS value to x dB (dflt: %4.1f)\n", PNS );
+    stderr_printf (
+             "==ATH/Bandwidth settings==\n" );
+    stderr_printf (
+             "  --bw x           maximum bandwidth in Hz (dflt: %4.1f kHz)\n", (Max_Band+1)*(SampleFreq/32000.) );
+    stderr_printf (
+             "  --minSMR x       minimum SMR of x dB over encoded bandwidth (dflt: %2.1f)\n",  minSMR );
+    stderr_printf (
+             "  --ltq xyy        x=0: ISO threshold in quiet (not recommended)\n"
+             "                   x=1: more sensitive threshold in quiet (Buschmann)\n"
+             "                   x=2: even more sensitive threshold in quiet (Filburt)\n"
+             "                   x=3: Klemm\n"
+             "                   x=4: Buschmann-Klemm Mix\n"
+             "                   x=5: minimum of Klemm and Buschmann (dflt)\n"
+             "                   y=00...99: HF roll-off (00:+30 dB, 99:-30 dB @20 kHz\n" );
+    stderr_printf (
+             "  --ltq_gain x     add offset of x dB to chosen ltq (dflt: %+4.1f)\n",       Ltq_offset   );
+    stderr_printf (
+             "  --ltq_max x      maximum level for ltq (dflt: %4.1f dB)\n",                Ltq_max      );
+    stderr_printf (
+             "  --ltq_var x      adaptive threshold in quiet: 0: off, >0: on (dflt: %g)\n",varLtq       );
+    stderr_printf (
+             "  --tmpMask x      exploit postmasking: 0: off, 1: on (dflt: %i)\n",         tmpMask_used );
+    stderr_printf (
+             "==Other settings==========\n" );
+    stderr_printf (
+             "  --ms x           Mid/Side Stereo, 0: off, 1: reduced, 2: on, 3: decoupled,\n"
+             "                   10: enhanced 1.5/3 dB, 11: 2/6 dB, 12: 2.5/9 dB,\n"
+             "                   13: 3/12 dB, 15: 3/oo dB (dflt: %i)\n",                        MS_Channelmode );
+    stderr_printf (
+             "  --ans x          Adaptive Noise Shaping Order: 0: off, 1...6: on (dflt: %i)\n", NS_Order );
+    stderr_printf (
+             "  --cvd x          ClearVoiceDetection, 0: off, 1: on, 2: dual (dflt: %i)\n",     CVD_used );
+    stderr_printf (
+             "  --shortthr x     short FFT threshold (dflt: %4.1f)\n",                          ShortThr );
+    stderr_printf (
+             "  --transdet x     slewrate for transient detection (dflt: %3.1f)\n",             TransDetect );
+    stderr_printf (
+             "  --minval x       calculation of MinVal (1:Buschmann, 2,3:Klemm)\n" );
+    stderr_printf (
+             "  --noxlevel       use old filterbank clipping solving strategy\n" );
+    stderr_printf (
+             "\n" );
+
+    stderr_printf (
+             "\033[1m\rExamples:\033[0m\n"
+             "  mppenc inputfile.wav\n"
+             "  mppenc inputfile.wav outputfile.mpc\n"
+             "  mppenc --radio inputfile.wav outputfile.mpc\n"
+             "  mppenc --silent --radio --pns 0.25 inputfile.wav outputfile.mpc\n"
+             "  mppenc --nmt 12 --tmn 28 inputfile.wav outputfile.mpc\n"
+             "\n");
+}
+
+
+static void
+shorthelp ( void )
+{
+    stderr_printf (
+             "\n"
+             "\033[1m\rUsage:\033[0m\n"
+             "  mppenc [--options] <Input_File>\n"
+             "  mppenc [--options] <Input_File> <Output_File>\n"
+             "\n"
+
+             "\033[1m\rStandard options:\033[0m\n"
+             "  --silent         repress console messages                 (dflt: off)\n"
+             "  --verbose        increase verbosity                       (dflt: off)\n"
+             "  --deleteinput    delete Input_File after encoding         (dflt: off)\n"
+             "  --overwrite      overwrite existing Output_File           (dflt: off)\n"
+             "  --fade sec       fade in and out with 'sec' duration      (dflt: 0.0)\n"
+             "\n"
+
+             "\033[1m\rProfiles and Quality Scale:\033[0m\n"
+             "  --thumb          (--quality 3.00)   low/medium quality    (~  90 kbps)\n"
+             "  --radio          (--quality 4.00)   medium quality        (~ 130 kbps)\n"
+             "  --standard       (--quality 5.00)   high quality, (dflt)  (~ 180 kbps)\n"
+             "  --insane         (--quality 7.00)   excellent quality     (~ 240 kbps)\n"
+             "\n"
+
+             "\033[1m\rExamples:\033[0m\n"
+             "  mppenc inputfile.wav\n"
+             "  mppenc inputfile.wav outputfile.mpc\n"
+             "  mppenc --insane inputfile.wav outputfile.mpc\n"
+             "  mppenc --silent --radio inputfile.wav outputfile.mpc\n"
+             "\n"
+             "For further information use --longhelp option.\n" );
+}
+
+
+/*
+ *  Wishes for fading:
+ *
+ *            _____________________
+ *           /|                   |\
+ *         /  |                   |  \
+ *        /   |                   |   \
+ *  ____/     |                   |     \______________
+ *  |  |      |                   |      |  |
+ *  |t1|  t2  |                   |  t4  |t5|
+ *  |                 t3                    |
+ *     |<-------------- M P C ------------->|
+ *  |<-------------------- W A V E ------------------>|
+ *
+ *   t1: StartTime   (Standard: 0, positive: from beginning of file, negative: from end of file)
+ *   t2: FadeInTime  (Standard: 0, positive: Fadetime)
+ *   t3: EndTime     (Standard: 0, non-positive: from end of file, positive: from beginning of file)
+ *   t4: FadeOutTime (Standard: 0, positive: Fadetime)
+ *   t5: PostGapTime (Standard: 0, positive: additional silence)
+ *
+ * The beginning of phase t4 can also be triggered by the signal SIGINT.
+ * With SIGTERM, the current frame is fully decoded and then terminated.
+ *
+ * Another question is if you can't put t1 before the zero, same with t3 and t5
+ * (track-spanning cutting).
+ */
+
+#include "fastmath.h"
+
+
+float  bump_exp   = 1.f;
+float  bump_start = 0.040790618517f;
+
+
+static void
+setbump ( double e )
+{
+    bump_exp   = e;
+    bump_start = 1 - sqrt (1 - 1 / (1 - log(1.e-5) / e));
+}
+
+
+static double
+bump ( double x )
+{
+    x = bump_start + x * (1. - bump_start);
+    if ( x <= 0.) return 0.;
+    if ( x >= 1.) return 1.;
+    x *= (2. - x);
+    x  = (x - 1.) / x;
+    return exp (x * bump_exp);
+}
+
+
+static void
+Fading_In ( PCMDataTyp* data, unsigned int N, const float fs )
+{
+    float  inv_fs = 1.f / fs;
+    float  fadein_pos;
+    float  scale;
+    int    n;
+    int    idx;
+
+    ENTER(2);
+    for ( n = 0; n < BLOCK; n++, N++ ) {
+        idx           = n + CENTER;
+        fadein_pos    = N * inv_fs;
+        scale         = fadein_pos / FadeInTime;
+        scale         = bump (scale);
+        data->L[idx] *= scale;
+        data->R[idx] *= scale;
+        data->M[idx] *= scale;
+        data->S[idx] *= scale;
+    }
+    LEAVE(2);
+}
+
+
+static void
+Fading_Out ( PCMDataTyp* data, unsigned int N, const float fs )
+{
+    float  inv_fs = 1.f / fs;
+    float  fadeout_pos;
+    float  scale;
+    int    n;
+    int    idx;
+
+    ENTER(3);
+    for ( n = 0; n < BLOCK; n++, N++ ) {
+        idx           = n + CENTER;
+        fadeout_pos   = UintMAX_FP(SamplesInWAVE - N) * inv_fs;
+        scale         = fadeout_pos / FadeOutTime;
+        scale         = bump (scale);
+        data->L[idx] *= scale;
+        data->R[idx] *= scale;
+        data->M[idx] *= scale;
+        data->S[idx] *= scale;
+    }
+    LEAVE(3);
+}
+
+
+static const unsigned char  Penalty [256] = {
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+      0,  2,  5,  9, 15, 23, 36, 54, 79,116,169,246,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+};
+
+#define P(new,old)  Penalty [128 + (old) - (new)]
+
+static void
+SCF_Extraktion ( const int MaxBand, SubbandFloatTyp* x )
+{
+    int    Band;
+    int    n;
+    int    d01;
+    int    d12;
+    int    d02;
+    int    warnL;
+    int    warnR;
+    int*   scfL;
+    int*   scfR;
+    int    comp_L [3];
+    int    comp_R [3];
+    float  tmp_L  [3];
+    float  tmp_R  [3];
+    float  facL;
+    float  facR;
+    float  L;
+    float  R;
+    float  SL;
+    float  SR;
+
+    ENTER(4);
+
+    for ( Band = 0; Band <= MaxBand; Band++ ) {         // Suche nach Maxima
+        L  = FABS (x[Band].L[ 0]);
+        R  = FABS (x[Band].R[ 0]);
+        SL = x[Band].L[ 0] * x[Band].L[ 0];
+        SR = x[Band].R[ 0] * x[Band].R[ 0];
+        for ( n = 1; n < 12; n++ ) {
+            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
+            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
+            SL += x[Band].L[n] * x[Band].L[n];
+            SR += x[Band].R[n] * x[Band].R[n];
+        }
+        Power_L [Band][0] = SL;
+        Power_R [Band][0] = SR;
+        tmp_L [0] = L;
+        tmp_R [0] = R;
+
+        L  = FABS (x[Band].L[12]);
+        R  = FABS (x[Band].R[12]);
+        SL = x[Band].L[12] * x[Band].L[12];
+        SR = x[Band].R[12] * x[Band].R[12];
+        for ( n = 13; n < 24; n++ ) {
+            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
+            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
+            SL += x[Band].L[n] * x[Band].L[n];
+            SR += x[Band].R[n] * x[Band].R[n];
+        }
+        Power_L [Band][1] = SL;
+        Power_R [Band][1] = SR;
+        tmp_L [1] = L;
+        tmp_R [1] = R;
+
+        L  = FABS (x[Band].L[24]);
+        R  = FABS (x[Band].R[24]);
+        SL = x[Band].L[24] * x[Band].L[24];
+        SR = x[Band].R[24] * x[Band].R[24];
+        for ( n = 25; n < 36; n++ ) {
+            if (L < FABS (x[Band].L[n])) L = FABS (x[Band].L[n]);
+            if (R < FABS (x[Band].R[n])) R = FABS (x[Band].R[n]);
+            SL += x[Band].L[n] * x[Band].L[n];
+            SR += x[Band].R[n] * x[Band].R[n];
+        }
+        Power_L [Band][2] = SL;
+        Power_R [Band][2] = SR;
+        tmp_L [2] = L;
+        tmp_R [2] = R;
+
+        // calculation of the scalefactor-indexes
+        // -12.6f*log10(x)+57.8945021823f = -10*log10(x/32767)*1.26+1
+        // normalize maximum of +/- 32767 to prevent quantizer overflow
+        // It can stand a maximum of +/- 32768 ...
+
+        // Where is scf{R,L} [0...2] initialized ???
+        scfL = SCF_Index_L [Band];
+        scfR = SCF_Index_R [Band];
+        if (tmp_L [0] > 0.) scfL [0] = IFLOORF (-12.6f * LOG10 (tmp_L [0]) + 57.8945021823f );
+        if (tmp_L [1] > 0.) scfL [1] = IFLOORF (-12.6f * LOG10 (tmp_L [1]) + 57.8945021823f );
+        if (tmp_L [2] > 0.) scfL [2] = IFLOORF (-12.6f * LOG10 (tmp_L [2]) + 57.8945021823f );
+        if (tmp_R [0] > 0.) scfR [0] = IFLOORF (-12.6f * LOG10 (tmp_R [0]) + 57.8945021823f );
+        if (tmp_R [1] > 0.) scfR [1] = IFLOORF (-12.6f * LOG10 (tmp_R [1]) + 57.8945021823f );
+        if (tmp_R [2] > 0.) scfR [2] = IFLOORF (-12.6f * LOG10 (tmp_R [2]) + 57.8945021823f );
+
+        // restriction to SCF_Index = 0...63, make note of the internal overflow
+        warnL = warnR = 0;
+        if (scfL[0] & ~63) { if (scfL[0] < 0) { if (XLevel==0) scfL[0] = 0, warnL = 1; } else scfL[0] = 63; }
+        if (scfL[1] & ~63) { if (scfL[1] < 0) { if (XLevel==0) scfL[1] = 0, warnL = 1; } else scfL[1] = 63; }
+        if (scfL[2] & ~63) { if (scfL[2] < 0) { if (XLevel==0) scfL[2] = 0, warnL = 1; } else scfL[2] = 63; }
+        if (scfR[0] & ~63) { if (scfR[0] < 0) { if (XLevel==0) scfR[0] = 0, warnR = 1; } else scfR[0] = 63; }
+        if (scfR[1] & ~63) { if (scfR[1] < 0) { if (XLevel==0) scfR[1] = 0, warnR = 1; } else scfR[1] = 63; }
+        if (scfR[2] & ~63) { if (scfR[2] < 0) { if (XLevel==0) scfR[2] = 0, warnR = 1; } else scfR[2] = 63; }
+
+        // save old values for compensation calculation
+        comp_L[0] = scfL[0]; comp_L[1] = scfL[1]; comp_L[2] = scfL[2];
+        comp_R[0] = scfR[0]; comp_R[1] = scfR[1]; comp_R[2] = scfR[2];
+
+        // determination and replacement of scalefactors of minor differences with the smaller one???
+        // a smaller one is quantized more roughly, i.e. the noise gets amplified???
+
+        if ( CombPenalities >= 0 ) {
+            if      ( P(scfL[0],scfL[1]) + P(scfL[0],scfL[2]) <= CombPenalities ) scfL[2] = scfL[1] = scfL[0];
+            else if ( P(scfL[1],scfL[0]) + P(scfL[1],scfL[2]) <= CombPenalities ) scfL[0] = scfL[2] = scfL[1];
+            else if ( P(scfL[2],scfL[0]) + P(scfL[2],scfL[1]) <= CombPenalities ) scfL[0] = scfL[1] = scfL[2];
+            else if ( P(scfL[0],scfL[1])                      <= CombPenalities ) scfL[1] = scfL[0];
+            else if ( P(scfL[1],scfL[0])                      <= CombPenalities ) scfL[0] = scfL[1];
+            else if ( P(scfL[1],scfL[2])                      <= CombPenalities ) scfL[2] = scfL[1];
+            else if ( P(scfL[2],scfL[1])                      <= CombPenalities ) scfL[1] = scfL[2];
+
+            if      ( P(scfR[0],scfR[1]) + P(scfR[0],scfR[2]) <= CombPenalities ) scfR[2] = scfR[1] = scfR[0];
+            else if ( P(scfR[1],scfR[0]) + P(scfR[1],scfR[2]) <= CombPenalities ) scfR[0] = scfR[2] = scfR[1];
+            else if ( P(scfR[2],scfR[0]) + P(scfR[2],scfR[1]) <= CombPenalities ) scfR[0] = scfR[1] = scfR[2];
+            else if ( P(scfR[0],scfR[1])                      <= CombPenalities ) scfR[1] = scfR[0];
+            else if ( P(scfR[1],scfR[0])                      <= CombPenalities ) scfR[0] = scfR[1];
+            else if ( P(scfR[1],scfR[2])                      <= CombPenalities ) scfR[2] = scfR[1];
+            else if ( P(scfR[2],scfR[1])                      <= CombPenalities ) scfR[1] = scfR[2];
+        }
+        else {
+
+            d12  = scfL [2] - scfL [1];
+            d01  = scfL [1] - scfL [0];
+            d02  = scfL [2] - scfL [0];
+
+            if      ( 0 < d12  &&  d12 < 5 ) scfL [2] = scfL [1];
+            else if (-3 < d12  &&  d12 < 0 ) scfL [1] = scfL [2];
+            else if ( 0 < d01  &&  d01 < 5 ) scfL [1] = scfL [0];
+            else if (-3 < d01  &&  d01 < 0 ) scfL [0] = scfL [1];
+            else if ( 0 < d02  &&  d02 < 4 ) scfL [2] = scfL [0];
+            else if (-2 < d02  &&  d02 < 0 ) scfL [0] = scfL [2];
+
+            d12  = scfR [2] - scfR [1];
+            d01  = scfR [1] - scfR [0];
+            d02  = scfR [2] - scfR [0];
+
+            if      ( 0 < d12  &&  d12 < 5 ) scfR [2] = scfR [1];
+            else if (-3 < d12  &&  d12 < 0 ) scfR [1] = scfR [2];
+            else if ( 0 < d01  &&  d01 < 5 ) scfR [1] = scfR [0];
+            else if (-3 < d01  &&  d01 < 0 ) scfR [0] = scfR [1];
+            else if ( 0 < d02  &&  d02 < 4 ) scfR [2] = scfR [0];
+            else if (-2 < d02  &&  d02 < 0 ) scfR [0] = scfR [2];
+        }
+
+        // calculate SNR-compensation
+        tmp_L [0]         = invSCF [comp_L[0] - scfL[0]];
+        tmp_L [1]         = invSCF [comp_L[1] - scfL[1]];
+        tmp_L [2]         = invSCF [comp_L[2] - scfL[2]];
+        tmp_R [0]         = invSCF [comp_R[0] - scfR[0]];
+        tmp_R [1]         = invSCF [comp_R[1] - scfR[1]];
+        tmp_R [2]         = invSCF [comp_R[2] - scfR[2]];
+        SNR_comp_L [Band] = (tmp_L[0]*tmp_L[0] + tmp_L[1]*tmp_L[1] + tmp_L[2]*tmp_L[2]) * 0.3333333333f;
+        SNR_comp_R [Band] = (tmp_R[0]*tmp_R[0] + tmp_R[1]*tmp_R[1] + tmp_R[2]*tmp_R[2]) * 0.3333333333f;
+
+        // normalize the subband samples
+        facL = invSCF[scfL[0]];
+        facR = invSCF[scfR[0]];
+        for ( n = 0; n < 12; n++ ) {
+            x[Band].L[n] *= facL;
+            x[Band].R[n] *= facR;
+        }
+        facL = invSCF[scfL[1]];
+        facR = invSCF[scfR[1]];
+        for ( n = 12; n < 24; n++ ) {
+            x[Band].L[n] *= facL;
+            x[Band].R[n] *= facR;
+        }
+        facL = invSCF[scfL[2]];
+        facR = invSCF[scfR[2]];
+        for ( n = 24; n < 36; n++ ) {
+            x[Band].L[n] *= facL;
+            x[Band].R[n] *= facR;
+        }
+
+        // limit to +/-32767 if internal clipping
+        if ( warnL )
+            for ( n = 0; n < 36; n++ ) {
+                if      (x[Band].L[n] > +32767.f) {
+                    Overflows++;
+                    MaxOverFlow = maxf (MaxOverFlow,  x[Band].L[n]);
+                    x[Band].L[n] = 32767.f;
+                }
+                else if (x[Band].L[n] < -32767.f) {
+                    Overflows++;
+                    MaxOverFlow = maxf (MaxOverFlow, -x[Band].L[n]);
+                    x[Band].L[n] = -32767.f;
+                }
+            }
+        if ( warnR )
+            for ( n = 0; n < 36; n++ ) {
+                if      (x[Band].R[n] > +32767.f) {
+                    Overflows++;
+                    MaxOverFlow = maxf (MaxOverFlow,  x[Band].R[n]);
+                    x[Band].R[n] = 32767.f;
+                }
+                else if (x[Band].R[n] < -32767.f) {
+                    Overflows++;
+                    MaxOverFlow = maxf (MaxOverFlow, -x[Band].R[n]);
+                    x[Band].R[n] = -32767.f;
+                }
+            }
+    }
+
+    LEAVE(4);
+    return;
+}
+
+
+static void
+Quantisierung ( const int               MaxBand,
+                const int*              resL,
+                const int*              resR,
+                const SubbandFloatTyp*  subx,
+                SubbandQuantTyp*        subq )
+{
+    static float  errorL [32] [36 + MAX_NS_ORDER];
+    static float  errorR [32] [36 + MAX_NS_ORDER];
+    int           Band;
+
+    ENTER(5);
+
+    // quantize Subband- and Subframe-samples
+    for ( Band = 0; Band <= MaxBand; Band++, resL++, resR++ ) {
+
+        if ( *resL > 0 ) {
+            if ( NS_Order_L [Band] > 0 ) {
+                QuantizeSubbandWithNoiseShaping ( subq[Band].L, subx[Band].L, *resL, errorL [Band], FIR_L [Band] );
+                memcpy ( errorL [Band], errorL[Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
+            } else {
+                QuantizeSubband                 ( subq[Band].L, subx[Band].L, *resL, errorL [Band] );
+                memcpy ( errorL [Band], errorL[Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
+            }
+        } else {
+        }
+
+        if ( *resR > 0 ) {
+            if ( NS_Order_R [Band] > 0 ) {
+                QuantizeSubbandWithNoiseShaping ( subq[Band].R, subx[Band].R, *resR, errorR [Band], FIR_R [Band] );
+                memcpy ( errorR [Band], errorR [Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
+            } else {
+                QuantizeSubband                 ( subq[Band].R, subx[Band].R, *resR, errorL [Band] );
+                memcpy ( errorR [Band], errorR [Band] + 36, MAX_NS_ORDER * sizeof (**errorL) );
+            }
+        } else {
+        }
+    }
+
+    LEAVE(5);
+    return;
+}
+
+
+static int
+PNS_SCF ( int* scf, float S0, float S1, float S2 )
+{
+//    printf ("%7.1f %7.1f %7.1f  ", sqrt(S0/12), sqrt(S1/12), sqrt(S2/12) );
+
+#if 1
+    if ( S0 < 0.5 * S1  ||  S1 < 0.5 * S2  ||  S0 < 0.5 * S2 )
+        return 0;
+
+    if ( S1 < 0.25 * S0  ||  S2 < 0.25 * S1  ||  S2 < 0.25 * S0 )
+        return 0;
+#endif
+
+
+    if ( S0 >= 0.8 * S1 ) {
+        if ( S0 >= 0.8 * S2  &&  S1 > 0.8 * S2 )
+            S0 = S1 = S2 = 0.33333333333f * (S0 + S1 + S2);
+        else
+            S0 = S1 = 0.5f * (S0 + S1);
+    }
+    else {
+        if ( S1 >= 0.8 * S2 )
+            S1 = S2 = 0.5f * (S1 + S2);
+    }
+
+    scf [0] = scf [1] = scf [2] = 63;
+    S0 = sqrt (S0/12 * 4/1.2005080577484075047860806747022);
+    S1 = sqrt (S1/12 * 4/1.2005080577484075047860806747022);
+    S2 = sqrt (S2/12 * 4/1.2005080577484075047860806747022);
+    if (S0 > 0.) scf [0] = IFLOORF (-12.6f * LOG10 (S0) + 57.8945021823f );
+    if (S1 > 0.) scf [1] = IFLOORF (-12.6f * LOG10 (S1) + 57.8945021823f );
+    if (S2 > 0.) scf [2] = IFLOORF (-12.6f * LOG10 (S2) + 57.8945021823f );
+
+    if ( scf[0] & ~63 ) scf[0] = scf[0] > 63 ? 63 : 0;
+    if ( scf[1] & ~63 ) scf[1] = scf[1] > 63 ? 63 : 0;
+    if ( scf[2] & ~63 ) scf[2] = scf[2] > 63 ? 63 : 0;
+
+    return 1;
+}
+
+
+static void
+Allocate ( const int MaxBand, int* res, float* x, int* scf, const float* comp, const float* smr, const SCFTriple* Pow, const int* Transient )
+{
+    int    Band;
+    int    k;
+    float  tmpMNR;      // to adjust the scalefactors
+    float  save [36];   // to adjust the scalefactors
+    float  MNR;         // Mask-to-Noise ratio
+
+    ENTER(6);
+
+    for ( Band = 0; Band <= MaxBand; Band++, res++, comp++, smr++, scf += 3, x += 72 ) {
+        // printf ( "%2u: %u\n", Band, Transient[Band] );
+
+        // Find out needed quantization resolution Res to fulfill the calculated MNR
+        // This is done by exactly measuring the quantization residuals against the signal itself
+        // Starting with Res=1  Res in increased until MNR becomes less than 1.
+        if ( Band > 0  &&  res[-1] < 3  &&  *smr >= 1. &&  *smr < Band * PNS  &&
+             PNS_SCF ( scf, Pow [Band][0], Pow [Band][1], Pow [Band][2] ) ) {
+            *res = -1;
+        } else {
+            for ( MNR = *smr * 1.; MNR > 1.  &&  *res != 15; )
+                MNR = *smr * (Transient[Band] ? ISNR_Schaetzer_Trans : ISNR_Schaetzer) ( x, *comp, ++*res );
+        }
+
+        // Fine adapt SCF's (MNR > 0 prevents adaption of zero samples, which is nonsense)
+        // only apply to Huffman-coded samples (otherwise no savings in bitrate)
+        if ( *res > 0  &&  *res <= LAST_HUFFMAN  &&  MNR < 1.  &&  MNR > 0.  &&  !Transient[Band] ) {
+            while ( scf[0] > 0  &&  scf[1] > 0  &&  scf[2] > 0 ) {
+
+                --scf[2]; --scf[1]; --scf[0];                   // adapt scalefactors and samples
+                memcpy ( save, x, sizeof save );
+                for (k = 0; k < 36; k++ )
+                    x[k] *= SCFfac;
+
+                tmpMNR = *smr * (Transient[Band] ? ISNR_Schaetzer_Trans : ISNR_Schaetzer) ( x, *comp, *res );// recalculate MNR
+
+                // FK: if ( tmpMNR > MNR  &&  tmpMNR <= 1 ) {          // check for MNR
+                if ( tmpMNR <= 1 ) {                            // check for MNR
+                    MNR = tmpMNR;
+                }
+                else {
+                    ++scf[0]; ++scf[1]; ++scf[2];               // restore scalefactors and samples
+                    memcpy ( x, save, sizeof save );
+                    break;
+                }
+            }
+        }
+
+    }
+    LEAVE(6);
+    return;
+}
+
+
+
+
+typedef struct {
+    float            ShortThr;
+    unsigned char    MinValChoice;
+    unsigned int     EarModelFlag;
+    signed char      Ltq_offset;
+    float            TMN;
+    float            NMT;
+    signed char      minSMR;
+    signed char      Ltq_max;
+    unsigned short   BandWidth;
+    unsigned char    tmpMask_used;
+    unsigned char    CVD_used;
+    float            varLtq;
+    unsigned char    MS_Channelmode;
+    unsigned char    CombPenalities;
+    unsigned char    NS_Order;
+    float            PNS;
+    float            TransDetect;
+} Profile_Setting_t;
+
+
+#define PROFILE_PRE2_TELEPHONE   5      // --quality  0
+#define PROFILE_PRE_TELEPHONE    6      // --quality  1
+#define PROFILE_TELEPHONE        7      // --quality  2
+#define PROFILE_THUMB            8      // --quality  3
+#define PROFILE_RADIO            9      // --quality  4
+#define PROFILE_STANDARD        10      // --quality  5
+#define PROFILE_XTREME          11      // --quality  6
+#define PROFILE_INSANE          12      // --quality  7
+#define PROFILE_BRAINDEAD       13      // --quality  8
+#define PROFILE_POST_BRAINDEAD  14      // --quality  9
+#define PROFILE_POST2_BRAINDEAD 15      // --quality 10
+
+
+static const Profile_Setting_t  Profiles [16] = {
+    { 0 },
+    { 0 },
+    { 0 },
+    { 0 },
+    { 0 },
+/*    Short   MinVal  EarModel  Ltq_                min   Ltq_  Band-  tmpMask  CVD_  varLtq    MS   Comb   NS_        Trans */
+/*    Thr     Choice  Flag      offset  TMN   NMT   SMR   max   Width  _used    used         channel Penal used  PNS    Det  */
+    { 1.e9f,  1,      300,       30,    3.0, -1.0,    0,  106,   4820,   1,      1,    1.,      3,     24,  6,   1.09f, 200 },  // 0: pre-Telephone
+    { 1.e9f,  1,      300,       24,    6.0,  0.5,    0,  100,   7570,   1,      1,    1.,      3,     20,  6,   0.77f, 180 },  // 1: pre-Telephone
+    { 1.e9f,  1,      400,       18,    9.0,  2.0,    0,   94,  10300,   1,      1,    1.,      4,     18,  6,   0.55f, 160 },  // 2: Telephone
+    { 50.0f,  2,      430,       12,   12.0,  3.5,    0,   88,  13090,   1,      1,    1.,      5,     15,  6,   0.39f, 140 },  // 3: Thumb
+    { 15.0f,  2,      440,        6,   15.0,  5.0,    0,   82,  15800,   1,      1,    1.,      6,     10,  6,   0.27f, 120 },  // 4: Radio
+    {  5.0f,  2,      550,        0,   18.0,  6.5,    1,   76,  19980,   1,      2,    1.,     11,      9,  6,   0.00f, 100 },  // 5: Standard
+    {  4.0f,  2,      560,       -6,   21.0,  8.0,    2,   70,  22000,   1,      2,    1.,     12,      7,  6,   0.00f,  80 },  // 6: Xtreme
+    {  3.0f,  2,      570,      -12,   24.0,  9.5,    3,   64,  24000,   1,      2,    2.,     13,      5,  6,   0.00f,  60 },  // 7: Insane
+    {  2.8f,  2,      580,      -18,   27.0, 11.0,    4,   58,  26000,   1,      2,    4.,     13,      4,  6,   0.00f,  40 },  // 8: BrainDead
+    {  2.6f,  2,      590,      -24,   30.0, 12.5,    5,   52,  28000,   1,      2,    8.,     13,      4,  6,   0.00f,  20 },  // 9: post-BrainDead
+    {  2.4f,  2,      599,      -30,   33.0, 14.0,    6,   46,  30000,   1,      2,   16.,     15,      2,  6,   0.00f,  10 },  //10: post-BrainDead
+};
+
+
+static int
+TestProfileParams ( void )
+{   //                                       0    1    2    3    4   5   6  7 8 9  10  11  12  13 14  15
+    static signed char  TMNStereoAdj [] = { -6, -18, -15, -18, -12, -9, -6, 0,0,0, +1, +1, +1, +1, 0, +1 };  // Penalties for TMN
+    static signed char  NMTStereoAdj [] = { -3, -18, -15, -15,  -9, -6, -3, 0,0,0,  0, +1, +1, +1, 0, +1 };  // Penalties for NMT
+    int                 i;
+
+    MainQual = PROFILE_PRE2_TELEPHONE;
+
+    for ( i = PROFILE_PRE2_TELEPHONE; i <= PROFILE_POST2_BRAINDEAD; i++ ) {
+        if ( ShortThr     > Profiles [i].ShortThr     ) continue;
+        if ( MinValChoice < Profiles [i].MinValChoice ) continue;
+        if ( EarModelFlag < Profiles [i].EarModelFlag ) continue;
+        if ( Ltq_offset   > Profiles [i].Ltq_offset   ) continue;
+        if ( Ltq_max      > Profiles [i].Ltq_max      ) continue;                     // offset should normally be considered here
+        if ( TMN + TMNStereoAdj [MS_Channelmode] <
+             Profiles [i].TMN + TMNStereoAdj [Profiles [i].MS_Channelmode] )
+                                                        continue;
+        if ( NMT + NMTStereoAdj [MS_Channelmode] <
+             Profiles [i].NMT + NMTStereoAdj [Profiles [i].MS_Channelmode] )
+                                                        continue;
+        if ( minSMR       < Profiles [i].minSMR       ) continue;
+        if ( Bandwidth    < Profiles [i].BandWidth    ) continue;
+        if ( tmpMask_used < Profiles [i].tmpMask_used ) continue;
+        if ( CVD_used     < Profiles [i].CVD_used     ) continue;
+     // if ( varLtq       > Profiles [i].varLtq       ) continue;
+     // if ( NS_Order     < Profiles [i].NS_Order     ) continue;
+        if ( PNS          > Profiles [i].PNS          ) continue;
+        MainQual = i;
+    }
+    return MainQual;
+}
+
+
+static void
+SetQualityParams ( float qual )
+{
+    int    i;
+    float  mix;
+
+    if      ( qual <  0. ) {
+        qual =  0.;
+    }
+    if      ( qual > 10. ) {
+        qual = 10.;
+#ifdef _WIN32
+        stderr_printf ( "\nmppenc: Can't open MACDll.dll, quality set to 10.0\n" );
+#else
+        stderr_printf ( "\nmppenc: Can't open libMAC.so, quality set to 10.0\n" );
+#endif
+    }
+
+    i   = (int) qual + PROFILE_PRE2_TELEPHONE;
+    mix = qual - (int) qual;
+
+    MainQual       = i;
+    ShortThr       = Profiles [i].ShortThr   * (1-mix) + Profiles [i+1].ShortThr   * mix;
+    MinValChoice   = Profiles [i].MinValChoice  ;
+    EarModelFlag   = Profiles [i].EarModelFlag  ;
+    Ltq_offset     = Profiles [i].Ltq_offset * (1-mix) + Profiles [i+1].Ltq_offset * mix;
+    varLtq         = Profiles [i].varLtq     * (1-mix) + Profiles [i+1].varLtq     * mix;
+    Ltq_max        = Profiles [i].Ltq_max    * (1-mix) + Profiles [i+1].Ltq_max    * mix;
+    TMN            = Profiles [i].TMN        * (1-mix) + Profiles [i+1].TMN        * mix;
+    NMT            = Profiles [i].NMT        * (1-mix) + Profiles [i+1].NMT        * mix;
+    minSMR         = Profiles [i].minSMR        ;
+    Bandwidth      = Profiles [i].BandWidth  * (1-mix) + Profiles [i+1].BandWidth  * mix;
+    tmpMask_used   = Profiles [i].tmpMask_used  ;
+    CVD_used       = Profiles [i].CVD_used      ;
+    MS_Channelmode = Profiles [i].MS_Channelmode;
+    CombPenalities = Profiles [i].CombPenalities;
+    NS_Order       = Profiles [i].NS_Order      ;
+    PNS            = Profiles [i].PNS        * (1-mix) + Profiles [i+1].PNS        * mix;
+    TransDetect    = Profiles [i].TransDetect* (1-mix) + Profiles [i+1].TransDetect* mix;
+}
+
+
+/* Planned: return the evaluated options, without InputFile and OutputFile, argc implicit instead of explicit */
+
+static int
+EvalParameters ( int argc, char** argv, char** InputFile, char** OutputFile, int onlyfilenames )
+{
+    int          k;
+    size_t       len;
+    static char  output [2048];
+    static char  errmsg [] = "\n\033[33;41;1mERROR\033[0m: Missing argument for option '--%s'\n\n";
+    FILE*        fp;
+    char*        p;
+    char         buff [32768];
+
+    /********************************* In / Out Files *********************************/
+    *InputFile  = argv [argc-1];
+    *OutputFile = NULL;
+
+    // search for output file
+    if ( argc >= 3 ) {
+        len = strlen (argv[argc-1]);
+
+        if ( strcmp (argv[argc-1], "/dev/null") == 0  ||
+             strcmp (argv[argc-1], "-")         == 0  ||
+             (len >= 4  &&  (0 == strcasecmp (argv [argc-1] + len - 4, ".MPC")  ||
+                             0 == strcasecmp (argv [argc-1] + len - 4, ".MPP")  ||
+                             0 == strcasecmp (argv [argc-1] + len - 4, ".MP+"))) ) {
+            *OutputFile = argv[argc-1];
+            *InputFile  = argv[argc-2];
+            argc -= 2;
+        }
+    }
+
+    // if no Output-File is stated, set OutFile to InFile.mpc
+    if ( *OutputFile == NULL  ) {
+        strcpy ( *OutputFile = output, *InputFile );
+        len = strlen ( output );
+        if ( len > 4  &&  output[len-4] == '.' )
+            len -= 4;
+        strcpy (output+len, ".mpc");
+        argc -= 1;
+    }
+
+    if ( onlyfilenames )
+        return 0;
+
+    /********************************* In / Out Files *********************************/
+
+
+    // search for options
+    for ( k = 1; k < argc; k++ ) {
+
+        const char*  arg = argv [k];
+
+        if ( arg[0] != '-'  ||  arg[1] != '-' )
+            continue;
+        arg += 2;
+
+        if      ( 0 == strcmp ( arg, "verbose" ) ) {                                     // verbose
+            verbose++;
+        }
+        else if ( 0 == strcmp ( arg, "telephone" ) ) {                                   // MainQual
+            SetQualityParams (2.0);
+        }
+        else if ( 0 == strcmp ( arg, "thumb" ) ) {                                       // MainQual
+            SetQualityParams (3.0);
+        }
+        else if ( 0 == strcmp ( arg, "radio"   ) ) {
+            SetQualityParams (4.0);
+        }
+        else if ( 0 == strcmp ( arg, "standard")  ||  0 == strcmp ( arg, "normal") ) {
+            SetQualityParams (5.0);
+        }
+        else if ( 0 == strcmp ( arg, "xtreme")  ||  0 == strcmp ( arg, "extreme") ) {
+            SetQualityParams (6.0);
+        }
+        else if ( 0 == strcmp ( arg, "insane") ) {
+            SetQualityParams (7.0);
+        }
+        else if ( 0 == strcmp ( arg, "braindead") ) {
+            SetQualityParams (8.0);
+        }
+        else if ( 0 == strcmp ( arg, "quality") ) {                                      // Quality
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            SetQualityParams (atof (argv[k]) );
+        }
+        else if ( 0 == strcmp ( arg, "neveroverwrite") ) {                              // NeverOverWrite
+            WriteMode = MODE_NEVER_OVERWRITE;
+        }
+        else if ( 0 == strcmp ( arg, "forcewrite")  ||  0 == strcmp ( arg, "overwrite") ) { // ForceWrite
+            WriteMode = MODE_OVERWRITE;
+        }
+        else if ( 0 == strcmp ( arg, "interactive")  ) {                                // Interactive
+            WriteMode = MODE_ASK_FOR_OVERWRITE;
+        }
+        else if ( 0 == strcmp ( arg, "delinput")  ||  0 == strcmp ( arg, "delete")  ||  0 == strcmp ( arg, "deleteinput" ) ) {                                    // DelInput
+            DelInput = 0xAFFEDEAD;
+        }
+        else if ( 0 == strcmp ( arg, "beep")  ) {
+            IsEndBeep = 1;
+        }
+        else if ( 0 == strcmp ( arg, "scale") ) {                                       // ScalingFactor
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            ScalingFactorl = ScalingFactorr = (float) atof (argv[k]);
+            if (strchr (argv[k], ','))
+                ScalingFactorr = (float) atof (strchr (argv[k], ',') + 1);
+            if ( ScalingFactorl == 0.97f  ||  ScalingFactorl == 0.98f ) stderr_printf ("--scale 0.97 or --scale 0.98 is nearly useless to prevent clipping. Use replaygain tool\nto determine EXACT attenuation to avoid clipping. Factor can be between 0.696 and 1.000.\nSee \"http://www.uni-jena.de/~pfk/mpp/clipexample.html\".\n\n" );
+        }
+        else if ( 0 == strcmp ( arg, "kbd") ) {                                       // ScalingFactor
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            if ( 2 != sscanf ( argv[k], "%f,%f", &KBD1, &KBD2 ))
+                { stderr_printf ( "%s: missing two arguments", arg ); return -1; }
+            Init_FFT ();
+        }
+        else if ( 0 == strcmp ( arg, "fadein") ) {                                      // FadeInTime
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            FadeInTime = (float) atof (argv[k]);
+            if ( FadeInTime < 0.f ) FadeInTime = 0.f;
+        }
+        else if ( 0 == strcmp ( arg, "fadeout") ) {                                     // FadeOutTime
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            FadeOutTime = (float) atof (argv[k]);
+            if ( FadeOutTime < 0.f ) FadeOutTime = 0.f;
+        }
+        else if ( 0 == strcmp ( arg, "fade") ) {                                        // FadeInTime + FadeOutTime
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            FadeOutTime = (float) atof (argv[k]);
+            if ( FadeOutTime < 0.f ) FadeOutTime = 0.f;
+            FadeInTime = FadeOutTime;
+        }
+        else if ( 0 == strcmp ( arg, "fadeshape") ) {                                   // FadeOutTime
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            FadeShape = (float) atof (argv[k]);
+            if ( FadeShape < 0.001f  ||  FadeShape > 1000.f ) FadeShape = 1.f;
+            setbump ( FadeShape );
+        }
+        else if ( 0 == strcmp ( arg, "skip")  ||  0 == strcmp ( arg, "start") ) {       // SkipTime
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            SkipTime = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "dur")  ||  0 == strcmp ( arg, "duration") ) {     // maximum Duration
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            Duration = atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "ans") ) {                                         // AdaptiveNoiseShaping
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            NS_Order = atoi (argv[k]);
+            NS_Order = mini ( NS_Order, MAX_NS_ORDER );
+        }
+        else if ( 0 == strcmp ( arg, "predict") ) {                                     // AdaptiveNoiseShaping
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            PredictionBands = atoi (argv[k]);
+            PredictionBands = mini ( PredictionBands, 32 );
+        }
+        else if ( 0 == strcmp ( arg, "ltq_var")  ||  0 == strcmp ( arg, "ath_var") ) {  // ltq_var
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            varLtq = atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "pns") ) {                                         // pns
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            PNS = atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "minval") ) {                                      // MinValChoice
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            MinValChoice = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "transdet") ) {                                    // TransDetect
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            TransDetect = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "shortthr") ) {                                    // ShortThr
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            ShortThr = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "noxlevel") ) {                                      // Xlevel
+            XLevel = 0;
+        }
+        else if ( 0 == strcmp ( arg, "xlevel") ) {                                      // Xlevel
+            stderr_printf ( "\nXlevel coding now enabled by default, --xlevel ignored.\n" );
+        }
+        else if ( 0 == strcmp ( arg, "nmt") ) {                                         // NMT
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
+            NMT = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "tmn") ) {                                         // TMN
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
+            TMN = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "cvd") ) {                                         // ClearVoiceDetection
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            CVD_used = atoi (argv[k]);
+            if ( CVD_used == 0 )
+                stderr_printf ( "\nDisabling CVD always reduces quality!\a\n" );
+        }
+        else if ( 0 == strcmp ( arg, "ms") ) {                                          // Mid/Side Stereo
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            MS_Channelmode = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "minSMR") ) {                                      // minimum SMR
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            if ( minSMR > (float) atof (argv[k]) )
+                stderr_printf ( "This option usage may reduces quality!\a\n" );
+            minSMR = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "tmpMask") ) {                                     // temporal post-masking
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            tmpMask_used = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "ltq_max")  ||  0 == strcmp ( arg, "ath_max") ) {  // Maximum for threshold in quiet
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg );  return -1; }
+            Ltq_max = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "ltq_gain")  ||  0 == strcmp ( arg, "ath_gain") ) {// Offset for threshold in quiet
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            Ltq_offset = (float) atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "silent")  ||  0 == strcmp ( arg, "quiet") ) {
+            SetStderrSilent (1);
+        }
+        else if ( 0 == strcmp ( arg, "stderr") ) {                                      // Offset for threshold in quiet
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            freopen ( argv[k], "a", stderr );
+        }
+        else if ( 0 == strcmp ( arg, "ltq")  ||  0 == strcmp ( arg, "ath") ) {          // threshold in quiet
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            EarModelFlag = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "noco") ) {
+            NoiseInjectionComp ();
+        }
+        else if ( 0 == strcmp ( arg, "newcomb") ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            CombPenalities = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "ape1") ) {                                     // Mark APE as APE 1.000
+            APE_Version = 1000;
+        }
+        else if ( 0 == strcmp ( arg, "ape2") ) {                                     // Mark APE as APE 2.000
+            APE_Version = 2000;
+        }
+        else if ( 0 == strcmp ( arg, "unicode") ) {                                  // no tag conversion
+            NoUnicode = 0;
+        }
+        else if ( 0 == strcmp ( arg, "writetags") ) {
+            EnableTags = 1;
+        }
+        else if ( 0 == strcmp ( arg, "lowdelay") ) {
+            LowDelay = 1;
+        }
+        else if ( 0 == strcmp ( arg, "bw")  ||  0 == strcmp ( arg, "lowpass") ) {       // bandwidth
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            Bandwidth = atof (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "displayupdatetime") ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            DisplayUpdateTime = atoi (argv[k]);
+        }
+        else if ( 0 == strcmp ( arg, "artist" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Artist", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "album" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Album", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "debutalbum" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Debut Album", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "publisher" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Publisher", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "conductor" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Conductor", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "title" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Title", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "subtitle" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Subtitle", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "track" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Track", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "comment" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Comment", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "composer" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Composer", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "copyright" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Copyright", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "publicationright" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Publicationright", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "filename" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "File", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "recordlocation" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Record Location", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "recorddate" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Record Date", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "ean/upc" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "EAN/UPC", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "year" )  ||  0 == strcmp ( arg, "releasedate") ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Year", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "genre" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Genre", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "media" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Media", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "index" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Index", 0, p, strlen(p), NoUnicode*3, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "isrc" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "ISRC", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "abstract" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Abstract", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "bibliography" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Bibliography", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "introplay" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Introplay", 0, p, strlen(p), NoUnicode*3, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "media" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = argv[k];
+            addtag ( "Media", 0, p, strlen(p), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "tag" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = strchr ( argv[k], '=' );
+            if ( p == NULL )
+                addtag ( argv[k], strlen(argv[k]), "", 0, NoUnicode, 0 );
+            else
+                addtag ( argv[k], p-argv[k], p+1, strlen(p+1), NoUnicode, 0 );
+        }
+        else if ( 0 == strcmp ( arg, "tagfile" ) ) {
+            if ( ++k >= argc ) { stderr_printf ( errmsg, arg ); return -1; }
+            p = strchr ( argv[k], '=' );
+            if ( p == NULL ) {
+                stderr_printf (" Enter value for tag key '%s': ", argv[k] );
+                fgets ( buff, sizeof buff, stdin );
+                len = strlen (buff);
+                while ( len > 0  &&  (buff [len-1] == '\r'  ||  buff [len-1] == '\n') )
+                    len--;
+                addtag ( arg, strlen(arg), buff, len, NoUnicode*6, 0 );
+            }
+            else {
+                fp = fopen ( p+1, "rb" );
+                if ( fp == NULL ) {
+                    fprintf ( stderr, "Can't open file '%s'.\n", p+1 );
+                }
+                else {
+                    addtag ( argv[k], p-argv[k], buff, fread (buff,1,sizeof buff,fp), NoUnicode*2, 3 );
+                    fclose (fp);
+                }
+            }
+        }
+        else {
+            char c;
+            stderr_printf ( "\n\033[33;41;1mERROR\033[0m: unknown option '--%s' !\n", arg );
+
+            stderr_printf ( "\nNevertheless continue with encoding (Y/n)? \a" );
+            c = waitkey ();
+            if ( c != 'Y' && c != 'y' ) {
+                stderr_printf ( "\n\n*** Abort ***\n" );
+                return -1;
+            }
+            stderr_printf ( "\n" );
+        }
+    }
+
+    TestProfileParams ();
+    return 0;
+}
+
+
+static void
+ShowParameters ( char* inDatei, char* outDatei )
+{
+    static const char        unk      []       = "???";
+    static const char*       EarModel []       = { "ISO (bad!!!)", "Busch", "Filburt", "Klemm", "Klemm/Busch mix", "min(Klemm,Busch)" };
+    static const char        th       [ 7] [4] = { "no", "1st", "2nd", "3rd", "4th", "5th", "6th" };
+    static const char        able     [ 3] [9] = { "Disabled", "Enabled", "Dual" };
+    static const char*       stereo   [16]     = {
+        "Simple uncoupled Stereo",
+        "Mid/Side Stereo + Intensity Stereo 2 bit",
+        "Mid/Side Stereo + Intensity Stereo 4 bit",
+        "Mid/Side Stereo, destroyed imaging (unusable)",
+        "Mid/Side Stereo, much reduced imaging",
+        "Mid/Side Stereo, reduced imaging (-3 dB)",
+        "Mid/Side Stereo when superior",
+        unk, unk, unk,
+        "Mid/Side Stereo when superior + enhanced (1.5/3 dB)",
+        "Mid/Side Stereo when superior + enhanced (2/6 dB)",
+        "Mid/Side Stereo when superior + enhanced (2.5/9 dB)",
+        "Mid/Side Stereo when superior + enhanced (3/12 dB)",
+        unk,
+        "Mid/Side Stereo when superior + enhanced (3/oo dB)"
+    };
+    static const char* const Profiles [16]     = {
+        "n.a", "Unstable/Experimental", unk, unk, unk, "below Telephone", "below Telephone", "Telephone",
+        "Thumb", "Radio", "Standard", "Xtreme", "Insane", "BrainDead", "above BrainDead", "above BrainDead"
+    };
+
+    stderr_printf ( "\n"
+                    " encoding file '%s'\n"
+                    "       to file '%s'\n"
+                    "\n"
+                    " SV %u.%u%s, Profile '%s'\n",
+                    inDatei, outDatei, 7, PNS > 0 ? 1 : 0, XLevel ? " + XLevel coding" : "", Profiles [MainQual] );
+
+    if ( verbose > 0 ) {
+        stderr_printf ( "\n" );
+        if ( FadeInTime != 0.  ||  FadeOutTime != 0.  ||  verbose > 1 )
+            stderr_printf ( " PCM fader                : fade-in: %.2f s, fade-out: %.2f s, shape: %g\n", FadeInTime, FadeOutTime, FadeShape );
+        if ( ScalingFactorr != 1.  ||  ScalingFactorl != 1.  ||  verbose > 1 )
+            stderr_printf ( " Scaling input by         : left %.5f, right: %.5f\n", ScalingFactorl, ScalingFactorr );
+        stderr_printf ( " Maximum encoded bandwidth: %4.1f kHz\n", (Max_Band+1) * (SampleFreq/32./2000.) );
+        stderr_printf ( " Adaptive Noise Shaping   : max. %s order\n", th [NS_Order] );
+        stderr_printf ( " Clear Voice Detection    : %s\n", able [CVD_used] );
+        stderr_printf ( " Mid/Side Stereo          : %s\n", stereo [MS_Channelmode] );
+        stderr_printf ( " Threshold of Hearing     : Model %3u: %s, Max ATH: %2.0f dB, Offset: %+1.0f dB, +Offset@20 kHz:%3.0f dB\n",
+                        EarModelFlag,
+                        EarModelFlag/100 < sizeof(EarModel)/sizeof(*EarModel) ? EarModel [EarModelFlag/100] : unk,
+                        Ltq_max,
+                        Ltq_offset,
+                        -0.6 * (int) (EarModelFlag % 100 - 50) );
+        if ( NMT !=  6.5 || verbose > 1 )
+            stderr_printf ( " Noise masks Tone Ratio   : %4.1f dB\n", NMT );
+        if ( TMN != 18.0 || verbose > 1 )
+            stderr_printf ( " Tone masks Noise Ratio   : %4.1f dB\n", TMN );
+        if ( PNS > 0 )
+            stderr_printf ( " PNS Threshold            : %4.2f\n", PNS );
+        if ( !tmpMask_used )
+            stderr_printf ( " No exploitation of temporal post masking\n" );
+        else if ( verbose > 1 )
+            stderr_printf ( " Exploitation of temporal post masking\n" );
+        if ( minSMR > 0. )
+            stderr_printf ( " Minimum Signal-to-Mask   : %4.1f dB\n", minSMR );
+        else if ( verbose > 1 )
+            stderr_printf ( " No minimum SMR (psycho model controlled filtering)\n" );
+        if ( DelInput == 0xAFFEDEAD )
+            stderr_printf ( " Deleting input file after (successful) encoding\n" );
+        else if ( verbose > 1 )
+            stderr_printf ( " No deleting of input file after encoding\n" );
+    }
+    stderr_printf ( "\n" );
+}
+
+
+/*
+ *  Print out the time to stderr with a precision of 10 ms always using
+ *  12 characters. Time is represented by the sample count. An additional
+ *  prefix character (normally ' ' or '-') is prepended before the first
+ *  digit.
+ */
+
+static const char*
+PrintTime ( UintMax_t samples, int sign )
+{
+    static char  ret [32];
+    Ulong        tmp  = (Ulong) ( UintMAX_FP(samples) * 100. / SampleFreq );
+    Uint         hour = (Uint)  ( tmp / 360000     );
+    Uint         min  = (Uint)  ( tmp / 6000 %  60 );
+    Uint         sec  = (Uint)  ( tmp / 100  %  60 );
+    Uint         csec = (Uint)  ( tmp        % 100 );
+
+
+    if ( UintMAX_FP(samples) >= SampleFreq * 360000. )
+        return "            ";
+    else if ( hour > 9 )
+        sprintf ( ret,  "%c%2u:%02u", sign, hour, min );
+    else if ( hour > 0 )
+        sprintf ( ret, " %c%1u:%02u", sign, hour, min );
+    else if ( min  > 9 )
+        sprintf ( ret,    "   %c%2u", sign,       min );
+    else
+        sprintf ( ret,   "    %c%1u", sign,       min );
+
+    sprintf ( ret + 6,   ":%02u.%02u", sec, csec );
+    return ret;
+}
+
+
+static void
+ShowProgress ( UintMax_t  samples,
+               UintMax_t  total_samples,
+               UintMax_t  databits )
+{
+    static clock_t  start;
+    clock_t         curr;
+    float           percent;
+    float           kbps;
+    float           speed;
+    float           total_estim;
+
+    if ( samples == 0 ) {
+        if ( DisplayUpdateTime >= 0 ) {
+            stderr_printf ("    %%|avg.bitrate| speed|play time (proc/tot)| CPU time (proc/tot)| ETA\n"
+                            "  -.-    -.- kbps  -.--x     -:--.-    -:--.-     -:--.-    -:--.-     -:--.-\r" );
+        }
+        start = clock ();
+        return;
+    }
+    curr    = clock ();
+    if ( curr == start )
+        return;
+
+    percent     = 100.f    * UintMAX_FP(samples) / UintMAX_FP(total_samples);
+    kbps        =   1.e-3f * UintMAX_FP(databits) * SampleFreq / UintMAX_FP(samples);
+    speed       =   1.f    * UintMAX_FP(samples) * (CLOCKS_PER_SEC / SampleFreq) / (unsigned long)(curr - start) ;
+    total_estim =   1.f    * UintMAX_FP(total_samples) / UintMAX_FP(samples) * (unsigned long)(curr - start);
+
+    // progress percent
+    if ( total_samples < IntMax_MAX )
+        stderr_printf ("\r%5.1f ", percent );
+    else
+        stderr_printf ("\r      " );
+
+    // average data rate
+    stderr_printf ( "%6.1f kbps ", kbps );
+
+    // encoder speed
+    stderr_printf ( "%5.2fx ", speed );
+
+    // 2x duration in WAVE file time (encoded/total)
+    stderr_printf ("%10.10s" , PrintTime ( samples      , (char)' ')+1 );
+    stderr_printf ("%10.10s ", PrintTime ( total_samples, (char)' ')+1 );
+
+    // 2x coding time (encoded/total)
+    stderr_printf ("%10.10s" , PrintTime ( (curr - start) * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1 );
+    stderr_printf ("%10.10s ", PrintTime ( total_estim    * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1 );
+
+    // ETA
+    stderr_printf ( "%10.10s\r", samples < total_samples  ?  PrintTime ((total_estim - curr + start) * (SampleFreq/CLOCKS_PER_SEC), (char)' ')+1  :  "" );
+    fflush ( stderr );
+
+    if ( WIN32_MESSAGES  &&  FrontendPresent )
+        SendProgressMessage ( kbps, speed, percent );
+}
+
+
+static int
+myfeof ( FILE* fp )
+{
+    int  ch;
+
+    if ( fp != (FILE*)-1 )
+        return feof (fp);
+
+    ch = CheckKeyKeep ();
+    if ( ch == 'q'  ||  ch == 'Q' )
+        return 1;
+    return 0;
+}
+
+static void fill_float(float * buffer,float val,unsigned count)
+{
+	unsigned n;
+	for(n=0;n<count;n++) buffer[n] = val;
+}
+
+
+static int
+mainloop ( int argc, char** argv )
+{
+    SMRTyp           SMR;                       // contains SMRs for the given frame
+    PCMDataTyp       Main;                      // contains PCM data for 1600 samples
+    SubbandFloatTyp  X [32];                    // Subbandsamples as float()
+    SubbandQuantTyp  Q [32];                    // Subband samples after quantization
+    wave_t           Wave;                      // contains WAV-files arguments
+    UintMax_t        AllSamplesRead   =    0;   // overall read Samples per channel
+    unsigned int     CurrentRead      =    0;   // current read Samples per channel
+    unsigned int     N;                         // counter for processed frames
+    unsigned int     LastValidSamples =    0;   // number of valid samples for the last frame
+    unsigned int     LastValidFrame   =    0;   // overall number of frames
+    char*            InputName        = NULL;   // Name of WAVE file
+    char*            OutputName       = NULL;   // Name of bitstream file
+    FILE*            OutputFile       = NULL;   // Filepointer to output file
+    int              Silence          =    0;
+    int              OldSilence       =    0;
+    time_t           T;
+    UintMax_t        OldBufferedBits;
+    BitstreamPos     bitstreampos;
+    int              TransientL [PART_SHORT];   // Flag of transient detection
+    int              TransientR [PART_SHORT];   // Flag of transient detection
+    int              Transient  [32];           // Flag of transient detection
+
+
+    ENTER(2);
+
+    // initialize PCM-data
+    memset ( &Main, 0, sizeof Main );
+
+    // open WAV file
+    if ( EvalParameters ( argc, argv, &InputName, &OutputName, 1 ) < 0 )
+        return 1;
+    if ( Open_WAV_Header ( &Wave, InputName ) < 0 ) {
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: Unable to read or decode: '%s'\n", InputName );
+        return 1;
+    }
+    TitleBar ( InputName );
+    CopyTags ( InputName );
+
+    // read WAV-Header
+    if ( 0 != Read_WAV_Header (&Wave) ) {
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: Invalid file header, not a WAVE file '%s'\n", InputName );
+        return 1;
+    }
+
+    SampleFreq    = Wave.SampleFreq;
+    SamplesInWAVE = Wave.PCMSamples;
+
+    if ( Wave.SampleFreq != 44100.  &&  Wave.SampleFreq != 48000.  &&  Wave.SampleFreq != 37800.  &&  Wave.SampleFreq != 32000. ) {
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: Sampling frequency of %g kHz is not supported!\n\n", (double)(Wave.SampleFreq * 1.e-3) );
+        return 1;
+    }
+
+    if ( Wave.BitsPerSample < 8  ||  Wave.BitsPerSample > 32 ) {
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: %i bits per sample are not supported!\n\n", Wave.BitsPerSample );
+        return 1;
+    }
+
+    switch ( Wave.Channels ) {
+    case  0:
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: 0 channels file, this is nonsense\n\n" );
+        return 1;
+    case  1: case  2:
+        break;
+    case  3: case  4: case  5: case  6: case  7: case  8:
+        stderr_printf ( "WARNING: %i channel(s) file, only first 2 channels are encoded.\n\n", Wave.Channels );
+        break;
+    default:
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: %i channel(s) file, not supported\n\n", Wave.Channels );
+        return 1;
+    }
+
+    SetQualityParams (5.0);
+
+    if ( EvalParameters ( argc, argv, &InputName, &OutputName, 0 ) < 0 )
+        return 1;
+
+    if ( UintMAX_FP(SamplesInWAVE) >= Wave.SampleFreq * (SkipTime + Duration) ) {
+        SamplesInWAVE = Wave.SampleFreq * (SkipTime + Duration);
+    }
+
+    Init_Psychoakustiktabellen ();              // must be done AFTER decoding command line parameters
+
+    // check fade-length
+    if ( FadeInTime + FadeOutTime > UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq ) {
+        stderr_printf ( "WARNING: Duration of fade in + out exceeds file length!\n");
+        FadeInTime = FadeOutTime = 0.5 * UintMAX_FP(SamplesInWAVE) / Wave.SampleFreq;
+    }
+
+    /* open bitstream file */
+    if      ( 0 == strcmp ( OutputName, "/dev/null") ) {
+        OutputFile = fopen (DEV_NULL, "wb");
+    }
+    else if ( 0 == strcmp ( OutputName, "-")  ||  0 == strcmp ( OutputName, "/dev/stdout") ) {
+        OutputFile = SETBINARY_OUT (stdout);
+    }
+    else
+        switch ( WriteMode ) {
+        default:
+            stderr_printf ( "\033[33;41;1mERROR\033[0m: Invalid Write mode, internal error\n" );
+            return 1;
+        case MODE_NEVER_OVERWRITE:
+            OutputFile = fopen ( OutputName, "rb" );
+            if ( OutputFile != NULL ) {
+                fclose ( OutputFile );
+                stderr_printf ( "\033[33;41;1mERROR\033[0m: Output file '%s' already exists\n", OutputName );
+                return 1;
+            }
+            OutputFile = fopen ( OutputName, "w+b" );
+            break;
+        case MODE_OVERWRITE:
+            OutputFile = fopen ( OutputName, "w+b" );
+            break;
+        case MODE_ASK_FOR_OVERWRITE:
+            OutputFile = fopen ( OutputName, "rb" );
+            if ( OutputFile != NULL ) {
+                char c;
+                fclose ( OutputFile );
+                stderr_printf ( "\nmppenc: Output file '%s' already exists, overwrite (Y/n)? ", OutputName );
+                c = waitkey ();
+                if ( c != 'Y'  &&  c != 'y' ) {
+                    stderr_printf ( "No!!!\n\n*** Canceled overwrite ***\n" );
+                    return 1;
+                }
+                                stderr_printf ( " YES\n" );
+            }
+            OutputFile = fopen ( OutputName, "w+b" );
+            break;
+        }
+
+    if ( OutputFile == NULL ) {
+        stderr_printf ( "\033[33;41;1mERROR\033[0m: Could not create output file '%s'\n", OutputName );
+        return 1;
+    }
+
+#ifndef IO_BUFFERING
+    setvbuf ( OutputFile, NULL, _IONBF, 0 );
+#endif
+
+    ShowParameters ( InputName, OutputName );
+    if ( WIN32_MESSAGES  &&  FrontendPresent )
+        SendModeMessage (MainQual);
+
+    if ( SkipTime > 0. ) {
+        unsigned long  SkipSamples = SampleFreq * SkipTime;
+        ssize_t        read;
+
+        while ( SkipSamples > 0 ) {
+            read          = Read_WAV_Samples ( &Wave, mini(BLOCK, SkipSamples), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
+            if ( read <= 0 )
+                break;
+            SkipSamples   -= read;
+            SamplesInWAVE -= read;
+        }
+    }
+
+    BufferedBits     = 0;
+    LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
+    LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
+    WriteHeader_SV7 ( Max_Band, MainQual, MS_Channelmode > 0, LastValidFrame, LastValidSamples, PNS > 0 ? 0x17 : 0x07, SampleFreq );
+
+    // initialize timer
+    ShowProgress ( 0, SamplesInWAVE, BufferedBits );
+    T            = time ( NULL );
+
+    // read samples
+    CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
+    AllSamplesRead += CurrentRead;
+
+	if (CurrentRead > 0)
+	{
+		fill_float( Main.L, Main.L[CENTER], CENTER );
+		fill_float( Main.R, Main.R[CENTER], CENTER );
+		fill_float( Main.M, Main.M[CENTER], CENTER );
+		fill_float( Main.S, Main.S[CENTER], CENTER );
+	}
+
+	Analyse_Init ( Main.L[CENTER], Main.R[CENTER], X, Max_Band );
+
+    // adapt SamplesInWAVE to the real number of contained samples
+    if ( myfeof (Wave.fp) ) {
+        stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
+                        UintMAX_FP(AllSamplesRead) / SampleFreq, UintMAX_FP(SamplesInWAVE) / SampleFreq );
+        SamplesInWAVE = AllSamplesRead;
+
+        // in the case of a broken wav-header, recalculate the overall frames
+        // and the valid samples for the last frame
+        LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
+        LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
+        // fprintf ( stderr, "\nKorrupt WAV file in Frame %d: NEU!: Frames: %u, last valid: %u\n", -1, LastValidFrame, LastValidSamples );
+    }
+
+    for ( N = 0; (UintMax_t)N * BLOCK < SamplesInWAVE + DECODER_DELAY; N++ ) {
+
+        // setting residual data-fields to zero
+        if ( CurrentRead < BLOCK  &&  N > 0 ) {
+            fill_float( Main.L + (CENTER + CurrentRead), Main.L[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
+            fill_float( Main.R + (CENTER + CurrentRead), Main.R[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
+            fill_float( Main.M + (CENTER + CurrentRead), Main.M[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
+            fill_float( Main.S + (CENTER + CurrentRead), Main.S[CENTER + CurrentRead - 1], BLOCK - CurrentRead );
+        }
+
+        /*********************************************************************************/
+        /*                                Fade In and Fade Out                                */
+        /*********************************************************************************/
+        if ( FadeInTime  > 0. )
+            if ( FadeInTime  > UintMAX_FP(BLOCK         + (UintMax_t)N*BLOCK) / Wave.SampleFreq )
+                Fading_In  ( &Main, N*BLOCK, Wave.SampleFreq );
+        if ( FadeOutTime > 0. )
+            if ( FadeOutTime > UintMAX_FP(SamplesInWAVE - (UintMax_t)N*BLOCK) / Wave.SampleFreq )
+                Fading_Out ( &Main, N*BLOCK, Wave.SampleFreq );
+
+        /********************************************************************/
+        /*                         Encoder-Core                             */
+        /********************************************************************/
+        // you only get null samples at the output of the filterbank when the last frame contains zeroes
+
+        memset ( Res_L, 0, sizeof Res_L );
+        memset ( Res_R, 0, sizeof Res_R );
+
+        if ( !Silence  ||  !OldSilence ) {
+            Analyse_Filter ( &Main, X, Max_Band );                      // Analysis-Filterbank (Main -> X)
+            SMR = Psychoakustisches_Modell ( Max_Band*0+31, &Main, TransientL, TransientR );    // Psychoacoustics return SMRs for input data 'Main'
+            if ( minSMR > 0 )
+                RaiseSMR ( Max_Band, &SMR );                            // Minimum-operation on SBRs (full bandwidth)
+            if ( MS_Channelmode > 0 )
+                MS_LR_Entscheidung ( Max_Band, MS_Flag, &SMR, X );      // Selection of M/S- or L/R-Coding
+            SCF_Extraktion ( Max_Band, X );                             // Extraction of the scalefactors and normalization of the subband samples
+            TransientenCalc ( Transient, TransientL, TransientR );
+            if ( NS_Order > 0 ) {
+                NS_Analyse ( Max_Band, MS_Flag, SMR, Transient );                  // calculate possible ANS-Filter and the expected gain
+            }
+
+            Allocate ( Max_Band, Res_L, X[0].L, SCF_Index_L[0], SNR_comp_L, SMR.L, (const SCFTriple*) Power_L, Transient );   // allocate bits for left + right channel
+            Allocate ( Max_Band, Res_R, X[0].R, SCF_Index_R[0], SNR_comp_R, SMR.R, (const SCFTriple*) Power_R, Transient );
+
+            Quantisierung ( Max_Band, Res_L, Res_R, X, Q );             // quantize samples
+        }
+
+        if ( Zaehler >= BUFFER_ALMOST_FULL  ||  LowDelay ) {
+            FlushBitstream ( OutputFile, Buffer, Zaehler );
+            Zaehler = 0;
+         }
+
+        OldSilence      = Silence;
+        OldBufferedBits = BufferedBits;
+        GetBitstreamPos    ( &bitstreampos );
+        WriteBits          ( 0, 20 );                                                      // Reserve 20 bits for jump-information
+        WriteBitstream_SV7 ( Max_Band, Q );                                                // write SV7-Bitstream
+        WriteBitsAt        ( (Uint32_t)(BufferedBits - OldBufferedBits - 20), 20, bitstreampos );      // Patch 20 bits for jump-information to the right value
+
+        if ( (Int)(time (NULL) - T) >= 0 ) {                            // output
+            T += labs (DisplayUpdateTime);
+            ShowProgress ( (UintMax_t)(N+1) * BLOCK, SamplesInWAVE, BufferedBits );
+        }
+
+        // for backwards-compatibility with older decoders write the 11 bit for
+        // reconstruction of exact filelength before the very last frame
+
+        memmove ( Main.L, Main.L + BLOCK, CENTER * sizeof(float) );
+        memmove ( Main.R, Main.R + BLOCK, CENTER * sizeof(float) );
+        memmove ( Main.M, Main.M + BLOCK, CENTER * sizeof(float) );
+        memmove ( Main.S, Main.S + BLOCK, CENTER * sizeof(float) );
+
+		//if ( AllSamplesRead + BLOCK > SamplesInWAVE )
+		//{
+		//	int n = 0;
+		//}
+
+        // read samples
+        CurrentRead     = Read_WAV_Samples ( &Wave, (int)minf(BLOCK, SamplesInWAVE - AllSamplesRead), &Main, CENTER, ScalingFactorl, ScalingFactorr, &Silence );
+        AllSamplesRead += CurrentRead;
+
+        // adapt SamplesInWAV to the real number of contained samples
+        if ( myfeof (Wave.fp) ) {
+            stderr_printf ( "WAVE file has incorrect header: header: %.3f s, contents: %.3f s    \n",
+                            UintMAX_FP(AllSamplesRead) / SampleFreq, UintMAX_FP(SamplesInWAVE) / SampleFreq );
+            SamplesInWAVE = AllSamplesRead;
+
+            // in the case of broken wav-header, recalculate the overall frames
+            // and the valid samples for the last frame
+            LastValidFrame   = (SamplesInWAVE + BLOCK - 1) / BLOCK;
+            LastValidSamples = (SamplesInWAVE + BLOCK - 1) - BLOCK * LastValidFrame + 1;
+            // fprintf ( stderr, "\nKorrupt WAV file in Frame %d: NEU!: Frames: %u, last valid: %u\n", N, LastValidFrame, LastValidSamples );
+        }
+
+        if ( N == LastValidFrame - 1 ) {
+            WriteBits ( LastValidSamples, 11 );
+            // fprintf ( stderr, "\nGültige Samples im letzten Frame: %4u   \n", LastValidSamples );
+        }
+        if ( N >= LastValidFrame ) {
+            // fprintf ( stderr, "Zusätzlicher Frame %u (von %u) angehängt.   \n", N, LastValidFrame );
+        }
+
+    }
+    LEAVE(2);
+
+    // write the last incomplete word to buffer, so it's written during the next flush
+    FinishBitstream();
+    ShowProgress ( SamplesInWAVE, SamplesInWAVE, BufferedBits );
+
+    FlushBitstream ( OutputFile, Buffer, Zaehler );
+    Zaehler = 0;
+
+    UpdateHeader ( OutputFile, LastValidFrame, LastValidSamples );
+
+    if(EnableTags)
+        FinalizeTags ( OutputFile, APE_Version );
+    fclose ( OutputFile );
+    fclose ( Wave.fp );
+
+    if ( DelInput == 0xAFFEDEAD  &&  remove (InputName) == -1 )         // delete input file if DelInput is active
+        stderr_printf ( "\n\n\033[33;41;1mERROR\033[0m: Could not delete input file '%s'\n", InputName );
+
+    if ( WIN32_MESSAGES  &&  FrontendPresent )
+        SendQuitMessage ();
+
+    stderr_printf ( "\n" );
+    return 0;
+}
+
+
+void
+OverdriveReport ( void )
+{
+    if ( Overflows > 0 ) {                                                // report internal clippings
+        if ( XLevel == 0 ) {
+            stderr_printf ( "\n"
+                            "\033[1m\rWARNING:\n"
+                            "\033[0m\r  %u internal clippings occured due to a restriction of StreamVersion 7.\n"
+                            "  Re-encode with '--scale %.3f', or remove option '--noxlevel'.\a\n\n",
+                            Overflows, ScalingFactorl * 32767. / MaxOverFlow - 0.0005f );
+        }
+        else {
+            stderr_printf ( "\n"
+                            "\033[1m\rWARNING:\n"
+                            "\033[0m\r  %u internal clippings occured due to a restriction of StreamVersion 7.\n"
+                            "  Use the '--scale' method to avoid additional distortions. Note that this\n"
+                            "  file already has annoying distortions due to slovenly CD mastering.\a\n\n", Overflows );
+        }
+    }
+}
+
+
+/************ The main() function *****************************/
+int Cdecl
+main ( int argc, char** argv )
+{
+    int  ret;
+
+#if (defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO)  &&  (defined USE_REALTIME  ||  defined USE_NICE)
+    // DisableSUID ();
+#endif
+
+#ifdef _OS2
+    _wildcard ( &argc, &argv );
+#endif
+
+    if ( WIN32_MESSAGES ) {
+        FrontendPresent = SearchForFrontend (); // search for presence of Windows Frontend
+        if ( FrontendPresent )
+            SendStartupMessage ( MPPENC_VERSION, 7, MPPENC_BUILD );
+    }
+
+    START();
+    ENTER(1);
+
+    // Welcome message
+    if ( argc < 2  ||  ( 0 != strcmp (argv[1], "--silent")  &&  0 != strcmp (argv[1], "--quiet")) )
+        (void) stderr_printf ("\r\x1B[1m\r%s\n\x1B[0m\r     \r", About );
+
+    // no arguments or call for help
+    if ( argc < 2  ||  0==strcmp (argv[1],"-h")  ||  0==strcmp (argv[1],"-?")  ||  0==strcmp (argv[1],"--help") ) {
+        SetQualityParams (5.0);
+        dup2 ( 1, 2 );
+        shorthelp ();
+        return 1;
+    }
+
+    if ( 0==strcmp (argv[1],"--longhelp")  ||  0==strcmp (argv[1],"-??") ) {
+        SetQualityParams (5.0);
+        dup2 ( 1, 2 );
+        longhelp ();
+        return 1;
+    }
+
+    // initialize tables which must be initialized once and only once
+#ifdef FAST_MATH
+    Init_FastMath ();                           // check if something has to be done for each file !!
+#endif
+    Init_SV7 ();
+    Init_Psychoakustiktabellen ();
+    Init_Skalenfaktoren ();
+    Init_Psychoakustik ();
+    Init_FPU ();
+    Init_ANS ();
+    Klemm    ();
+
+    ret = mainloop ( argc, argv );              // analyze command line and do the requested work
+
+    OverdriveReport ();                         // output a report if clipping was necessary
+
+    if(IsEndBeep)
+        stderr_printf("\a\a\a");
+
+    LEAVE(1);
+    REPORT();
+#ifdef BUGBUG
+    reppr ();
+#endif
+    return ret;
+}
+
+/* end of mppenc.c */
Index: /mppenc/trunk/src/mppenc.h
===================================================================
--- /mppenc/trunk/src/mppenc.h	(revision 97)
+++ /mppenc/trunk/src/mppenc.h	(revision 97)
@@ -0,0 +1,372 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef MPPENC_MPPENC_H
+#define MPPENC_MPPENC_H
+
+#ifdef _WIN32
+# define CVD_FASTLOG
+# define FAST_MATH
+#endif
+
+#include "mppdec.h"
+#include "minimax.h"
+
+//#define IO_BUFFERING                          // activates IO-buffer (default: off)
+
+#define WIN32_MESSAGES      1                   // support Windows-Messaging to Frontend
+
+// analyse_filter.c
+#define X_MEM            1152
+
+// ans.c
+#define MAX_NS_ORDER        6                   // maximum order of the Adaptive Noise Shaping Filter (IIR)
+#define MAX_ANS_BANDS      16
+#define MAX_ANS_LINES    (32 * MAX_ANS_BANDS)   // maximum number of noiseshaped FFT-lines
+///////// 16 * MAX_ANS_BANDS not sufficient? //////////////////
+#define MS2SPAT1             0.5f
+#define MS2SPAT2             0.25f
+#define MS2SPAT3             0.125f
+#define MS2SPAT4             0.0625f
+
+// bitstream.c
+#define BUFFER_ALMOST_FULL  8192
+#define BUFFER_FULL         (BUFFER_ALMOST_FULL + 4352)         // 34490 bit/frame  1320.3 kbps
+
+// cvd.c
+#define MAX_CVD_LINE      300                   // maximum FFT-Index for CVD
+#define CVD_UNPRED          0.040f              // unpredictability (cw) for CVD-detected bins, e33 (04)
+#define MIN_ANALYZED_IDX   12                   // maximum base-frequency = 44100/MIN_ANALYZED_IDX ^^^^^^
+#define MED_ANALYZED_IDX   50                   // maximum base-frequency = 44100/MED_ANALYZED_IDX ^^^^^^
+#define MAX_ANALYZED_IDX  900                   // minimum base-frequency = 44100/MAX_ANALYZED_IDX  (816 for Amnesia)
+
+// mppenc.h
+#define CENTER            448                   // offset for centering current data in Main-array
+#define BLOCK            1152                   // blocksize
+#define ANABUFFER    (BLOCK + CENTER)           // size of PCM-data array for analysis
+
+// psy.c
+#define SHORTFFT_OFFSET   168                   // fft-offset for short FFT's
+#define PREFAC_LONG        10                   // preecho-factor for long partitions
+
+// psy_tab.h
+#define PART_LONG          57                   // number of partitions for long
+#define PART_SHORT     (PART_LONG / 3)          // number of partitions for short
+#define MAX_SPL            20                   // maximum assumed Sound Pressure Level
+
+// quant.h
+#define SCFfac              0.832980664785f     // = SCF[n-1]/SCF[n]
+
+// wave_in.h
+
+
+// fast but maybe more inaccurate, use if you need speed
+#if defined(__GNUC__) && !defined(__APPLE__)
+#  define SIN(x)      sinf ((float)(x))
+#  define COS(x)      cosf ((float)(x))
+#  define ATAN2(x,y)  atan2f ((float)(x), (float)(y))
+#  define SQRT(x)     sqrtf ((float)(x))
+#  define LOG(x)      logf ((float)(x))
+#  define LOG10(x)    log10f ((float)(x))
+#  define POW(x,y)    expf (logf(x) * (y))
+#  define POW10(x)    expf (M_LN10 * (x))
+#  define FLOOR(x)    floorf ((float)(x))
+#  define IFLOOR(x)   (int) floorf ((float)(x))
+#  define FABS(x)     fabsf ((float)(x))
+#else
+# define SIN(x)      (float) sin (x)
+# define COS(x)      (float) cos (x)
+# define ATAN2(x,y)  (float) atan2 (x, y)
+# define SQRT(x)     (float) sqrt (x)
+# define LOG(x)      (float) log (x)
+# define LOG10(x)    (float) log10 (x)
+# define POW(x,y)    (float) pow (x,y)
+# define POW10(x)    (float) pow (10., (x))
+# define FLOOR(x)    (float) floor (x)
+# define IFLOOR(x)   (int)   floor (x)
+# define FABS(x)     (float) fabs (x)
+#endif
+
+#define SQRTF(x)      SQRT (x)
+#ifdef FAST_MATH
+# define TABSTEP      64
+# define COSF(x)      my_cos ((float)(x))
+# define ATAN2F(x,y)  my_atan2 ((float)(x), (float)(y))
+# define IFLOORF(x)   my_ifloor ((float)(x))
+#else
+# undef  TABSTEP
+# define COSF(x)      COS (x)
+# define ATAN2F(x,y)  ATAN2 (x,y)
+# define IFLOORF(x)   IFLOOR (x)
+#endif
+
+typedef struct {
+    float  L [ANABUFFER];
+    float  R [ANABUFFER];
+    float  M [ANABUFFER];
+    float  S [ANABUFFER];
+} PCMDataTyp;
+
+typedef struct {
+    float  L [36];
+    float  R [36];
+} SubbandFloatTyp;
+
+typedef struct {
+    unsigned int  L [36];
+    unsigned int  R [36];
+} SubbandQuantTyp;
+
+typedef struct {
+    float  L [32];
+    float  R [32];
+    float  M [32];
+    float  S [32];
+} SMRTyp;
+
+typedef struct {
+    FILE*         fp;                   // File pointer to read data
+    Ulong         PCMOffset;            // File offset of PCM data
+    long double   SampleFreq;           // Sample frequency in Hz
+    Uint          BitsPerSample;        // used bits per sample, 8*BytesPerSample-7 <= BitsPerSample <= BytesPerSample
+    Uint          BytesPerSample;       // allocated bytes per sample
+    Uint          Channels;             // Number of channels, 1...8
+    UintMax_t     PCMBytes;             // PCM Samples (in 8 bit units)
+    UintMax_t     PCMSamples;           // PCM Samples per Channel
+    Bool_t        raw;                  // raw: headerless format
+} wave_t;
+
+// analy_filter.c
+void   Analyse_Filter(const PCMDataTyp*, SubbandFloatTyp*, const int);
+void   Analyse_Init ( float Left, float Right, SubbandFloatTyp* out, const int MaxBand );
+
+void   Klemm ( void );
+
+// ans.c
+extern unsigned int  NS_Order;                          // global Flag for Noise Shaping
+extern unsigned int  NS_Order_L [32];
+extern unsigned int  NS_Order_R [32];                   // order of the Adaptive Noiseshaping (0: off, 1...5: on)
+extern float         FIR_L     [32] [MAX_NS_ORDER];
+extern float         FIR_R     [32] [MAX_NS_ORDER];     // contains FIR-Filter for NoiseShaping
+extern float         ANSspec_L [MAX_ANS_LINES];
+extern float         ANSspec_R [MAX_ANS_LINES];         // L/R-masking threshold for ANS
+extern float         ANSspec_M [MAX_ANS_LINES];
+extern float         ANSspec_S [MAX_ANS_LINES];         // M/S-masking threshold for ANS
+
+void   Init_ANS   ( void );
+void   NS_Analyse ( const int, const unsigned char* MS, const SMRTyp, const int* Transient );
+
+
+// bitstream.c
+typedef struct {
+    Uint32_t*     ptr;
+    unsigned int  bit;
+} BitstreamPos;
+
+
+extern Uint32_t      Buffer [BUFFER_FULL];      // buffer for bitstream file (128 KB)
+extern Uint32_t      dword;                     // 32 bit-Word for Bitstream-I/O
+extern unsigned int  Zaehler;                   // position counter for processed bitstream word (32 bit)
+extern UintMax_t     BufferedBits;              // counter for the number of written bits in the bitstream
+
+void  FlushBitstream    ( FILE* fp, const Uint32_t* buffer, size_t words32bit );
+void  UpdateHeader      ( FILE* fp, Uint32_t Frames, Uint ValidSamples );
+void  WriteBits         ( const Uint32_t input, const unsigned int bits );
+void  WriteBitsAt       ( const Uint32_t input, const unsigned int bits, const BitstreamPos pos );
+void  GetBitstreamPos   ( BitstreamPos* const pos );
+
+// cvd.c
+int    CVD2048 ( const float*, int* );
+
+
+// fastmath.c
+void   Init_FastMath ( void );
+extern const float  tabatan2   [] [2];
+extern const float  tabcos     [] [2];
+extern const float  tabsqrt_ex [];
+extern const float  tabsqrt_m  [] [2];
+
+
+// fft4g.c
+void   rdft                ( const int, float*, int*, float* );
+void   Generate_FFT_Tables ( const int, int*, float* );
+
+
+// fft_routines.c
+void   Init_FFT      ( void );
+void   PowSpec256    ( const float*, float* );
+void   PowSpec1024   ( const float*, float* );
+void   PowSpec2048   ( const float*, float* );
+void   PolarSpec1024 ( const float*, float*, float* );
+void   Cepstrum2048  ( float* cep, const int );
+
+
+// mppenc.c
+extern float         SNR_comp_L [32];
+extern float         SNR_comp_R [32];   // SNR-compensation after SCF-combination and ANS-gain
+extern unsigned int  MS_Channelmode;    // global flag for enhanced functionality
+extern unsigned int  Overflows;
+extern float         SampleFreq;
+extern float         Bandwidth;
+extern float         KBD1;
+extern float         KBD2;
+
+// psy.c
+extern unsigned int  CVD_used;          // global flag for ClearVoiceDetection (more switches for the psychoacoustic model)
+extern float         varLtq;            // variable threshold in quiet
+extern unsigned int  tmpMask_used;      // global flag for temporal masking
+extern float         ShortThr;          // factor for calculation masking threshold with transients
+extern float         minSMR;            // minimum SMR for all subbands
+
+void   Init_Psychoakustik       ( void );
+SMRTyp Psychoakustisches_Modell ( const int, const PCMDataTyp*, int* TransientL, int* TransientR );
+void   TransientenCalc          ( int* Transient, const int* TransientL, const int* TransientR );
+void   RaiseSMR                 ( const int, SMRTyp* );
+void   MS_LR_Entscheidung       ( const int, unsigned char* MS, SMRTyp*, SubbandFloatTyp* );
+
+
+// psy_tab.c
+extern int          MinValChoice;               // Flag for calculation of MinVal-values
+extern unsigned int EarModelFlag;               // Flag for threshold in quiet
+extern float        Ltq_offset;                 // Offset for threshold in quiet
+extern float        Ltq_max;                    // maximum level for threshold in quiet
+extern float        fftLtq   [512];             // threshold in quiet (FFT)
+extern float        partLtq  [PART_LONG];       // threshold in quiet (Partitions)
+extern float        invLtq   [PART_LONG];       // inverse threshold in quiet (Partitions, long)
+extern float        Loudness [PART_LONG];       // weighting factors for calculation of loudness
+extern float        MinVal   [PART_LONG];       // minimum quality that's adapted to the model, minval for long
+extern float        SPRD     [PART_LONG] [PART_LONG]; // tabulated spreading function
+extern float        TMN;                        // Offset for purely sinusoid components
+extern float        NMT;                        // Offset for purely noisy components
+extern float        TransDetect;                // minimum slewrate for transient detection
+extern float        O_MAX;
+extern float        O_MIN;
+extern float        FAC1;
+extern float        FAC2;     // constants to calculate the used offset
+
+extern const float  Butfly    [7];              // Antialiasing to calculate the subband powers
+extern const float  InvButfly [7];              // Antialiasing to calculate the masking thresholds
+extern const float  iw        [PART_LONG];      // inverse partition-width for long
+extern const float  iw_short  [PART_SHORT];     // inverse partition-width for short
+extern const int    wl        [PART_LONG];      // w_low  for long
+extern const int    wl_short  [PART_SHORT];     // w_low  for short
+extern const int    wh        [PART_LONG];      // w_high for long
+extern const int    wh_short  [PART_SHORT];     // w_high for short
+
+void   Init_Psychoakustiktabellen ( void );
+
+
+// quant.c
+extern float __invSCF [128 + 6];        // tabulated scalefactors (inverted)
+#define invSCF  (__invSCF + 6)
+
+void   Init_Skalenfaktoren             ( void );
+float  ISNR_Schaetzer                  ( const float* samples, const float comp, const int res);
+float  ISNR_Schaetzer_Trans            ( const float* samples, const float comp, const int res);
+void   QuantizeSubband                 ( unsigned int* qu_output, const float* input, const int res, float* errors );
+void   QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, float* errors, const float* FIR );
+
+void   NoiseInjectionComp ( void );
+
+
+// encode_sv7.c
+extern unsigned char  MS_Flag     [32];                  // subband-wise mid/side flag
+extern int            Res_L       [32];
+extern int            Res_R       [32];                  // resolution steps of the subbands
+extern int            SCF_Index_L [32] [3];
+extern int            SCF_Index_R [32] [3];              // Scalefactor-index for Bitstream
+
+void         Init_SV7             ( void );
+void         WriteHeader_SV7      ( const unsigned int, const unsigned int, const unsigned int, const Uint32_t TotalFrames, const unsigned int SamplesRest, const unsigned int StreamVersion, const unsigned int SampleFreq );
+void         WriteBitstream_SV7   ( const int, const SubbandQuantTyp* );
+void         FinishBitstream      ( void );
+
+
+// huffsv7.c
+extern Huffman_t         HuffHdr  [10];         // contains tables for SV7-header
+extern Huffman_t         HuffSCFI [ 4];         // contains tables for SV7-scalefactor select
+extern Huffman_t         HuffDSCF [16];         // contains tables for SV7-scalefactor coding
+extern const Huffman_t*  HuffQ [2] [8];         // points to tables for SV7-sample coding
+
+void    Huffman_SV7_Encoder ( void );
+
+
+// keyboard.c
+int    WaitKey      ( void );
+int    CheckKeyKeep ( void );
+int    CheckKey     ( void );
+
+
+// regress.c
+void    Regression       ( float* const _r, float* const _b, const float* p, const float* q );
+
+
+// tags.c
+void    Init_Tags        ( void );
+int     FinalizeTags     ( FILE* fp, unsigned int Version );
+int     addtag           ( const char* key, size_t keylen, const unsigned char* value, size_t valuelen, int converttoutf8, int flags );
+int     gettag           ( const char* key, char* dst, size_t len );
+int     CopyTags         ( const char* filename );
+
+
+// wave_in.c
+int     Open_WAV_Header  ( wave_t* type, const char* name );
+size_t  Read_WAV_Samples ( wave_t* t, const size_t RequestedSamples, PCMDataTyp* data, const ptrdiff_t offset, const float scalel, const float scaler, int* Silence );
+int     Read_WAV_Header  ( wave_t* type );
+
+
+// winmsg.c
+#ifdef _WIN32
+int    SearchForFrontend   ( void );
+void   SendQuitMessage     ( void );
+void   SendModeMessage     ( const int );
+void   SendStartupMessage  ( const char*, const int, const char* );
+void   SendProgressMessage ( const int, const float, const float );
+#else
+# undef  WIN32_MESSAGES
+# define WIN32_MESSAGES                 0
+# define SearchForFrontend()            (0)
+# define SendQuitMessage()              (void)0
+# define SendModeMessage(x)             (void)0
+# define SendStartupMessage(x,y,s)      (void)0
+# define SendProgressMessage(x,y,z)     (void)0
+#endif /* _WIN32 */
+
+
+#define MPPENC_DENORMAL_FIX_BASE ( 32. * 1024. /* normalized sample value range */ / ( (float) (1 << 24 /* first bit below 32-bit PCM range */ ) ) )
+#define MPPENC_DENORMAL_FIX_LEFT ( MPPENC_DENORMAL_FIX_BASE )
+#define MPPENC_DENORMAL_FIX_RIGHT ( MPPENC_DENORMAL_FIX_BASE * 0.5f )
+
+
+#endif /* MPPENC_MPPENC_H */
+
+#if 0
+# define LAST_HUFFMAN   15
+# define DUMP_HIGHRES
+#endif
+
+#if 0
+# define DUMP_RES15
+#endif
+
+#ifndef LAST_HUFFMAN
+# define LAST_HUFFMAN    7
+#endif
+
+/* end of mppenc.h */
Index: /mppenc/trunk/src/pipeopen.c
===================================================================
--- /mppenc/trunk/src/pipeopen.c	(revision 97)
+++ /mppenc/trunk/src/pipeopen.c	(revision 97)
@@ -0,0 +1,195 @@
+/*
+ *  Opens a communication channel to another program using unnamed pipe mechanism and stdin/stdout.
+ *
+ *  (C) Frank Klemm 2001,02. All rights reserved.
+ *
+ *  Principles:
+ *
+ *  History:
+ *    2001          created
+ *    2002
+ *
+ *  Global functions:
+ *    - pipeopen
+ *
+ *  TODO:
+ *    -
+ */
+
+//#define DEBUG2
+
+#include "mppdec.h"
+#include <ctype.h>
+
+
+/*
+ *
+ */
+
+static int
+EscapeProgramPathName ( const char*  longprogname,
+                        char*        escaped,
+                        size_t       len )
+{
+    int   ret = 0;
+
+#ifdef _WIN32
+    ret = GetShortPathName ( longprogname, escaped, len );
+#else
+    if ( strlen (longprogname) <= len-3 )
+        ret = sprintf ( escaped, "\"%s\"", longprogname );      // Note that this only helps against spaces and some similar things in the file name, not against all strange stuff
+#endif
+
+    if ( ret <= 0  ||  ret >= (int)len ) {
+    }
+
+    return ret;
+}
+
+
+/*
+ *
+ */
+
+static FILE*
+OpenPipeWhenBinaryExist ( const char*  path,
+                          size_t       pathlen,
+                          const char*  executable_filename,
+                          const char*  command_line )
+{
+    char   filename [4096];
+    char   cmdline  [4096];
+    char*  p  = filename;
+    FILE*  fp;
+
+    for ( ; *path  &&  pathlen--; path++ )
+        if ( *path != '"' )
+            *p++ = *path;
+    *p++ = PATH_SEP;
+    strcpy ( p, executable_filename );
+#ifdef DEBUG2
+    stderr_printf ("Test for file »%s«        \n", filename );
+#endif
+    fp = fopen ( filename, "rb" );
+    if ( fp != NULL ) {
+        fclose ( fp );
+        EscapeProgramPathName ( filename, cmdline, sizeof cmdline );
+        strcat ( cmdline, command_line );
+        fp = POPEN_READ_BINARY_OPEN ( cmdline );
+#ifdef DEBUG2
+        stderr_printf ("Executed »%s«\n", cmdline );
+#endif
+   }
+   return fp;
+}
+
+
+/*
+ *
+ */
+
+static FILE*
+TracePathList ( const char*  p,
+                const char*  executable_filename,
+                const char*  command_line )
+{
+    const char*  nextsep;
+    FILE*        fp;
+
+    while ( p != NULL   &&  *p != '\0' ) {
+        if ( (nextsep = strchr (p, ENVPATH_SEP)) == NULL ) {
+            fp = OpenPipeWhenBinaryExist ( p, (size_t)         -1, executable_filename, command_line );
+            p  = NULL;
+        }
+        else {
+            fp = OpenPipeWhenBinaryExist ( p, (size_t)(nextsep-p), executable_filename, command_line );
+            p  = nextsep + 1;
+        }
+        if ( fp != NULL )
+            return fp;
+    }
+    return NULL;
+}
+
+
+/*
+ *  Executes command line given by »command«.
+ *  The command must be found in some predefined paths or in the ${PATH} aka %PATH%
+ *  The char »#« in command is replaced by the contents
+ *  of »filename«. Special characters are escaped.
+ */
+
+FILE*
+pipeopen ( const char* command, const char* filename )
+{
+    static const char  pathlist [] =
+#ifdef _WIN32
+        ".";
+#else
+        "/usr/bin:/usr/local/bin:/opt/mpp:.";
+#endif
+    char          command_line        [4096];           // » -o - bar.pac«
+    char          executable_filename [4096];           // »foo.exe«
+    char*         p;
+    const char*   q;
+    FILE*         fp;
+
+    // does the source file exist and is readble?
+    if ( (fp = fopen (filename, "rb")) == NULL ) {
+        stderr_printf ("file '%s' not found.\n", filename );
+        return NULL;
+    }
+    fclose (fp);
+
+    // extract executable name from the 'command' to executable_filename, append executable extention
+    p = executable_filename;
+    for ( ; *command != ' '  &&  *command != '\0'; command++ )
+        *p++ = *command;
+    strcpy ( p, EXE_EXT );
+
+
+    // Copy 'command' to 'command_line' replacing '#' by filename
+    p = command_line;
+    for ( ; *command != '\0'; command++ ) {
+        if ( *command != '#' ) {
+            *p++ = *command;
+        }
+        else {
+            q = filename;
+            if (*q == '-') {
+                *p++ = '.';
+                *p++ = PATH_SEP;
+            }
+#ifdef _WIN32                           // Windows secure Way to "escape"
+            *p++ = '"';
+            while (*q)
+                *p++ = *q++;
+            *p++ = '"';
+#else                                   // Unix secure Way to \e\s\c\a\p\e
+            while (*q) {
+                if ( !isalnum(*q)  &&  *q != '.'  &&  *q != '-'  &&  *q != '_'  &&  *q != '/' )
+                    *p++ = '\\';
+                *p++ = *q++;
+            }
+#endif
+        }
+    }
+    *p = '\0';
+
+    // Try the several built-in paths to find binary
+    fp = TracePathList ( pathlist       , executable_filename, command_line );
+    if ( fp != NULL )
+        return fp;
+
+    // Try the PATH settings to find binary (Why we must search for the executable in all PATH settings? --> popen itself do not return useful information)
+    fp = TracePathList ( getenv ("PATH"), executable_filename, command_line );
+    if ( fp != NULL )
+        return fp;
+
+#ifdef DEBUG2
+    stderr_printf ("Nothing found to execute.\n" );
+#endif
+    return NULL;
+}
+
+/* end of pipeopen.c */
Index: /mppenc/trunk/src/predict.h
===================================================================
--- /mppenc/trunk/src/predict.h	(revision 97)
+++ /mppenc/trunk/src/predict.h	(revision 97)
@@ -0,0 +1,176 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+
+#define MAX_LPC_ORDER       35
+#define log2(x)             ( log (x) * (1./M_LN2) )
+#define ORDER_PENALTY       0
+
+
+static int                                     // best prediction order model
+CalculateLPCCoeffs ( Int32_t*  buf,            // Samples
+                     size_t    nbuf,           // Number of samples
+                     Int32_t   offset,         //
+                     double*   lpcout,         // quantized prediction coefficients
+                     int       nlpc,           // max. prediction order
+                     float*    psigbit,        // expected number of bits per original signal sample
+                     float*    presbit )       // expected number of bits per residual signal sample
+{
+    static double*  fbuf  = NULL;
+    static int      nflpc = 0;
+    static int      nfbuf = 0;
+    int             nbit;
+    int             i;
+    int             j;
+    int             bestnbit;
+    int             bestnlpc;
+    double          e;
+    double          bestesize;
+    double          ci;
+    double          esize;
+    double          acf [MAX_LPC_ORDER + 1];
+    double          ref [MAX_LPC_ORDER + 1];
+    double          lpc [MAX_LPC_ORDER + 1];
+    double          tmp [MAX_LPC_ORDER + 1];
+    double          escale = 0.5 * M_LN2 * M_LN2 / nbuf;
+    double          sum;
+
+    if ( nlpc >= nbuf )                         // if necessary, limit the LPC order to the number of samples available
+        nlpc = nbuf - 1;
+
+    if ( nlpc > nflpc  ||  nbuf > nfbuf ) {     // grab some space for a 'zero mean' buffer of floats if needed
+        if ( fbuf != NULL )
+            free ( fbuf - nflpc );
+        fbuf  = nlpc + ((double*) calloc ( nlpc+nbuf, sizeof (*fbuf) ));
+        nfbuf = nbuf;
+        nflpc = nlpc;
+    }
+
+    e = 0.;
+    for ( j = 0; j < nbuf; j++ ) {              // zero mean signal and compute energy
+        sum = fbuf [j] = buf[j] - (double)offset;
+        e  += sum * sum;
+    }
+
+    esize     = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
+    *psigbit  = esize;                          // return the expected number of bits per original signal sample
+
+    acf [0]   = e;                              // store the best values so far (the zeroth order predictor)
+    bestnlpc  = 0;
+    bestnbit  = nbuf * esize;
+    bestesize = esize;
+
+    for ( i = 1; i <= nlpc  &&  e > 0.  &&  i < bestnlpc + 4; i++ ) {   // just check two more than bestnlpc
+
+        sum = 0.;
+        for ( j = i; j < nbuf; j++ )                                    // compute the jth autocorrelation coefficient
+            sum += fbuf [j] * fbuf [j-i];
+        acf [i] = sum;
+
+        ci = 0.;                                                        // compute the reflection and LP coeffients for order j predictor
+        for ( j = 1; j < i; j++ )
+            ci += lpc [j] * acf [i-j];
+        lpc [i] = ref [i] = ci = (acf [i] - ci) / e;
+        for ( j = 1; j < i; j++ )
+            tmp [j] = lpc [j] - ci * lpc [i-j];
+        for ( j = 1; j < i; j++ )
+            lpc [j] = tmp [j];
+
+        e    *= 1 - ci*ci;                                              // compute the new energy in the prediction residual
+        esize = e > 0.  ?  0.5 * log2 (escale * e)  :  0.;
+
+        nbit = nbuf * esize + i * ORDER_PENALTY;
+        if ( nbit < bestnbit ) {                                        // store this model if it is the best so far
+            bestnlpc  = i;                                              // store best model order
+            bestnbit  = nbit;
+            bestesize = esize;
+
+            for ( j = 0; j < bestnlpc; j++ )                            // store the quantized LP coefficients
+                lpcout [j] = lpc [j+1];
+        }
+    }
+
+    *presbit = bestesize;                       // return the expected number of bits per residual signal sample
+    return bestnlpc;                            // return the best model order
+}
+
+
+static void
+Pred ( const unsigned int*  new,
+       unsigned int*        old )
+{
+    static Double  DOUBLE [36];
+    Float   org;
+    Float   pred;
+    int     i;
+    int     j;
+    int     sum = 18;
+    int     order;
+    double  oldeff = 0.;
+    double  neweff = 0.;
+
+    for ( i = 0; i < 36; i++ )
+        sum += old [i];
+    sum = (int) floor (sum / 36.);
+
+    order = CalculateLPCCoeffs ( old, 36, sum*0, DOUBLE, 35, &org, &pred );
+
+    printf ("avg: %4u  [%2u]  %.2f  %.2f\n\n", sum, order, org, pred );
+    if ( order < 1 )
+        return;
+
+    for ( i = 0; i < order; i++ )
+        printf ("%f ", DOUBLE[i] );
+    printf ("\n");
+
+    for ( i = 0; i < 36; i++ ) {
+        double  sum = 0.;
+        for ( j = 1; j <= order; j++ ) {
+            sum += (i-j < 0 ? old[i-j+36] : new [i-j]) * DOUBLE [j-1];
+        }
+        printf ("%2u: %6.2f %3d\n", i, sum, new [i] );
+        oldeff += new[i]       * new[i];
+        neweff += (sum-new[i]) * (sum-new[i]);
+    }
+    printf ("%6.2f %6.2f\n", sqrt(oldeff), sqrt(neweff) );
+}
+
+
+void
+Predicate ( int Channel, int Band, unsigned int* x, int* scf )
+{
+    static Int32_t  OLD [2] [32] [36];
+    int    i;
+
+    printf ("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n");
+    for ( i = 0; i < 36; i++ )
+        printf ("%2d ", OLD [Channel][Band][i] );
+    printf ("\n");
+    for ( i = 0; i < 36; i++ )
+        printf ("%2d ", x[i] );
+    printf ("\n");
+    printf ("%2u-%2u-%2u  ", scf[0], scf[1], scf[2] );
+    Pred ( x, OLD [Channel][Band] );
+    for ( i = 0; i < 36; i++ )
+        OLD [Channel][Band][i] = x[i];
+}
+
+/* end of predict.c */
Index: /mppenc/trunk/src/profile.c
===================================================================
--- /mppenc/trunk/src/profile.c	(revision 97)
+++ /mppenc/trunk/src/profile.c	(revision 97)
@@ -0,0 +1,174 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include "mppdec.h"
+#include "profile.h"
+
+/*
+ *  For every architecture you want to profile/checkpoint you need the following items:
+ *
+ *  uintmax_t:
+ *      A type which is used for time calculation, mostly 32 bit or 64 bit,
+ *      should be large enough so that no overruns occures during the measurement
+ *  STD_TIMER_CLK:
+ *      Clock frequency of the used timer in MHz
+ *  RDTSC():
+ *      A macro reading the current time into a local variable timetemp with the type uintmax_t,
+ *      Time is in 1.e-6/STD_TIMER_CLK seconds.
+ *
+ *  Places:
+ *      typedef of uintmax_t:     profile.h
+ *      RDTSC():                  profile.h
+ *      STD_TIMER_CLK:            profile.c
+ *      no-inline functions maybe needed by RDTSC():
+ *                                profile.c
+ */
+
+#ifdef PROFILE
+
+#ifdef __TURBOC__
+# define STD_TIMER_CLK  1.193181667 /* MHz */
+
+uintmax_t
+readtime ( void )               /* PC onboard timer */
+{
+    asm  XOR   AX, AX
+    asm  MOV   ES, AX
+    asm  OUT   67, AL
+    asm  MOV   DX, ES:[46Ch]
+    asm  IN    AL, 64
+    asm  XCHG  AL, AH
+    asm  IN    AL, 64
+    asm  XCHG  AL, AH
+    asm  NEG   AX
+}
+
+#elif defined USE_SYSV_TIMER
+# define STD_TIMER_CLK    1.0000000 /* MHz */
+
+# include <sys/time.h>
+# include <unistd.h>
+
+uintmax_t
+readtime ( void )               /* System V timer */
+{
+    struct timeval  tv;
+
+    gettimeofday ( &tv, NULL );
+    return tv.tv_sec * (uintmax_t)1000000LU + tv.tv_usec;
+}
+
+#else
+# define STD_TIMER_CLK  233.3333333 /* MHz */
+#endif
+
+
+uintmax_t       timecounter    [256];
+const char*     timename       [256];
+unsigned char   functionstack [1024];
+unsigned char*  functionstack_pointer = functionstack;
+
+
+static void Cdecl
+signal_handler ( int signum )
+{
+    char            name [128];
+    char            file [128];
+    char            no   [ 32];
+    unsigned char*  f;
+
+    (void) stderr_printf ( "\n\nSignal %d detected. Call stack:\n", signum );
+    for ( f = functionstack+1; f <= functionstack_pointer; f++ ) {
+        (void) sscanf        ( timename[*f], "%128[^|]|%128[^|]|%32[0-9]", name, file, no );
+        (void) stderr_printf ( "%-24.24s%12.12s:%s\n", name, file, no );
+    }
+    _exit ( 128+signum );
+}
+
+
+void
+set_signal ( void )
+{
+    signal ( SIGILL , signal_handler );
+    signal ( SIGINT , signal_handler );
+    signal ( SIGSEGV, signal_handler );
+    signal ( SIGFPE , signal_handler );
+}
+
+
+void
+report ( void )
+{
+    static char  dash [] = "---------------------------------------";
+    uintmax_t    sum;
+    uintmax_t    max;
+    int          i;
+    int          j;
+    int          k;
+    char         name [128];
+    char         file [128];
+    char         no   [ 32];
+    size_t       filelen;
+    double       MHz = STD_TIMER_CLK;
+
+#ifdef __linux__
+    FILE*        fp;
+
+    // read out CPU frequency if proc-FS is present
+    if ( (fp = fopen ("/proc/cpuinfo", "r")) != NULL ) {
+        while ( fgets(name, sizeof(name), fp) )
+            if ( 1 == sscanf ( name, "cpu MHz : %lf", &MHz ) )
+                break;
+        (void) fclose (fp);
+    }
+#endif
+
+    // calculate total time
+    for ( sum = 0, i = 1; i < sizeof(timecounter)/sizeof(*timecounter); i++ )
+        sum += timecounter [i];
+
+    (void) fprintf ( stderr, "\n%s%s\n", dash, dash );
+    (void) fprintf ( stderr, "100.0%%   %13.6f ms   *** TOTAL ***%25s[%.1f MHz]\n", sum/(MHz*1000.), "", MHz );
+
+    // output sorted
+    while ( 1 ) {
+        for ( max = 0, j = 1; j < sizeof(timecounter)/sizeof(*timecounter); j++ )
+            if ( timecounter [j] > max )
+                max = timecounter [k = j];
+        if (max == 0)
+            break;
+        sscanf ( timename [k], "%128[^|]|%128[^|]|%32[0-9]", name, file, no );
+        filelen = strlen (file);
+        (void) fprintf ( stderr, "%6.2f%%  %13.6f ms   %-28.28s%18.18s:%s\n",
+                         100. * timecounter[k] / sum, timecounter[k] / (MHz*1000.),
+                         name, filelen < 18 ? file : file+filelen-18, no );
+        timecounter [k] = 0;
+    }
+
+    (void) fprintf ( stderr, "%s%s\n", dash, dash );
+    (void) fflush  ( stderr );
+}
+
+#endif /* PROFILE */
+
+/* end of profile.c */
Index: /mppenc/trunk/src/profile.h
===================================================================
--- /mppenc/trunk/src/profile.h	(revision 97)
+++ /mppenc/trunk/src/profile.h	(revision 97)
@@ -0,0 +1,98 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef MPPDEC_PROFILE_H
+#define MPPDEC_PROFILE_H
+
+#ifdef PROFILE
+
+/* T I M E C O U N T - F U N C T I O N */
+# if   defined _WIN32
+typedef /*unsigned*/ __int64  uintmax_t;
+#pragma warning ( disable: 4035 )
+static __inline uintmax_t  rdtscll ( void ) { __asm { rdtsc }; }
+#pragma warning ( default: 4035 )
+#  define RDTSC()  timetemp = rdtscll ()
+#  define __FUNCTION__  "?"
+# elif defined __TURBOC__
+typedef signed long  uintmax_t;
+uintmax_t readtime ( void );
+#  define RDTSC()  timetemp = readtime ()
+#  define __FUNCTION__  "?"
+# else
+typedef unsigned long long  uintmax_t;
+#  include <asm/msr.h>
+#  define RDTSC()  rdtscll (timetemp)
+# endif /* _WIN32 */
+
+
+/* M A C R O S */
+# define _STR(x)    #x
+# define __STR(x)   _STR(x)
+
+# define ENTER(x)  do {                                                             \
+                     uintmax_t  timetemp;                                           \
+                     RDTSC();                                                       \
+                     timecounter[*functionstack_pointer]       += timetemp;         \
+                     timecounter[*++functionstack_pointer = x] -= timetemp;         \
+                     timename[x] = __FUNCTION__ "()|" __FILE__ "|" __STR(__LINE__); \
+                   } while (0)
+
+# define NEXT(x,n) do {                                                      \
+                     uintmax_t  timetemp;                                    \
+                     RDTSC();                                                \
+                     timecounter[*functionstack_pointer]     += timetemp;    \
+                     timecounter[*functionstack_pointer = x] -= timetemp;    \
+                     timename[x] = __FUNCTION__ "-" __STR(n) "|" __FILE__ "|" __STR(__LINE__); \
+                   } while (0)
+
+# define LEAVE(x)  do {                                                  \
+                     uintmax_t  timetemp;                                \
+                     RDTSC();                                            \
+                     timecounter[x]                        += timetemp;  \
+                     timecounter[*--functionstack_pointer] -= timetemp;  \
+                   } while (0)
+
+# define START()   set_signal ()
+# define REPORT()  report ()
+
+/* V A R I A B L E S */
+extern uintmax_t       timecounter    [256];
+extern const char*     timename       [256];
+extern unsigned char   functionstack [1024];
+extern unsigned char*  functionstack_pointer;
+
+/* F U N C T I O N S */
+void  set_signal ( void );
+void  report     ( void );
+
+#else
+
+/* M A C R O S */
+# define START()
+# define ENTER(x)
+# define NEXT(x,n)
+# define LEAVE(x)
+# define REPORT()
+
+#endif /* PROFILE */
+
+#endif /* MPPDEC_PROFILE_H */
+
+/* end of profile.h */
Index: /mppenc/trunk/src/psy.c
===================================================================
--- /mppenc/trunk/src/psy.c	(revision 97)
+++ /mppenc/trunk/src/psy.c	(revision 97)
@@ -0,0 +1,1309 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *  Prediction
+ *  Short-Block-detection with smooth inset
+ *  revise CalcMSThreshold
+ *  /dev/audio for Windows too
+ *  revise PNS/IS
+ *  CVS with smoother inset
+ *  several files per call
+ *  revise ANS with changing SCFs
+
+  * No IS
+  * PNS estimation very rough, also IS should be used to reduce data rate in the side channel
+  * ANS problems at Frame boundaries when resolution changes
+  * ANS problems at Subframe boundaries when SCF changes
+  * CVS+ with smoother transition
+
+----------------------------------------
+
+Optimize Tabelle[18] (use second table)
+CVS+
+
+- ANS is disregarded during the search for the best Res
+- ANS messes up if res changes (each 36 samples) and/or SCF changes (each 12 samples)
+- PNS not in difference signal
+
+- implement IS in decoder
+- Experimental Quantizer with complete energy preservation
+  - 1D, calculated
+  - 2D, calculated
+  - 2D, manually modified, coeffs set to 1.f
+
+ */
+
+#include "mppenc.h"
+
+/* V A R I A B L E S */
+/* further switches for the psymodel */
+unsigned int  CVD_used;         // global flag for ClearVoiceDetection
+float         varLtq;           // variable threshold in quiet
+unsigned int  tmpMask_used;     // global flag for temporal masking
+float         ShortThr;         // Factor to calculate the masking threshold with transients
+float         minSMR;           // minimum SMR for all subbands
+
+float         a          [PART_LONG];
+float         b          [PART_LONG];
+float         c          [PART_LONG];
+float         d          [PART_LONG];           // Integrations for tmpMask
+static float  Xsave_L    [3 * 512];
+static float  Xsave_R    [3 * 512];             // FFT-Amplitudes L/R
+static float  Ysave_L    [3 * 512];
+static float  Ysave_R    [3 * 512];             // FFT-Phases L/R
+float         T_L        [PART_LONG];
+float         T_R        [PART_LONG];           // time-constants for tmpMask
+float         pre_erg_L[2][PART_SHORT];
+float         pre_erg_R[2][PART_SHORT];          // Preecho-control short
+float         PreThr_L   [PART_LONG];
+float         PreThr_R   [PART_LONG];           // for Pre-Echo-control L/R
+float         tmp_Mask_L [PART_LONG];
+float         tmp_Mask_R [PART_LONG];           // for Post-Masking L/R
+int           Vocal_L    [MAX_CVD_LINE + 4];
+int           Vocal_R    [MAX_CVD_LINE + 4];    // FFT-Line belongs to harmonic?
+
+/* F U N C T I O N S */
+// Resets Arrays
+void
+Init_Psychoakustik ( void )
+{
+    int  i;
+
+    ENTER(200);
+    // generate FFT lookup-tables with largest FFT-size of 1024
+    Init_FFT ();
+
+    // setting pre-echo variables to Ltq
+    for ( i = 0; i < PART_LONG; i++ ) {
+        pre_erg_L  [0][i/3] = pre_erg_R  [0][i/3] =
+        pre_erg_L  [1][i/3] = pre_erg_R  [1][i/3] =
+        tmp_Mask_L [i]   = tmp_Mask_R [i]   =
+        PreThr_L   [i]   = PreThr_R   [i]   = partLtq [i];
+    }
+
+    // initializing arrays with zero
+    memset ( Xsave_L,   0, sizeof Xsave_L );
+    memset ( Xsave_R,   0, sizeof Xsave_R );
+    memset ( Ysave_L,   0, sizeof Ysave_L );
+    memset ( Ysave_R,   0, sizeof Ysave_R );
+    memset ( a,         0, sizeof a       );
+    memset ( b,         0, sizeof b       );
+    memset ( c,         0, sizeof c       );
+    memset ( d,         0, sizeof d       );
+    memset ( T_L,       0, sizeof T_L     );
+    memset ( T_R,       0, sizeof T_R     );
+    memset ( Vocal_L,   0, sizeof Vocal_L );
+    memset ( Vocal_R,   0, sizeof Vocal_R );
+
+    LEAVE(200);
+    return;
+}
+
+
+// VBRmode 1: Adjustment of all SMRs via a factor (offset of SMRoffset dB)
+// VBRmode 2: SMRs have a minimum of minSMR dB
+static void
+RaiseSMR_Signal ( const int MaxBand, float* signal, float tmp )
+{
+    int    Band;
+    float  z = 0.;
+
+    for ( Band = MaxBand; Band >= 0; Band-- ) {
+        if ( z < signal [Band]  ) z = signal [Band];
+        if ( z > tmp            ) z = tmp;
+        if ( signal [Band]  < z ) signal [Band] = z;
+    }
+}
+
+
+void
+RaiseSMR ( const int MaxBand, SMRTyp* smr )
+{
+    float  tmp = POW10 ( 0.1 * minSMR );
+
+    ENTER(201);
+    RaiseSMR_Signal ( MaxBand, smr->L, tmp );
+    RaiseSMR_Signal ( MaxBand, smr->R, tmp );
+    RaiseSMR_Signal ( MaxBand, smr->M, tmp );
+    RaiseSMR_Signal ( MaxBand, smr->S, 0.5 * tmp );
+
+    LEAVE(201);
+    return;
+}
+
+// input : *smr
+// output: *smr, *ms, *x        (only the entries for L/R contain relevant data)
+// Check if either M/S- or L/R-coding has a lower perceptual entropy
+// Choose the better mode, copy the appropriate data into the
+// arrays that belong to L and R and set the ms-Flag accordingly.
+void
+MS_LR_Entscheidung ( const int MaxBand, unsigned char* ms, SMRTyp* smr, SubbandFloatTyp* x )
+{
+    int     Band;
+    int     n;
+    float   PE_MS;
+    float   PE_LR;
+    float   tmpM;
+    float   tmpS;
+    float*  l;
+    float*  r;
+
+    ENTER(202);
+
+    for ( Band = 0; Band <= MaxBand; Band++ ) {        // calculate perceptual entropy
+        PE_LR = PE_MS = 1.f;
+        if (smr->L[Band] > 1.) PE_LR *= smr->L[Band];
+        if (smr->R[Band] > 1.) PE_LR *= smr->R[Band];
+        if (smr->M[Band] > 1.) PE_MS *= smr->M[Band];
+        if (smr->S[Band] > 1.) PE_MS *= smr->S[Band];
+
+        if ( PE_MS < PE_LR ) {
+            ms[Band] = 1;
+
+            // calculate M/S-signal and copies it to L/R-array
+            l = x[Band].L;
+            r = x[Band].R;
+            for ( n = 0; n < 36; n++, l++, r++ ) {
+                tmpM = (*l + *r) * 0.5f;
+                tmpS = (*l - *r) * 0.5f;
+                *l   = tmpM;
+                *r   = tmpS;
+            }
+
+            // copy M/S - SMR to L/R-fields
+            smr->L[Band] = smr->M[Band];
+            smr->R[Band] = smr->S[Band];
+        }
+        else {
+            ms[Band] = 0;
+        }
+    }
+
+    LEAVE(202);
+    return;
+}
+
+// input : FFT-spectrums *spec0 und *spec1
+// output: energy in the individual subbands *erg0 and *erg1
+// With Butfly[], you can calculate the results of aliasing during calculation 
+// of subband energy from the FFT-spectrums.
+static void
+SubbandEnergy ( const int     MaxBand,
+                float*        erg0,
+                float*        erg1,
+                const float*  spec0,
+                const float*  spec1 )
+{
+    int    n;
+    int    k;
+    int    alias;
+    float  tmp0;
+    float  tmp1;
+
+    ENTER(203);
+
+    // Is this here correct for FFT-based data or is this calculation rule only for MDCTs???
+
+    for ( k = 0; k <= MaxBand; k++ ) {                  // subband index
+        tmp0 = tmp1 = 0.f;
+        for ( n = 0; n < 16; n++, spec0++, spec1++ ) {  // spectral index
+            tmp0 += *spec0;
+            tmp1 += *spec1;
+
+            // Consideration of Aliasing between the subbands
+            if      ( n <   +sizeof(Butfly)/sizeof(*Butfly)  &&  k !=  0 ) {
+                alias = -1 - (n<<1);
+                tmp0 += Butfly [n]    * (spec0[alias] - *spec0);
+                tmp1 += Butfly [n]    * (spec1[alias] - *spec1);
+            }
+            else if ( n > 15-sizeof(Butfly)/sizeof(*Butfly)  &&  k != 31 ) {
+                alias = 31 - (n<<1);
+                tmp0 += Butfly [15-n] * (spec0[alias] - *spec0);
+                tmp1 += Butfly [15-n] * (spec1[alias] - *spec1);
+            }
+        }
+        *erg0++ = tmp0;
+        *erg1++ = tmp1;
+    }
+
+    LEAVE(203);
+    return;
+}
+
+// input : FFT-Spectrums *spec0 and *spec1
+// output: energy in the individual partitions *erg0 and *erg1
+static void
+PartitionEnergy ( float*        erg0,
+                  float*        erg1,
+                  const float*  spec0,
+                  const float*  spec1 )
+{
+    unsigned int  n;
+    unsigned int  k;
+    float         e0;
+    float         e1;
+
+    ENTER(204);
+
+#if 000000
+    for ( n = 0; n < PART_LONG; n++ ) {
+        k  = wh[n] - wl[n];
+        e0 = *spec0++;
+        e1 = *spec1++;
+        while ( k-- ) {
+            e0 += *spec0++;
+            e1 += *spec1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+#else
+    n = 0;
+
+    for ( ; n < 23; n++ ) {             // 11 or 23
+        k  = wh[n] - wl[n];
+        e0 = *spec0++;
+        e1 = *spec1++;
+        while ( k-- ) {
+            e0 += *spec0++;
+            e1 += *spec1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+
+    for ( ; n < 48; n++ ) {             // 37 ... 46, 48, 57
+        k  = wh[n] - wl[n];
+        e0 = sqrt (*spec0++);
+        e1 = sqrt (*spec1++);
+        while ( k-- ) {
+            e0 += sqrt (*spec0++);
+            e1 += sqrt (*spec1++);
+        }
+        *erg0++ = e0*e0 * iw[n];
+        *erg1++ = e1*e1 * iw[n];
+    }
+
+    for ( ; n < PART_LONG; n++ ) {
+        k  = wh[n] - wl[n];
+        e0 = *spec0++;
+        e1 = *spec1++;
+        while ( k-- ) {
+            e0 += *spec0++;
+            e1 += *spec1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+
+
+#endif
+
+    LEAVE(204);
+    return;
+}
+
+
+// input : FFT-Spectrums *spec0, *spec1 and unpredictability *cw0 and *cw1
+// output: weighted energy in the individual partitions *erg0, *erg1
+static void
+WeightedPartitionEnergy ( float*        erg0,
+                          float*        erg1,
+                          const float*  spec0,
+                          const float*  spec1,
+                          const float*  cw0,
+                          const float*  cw1 )
+{
+    unsigned int  n;
+    unsigned int  k;
+    float         e0;
+    float         e1;
+
+    ENTER(205);
+
+#if 000000
+    for ( n = 0; n < PART_LONG; n++ ) {
+        e0 = *spec0++ * *cw0++;
+        e1 = *spec1++ * *cw1++;
+        k  = wh[n] - wl[n];
+        while ( k-- ) {
+            e0 += *spec0++ * *cw0++;
+            e1 += *spec1++ * *cw1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+#else
+    n = 0;
+
+    for ( ; n < 23; n++ ) {
+        e0 = *spec0++ * *cw0++;
+        e1 = *spec1++ * *cw1++;
+        k  = wh[n] - wl[n];
+        while ( k-- ) {
+            e0 += *spec0++ * *cw0++;
+            e1 += *spec1++ * *cw1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+
+    for ( ; n < 48; n++ ) {
+        e0 = sqrt (*spec0++ * *cw0++);
+        e1 = sqrt (*spec1++ * *cw1++);
+        k  = wh[n] - wl[n];
+        while ( k-- ) {
+            e0 += sqrt (*spec0++ * *cw0++);
+            e1 += sqrt (*spec1++ * *cw1++);
+        }
+        *erg0++ = e0*e0 * iw[n];
+        *erg1++ = e1*e1 * iw[n];
+    }
+
+    for ( ; n < PART_LONG; n++ ) {
+        e0 = *spec0++ * *cw0++;
+        e1 = *spec1++ * *cw1++;
+        k  = wh[n] - wl[n];
+        while ( k-- ) {
+            e0 += *spec0++ * *cw0++;
+            e1 += *spec1++ * *cw1++;
+        }
+        *erg0++ = e0;
+        *erg1++ = e1;
+    }
+#endif
+
+    LEAVE(205);
+    return;
+}
+
+// input : masking thresholds, first half of the arrays *shaped0 and *shaped1
+// output: masking thresholds, second half of the arrays *shaped0 and *shaped1
+// Considering the result of aliasing via InvButfly[]
+// The input *thr0, *thr1 is gathered via address calculation from *shaped0, *shaped1
+
+static void
+AdaptThresholds ( const int MaxLine, float* shaped0, float* shaped1 )
+{
+    int           n;
+    int           mod;
+    int           alias;
+    float         tmp;
+    const float*  invb = InvButfly;
+    const float*  thr0 = shaped0 - 512;
+    const float*  thr1 = shaped1 - 512;
+    float         tmp0;
+    float         tmp1;
+
+    ENTER(206);
+
+    // should be able to optimize it with coasting.  [ 9 ] + n * [ 7 + 7 + 2 ] + [ 7 ]
+    //                                                    Schleife    Schl Schl Ausr  Schleife
+    for ( n = 0; n < MaxLine; n++, thr0++, thr1++ ) {
+        mod  = n & 15;  // n%16
+        tmp0 = *thr0;
+        tmp1 = *thr1;
+
+        if      ( mod <   +sizeof(InvButfly)/sizeof(*InvButfly)  &&  n >  12 ) {
+            alias = -1 - (mod<<1);
+            tmp   = thr0[alias] * invb[mod];
+            if ( tmp < tmp0 ) tmp0 = tmp;
+            tmp   = thr1[alias] * invb[mod];
+            if ( tmp < tmp1 ) tmp1 = tmp;
+        }
+        else if ( mod > 15-sizeof(InvButfly)/sizeof(*InvButfly)  &&  n < 499 ) {
+            alias = 31 - (mod<<1);
+            tmp   = thr0[alias] * invb[15-mod];
+            if ( tmp < tmp0 ) tmp0 = tmp;
+            tmp   = thr1[alias] * invb[15-mod];
+            if ( tmp < tmp1 ) tmp1 = tmp;
+        }
+        *shaped0++ = tmp0;
+        *shaped1++ = tmp1;
+    }
+
+    LEAVE(206);
+    return;
+}
+
+#include "fastmath.h"
+
+// input : current spectrum in the form of power *spec and phase *phase,
+//         the last two earlier spectrums are at position
+//         512 and 1024 of the corresponding Input-Arrays.
+//         Array *vocal, which can mark an FFT_Linie as harmonic
+// output: current amplitude *amp and unpredictability *cw
+static void
+CalcUnpred ( const int     MaxLine,
+             const float*  spec,
+             const float*  phase,
+             const int*    vocal,
+             float*        amp0,
+             float*        phs0,
+             float*        cw )
+{
+    int     n;
+    float   amp;
+    float   tmp;
+#define amp1  ((amp0) +  512)           // amp[ 512...1023] contains data of frame-1
+#define amp2  ((amp0) + 1024)           // amp[1024...1535] contains data of frame-2
+#define phs1  ((phs0) +  512)           // phs[ 512...1023] contains data of frame-1
+#define phs2  ((phs0) + 1024)           // phs[1024...1535] contains data of frame-2
+
+    ENTER(207);
+
+    for ( n = 0; n < MaxLine; n++ ) {
+        tmp     = COSF  ((phs0[n] = phase[n]) - 2*phs1[n] + phs2[n]);   // copy phase to output-array, predict phase and calculate predictive error
+        amp0[n] = SQRTF (spec[n]);                                      // calculate and set amplitude
+        amp     = 2*amp1[n] - amp2[n];                                  // predict amplitude
+
+        // calculate unpredictability
+        cw[n] = SQRTF (spec[n] + amp * (amp - 2*amp0[n] * tmp)) / (amp0[n] + FABS(amp));
+    }
+
+    // postprocessing of harmonic FFT-lines (*cw is set to CVD_UNPRED)
+    if ( CVD_used  &&  vocal != NULL ) {
+        for ( n = 0; n < MAX_CVD_LINE; n++, cw++, vocal++ )
+            if ( *vocal != 0  &&  *cw > CVD_UNPRED * 0.01 * *vocal )
+                *cw = CVD_UNPRED * 0.01 * *vocal;
+    }
+
+    LEAVE(207);
+    return;
+}
+#undef amp1
+#undef amp2
+#undef phs1
+#undef phs2
+
+
+// input : Energy *erg, calibrated energy *werg
+// output: spread energy *res, spread weighted energy *wres
+// SPRD describes the spreading function as calculated in psy_tab.c
+static void
+SpreadingSignal ( const float* erg, const float* werg, float* res, float* wres )
+{
+    int           n;
+    int           k;
+    int           start;
+    int           stop;
+    const float*  sprd;
+    float         e;
+    float         ew;
+
+    ENTER(208);
+
+    for (k=0; k<PART_LONG; ++k, ++erg, ++werg) { // Source (masking partition)
+        start = maxi(k-5, 0);           // minimum affected partition
+        stop  = mini(k+7, PART_LONG-1); // maximum affected partition
+        sprd  = SPRD[k] + start;         // load vector
+        e     = *erg;
+        ew    = *werg;
+
+        for (n=start; n<=stop; ++n, ++sprd) {
+            res [n] += *sprd * e;       // spreading signal
+            wres[n] += *sprd * ew;      // spreading weighted signal
+        }
+    }
+
+    LEAVE(208);
+    return;
+}
+
+// input : spread weighted energy *werg, spread energy *erg
+// output: masking threshold *erg after applying the tonality-offset
+static void
+ApplyTonalityOffset ( float* erg0, float* erg1, const float* werg0, const float* werg1 )
+{
+    int    n;
+    float  Offset;
+    float  quot;
+
+    ENTER(230);
+
+    // calculation of the masked threshold in the partition range
+    for ( n = 0; n < PART_LONG; n++ ) {
+        quot = *werg0++ / *erg0;
+        if      (quot <= 0.05737540597f) Offset = O_MAX;
+        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
+        else                             Offset = O_MIN;
+        *erg0++ *= iw[n] * minf(MinVal[n], Offset);
+
+        quot = *werg1++ / *erg1;
+        if      (quot <= 0.05737540597f) Offset = O_MAX;
+        else if (quot <  0.5871011603f ) Offset = FAC1 * POW (quot, FAC2);
+        else                             Offset = O_MIN;
+        *erg1++ *= iw[n] * minf(MinVal[n], Offset);
+    }
+
+    LEAVE(230);
+    return;
+}
+
+// input: previous loudness *loud, energies *erg, threshold in quiet *adapted_ltq
+// output: tracked loudness *loud, adapted threshold in quiet <Return value>
+static float
+AdaptLtq ( const float* erg0, const float* erg1 )
+{
+    static float  loud   = 0.f;
+    float*        weight = Loudness;
+    float         sum    = 0.f;
+    int           n;
+
+    // calculate loudness
+    for ( n = 0; n < PART_LONG; n++ )
+        sum += (*erg0++ + *erg1++) * *weight++;
+
+    // Utilization of the time constants (fast drop of Ltq T=5, slow rise of Ltq T=20)
+    //loud = (sum < loud) ? (4 * sum + loud)*0.2f : (19 * loud + sum)*0.05f;
+    loud = 0.98 * loud + 0.02 * (0.5 * sum);
+
+    // calculate dynamic offset for threshold in quiet, 0...+20 dB, at 96 dB loudness, an offset of 20 dB is assumed
+    return 1.f + varLtq * loud * 5.023772e-08f;
+}
+
+// input : simultaneous masking threshold *frqthr,
+//         previous masking threshold *tmpthr,
+//         Integrations *a (short-time) and *b (long-time)
+// output: tracked Integrations *a and *b, time constant *tau
+static void
+CalcTemporalThreshold ( float* a, float* b, float* tau, float* frqthr, float* tmpthr )
+{
+    int    n;
+    float  tmp;
+
+    ENTER(220);
+
+    for ( n = 0; n < PART_LONG; n++ ) {
+        // following calculations relative to threshold in quiet
+        frqthr[n] *= invLtq[n];
+        tmpthr[n] *= invLtq[n];
+
+        // new post-masking 'tmp' via time constant tau, if old post-masking  > Ltq (=1)
+        tmp = tmpthr[n] > 1.f  ?  POW ( tmpthr[n], tau[n] )  :  1.f;
+
+        // calculate time constant for post-masking in next frame,
+        // if new time constant has to be calculated (new tmpMask < frqMask)
+        a[n] += 0.5f  * (frqthr[n] - a[n]); // short time integrator
+        b[n] += 0.15f * (frqthr[n] - b[n]); // long  time integrator
+        if (tmp < frqthr[n])
+            tau[n] = a[n] <= b[n]  ?  0.8f  :  0.2f + b[n] / a[n] * 0.6f;
+
+        // use post-masking of (Re-Normalization)
+        tmpthr[n] = maxf (frqthr[n], tmp) * partLtq[n];
+    }
+
+    LEAVE(220);
+    return;
+}
+
+// input : L/R-Masking thresholds in Partitions *thrL, *thrR
+//         L/R-Subband energies *ergL, *ergR
+//         M/S-Subband energies *ergM, *ergS
+// output: M/S-Masking thresholds in Partitions *thrM, *thrS
+static void
+CalcMSThreshold ( const float*  const ergL,
+                  const float*  const ergR,
+                  const float*  const ergM,
+                  const float*  const ergS,
+                  float*        const thrL,
+                  float*        const thrR,
+                  float*        const thrM,
+                  float*        const thrS )
+{
+    int    n;
+    float  norm;
+    float  tmp;
+
+    // All hardcoded numbers here should be pulled from somewhere,
+    // the "4.", the -2 dB, the 0.0625 and the 0.9375, as well as all bands where this is done
+
+    for ( n = 0; n < PART_LONG; n++ ) {
+        // estimate M/S thresholds out of L/R thresholds and M/S and L/R energies
+        thrS[n] = thrM[n] = maxf (ergM[n], ergS[n]) / maxf (ergL[n], ergR[n]) * minf (thrL[n], thrR[n]);
+
+        switch ( MS_Channelmode ) { // preserve 'near-mid' signal components
+        case 3:
+            if ( n > 0 ) {
+                double ratioMS = ergM[n] > ergS[n] ? ergS[n] / ergM[n]  :  ergM[n] / ergS[n];
+                double ratioLR = ergL[n] > ergR[n] ? ergR[n] / ergL[n]  :  ergL[n] / ergR[n];
+                if ( ratioMS < ratioLR ) {              // MS
+                    if ( ergM[n] > ergS[n] )
+                        thrS[n] = thrL[n] = thrR[n] = 1.e18f;
+                    else
+                        thrM[n] = thrL[n] = thrR[n] = 1.e18f;
+                }
+                else {                                  // LR
+                    if ( ergL[n] > ergR[n] )
+                        thrR[n] = thrM[n] = thrS[n] = 1.e18f;
+                    else
+                        thrL[n] = thrM[n] = thrS[n] = 1.e18f;
+                }
+            }
+            break;
+        case 4:
+            if ( n > 0 ) {
+                double ratioMS = ergM[n] > ergS[n] ? ergS[n] / ergM[n]  :  ergM[n] / ergS[n];
+                double ratioLR = ergL[n] > ergR[n] ? ergR[n] / ergL[n]  :  ergL[n] / ergR[n];
+                if ( ratioMS < ratioLR ) {              // MS
+                    if ( ergM[n] > ergS[n] )
+                        thrS[n] = 1.e18f;
+                    else
+                        thrM[n] = 1.e18f;
+                }
+                else {                                  // LR
+                    if ( ergL[n] > ergR[n] )
+                        thrR[n] = 1.e18f;
+                    else
+                        thrL[n] = 1.e18f;
+                }
+            }
+            break;
+        case 5:
+            thrS[n] *= 2.;      // +3 dB
+            break;
+        case 6:
+            break;
+        default:
+            fprintf ( stderr, "Unknown stereo mode\n");
+        case 10:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.70794578f * iw[n];  // -1.5 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = MS2SPAT1 * thrS[n] + (1.f-MS2SPAT1) * tmp;    // raises masking threshold by up to 3 dB
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = MS2SPAT1 * thrM[n] + (1.f-MS2SPAT1) * tmp;
+                }
+            }
+            break;
+        case 11:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.63095734f * iw[n];  // -2.0 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = MS2SPAT2 * thrS[n] + (1.f-MS2SPAT2) * tmp;    // raises masking threshold by up to 6 dB
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = MS2SPAT2 * thrM[n] + (1.f-MS2SPAT2) * tmp;
+                }
+            }
+            break;
+        case 12:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.56234133f * iw[n];  // -2.5 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = MS2SPAT3 * thrS[n] + (1.f-MS2SPAT3) * tmp;    // raises masking threshold by up to 9 dB
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = MS2SPAT3 * thrM[n] + (1.f-MS2SPAT3) * tmp;
+                }
+            }
+            break;
+        case 13:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.50118723f * iw[n];  // -3.0 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = MS2SPAT4 * thrS[n] + (1.f-MS2SPAT4) * tmp;    // raises masking threshold by up to 12 dB
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = MS2SPAT4 * thrM[n] + (1.f-MS2SPAT4) * tmp;
+                }
+            }
+            break;
+        case 15:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.50118723f * iw[n];  // -3.0 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = tmp;                                  // raises masking threshold by up to +oo dB an
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = tmp;
+                }
+            }
+            break;
+        case 22:
+            if ( 4. * ergL[n] > ergR[n]   &&  ergL[n] < 4. * ergR[n] ) {// Energy between both channels differs by less than 6 dB
+                norm = 0.56234133f * iw[n];  // -2.5 dB * iwidth
+                if        ( ergM[n] > ergS[n] ) {
+                    tmp = ergS[n] * norm;
+                    if ( thrS[n] > tmp )
+                        thrS[n] = maxf (tmp, ergM[n]*iw[n]*0.025);              // +/- 1.414°
+                } else if ( ergS[n] > ergM[n] ) {
+                    tmp = ergM[n] * norm;
+                    if ( thrM[n] > tmp )
+                        thrM[n] = maxf (tmp, ergS[n]*iw[n]*0.025);              // +/- 1.414°
+                }
+            }
+            break;
+        }
+    }
+
+    return;
+}
+
+// input : Masking thresholds in Partitions *partThr0, *partThr1
+//         level of threshold in quiet *ltq in FFT-resolution
+// output: Masking thresholds in FFT-resolution *thr0, *thr1
+// inline, because it's called 4x
+static void
+ApplyLtq ( float*        thr0,
+           float*        thr1,
+           const float*  partThr0,
+           const float*  partThr1,
+           const float   AdaptedLTQ,
+           int           MSflag )
+{
+    int    n;
+    int    k;
+    float  ltq;
+    float  tmp;
+        float  ms = MSflag  ?  0.125f * AdaptedLTQ  :  0.25f * AdaptedLTQ ;
+
+    for ( n = 0; n < PART_LONG; n++ ) {
+        for ( k = wl[n]; k <= wh[n]; k++, thr0++, thr1++ ) {    // threshold in quiet (Partition)
+#if 0
+            ltq   = AdaptedLTQ * fftLtq [k];
+            *thr0 = maxf ( partThr0 [n], ltq );
+            *thr1 = maxf ( partThr1 [n], ltq );
+#else
+            // Applies a much more gentle ATH rolloff + 6 dB more dynamic
+            ltq   = sqrt (ms * fftLtq [k]);
+            tmp   = sqrt (partThr0 [n]) + ltq;
+            *thr0 = tmp * tmp;
+            tmp   = sqrt (partThr1 [n]) + ltq;
+            *thr1 = tmp * tmp;
+#endif
+        }
+    }
+    return;
+}
+
+// input : Subband energies *erg0, *erg1
+//         Masking thresholds in FFT-resolution *thr0, *thr1
+// output: SMR per Subband *smr0, *smr1
+static void
+CalculateSMR ( const int     MaxBand,
+               const float*  erg0,
+               const float*  erg1,
+               const float*  thr0,
+               const float*  thr1,
+               float*        smr0,
+               float*        smr1 )
+{
+    int    n;
+    int    k;
+    float  tmp0;
+    float  tmp1;
+
+    // calculation of the masked thresholds in the subbands
+    for (n = 0; n <= MaxBand; n++ ) {
+        tmp0 = *thr0++;
+        tmp1 = *thr1++;
+        for (k=1; k<16; ++k, ++thr0, ++thr1) {
+            if (*thr0 < tmp0) tmp0 = *thr0;
+            if (*thr1 < tmp1) tmp1 = *thr1;
+        }
+        *smr0++ = 0.0625f * *erg0++ / tmp0;
+        *smr1++ = 0.0625f * *erg1++ / tmp1;
+    }
+
+    return;
+}
+
+// input : energy spectrums erg[4][128] (4 delayed FFTs)
+//         Energy of the last short block *preerg in short partitions
+//         PreechoFac declares allowed traved of the masking threshold
+// output: masking threshold *thr in short partitions
+//         Energy of the last short block *preerg in short partitions
+#if 0
+static void
+CalcShortThreshold ( const float  erg [] [128],
+                     const float  PreechoFac,
+                     float*       thr,
+                     float        preerg[2][PART_SHORT],
+                     int*         transient )
+{
+    const int*    lo     = wl_short; // lower FFT-index
+    const int*    hi     = wh_short; // upper FFT-index
+    const float*  iwidth = iw_short; // inverse partition-width
+    int           k;
+    int           n;
+    int           m;
+    float         tmp;
+    float         enrg;
+    float         th;
+    const float*  ep;
+
+    for ( k = 0; k < PART_SHORT; k++, lo++, hi++ ) {
+        transient[k] = 0;
+        th           = 1.e20f;
+        for ( n = 0; n < 4; n++ ) {
+            ep   = erg[n] + *lo;
+            m    = *hi - *lo;
+            enrg = *ep++;
+            while (m--)
+                enrg += *ep++;
+
+            // preecho prevention
+            tmp     = enrg;
+            if (preerg[0][k] < enrg)
+                enrg = preerg[0][k];
+            preerg[0][k] = tmp;
+
+            // is signal transient?
+            if (tmp > TransDetect*enrg) transient[k] = 1;
+
+            // assume short threshold = engr*PreechoFac
+            th    = minf (th, enrg*PreechoFac);
+        }
+        thr[k] = th * *iwidth++;
+    }
+
+    return;
+}
+#else
+static void
+CalcShortThreshold ( float        erg [4] [128],
+                     const float  ShortThr,
+                     float*       thr,
+                     float        old_erg [2][PART_SHORT],
+                     int*         transient )
+{
+    const int*    index_lo = wl_short; // lower FFT-index
+    const int*    index_hi = wh_short; // upper FFT-index
+    const float*  iwidth   = iw_short; // inverse partition-width
+    int           k;
+    int           n;
+    int           m;
+    float         new_erg;
+    float         th;
+    const float*  ep;
+
+    for ( k = 0; k < PART_SHORT; k++ ) {
+        transient [k] = 0;
+        th            = old_erg [0][k];
+        for ( n = 0; n < 4; n++ ) {
+            ep   = erg[n] + index_lo [k];
+            m    = index_hi [k] - index_lo [k];
+
+            new_erg = *ep++;
+            while (m--)
+                new_erg += *ep++;               // e = Short_Partition-energy in piece n
+
+            if ( new_erg > old_erg [0][k] ) {           // bigger than the old?
+
+                if ( new_erg > old_erg [0][k] * TransDetect  ||
+                     new_erg > old_erg [1][k] * TransDetect*2 )  // is signal transient?
+                    transient [k] = 1;
+            }
+            else {
+                th = minf ( th, new_erg );          // assume short threshold = engr*PreechoFac
+            }
+
+            old_erg [1][k] = old_erg [0][k];
+            old_erg [0][k] = new_erg;           // save the current one
+        }
+        thr [k] = th * ShortThr * *iwidth++;  // pull out and multiply only when transient[k]=1
+    }
+
+    return;
+}
+
+#endif
+
+// input : previous simultaneous masking threshold *preThr,
+//         current simultaneous masking threshold *simThr
+// output: update of *preThr for next call,
+//         current masking threshold *partThr
+static void
+PreechoControl ( float*        partThr0,
+                 float*        preThr0,
+                 const float*  simThr0,
+                 float*        partThr1,
+                 float*        preThr1,
+                 const float*  simThr1 )
+{
+    int  n;
+
+    for ( n = 0; n < PART_LONG; n++ ) {
+        *partThr0++ = minf ( *simThr0, *preThr0 * PREFAC_LONG);
+        *partThr1++ = minf ( *simThr1, *preThr1 * PREFAC_LONG);
+        *preThr0++  = *simThr0++;
+        *preThr1++  = *simThr1++;
+    }
+    return;
+}
+
+
+void
+TransientenCalc ( int*       T,
+                  const int* TL,
+                  const int* TR )
+{
+    int  i;
+    int  x1;
+    int  x2;
+
+    memset ( T, 0, 32*sizeof(*T) );
+
+    for ( i = 0; i < PART_SHORT; i++ )
+        if ( TL[i]  ||  TR[i] ) {
+            x1 = wl_short[i] >> 2;
+            x2 = wh_short[i] >> 2;
+            while ( x1 <= x2 )
+                T [x1++] = 1;
+        }
+}
+
+
+// input : PCM-Data *data
+// output: SMRs for the input data
+SMRTyp
+Psychoakustisches_Modell ( const int MaxBand, const PCMDataTyp* data, int* TransientL, int* TransientR )
+{
+    float      Xi_L[32],     Xi_R[32];                          // acoustic pressure per Subband L/R
+    float      Xi_M[32],     Xi_S[32];                          // acoustic pressure per Subband M/S
+    float     cw_L[512],    cw_R[512];                          // unpredictability (only L/R)
+    float     erg0[512],    erg1[512];                          // holds energy spectrum of long FFT
+    float     phs0[512],    phs1[512];                          // holds phase spectrum of long FFT
+    float  Thr_L[2*512], Thr_R[2*512];                          // masking thresholds L/R, second half for triangle swap
+    float  Thr_M[2*512], Thr_S[2*512];                          // masking thresholds M/S, second half for triangle swap
+    float F_256[4][128];                                        // holds energies of short FFTs (L/R only)
+    float    Xerg[1024];                                        // holds energy spectrum of very long FFT
+    float        Ls_L[PART_LONG],       Ls_R[PART_LONG];        // acoustic pressure in Partition L/R
+    float        Ls_M[PART_LONG],       Ls_S[PART_LONG];        // acoustic pressure per each partition M/S
+    float   PartThr_L[PART_LONG],  PartThr_R[PART_LONG];        // masking thresholds L/R (Partition)
+    float   PartThr_M[PART_LONG],  PartThr_S[PART_LONG];        // masking thresholds M/S (Partition)
+    float  sim_Mask_L[PART_LONG], sim_Mask_R[PART_LONG];        // simultaneous masking (only L/R)
+    float      clow_L[PART_LONG],     clow_R[PART_LONG];        // spread, weighted energy (only L/R)
+    float       cLs_L[PART_LONG],      cLs_R[PART_LONG];        // weighted partition energy (only L/R)
+    float shortThr_L[PART_SHORT],shortThr_R[PART_SHORT];        // threshold for short FFT (only L/R)
+    int      n;
+    int      MaxLine    = (MaxBand+1)*16;                       // set FFT-resolution according to MaxBand
+    SMRTyp   SMR0;
+    SMRTyp   SMR1;                                              // holds SMR's for first and second Analysis
+    int      isvoc_L = 0;
+    int      isvoc_R = 0;
+    float    factorLTQ  = 1.f;                                  // Offset after variable LTQ
+
+    ENTER(50);
+    // 'ClearVocalDetection'-Process
+    if ( CVD_used ) {
+        memset ( Vocal_L, 0, sizeof Vocal_L );
+        memset ( Vocal_R, 0, sizeof Vocal_R );
+
+        // left channel
+        PowSpec2048 ( &data->L[0], Xerg );
+        isvoc_L = CVD2048 ( Xerg, Vocal_L );
+        // right channel
+        PowSpec2048 ( &data->R[0], Xerg );
+        isvoc_R = CVD2048 ( Xerg, Vocal_R );
+    }
+
+    // calculation of the spectral energy via FFT
+    PolarSpec1024 ( &data->L[0], erg0, phs0 );  // left
+    PolarSpec1024 ( &data->R[0], erg1, phs1 );  // right
+
+    // calculation of the acoustic pressures per each subband for L/R-signals
+    SubbandEnergy ( MaxBand, Xi_L, Xi_R, erg0, erg1 );
+
+    // calculation of the acoustic pressures per each partition
+    PartitionEnergy ( Ls_L, Ls_R, erg0, erg1 );
+
+    // calculate the predictability of the signal
+    // left
+    memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
+    memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
+    CalcUnpred ( MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
+    // right
+    memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
+    memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
+    CalcUnpred ( MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
+
+    // calculation of the weighted acoustic pressures per each partition
+    WeightedPartitionEnergy ( cLs_L, cLs_R, erg0, erg1, cw_L, cw_R );
+
+    // Spreading Signal & weighted unpredictability-signal
+    // left
+    memset ( clow_L    , 0, sizeof clow_L );
+    memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
+    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
+    // right
+    memset ( clow_R    , 0, sizeof clow_R );
+    memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
+    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
+
+    // Offset depending on tonality
+    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
+
+    // handling of transient signals
+    // calculate four short FFTs (left)
+    PowSpec256 ( &data->L[  0+SHORTFFT_OFFSET], F_256[0] );
+    PowSpec256 ( &data->L[144+SHORTFFT_OFFSET], F_256[1] );
+    PowSpec256 ( &data->L[288+SHORTFFT_OFFSET], F_256[2] );
+    PowSpec256 ( &data->L[432+SHORTFFT_OFFSET], F_256[3] );
+    // calculate short Threshold
+    CalcShortThreshold ( F_256, ShortThr, shortThr_L, pre_erg_L, TransientL );
+
+    // calculate four short FFTs (right)
+    PowSpec256 ( &data->R[  0+SHORTFFT_OFFSET], F_256[0] );
+    PowSpec256 ( &data->R[144+SHORTFFT_OFFSET], F_256[1] );
+    PowSpec256 ( &data->R[288+SHORTFFT_OFFSET], F_256[2] );
+    PowSpec256 ( &data->R[432+SHORTFFT_OFFSET], F_256[3] );
+    // calculate short Threshold
+    CalcShortThreshold ( F_256, ShortThr, shortThr_R, pre_erg_R, TransientR );
+
+    // dynamic adjustment of the threshold in quiet to the loudness of the current sequence
+    if ( varLtq > 0. )
+        factorLTQ = AdaptLtq ( Ls_L, Ls_R );
+
+    // utilization of the temporal post-masking
+    if ( tmpMask_used ) {
+        CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
+        CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
+        memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
+        memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
+    }
+
+    // transient signal?
+    for ( n = 0; n < PART_SHORT; n++ ) {
+        if ( TransientL [n] ) {
+            sim_Mask_L [3*n  ] = minf ( sim_Mask_L [3*n  ], shortThr_L [n] );
+            sim_Mask_L [3*n+1] = minf ( sim_Mask_L [3*n+1], shortThr_L [n] );
+            sim_Mask_L [3*n+2] = minf ( sim_Mask_L [3*n+2], shortThr_L [n] );
+        }
+        if ( TransientR[n] ) {
+            sim_Mask_R [3*n  ] = minf ( sim_Mask_R [3*n  ], shortThr_R [n] );
+            sim_Mask_R [3*n+1] = minf ( sim_Mask_R [3*n+1], shortThr_R [n] );
+            sim_Mask_R [3*n+2] = minf ( sim_Mask_R [3*n+2], shortThr_R [n] );
+        }
+    }
+
+    // Pre-Echo control
+    PreechoControl ( PartThr_L, PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
+
+    // utilization of the threshold in quiet
+    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
+
+    // Consideration of aliasing between the subbands (noise is smeared)
+    // In: Thr[0..511], Out: Thr[512...1023]
+    AdaptThresholds ( MaxLine, Thr_L+512, Thr_R+512 );
+    memmove ( Thr_L, Thr_L+512, 512*sizeof(float) );
+    memmove ( Thr_R, Thr_R+512, 512*sizeof(float) );
+
+    // calculation of the Signal-to-Mask-Ratio
+    CalculateSMR ( MaxBand, Xi_L, Xi_R, Thr_L, Thr_R, SMR0.L, SMR0.R );
+
+    /***************************************************************************************/
+    /***************************************************************************************/
+    if ( MS_Channelmode > 0 ) {
+        // calculation of the spectral energy via FFT
+        PowSpec1024 ( &data->M[0], erg0 );      // mid
+        PowSpec1024 ( &data->S[0], erg1 );      // side
+
+        // calculation of the acoustic pressures per each subband for M/S-signals
+        SubbandEnergy ( MaxBand, Xi_M, Xi_S, erg0, erg1 );
+
+        // calculation of the acoustic pressures per each partition
+        PartitionEnergy ( Ls_M, Ls_S, erg0, erg1 );
+
+        // calculate masking thresholds for M/S
+        CalcMSThreshold ( Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
+        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
+
+        // Consideration of aliasing between the subbands (noise is smeared)
+        // In: Thr[0..511], Out: Thr[512...1023]
+        AdaptThresholds ( MaxLine, Thr_M+512, Thr_S+512 );
+        memmove ( Thr_M, Thr_M+512, 512*sizeof(float) );
+        memmove ( Thr_S, Thr_S+512, 512*sizeof(float) );
+
+        // calculation of the Signal-to-Mask-Ratio
+        CalculateSMR ( MaxBand, Xi_M, Xi_S, Thr_M, Thr_S, SMR0.M, SMR0.S );
+    }
+
+    if ( NS_Order > 0 ) {       // providing the Noise Shaping thresholds
+        memcpy ( ANSspec_L, Thr_L, sizeof ANSspec_L );
+        memcpy ( ANSspec_R, Thr_R, sizeof ANSspec_R );
+        memcpy ( ANSspec_M, Thr_M, sizeof ANSspec_M );
+        memcpy ( ANSspec_S, Thr_S, sizeof ANSspec_S );
+    }
+    /***************************************************************************************/
+    /***************************************************************************************/
+
+    //
+    //-------- second model calculation via shifted FFT ------------------------
+    //
+    // calculation of the spectral power via FFT
+    PolarSpec1024 ( &data->L[576], erg0, phs0 ); // left
+    PolarSpec1024 ( &data->R[576], erg1, phs1 ); // right
+
+    // calculation of the acoustic pressures per each subband for L/R-signals
+    SubbandEnergy ( MaxBand, Xi_L, Xi_R, erg0, erg1 );
+
+    // calculation of the acoustic pressures per each partition
+    PartitionEnergy ( Ls_L, Ls_R, erg0, erg1 );
+
+    // calculate the predictability of the signal
+    // left
+    memmove ( Xsave_L+512, Xsave_L, 1024*sizeof(float) );
+    memmove ( Ysave_L+512, Ysave_L, 1024*sizeof(float) );
+    CalcUnpred ( MaxLine, erg0, phs0, isvoc_L ? Vocal_L : NULL, Xsave_L, Ysave_L, cw_L );
+    // right
+    memmove ( Xsave_R+512, Xsave_R, 1024*sizeof(float) );
+    memmove ( Ysave_R+512, Ysave_R, 1024*sizeof(float) );
+    CalcUnpred ( MaxLine, erg1, phs1, isvoc_R ? Vocal_R : NULL, Xsave_R, Ysave_R, cw_R );
+
+    // calculation of the weighted acoustic pressure per each partition
+    WeightedPartitionEnergy ( cLs_L, cLs_R, erg0, erg1, cw_L, cw_R );
+
+    // Spreading Signal & weighted unpredictability-signal
+    // left
+    memset ( clow_L    , 0, sizeof clow_L );
+    memset ( sim_Mask_L, 0, sizeof sim_Mask_L );
+    SpreadingSignal ( Ls_L, cLs_L, sim_Mask_L, clow_L );
+    // right
+    memset ( clow_R    , 0, sizeof clow_R );
+    memset ( sim_Mask_R, 0, sizeof sim_Mask_R );
+    SpreadingSignal ( Ls_R, cLs_R, sim_Mask_R, clow_R );
+
+    // Offset depending on tonality
+    ApplyTonalityOffset ( sim_Mask_L, sim_Mask_R, clow_L, clow_R );
+
+    // Handling of transient signals
+    // calculate four short FFTs (left)
+    PowSpec256 ( &data->L[ 576+SHORTFFT_OFFSET], F_256[0] );
+    PowSpec256 ( &data->L[ 720+SHORTFFT_OFFSET], F_256[1] );
+    PowSpec256 ( &data->L[ 864+SHORTFFT_OFFSET], F_256[2] );
+    PowSpec256 ( &data->L[1008+SHORTFFT_OFFSET], F_256[3] );
+    // calculate short Threshold
+    CalcShortThreshold ( F_256, ShortThr, shortThr_L, pre_erg_L, TransientL );
+
+    // calculate four short FFTs (right)
+    PowSpec256 ( &data->R[ 576+SHORTFFT_OFFSET], F_256[0] );
+    PowSpec256 ( &data->R[ 720+SHORTFFT_OFFSET], F_256[1] );
+    PowSpec256 ( &data->R[ 864+SHORTFFT_OFFSET], F_256[2] );
+    PowSpec256 ( &data->R[1008+SHORTFFT_OFFSET], F_256[3] );
+    // calculate short Threshold
+    CalcShortThreshold ( F_256, ShortThr, shortThr_R, pre_erg_R, TransientR );
+
+    // dynamic adjustment of threshold in quiet to loudness of the current sequence
+    if ( varLtq > 0. )
+        factorLTQ = AdaptLtq ( Ls_L, Ls_R );
+
+    // utilization of temporal post-masking
+    if (tmpMask_used) {
+        CalcTemporalThreshold ( a, b, T_L, sim_Mask_L, tmp_Mask_L );
+        CalcTemporalThreshold ( c, d, T_R, sim_Mask_R, tmp_Mask_R );
+        memcpy ( sim_Mask_L, tmp_Mask_L, sizeof sim_Mask_L );
+        memcpy ( sim_Mask_R, tmp_Mask_R, sizeof sim_Mask_R );
+    }
+
+    // transient signal?
+    for ( n = 0; n < PART_SHORT; n++ ) {
+        if ( TransientL[n] ) {
+            sim_Mask_L [3*n  ] = minf ( sim_Mask_L [3*n  ], shortThr_L [n] );
+            sim_Mask_L [3*n+1] = minf ( sim_Mask_L [3*n+1], shortThr_L [n] );
+            sim_Mask_L [3*n+2] = minf ( sim_Mask_L [3*n+2], shortThr_L [n] );
+        }
+        if ( TransientR[n] ) {
+            sim_Mask_R [3*n  ] = minf ( sim_Mask_R [3*n  ], shortThr_R [n] );
+            sim_Mask_R [3*n+1] = minf ( sim_Mask_R [3*n+1], shortThr_R [n] );
+            sim_Mask_R [3*n+2] = minf ( sim_Mask_R [3*n+2], shortThr_R [n] );
+        }
+    }
+
+    // Pre-Echo control
+    PreechoControl ( PartThr_L, PreThr_L, sim_Mask_L, PartThr_R, PreThr_R, sim_Mask_R );
+
+    // utilization of threshold in quiet
+    ApplyLtq ( Thr_L, Thr_R, PartThr_L, PartThr_R, factorLTQ, 0 );
+
+    // Consideration of aliasing between the subbands (noise is smeared)
+    // In: Thr[0..511], Out: Thr[512...1023]
+    AdaptThresholds ( MaxLine, Thr_L+512, Thr_R+512 );
+    memmove ( Thr_L, Thr_L+512, 512*sizeof(float) );
+    memmove ( Thr_R, Thr_R+512, 512*sizeof(float) );
+
+    // calculation of the Signal-to-Mask-Ratio
+    CalculateSMR ( MaxBand, Xi_L, Xi_R, Thr_L, Thr_R, SMR1.L, SMR1.R );
+
+    /***************************************************************************************/
+    /***************************************************************************************/
+    if ( MS_Channelmode > 0 ) {
+        // calculation of the spectral energy via FFT
+        PowSpec1024 ( &data->M[576], erg0 );    // mid
+        PowSpec1024 ( &data->S[576], erg1 );    // side
+
+        // calculation of the acoustic pressure per each subband for M/S-signals
+        SubbandEnergy ( MaxBand, Xi_M, Xi_S, erg0, erg1 );
+
+        // calculation of the acoustic pressure per each partition
+        PartitionEnergy ( Ls_M, Ls_S, erg0, erg1 );
+
+        // calculate masking thresholds for M/S
+        CalcMSThreshold ( Ls_L, Ls_R, Ls_M, Ls_S, PartThr_L, PartThr_R, PartThr_M, PartThr_S );
+        ApplyLtq ( Thr_M, Thr_S, PartThr_M, PartThr_S, factorLTQ, 1 );
+
+        // Consideration of aliasing between the subbands (noise is smeared)
+        // In: Thr[0..511], Out: Thr[512...1023]
+        AdaptThresholds ( MaxLine, Thr_M+512, Thr_S+512 );
+        memmove ( Thr_M, Thr_M+512, 512*sizeof(float) );
+        memmove ( Thr_S, Thr_S+512, 512*sizeof(float) );
+
+        // calculation of the Signal-to-Mask-Ratio
+        CalculateSMR ( MaxBand, Xi_M, Xi_S, Thr_M, Thr_S, SMR1.M, SMR1.S );
+    }
+    /***************************************************************************************/
+    /***************************************************************************************/
+
+    if ( NS_Order > 0 ) {
+        for ( n = 0; n < MAX_ANS_LINES; n++ ) {                 // providing Noise Shaping thresholds
+            ANSspec_L [n] = minf ( ANSspec_L [n], Thr_L [n] );
+            ANSspec_R [n] = minf ( ANSspec_R [n], Thr_R [n] );
+            ANSspec_M [n] = minf ( ANSspec_M [n], Thr_M [n] );
+            ANSspec_S [n] = minf ( ANSspec_S [n], Thr_S [n] );
+        }
+    }
+
+    for ( n = 0; n <= MaxBand; n++ ) {                          // choose 'worst case'-SMR from shifted analysis windows
+        SMR0.L[n] = maxf ( SMR0.L[n], SMR1.L[n] );
+        SMR0.R[n] = maxf ( SMR0.R[n], SMR1.R[n] );
+        SMR0.M[n] = maxf ( SMR0.M[n], SMR1.M[n] );
+        SMR0.S[n] = maxf ( SMR0.S[n], SMR1.S[n] );
+    }
+
+    LEAVE(50);
+    return SMR0;
+}
Index: /mppenc/trunk/src/psy_tab.c
===================================================================
--- /mppenc/trunk/src/psy_tab.c	(revision 97)
+++ /mppenc/trunk/src/psy_tab.c	(revision 97)
@@ -0,0 +1,462 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+// Antialiasing for calculation of the subband power
+const float  Butfly    [7] = { 0.5f, 0.2776f, 0.1176f, 0.0361f, 0.0075f, 0.000948f, 0.0000598f };
+
+// Antialiasing for calculation of the masking thresholds
+const float  InvButfly [7] = { 2.f, 3.6023f, 8.5034f, 27.701f, 133.33f, 1054.852f, 16722.408f };
+
+// w_low for long               0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56
+const int   wl [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  13,  15,  17,  19,  21,  23,  25,  27,  29,  31,  33,  35,  38,  41,  44,  47,  50,  54,  58,  62,  67,  72,  78,  84,  91,  98, 106, 115, 124, 134, 145, 157, 170, 184, 199, 216, 234, 254, 276, 301, 329, 360, 396, 437, 485 };
+const int   wh [PART_LONG] = {  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  12,  14,  16,  18,  20,  22,  24,  26,  28,  30,  32,  34,  37,  40,  43,  46,  49,  53,  57,  61,  66,  71,  77,  83,  90,  97, 105, 114, 123, 133, 144, 156, 169, 183, 198, 215, 233, 253, 275, 300, 328, 359, 395, 436, 484, 511 };
+// Width:                       1    1    1    1    1    1    1    1    1    1    1    2    2    2    2    2    2    2    2    2    2    2    2    3    3    3    3    3    4    4    4    5    5    6    6    7    7    8    9    9   10   11   12   13   14   15   17   18   20   22   25   28   31   36   41   48   27
+
+// inverse partition-width for long
+const float iw [PART_LONG] = { 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/3, 1.f/4, 1.f/4, 1.f/4, 1.f/5, 1.f/5, 1.f/6, 1.f/6, 1.f/7, 1.f/7, 1.f/8, 1.f/9, 1.f/9, 1.f/10, 1.f/11, 1.f/12, 1.f/13, 1.f/14, 1.f/15, 1.f/17, 1.f/18, 1.f/20, 1.f/22, 1.f/25, 1.f/28, 1.f/31, 1.f/36, 1.f/41, 1.f/48, 1.f/27 };
+
+// w_low for short                    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17   18
+const int   wl_short [PART_SHORT] = { 0,  1,  2,  3,  4,  5,  6,  8, 10, 12, 15, 18, 23, 29, 36, 46, 59, 75,  99 };
+const int   wh_short [PART_SHORT] = { 0,  1,  2,  3,  5,  6,  7,  9, 12, 14, 18, 23, 29, 36, 46, 58, 75, 99, 127 };
+
+// inverse partition-width for short
+const float iw_short [PART_SHORT] = { 1.f, 1.f, 1.f, 1.f, 1.f/2, 1.f/2, 1.f/2, 1.f/2, 1.f/3, 1.f/3, 1.f/4, 1.f/6, 1.f/7, 1.f/8, 1.f/11, 1.f/13, 1.f/17, 1.f/25, 1.f/29 };
+
+/*
+Nr.   wl  wh     fl    fh     bl         bh         bm        Nr.   wl  wh     fl    fh     bl         bh         bm
+ 0:    0   0      0     0   0.000000   0.000000   0.000000
+ 1:    1   1     43    43   0.425460   0.425460   0.425460     0:   0   0      0     0   0.000000   0.000000     0.000000
+ 2:    2   2     86    86   0.850241   0.850241   0.850241
+
+ 3:    3   3    129   129   1.273448   1.273448   1.273448
+ 4:    4   4    172   172   1.694205   1.694205   1.694205     1:   1   1    172   172   1.694205   1.694205     1.694205
+ 5:    5   5    215   215   2.111672   2.111672   2.111672
+
+ 6:    6   6    258   258   2.525051   2.525051   2.525051
+ 7:    7   7    301   301   2.933594   2.933594   2.933594     2:   2   2    345   345   3.336612   3.336612     3.336612
+ 8:    8   8    345   345   3.336612   3.336612   3.336612
+
+ 9:    9   9    388   388   3.733479   3.733479   3.733479
+10:   10  10    431   431   4.123635   4.123635   4.123635     3:   3   3    517   517   4.881924   4.881924     4.881924
+11-   11  12    474   517   4.506591   4.881924   4.695234
+
+12:   13  14    560   603   5.249283   5.608381   5.429880
+13:   15  16    646   689   5.958998   6.300971   6.131073     4:   4   5    689   861   6.300971   7.581073     6.958618
+14:   17  18    732   775   6.634195   6.958618   6.797509
+
+15:   19  20    818   861   7.274232   7.581073   7.428745
+16:   21  22    904   947   7.879211   8.168753   8.025049     5:   5   6    861  1034   7.581073   8.722594     8.168753
+17:   23  24    991  1034   8.449828   8.722594   8.587239
+
+18:   25  26   1077  1120   8.987223   9.243908   9.116546
+19:   27  28   1163  1206   9.492850   9.734263   9.614484     6:   6   7   1034  1206   8.722594   9.734263     9.243908
+20:   29  30   1249  1292   9.968365  10.195382  10.082745
+
+21:   31  32   1335  1378  10.415539  10.629064  10.523116
+22:   33  34   1421  1464  10.836184  11.037125  10.937413     7:   8   9   1378  1550  10.629064  11.421352    11.037125
+23:   35  37   1507  1593  11.232108  11.605071  11.421352
+
+24:   38  40   1637  1723  11.783474  12.125139  11.956764
+25:   41  43   1766  1852  12.288791  12.602659  12.447904     8:  10  12   1723  2067  12.125139  13.316883    12.753228
+26:   44  46   1895  1981  12.753228  13.042468  12.899777
+
+27:   47  49   2024  2110  13.181453  13.448898  13.316883
+28:   50  53   2153  2283  13.577635  13.945465  13.764881     9:  12  14   2067  2412  13.316883  14.288198    13.825796
+29:   54  57   2326  2455  14.062349  14.397371  14.232693
+
+30:   58  61   2498  2627  14.504172  14.811258  14.660130
+31:   62  66   2670  2842  14.909464  15.283564  15.100115    10:  15  18   2584  3101  14.711029  15.795819    15.283564
+32:   67  71   2885  3058  15.372757  15.714074  15.546390
+
+33:   72  77   3101  3316  15.795819  16.185532  15.994471
+34:   78  83   3359  3575  16.259980  16.616871  16.441494    11:  18  23   3101  3962  15.795819  17.204658    16.547424
+35:   84  90   3618  3876  16.685418  17.079349  16.885941
+
+36:   91  97   3919  4177  17.142352  17.506445  17.327264
+37:   98 105   4221  4522  17.564981  17.959646  17.765487    12:  23  29   3962  4996  17.204658  18.533945    17.904788
+38:  106 114   4565  4910  18.014031  18.433233  18.227034
+
+39:  115 123   4953  5297  18.483782  18.874805  18.682185
+40:  124 133   5340  5728  18.922095  19.332992  19.130789    13:  29  36   4996  6202  18.533945  19.801451    19.198897
+41:  134 144   5771  6202  19.377073  19.801451  19.592946
+
+42:  145 156   6245  6718  19.842285  20.272889  20.061808
+43:  157 169   6761  7278  20.310373  20.739167  20.529583    14:  36  46   6202  7924  19.801451  21.222342    20.565177
+44:  170 183   7321  7881  20.773175  21.191895  20.987911
+
+45:  184 198   7924  8527  21.222342  21.623344  21.428652
+46:  199 215   8570  9259  21.650236  22.050787  21.857360    15:  46  58   7924  9991  21.222342  22.420001    21.882271
+47:  216 233   9302 10034  22.074042  22.440072  22.263795
+
+48-  234 253  10078 10896  22.459969  22.807140  22.640652
+49:  254 275  10939 11843  22.823891  23.144847  22.991444    16:  59  75  10164 12920  22.499251  23.461146    23.044078
+50:  276 300  11886 12920  23.158772  23.461146  23.317264
+
+51:  301 328  12963 14126  23.472530  23.748999  23.617861
+52:  329 359  14169 15461  23.758199  24.005540  23.888450    17:  75  99  12920 17054  23.461146  24.248491    23.920884
+53:  360 395  15504 17011  24.012922  24.242660  24.134368
+
+54:  396 436  17054 18777  24.248491  24.454928  24.357873
+55:  437 484  18820 20844  24.459492  24.647977  24.559711    18:  99 127  17054 21878  24.248491  24.727775    24.524955
+56:  485 511  20887 22007  24.651498  24.737100  24.695685
+*/
+
+
+/* V A R I A B L E S */
+float  MinVal   [PART_LONG];               // contains minimum tonality soffsets
+float  Loudness [PART_LONG];               // weighting factors for loudness calculation
+float  SPRD     [PART_LONG] [PART_LONG];   // tabulated spreading function
+float  O_MAX;
+float  O_MIN;
+float  FAC1;
+float  FAC2;                               // constants for offset calculation
+float  partLtq  [PART_LONG];               // threshold in quiet (partitions)
+float  invLtq   [PART_LONG];               // inverse threshold in quiet (partitions, long)
+float  fftLtq   [512];                     // threshold in quiet (FFT)
+float  Ltq_offset;                         // Offset for threshold in quiet
+float  Ltq_max;                            // maximum level for threshold in quiet
+float  TMN;
+float  NMT;
+float  TransDetect;
+unsigned int    EarModelFlag;
+int    MinValChoice;
+
+
+/*
+ *  Klemm 1994 and 1997. Experimental data. Sorry, data looks a little bit
+ *  dodderly. Data below 30 Hz is extrapolated from other material, above 18
+ *  kHz the ATH is limited due to the original purpose (too much noise at
+ *  ATH is not good even if it's theoretically inaudible).
+ */
+
+static float
+ATHformula_Frank ( float freq )
+{
+    /*
+     * one value per 100 cent = 1
+     * semitone = 1/4
+     * third = 1/12
+     * octave = 1/40 decade
+     * rest is linear interpolated, values are currently in millibel rel. 20 µPa
+     */
+    static short tab [] = {
+        /*    10.0 */  9669, 9669, 9626, 9512,
+        /*    12.6 */  9353, 9113, 8882, 8676,
+        /*    15.8 */  8469, 8243, 7997, 7748,
+        /*    20.0 */  7492, 7239, 7000, 6762,
+        /*    25.1 */  6529, 6302, 6084, 5900,
+        /*    31.6 */  5717, 5534, 5351, 5167,
+        /*    39.8 */  5004, 4812, 4638, 4466,
+        /*    50.1 */  4310, 4173, 4050, 3922,
+        /*    63.1 */  3723, 3577, 3451, 3281,
+        /*    79.4 */  3132, 3036, 2902, 2760,
+        /*   100.0 */  2658, 2591, 2441, 2301,
+        /*   125.9 */  2212, 2125, 2018, 1900,
+        /*   158.5 */  1770, 1682, 1594, 1512,
+        /*   199.5 */  1430, 1341, 1260, 1198,
+        /*   251.2 */  1136, 1057,  998,  943,
+        /*   316.2 */   887,  846,  744,  712,
+        /*   398.1 */   693,  668,  637,  606,
+        /*   501.2 */   580,  555,  529,  502,
+        /*   631.0 */   475,  448,  422,  398,
+        /*   794.3 */   375,  351,  327,  322,
+        /*  1000.0 */   312,  301,  291,  268,
+        /*  1258.9 */   246,  215,  182,  146,
+        /*  1584.9 */   107,   61,   13,  -35,
+        /*  1995.3 */   -96, -156, -179, -235,
+        /*  2511.9 */  -295, -350, -401, -421,
+        /*  3162.3 */  -446, -499, -532, -535,
+        /*  3981.1 */  -513, -476, -431, -313,
+        /*  5011.9 */  -179,    8,  203,  403,
+        /*  6309.6 */   580,  736,  881, 1022,
+        /*  7943.3 */  1154, 1251, 1348, 1421,
+        /* 10000.0 */  1479, 1399, 1285, 1193,
+        /* 12589.3 */  1287, 1519, 1914, 2369,
+#if 0
+        /* 15848.9 */  3352, 4865, 5942, 6177,
+        /* 19952.6 */  6385, 6604, 6833, 7009,
+        /* 25118.9 */  7066, 7127, 7191, 7260,
+#else
+        /* 15848.9 */  3352, 4352, 5352, 6352,
+        /* 19952.6 */  7352, 8352, 9352, 9999,
+        /* 25118.9 */  9999, 9999, 9999, 9999,
+#endif
+    };
+    double    freq_log;
+    unsigned  index;
+
+    if ( freq <    10. ) freq =    10.;
+    if ( freq > 29853. ) freq = 29853.;
+
+    freq_log = 40. * log10 (0.1 * freq);   /* 4 steps per third, starting at 10 Hz */
+    index    = (unsigned) freq_log;
+    return 0.01 * (tab [index] * (1 + index - freq_log) + tab [index+1] * (freq_log - index));
+}
+
+
+/* F U N C T I O N S */
+// calculation of the threshold in quiet in FFT-resolution
+static void
+Ruhehoerschwelle ( unsigned int  EarModelFlag,
+                   int           Ltq_offset,
+                   int           Ltq_max )
+{
+    int     n;
+    int     k;
+    float   f;
+    float   erg;
+    double  tmp;
+    float   absLtq [512];
+
+    for ( n = 0; n < 512; n++ ) {
+        f = (float) ( (n+1) * (float)(SampleFreq / 2000.) / 512 );   // Frequency in kHz
+
+        switch ( EarModelFlag / 100 ) {
+        case 0:         // ISO-threshold in quiet
+            tmp  = 3.64*pow (f,-0.8) -  6.5*exp (-0.6*(f-3.3)*(f-3.3)) + 0.001*pow (f, 4.0);
+            break;
+        default:
+        case 1:         // measured threshold in quiet (Nick Berglmeir, Andree Buschmann, Kopfhörer)
+            tmp  = 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
+            break;
+        case 2:         // measured threshold in quiet (Filburt, Kopfhörer)
+            tmp  = 9.00*pow (f,-0.5) - 15.0*exp (-0.1*(f-4.0)*(f-4.0)) + 0.0341796875*pow (f, 2.5)          + 15.*exp (-(f-0.1)*(f-0.1)) - 18;
+            tmp  = mind ( tmp, Ltq_max - 18 );
+            break;
+        case 3:
+            tmp  = ATHformula_Frank ( 1.e3 * f );
+            break;
+        case 4:
+            tmp  = ATHformula_Frank ( 1.e3 * f );
+            if ( f > 4.8 ) {
+                tmp += 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
+                tmp *= 0.5 ;
+            }
+            break;
+        case 5:
+            tmp  = ATHformula_Frank ( 1.e3 * f );
+            if ( f > 4.8 ) {
+                tmp = 3.00*pow (f,-0.8) -  5.0*exp (-0.1*(f-3.0)*(f-3.0)) + 0.0000015022693846297*pow (f, 6.0) + 10.*exp (-(f-0.1)*(f-0.1));
+            }
+            break;
+        }
+
+        tmp -= f * f * (int)(EarModelFlag % 100 - 50) * 0.0015;  // 00: +30 dB, 100: -30 dB  @20 kHz
+
+        tmp       = mind ( tmp, Ltq_max );              // Limit ATH
+        tmp      += Ltq_offset - 23;                    // Add chosen Offset
+        fftLtq[n] = absLtq[n] = POW10 ( 0.1 * tmp);     // conversion into power
+    }
+
+    // threshold in quiet in partitions (long)
+    for ( n = 0; n < PART_LONG; n++ ) {
+        erg = 1.e20f;
+        for ( k = wl[n]; k <= wh[n]; k++ )
+            erg = minf (erg, absLtq[k]);
+
+        partLtq[n] = erg;               // threshold in quiet
+        invLtq [n] = 1.f / partLtq[n];  // Inverse
+    }
+}
+
+#ifdef _WIN32
+static double
+asinh ( double x )
+{
+    return x >= 0  ?  log (sqrt (x*x+1) + x)  :  -log (sqrt (x*x+1) - x);
+}
+#endif
+
+
+static double
+Freq2Bark ( double Hz )           // Klemm 2002
+{
+    return 9.97074*asinh (1.1268e-3 * Hz) - 6.25817*asinh (0.197193e-3 * Hz) ;
+}
+
+static double
+Bark2Freq ( double Bark )           // Klemm 2002
+{
+    return 956.86 * sinh (0.101561*Bark) + 11.7296 * sinh (0.304992*Bark) + 6.33622e-3*sinh (0.538621*Bark);
+}
+
+static double
+LongPart2Bark ( int Part )
+{
+    return Freq2Bark ((wl [Part] + wh [Part]) * SampleFreq / 2048.);
+}
+
+// calculating the table for loudness calculation based on absLtq = ank
+static void
+Loudness_Tabelle (void)
+{
+    int    n;
+    float  midfreq;
+    float  tmp;
+
+    // ca. dB(A)
+    for ( n = 0; n < PART_LONG; n++ ){
+        midfreq      = (wh[n] + wl[n] + 3) * (0.25 * SampleFreq / 512);     // center frequency in kHz, why +3 ???
+        tmp          = LOG10 (midfreq) - 3.5f;                                  // dB(A)
+        tmp          = -10 * tmp * tmp + 3 - midfreq/3000;
+        Loudness [n] = POW10 ( 0.1 * tmp );                                     // conversion into power
+    }
+}
+
+
+static double
+Bass ( float f, float TMN, float NMT, float bass )
+{
+    static unsigned char  lfe [11] = { 120, 100, 80, 60, 50, 40, 30, 20, 15, 10, 5 };
+    int                   tmp      = (int) ( 1024/44100. * f + 0.5 );
+
+    switch ( tmp ) {
+    case  0:
+    case  1:
+    case  2:
+    case  3:
+    case  4:
+    case  5:
+    case  6:
+    case  7:
+    case  8:
+    case  9:
+    case 10:
+        return TMN + bass * lfe [tmp];
+    case 11:
+    case 12:
+    case 13:
+    case 14:
+    case 15:
+    case 16:
+    case 17:
+    case 18:
+        return TMN;
+    case 19:
+    case 20:
+    case 21:
+    case 22:
+        return TMN*0.75 + NMT*0.25;
+    case 23:
+    case 24:
+        return TMN*0.50 + NMT*0.50;
+    case 25:
+    case 26:
+        return TMN*0.25 + NMT*0.75;
+    default:
+        return NMT;
+    }
+}
+
+
+// calculating the coefficient for utilization of the tonality offset, depending on TMN und NMT
+static void
+Tonalitaetskoeffizienten ( void )
+{
+    double                tmp;
+    int                   n;
+    float                 bass;
+
+    bass = 0.1/8 * NMT;
+    if ( MinValChoice <= 2  &&  bass > 0.1 )
+        bass = 0.1f;
+    if ( MinValChoice <= 1 )
+        bass = 0.0f;
+
+    // alternative: calculation of the minval-values dependent on TMN and TMN
+    for ( n = 0; n < PART_LONG; n++ ) {
+        tmp        = Bass ( (wl [n] + wh [n]) / 2048. * SampleFreq, TMN, NMT, bass );
+        MinVal [n] = POW10 ( -0.1 * tmp );                      // conversion into power
+    }
+
+    // calculation of the constants for "tonality offset"
+    O_MAX = POW10 ( -0.1 * TMN );
+    O_MIN = POW10 ( -0.1 * NMT );
+    FAC1  = POW10 ( -0.1 * (NMT - (TMN - NMT) * 0.229) ) ;
+    FAC2  = (TMN - NMT) * (0.99011159 * 0.1);
+}
+
+
+// calculation of the spreading function
+static void
+Spread ( void )
+{
+    int    i;
+    int    j;
+    float  tmpx;
+    float  tmpy;
+    float  tmpz;
+    float  x;
+
+    // calculation of the spreading-function for all occuring values
+    for ( i = 0; i < PART_LONG; i++ ) {                 // i is masking Partition, Source
+        for ( j = 0; j < PART_LONG; j++ ) {             // j is masking Partition, Target
+            tmpx = LongPart2Bark (j) - LongPart2Bark (i);// Difference of the partitions in Bark
+            tmpy = tmpz = 0.;                           // tmpz = 0: no dip
+
+            if      ( tmpx < 0 ) {                      // downwards (S1)
+                tmpy  = -32.f * tmpx;                   // 32 dB per Bark, e33 (10)
+            }
+            else if ( tmpx > 0 ) {                      // upwards (S2)
+#if 0
+                x = (wl[i]+wh[i])/2 * (float)(SampleFreq / 2000)/512;   // center frequency in kHz ???????
+                if (i==0) x = 0.5f  * (float)(SampleFreq / 2000)/512;   // if first spectral line
+#else
+                x  = i  ?  wl[i]+wh[i]  :  1;
+                x *= SampleFreq / 1000. / 2048;         // center frequency in kHz
+#endif
+                // dB/Bark
+                tmpy = (22.f + 0.23f / x) * tmpx;       // e33 (10)
+
+                // dip (up to 6 dB)
+                tmpz = 8 * minf ( (tmpx-0.5f) * (tmpx-0.5f) - 2 * (tmpx-0.5f), 0.f );
+            }
+
+            // calculate coefficient
+            SPRD[i][j] = POW10 ( -0.1 * (tmpy+tmpz) );  // [Source] [Target]
+        }
+    }
+
+    // Normierung e33 (10)
+    for ( i = 0; i < PART_LONG; i++ ) {                 // i is masked Partition
+        float  norm = 0.f;
+        for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
+            norm += SPRD [j] [i];
+        for ( j = 0; j < PART_LONG; j++ )               // j is masking Partition
+            SPRD [j] [i] /= norm;
+    }
+}
+
+// call all initialisation procedures
+void
+Init_Psychoakustiktabellen ( void )
+{
+    Max_Band = (int) ( Bandwidth * 64. / SampleFreq );
+    if ( Max_Band <  1 ) Max_Band =  1;
+    if ( Max_Band > 31 ) Max_Band = 31;
+
+    Tonalitaetskoeffizienten ();
+    Ruhehoerschwelle ( EarModelFlag, Ltq_offset, Ltq_max );
+    Loudness_Tabelle ();
+    Spread ();
+}
+
+/* end of psy_tab.c */
Index: /mppenc/trunk/src/quant.c
===================================================================
--- /mppenc/trunk/src/quant.c	(revision 97)
+++ /mppenc/trunk/src/quant.c	(revision 97)
@@ -0,0 +1,319 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+/* V A R I A B L E S */
+float  __SCF    [128 + 6];   // tabulated scalefactors
+float  __invSCF [128 + 6];   // inverted scalefactors
+
+
+// Quantization-coefficients: step/65536 bzw. (2*D[Res]+1)/65536
+static const float  __A [1 + 18] = {
+    0.0000762939453125f,
+    0.0000000000000000f, 0.0000457763671875f, 0.0000762939453125f, 0.0001068115234375f,
+    0.0001373291015625f, 0.0002288818359375f, 0.0004730224609375f, 0.0009613037109375f,
+    0.0019378662109375f, 0.0038909912109375f, 0.0077972412109375f, 0.0156097412109375f,
+    0.0312347412109375f, 0.0624847412109375f, 0.1249847412109375f, 0.2499847412109375f,
+    0.4999847412109375f
+};
+
+
+// Requantization-coefficients: 65536/step bzw. 1/A[Res]
+static const float  __C [1 + 18] = {
+    13107.200000000001f,
+    65535.000000000000f, 21845.333333333332f, 13107.200000000001f, 9362.285714285713f,
+     7281.777777777777f,  4369.066666666666f,  2114.064516129032f, 1040.253968253968f,
+      516.031496062992f,   257.003921568627f,   128.250489236790f,   64.062561094819f,
+       32.015632633121f,    16.003907203907f,     8.000976681723f,    4.000244155527f,
+        2.000061037018f,     1.000015259022f
+};
+
+
+// Requantization-Offset: 2*D+1 = steps of quantizer
+static const int  __D [1 + 18] = {
+    2,
+    0,     1,     2,     3,     4,     7,    15,    31,    63,
+  127,   255,   511,  1023,  2047,  4095,  8191, 16383, 32767
+};
+
+#define A   (__A + 1)
+#define C   (__C + 1)
+#define D   (__D + 1)
+
+// Generation of the scalefactors and their inverses
+void
+Init_Skalenfaktoren ( void )
+{
+    int  n;
+
+    for ( n = -6; n < 128; n++ ) {
+        SCF[n]    = (float) ( pow(10.,-0.1*(n-1)/1.26) );
+        invSCF[n] = (float) ( pow(10., 0.1*(n-1)/1.26) );
+    }
+}
+
+#pragma warning ( disable : 4305 )
+
+static float  NoiseInjectionCompensation1D [18] = {
+#if 1
+    1.f,
+    0.884621,
+    0.935711,
+    0.970829,
+    0.987941,
+    0.994315,
+    0.997826,
+    0.999744,
+    1., 1., 1., 1., 1., 1., 1., 1., 1., 1.
+#else
+    1.,
+    0.907073,   //  -1...+1
+    0.946334,   //  -2...+2
+    0.974793,   //  -3...+3
+    0.987647,   //  -4...+4
+    0.994330,   //  -7...+7
+    0.997846,   // -15...+15
+    1.,         // -31...+31
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+    1.,
+#endif
+} ;
+
+#if 0
+static float  NoiseInjectionCompensation2D [18] [32] = {
+    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
+    { 0.931595, 0.891390, 0.852494, 0.872420, 0.904053, 0.933716, 0.958976, 0.977719, 0.993979, 1.009011, 1.020961, 1.029564, 1.026582, 1.026753, 1.035573, 1.053251, 1.073429, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344, 1.096344,  },
+    { 0.878264, 0.882351, 0.904261, 0.930843, 0.949243, 0.966741, 0.980500, 0.988182, 0.993361, 0.997112, 0.998918, 0.999501, 1.003179, 1.007445, 1.008678, 0.995890, 0.991015, 0.988019, 0.985479, 0.987646, 1.003605, 1.029301, 1.040511, 1.061531, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302, 1.083302,  },
+    { 0.866977, 0.943500, 0.941561, 0.953049, 0.967274, 0.980476, 0.988678, 0.993240, 0.996376, 0.998513, 0.999545, 0.999775, 1.000898, 1.003954, 1.006308, 1.004932, 1.002867, 1.002922, 1.003624, 1.005487, 1.003919, 1.008022, 0.987693, 1.000358, 1.017461, 1.039166, 1.056053, 1.068191, 1.068191, 1.068191, 1.068191, 1.068191,  },
+    { 0.880390, 0.976713, 0.976180, 0.976596, 0.982011, 0.988786, 0.993619, 0.996641, 0.998824, 1.000297, 1.001195, 1.001718, 1.002395, 1.003503, 1.005617, 1.005072, 1.002409, 1.003703, 1.003412, 1.003318, 1.005290, 1.007112, 1.014370, 1.010040, 1.000780, 1.005700, 1.020505, 1.030123, 1.030123, 1.030123, 1.030123, 1.030123,  },
+    { 0.916894, 0.987164, 0.988734, 0.992318, 0.995268, 0.996932, 0.998141, 0.999072, 0.999674, 1.000104, 1.000292, 1.000386, 1.000399, 1.000222, 1.000671, 1.002127, 1.000137, 1.000046, 0.999644, 0.999156, 1.000568, 1.000098, 0.993764, 0.993954, 0.998971, 1.002835, 1.002972, 0.995376, 1.001643, 1.001643, 1.001643, 1.001643,  },
+    { 0.982771, 0.995034, 0.997118, 0.998294, 0.998652, 0.999016, 0.999382, 0.999598, 0.999746, 0.999851, 0.999837, 0.999881, 0.999847, 1.000154, 0.999885, 1.000222, 0.999963, 1.000934, 0.999804, 0.999927, 1.000379, 0.997574, 0.997943, 0.998748, 0.998151, 0.997458, 1.000319, 1.001091, 0.998461, 0.996151, 1.005969, 1.005969,  },
+    { 0.997150, 0.999903, 0.999424, 0.999537, 0.999661, 0.999753, 0.999851, 0.999903, 0.999928, 0.999963, 0.999969, 0.999941, 0.999974, 0.999967, 0.999996, 0.999975, 0.999966, 0.999704, 0.999946, 0.999894, 0.999905, 1.000840, 1.000716, 1.000799, 1.000406, 0.999912, 1.000153, 0.999789, 1.000495, 1.000495, 1.001167, 1.001347,  },
+    { 0.995524, 0.999983, 1.000044, 0.999965, 0.999970, 0.999974, 0.999986, 0.999995, 0.999996, 1.000011, 0.999997, 1.000010, 1.000010, 1.000026, 1.000006, 1.000148, 1.000048, 0.999999, 1.000161, 1.000193, 0.999797, 1.000145, 0.999974, 1.000039, 0.999731, 0.999985, 1.000563, 1.000256, 1.000637, 1.000050, 1.002013, 1.001053,  },
+    { 0.994796, 0.999833, 1.000003, 1.000012, 0.999986, 0.999991, 0.999991, 1.000000, 1.000004, 0.999999, 1.000005, 1.000004, 1.000008, 0.999996, 1.000027, 1.000097, 0.999951, 0.999938, 0.999989, 1.000001, 1.000048, 0.999935, 1.000068, 1.000134, 0.999961, 1.000198, 0.999956, 0.999957, 0.999844, 1.000087, 0.999708, 1.000198,  },
+    { 0.996046, 0.999902, 1.000019, 1.000017, 0.999983, 0.999997, 1.000002, 0.999993, 0.999999, 1.000003, 1.000001, 1.000015, 1.000004, 1.000006, 0.999987, 0.999993, 0.999992, 1.000029, 1.000064, 0.999997, 1.000044, 1.000044, 0.999919, 0.999875, 1.000011, 0.999897, 0.999905, 0.999996, 0.999934, 0.999968, 1.000008, 0.999902,  },
+    { 0.998703, 0.999963, 1.000021, 1.000006, 1.000008, 1.000000, 1.000003, 0.999994, 0.999990, 0.999990, 1.000003, 1.000009, 1.000001, 0.999999, 1.000001, 1.000009, 0.999999, 0.999988, 1.000003, 0.999971, 1.000005, 1.000042, 0.999924, 0.999995, 0.999998, 0.999988, 0.999961, 0.999942, 1.000046, 1.000061, 1.000112, 1.000052,  },
+    { 0.999872, 1.000001, 1.000004, 0.999998, 0.999999, 0.999998, 0.999992, 0.999990, 0.999991, 1.000000, 1.000000, 1.000000, 1.000002, 0.999996, 1.000004, 1.000011, 0.999963, 1.000016, 1.000050, 0.999996, 0.999998, 1.000006, 0.999990, 0.999948, 0.999974, 1.000060, 1.000014, 0.999987, 0.999986, 0.999917, 0.999973, 1.000035,  },
+    { 1.000366, 1.000006, 0.999996, 0.999995, 0.999998, 0.999996, 0.999991, 1.000001, 0.999990, 0.999996, 1.000010, 0.999999, 1.000002, 1.000000, 0.999996, 0.999990, 1.000014, 0.999978, 1.000011, 0.999983, 0.999988, 0.999971, 0.999997, 0.999989, 0.999986, 0.999958, 1.000005, 0.999992, 0.999975, 0.999975, 0.999975, 0.999975,  },
+    { 0.999736, 0.999995, 1.000002, 1.000004, 0.999999, 1.000000, 1.000003, 1.000000, 1.000007, 0.999992, 0.999997, 0.999998, 0.999998, 0.999997, 1.000007, 1.000012, 1.000004, 0.999995, 0.999996, 1.000009, 1.000003, 1.000008, 1.000001, 1.000003, 1.000011, 1.000019, 0.999991, 0.999970, 0.999970, 0.999970, 0.999970, 0.999965,  },
+    { 0.999970, 1.000000, 1.000000, 1.000000, 1.000001, 1.000000, 1.000000, 0.999999, 1.000001, 1.000000, 0.999999, 0.999999, 0.999999, 1.000007, 1.000005, 1.000002, 0.999999, 0.999999, 1.000000, 0.999997, 0.999999, 1.000001, 1.000001, 0.999988, 0.999988, 0.999984, 0.999995, 0.999986, 0.999986, 0.999986, 0.999986, 0.999986,  },
+    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
+    { 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000,  },
+};
+#endif
+
+#pragma warning ( default : 4305 )
+
+
+void
+NoiseInjectionComp ( void )
+{
+    int  i;
+
+    for ( i = 0; i < sizeof(NoiseInjectionCompensation1D)/sizeof(*NoiseInjectionCompensation1D); i++ )
+        NoiseInjectionCompensation1D [i] = 1.f;
+#if 0
+    for ( i = 0; i < sizeof(NoiseInjectionCompensation2D)/sizeof(**NoiseInjectionCompensation2D); i++ )
+        NoiseInjectionCompensation2D [0][i] = 1.f;
+#endif
+}
+
+
+// Quantizes a subband and calculates iSNR
+float
+ISNR_Schaetzer ( const float* input, const float SNRcomp, const int res )
+{
+    int    k;
+    float  fac    = A [res];
+    float  invfac = C [res];
+    float  Signal = 1.e-30f;
+    float  Fehler = 1.e-30f;
+    float  tmp ;
+    float  tmp2;
+    float  tmp3;
+
+    // Summation of the absolute power and the quadratic error
+    for ( k = 0; k < 36; k++ ) {
+        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
+        // q = ftol(in), correct rounding
+        tmp  = tmp2 * fac + 0xFF8000;
+        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
+        tmp  = tmp3 - tmp2;
+
+        Fehler += tmp * tmp;
+        Signal += tmp2 * tmp2;
+    }
+
+    // Utilization of SNRcomp only if SNR > 1 !!!
+    return Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
+}
+
+
+float
+ISNR_Schaetzer_Trans ( const float* input, const float SNRcomp, const int res )
+{
+    int    k;
+    float  fac    = A [res];
+    float  invfac = C [res];
+    float  Signal;
+    float  Fehler;
+    float  ret ;
+    float  tmp ;
+    float  tmp2;
+    float  tmp3;
+
+    // Summation of the absolute power and the quadratic error
+    k = 0;
+    Signal = Fehler = 1.e-30f;
+    for ( ; k < 12; k++ ) {
+        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
+        // q = ftol(in), correct rounding
+        tmp  = tmp2 * fac + 0xFF8000;
+        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
+        tmp  = tmp3 - tmp2;
+
+        Fehler += tmp * tmp;
+        Signal += tmp2 * tmp2;
+    }
+    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
+    ret = tmp;
+    Signal = Fehler = 1.e-30f;
+    for ( ; k < 24; k++ ) {
+        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
+        // q = ftol(in), correct rounding
+        tmp  = tmp2 * fac + 0xFF8000;
+        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
+        tmp  = tmp3 - tmp2;
+
+        Fehler += tmp * tmp;
+        Signal += tmp2 * tmp2;
+    }
+    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
+    if ( tmp > ret ) ret = tmp;
+    //ret += tmp;
+    Signal = Fehler = 1.e-30f;
+    for ( ; k < 36; k++ ) {
+        tmp2    = input[k] * NoiseInjectionCompensation1D [res];
+        // q = ftol(in), correct rounding
+        tmp  = tmp2 * fac + 0xFF8000;
+        tmp3 = (*(int*) & tmp - 0x4B7F8000) * invfac;
+        tmp  = tmp3 - tmp2;
+
+        Fehler += tmp * tmp;
+        Signal += tmp2 * tmp2;
+    }
+    tmp = Signal > Fehler  ?  Fehler / (SNRcomp * Signal)  :  Fehler / Signal;
+    if ( tmp > ret ) ret = tmp;
+    //ret += tmp;
+    //ret *= 0.33333333333f;
+
+    return ret;
+}
+
+
+// Linear quantizer for a subband
+void
+QuantizeSubband ( unsigned int* qu_output, const float* input, const int res, float* errors )
+{
+    int    n;
+    int    offset  = D [res];
+    float  mult    = A [res] * NoiseInjectionCompensation1D [res];
+    float  invmult = C [res];
+    float  tmp;
+    int    quant;
+    float  signal;
+
+    for ( n = 0; n < 36 - MAX_NS_ORDER; n++, input++, qu_output++ ) {
+        // q = ftol(in), correct rounding
+        tmp   = *input * mult + 0xFF8000;
+        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
+
+        // limitation to 0...2D
+        if ((unsigned int)quant > (unsigned int)2*offset ) {
+            quant = mini ( quant, 2*offset );
+            quant = maxi ( quant,        0 );
+        }
+        *qu_output  = quant;
+    }
+
+    for ( ; n < 36; n++, input++, qu_output++ ) {
+        // q = ftol(in), correct rounding
+        signal = *input * mult;
+        tmp   =  signal + 0xFF8000;
+        quant = (unsigned int)(*(int*) & tmp - 0x4B7F8000 + offset);
+
+        // calculate the current error and save it for error refeeding
+        errors [n + 6] = invmult * (quant - offset) - signal * NoiseInjectionCompensation1D [res];
+
+        // limitation to 0...2D
+        if ((unsigned int)quant > (unsigned int)2*offset ) {
+            quant = mini ( quant, 2*offset );
+            quant = maxi ( quant,        0 );
+        }
+        *qu_output  = quant;
+    }
+}
+
+
+// NoiseShaper for a subband
+void
+QuantizeSubbandWithNoiseShaping ( unsigned int* qu_output, const float* input, const int res, float* errors, const float* FIR )
+{
+#define E(x) *((int*)errors+(x))
+
+    float  signal;
+    float  tmp;
+    float  mult    = A [res];
+    float  invmult = C [res];
+    int    offset  = D [res];
+    int    n;
+    int    quant;
+
+    E(0) = E(1) = E(2) = E(3) = E(4) = E(5) = 0;       // arghh, it produces pops on each frame boundary!
+
+    for ( n = 0; n < 36; n++, input++, qu_output++ ) {
+        signal = *input * NoiseInjectionCompensation1D [res] - (FIR[5]*errors[n+0] + FIR[4]*errors[n+1] + FIR[3]*errors[n+2] + FIR[2]*errors[n+3] + FIR[1]*errors[n+4] + FIR[0]*errors[n+5]);
+
+        // quant = ftol(signal), correct rounding
+        tmp   = signal * mult + 0xFF8000;
+        quant = *(int*) & tmp - 0x4B7F8000;
+
+        // calculate the current error and save it for error refeeding
+        errors [n + 6] = invmult * quant - signal * NoiseInjectionCompensation1D [res];
+
+        // limitation to +/-D
+        quant = minf ( quant, +offset );
+        quant = maxf ( quant, -offset );
+
+        *qu_output = (unsigned int)(quant + offset);
+    }
+}
+
+/* end of quant.c */
+
+// pfk@schnecke.offl.uni-jena.de@EMAIL, Andree.Buschmann@web.de@EMAIL, BuschmannA@becker.de@EMAIL, miyaguch@eskimo.com@EMAIL, r3mix@irc.openprojects.net@EMAIL, dibrom@users.sourceforge.net@EMAIL, m.p.bakker-10@student.utwente.nl@EMAIL, djmrob@essex.ac.uk@EMAIL, dim@psytel-research.co.yu@EMAIL, lerch@zplane.de@EMAIL, takehiro@users.sourceforge.net@EMAIL, aleidinger@users.sourceforge.net@EMAIL, Robert.Hegemann@gmx.de@EMAIL, bouvigne@mp3-tech.org@EMAIL, monty@xiph.org@EMAIL, Pumpkinz99@aol.com@EMAIL, spase@outerspase.net@EMAIL, mt@wildpuppy.com@EMAIL, juha.laaksonheimo@tut.fi@EMAIL, speek@myrealbox.com@EMAIL, w.speek@12move.nl@EMAIL, martin@spueler.de@EMAIL, nicolaus.berglmeir@t-online.de@EMAIL, thomas.a.juerges@ruhr-uni-bochum.de@EMAIL, HelH@mpex.net@EMAIL, garf@roadum.demon.co.uk@EMAIL, gcp@sjeng.org@EMAIL, mike@naivesoftware.com@EMAIL, case@mobiili.net@EMAIL, steve.lhomme@free.fr@EMAIL, walter@binity.com@EMAIL
Index: /mppenc/trunk/src/stderr.c
===================================================================
--- /mppenc/trunk/src/stderr.c	(revision 97)
+++ /mppenc/trunk/src/stderr.c	(revision 97)
@@ -0,0 +1,180 @@
+/*
+ *  stderr - Message output system
+ *
+ *  (C) Frank Klemm, Janne Hyvärinen 2002. All rights reserved.
+ *
+ *  Principles:
+ *
+ *  History:
+ *    2001              created
+ *    2002 Spring       added functionality to switch on and off printing to easily allow silent modes
+ *    2002-10-10        Escape sequence handling for Windows added.
+ *
+ *  Global functions:
+ *    - SetStderrSilent()
+ *    - GetStderrSilent()
+ *    - stderr_printf()
+ *
+ *  TODO:
+ *    -
+ */
+
+#include "mppdec.h"
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
+
+static Bool_t  stderr_silent = 0;
+
+
+void
+SetStderrSilent ( Bool_t state )
+{
+    stderr_silent = state;
+}
+
+
+Bool_t
+GetStderrSilent ( void )
+{
+    return stderr_silent;
+}
+
+
+int Cdecl
+stderr_printf ( const char* format, ... )
+{
+    char     buff [2 * PATHLEN_MAX + 3072];
+    char*    p = buff;
+    char*    q;
+    int      ret;
+    va_list  v;
+
+    /* print to a buffer */
+    va_start ( v, format );
+    ret = vsprintf ( p, format, v );
+    va_end ( v );
+
+    if ( !stderr_silent ) {
+
+#if   defined __unix__  ||  defined __UNIX__
+
+        WRITE ( STDERR, buff, ret );
+
+#elif defined _WIN32
+
+# define FOREGROUND_ALL         ( FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED )
+# define BACKGROUND_ALL         ( BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED )
+
+        // for Windows systems we must merge carriage returns into the stream to avoid staircases
+        // Also escape sequences must be detected and replaced (incomplete now)
+
+        char                            buff [128];
+        static int                      init = 0;
+        CONSOLE_SCREEN_BUFFER_INFO      con_info;
+        static HANDLE                   hSTDERR;
+        static WORD                     attr;
+        static WORD                     attr_initial;
+        DWORD                           written;
+
+        if ( init == 0 ) {
+            hSTDERR = GetStdHandle ( STD_ERROR_HANDLE );
+            attr    = hSTDERR == INVALID_HANDLE_VALUE  ||  GetConsoleScreenBufferInfo ( hSTDERR, &con_info ) == 0
+                      ?  FOREGROUND_ALL  :  con_info.wAttributes;
+            attr_initial = attr;
+            init    = 1;
+        }
+
+        if ( hSTDERR == INVALID_HANDLE_VALUE ) {
+            while ( ( q = strchr (p, '\n')) != NULL ) {
+                WRITE ( STDERR, p, q-p );
+                WRITE ( STDERR, "\r\n", 2 );
+                p = q+1;
+            }
+            WRITE ( STDERR, p, strlen (p) );
+        }
+        else {
+            for ( ; *p; p++ ) {
+                switch ( *p ) {
+                case '\n':
+                    SetConsoleTextAttribute ( hSTDERR, attr_initial );
+                    fprintf ( stderr, "\r\n" );
+                    SetConsoleTextAttribute ( hSTDERR, attr );
+                    break;
+
+                case '\x1B':
+                    if ( p[1] == '[' ) {
+                        unsigned int  tmp;
+
+                        p++;
+                cont:   p++;
+                        for ( tmp = 0; (unsigned int)( *p - '0' ) < 10u; p++ )
+                            tmp = 10 * tmp + ( *p - '0' );
+
+                        switch ( *p ) {
+                        case ';':
+                        case 'm':
+                            switch ( tmp ) {
+                            case  0: attr  =  FOREGROUND_ALL;                                                   break; // reset defaults
+                            case  1: attr |=  FOREGROUND_INTENSITY;                                             break; // high intensity on
+                            case  2: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_INTENSITY;                     break; // (very) low intensity
+                            case  3:                                                                            break; // italic on
+                            case  4:                                                                            break; // underline on
+                            case  5:                                                                            break; // blinking on
+                            case  7:                                                                            break; // reverse
+                            case  8: attr  =  0;                                                                break; // invisible
+                            case 30: attr &= ~FOREGROUND_ALL;                                                   break;
+                            case 31: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED;                           break;
+                            case 32: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_GREEN;                         break;
+                            case 33: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED | FOREGROUND_GREEN;        break;
+                            case 34: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_BLUE;                          break;
+                            case 35: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED | FOREGROUND_BLUE;         break;
+                            case 36: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_GREEN | FOREGROUND_BLUE;       break;
+                            case 37: case 39:                 attr |= FOREGROUND_ALL;                           break;
+                            case 40: case 49:
+                                     attr &= ~BACKGROUND_ALL;                                                   break;
+                            case 41: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED;                           break;
+                            case 42: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_GREEN;                         break;
+                            case 43: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED | BACKGROUND_GREEN;        break;
+                            case 44: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_BLUE;                          break;
+                            case 45: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED | BACKGROUND_BLUE;         break;
+                            case 46: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_GREEN | BACKGROUND_BLUE;       break;
+                            case 47:                          attr |= BACKGROUND_ALL;                           break;
+                            }
+                            SetConsoleTextAttribute ( hSTDERR, attr );
+                            if ( *p == ';' )
+                                goto cont;
+                            break;
+
+                        default:
+                            WriteFile ( hSTDERR, buff, sprintf ( buff, "Unknown escape sequence ending with '%c'\n", *p ), &written, NULL );
+                            break;
+                        }
+                        break;
+                    }
+                default:
+                    fputc ( *p, stderr );
+                    break;
+                }
+            } /* end for */
+        }
+
+#else
+
+        // for non-Unix systems we must merge carriage returns into the stream to avoid staircases
+        while ( ( q = strchr (p, '\n')) != NULL ) {
+            WRITE ( STDERR, p, q-p );
+            WRITE ( STDERR, "\r\n", 2 );
+            p = q+1;
+        }
+        WRITE ( STDERR, p, strlen (p) );
+
+#endif
+
+    }
+
+    return ret;
+}
+
+/* end of stderr.c */
Index: /mppenc/trunk/src/tags.c
===================================================================
--- /mppenc/trunk/src/tags.c	(revision 97)
+++ /mppenc/trunk/src/tags.c	(revision 97)
@@ -0,0 +1,1332 @@
+/*
+ *  Encoder tag handling
+ *
+ *  (C) Frank Klemm 2002. Janne Hyvärinen 2002. All rights reserved.
+ *
+ *  Principles:
+ *
+ *
+ *  History:
+ *    2002-06     created
+ *    2002-08-12  added translation method 5 to addtag()
+ *                Tags taken from source file can't overwrite already existing items
+ *                added Init_Tags()
+ *    2002-08-13  Added all windows code pages
+ *    2002-10-09  Added code to parse tags from filename
+ *
+ *  Global functions:
+ *    - addtag()
+ *
+ *  TODO:
+ *    - '/' and '\' should be possible as PATH_SEP
+ */
+
+#include "mppenc.h"
+
+#ifdef USE_WIDECHAR
+# include <wchar.h>
+#endif
+
+
+static const char*  GenreList [] = {
+    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
+    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
+    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
+    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
+    "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
+    "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
+    "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
+    "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
+    "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
+    "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
+    "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
+    "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
+    "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
+    "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion",
+    "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
+    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
+    "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
+    "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
+    "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
+    "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
+    "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
+    "Dance Hall", "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
+    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", "Christian Gangsta",
+    "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
+    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
+    "SynthPop"
+};
+
+
+struct APETagFooterStruct {
+    Uint8_t   ID       [8];    // should equal 'APETAGEX'
+    Uint8_t   Version  [4];    // currently 1000 (version 1.000)
+    Uint8_t   Length   [4];    // the complete size of the tag, including this footer
+    Uint8_t   TagCount [4];    // the number of fields in the tag
+    Uint8_t   Flags    [4];    // the tag flags (none currently defined)
+    Uint8_t   Reserved [8];    // reserved for later use
+};
+
+
+typedef struct {
+    char*           key;
+    size_t          keylen;
+    unsigned char*  value;
+    size_t          valuelen;
+    unsigned int    flags;
+} TagItem_t;
+
+
+static TagItem_t       T [256];                        // up to 256 items, otherwise program crashs
+static unsigned int    TagCount = 0;
+
+#if defined __TURBOC__
+
+static unsigned short  CP_850 [256] = {
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
+    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
+    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
+    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
+    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
+};
+
+#elif defined _WIN32
+
+static unsigned short  CP_37 [256] = {  // ???
+    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
+    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
+    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
+    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC,
+    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
+    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
+    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
+    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
+    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
+    0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
+    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
+    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
+    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
+};
+
+static unsigned short  CP_42 [256] = { // CP_SYMBOLS
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0xF020, 0xF021, 0xF022, 0xF023, 0xF024, 0xF025, 0xF026, 0xF027, 0xF028, 0xF029, 0xF02A, 0xF02B, 0xF02C, 0xF02D, 0xF02E, 0xF02F,
+    0xF030, 0xF031, 0xF032, 0xF033, 0xF034, 0xF035, 0xF036, 0xF037, 0xF038, 0xF039, 0xF03A, 0xF03B, 0xF03C, 0xF03D, 0xF03E, 0xF03F,
+    0xF040, 0xF041, 0xF042, 0xF043, 0xF044, 0xF045, 0xF046, 0xF047, 0xF048, 0xF049, 0xF04A, 0xF04B, 0xF04C, 0xF04D, 0xF04E, 0xF04F,
+    0xF050, 0xF051, 0xF052, 0xF053, 0xF054, 0xF055, 0xF056, 0xF057, 0xF058, 0xF059, 0xF05A, 0xF05B, 0xF05C, 0xF05D, 0xF05E, 0xF05F,
+    0xF060, 0xF061, 0xF062, 0xF063, 0xF064, 0xF065, 0xF066, 0xF067, 0xF068, 0xF069, 0xF06A, 0xF06B, 0xF06C, 0xF06D, 0xF06E, 0xF06F,
+    0xF070, 0xF071, 0xF072, 0xF073, 0xF074, 0xF075, 0xF076, 0xF077, 0xF078, 0xF079, 0xF07A, 0xF07B, 0xF07C, 0xF07D, 0xF07E, 0xF07F,
+    0xF080, 0xF081, 0xF082, 0xF083, 0xF084, 0xF085, 0xF086, 0xF087, 0xF088, 0xF089, 0xF08A, 0xF08B, 0xF08C, 0xF08D, 0xF08E, 0xF08F,
+    0xF090, 0xF091, 0xF092, 0xF093, 0xF094, 0xF095, 0xF096, 0xF097, 0xF098, 0xF099, 0xF09A, 0xF09B, 0xF09C, 0xF09D, 0xF09E, 0xF09F,
+    0xF0A0, 0xF0A1, 0xF0A2, 0xF0A3, 0xF0A4, 0xF0A5, 0xF0A6, 0xF0A7, 0xF0A8, 0xF0A9, 0xF0AA, 0xF0AB, 0xF0AC, 0xF0AD, 0xF0AE, 0xF0AF,
+    0xF0B0, 0xF0B1, 0xF0B2, 0xF0B3, 0xF0B4, 0xF0B5, 0xF0B6, 0xF0B7, 0xF0B8, 0xF0B9, 0xF0BA, 0xF0BB, 0xF0BC, 0xF0BD, 0xF0BE, 0xF0BF,
+    0xF0C0, 0xF0C1, 0xF0C2, 0xF0C3, 0xF0C4, 0xF0C5, 0xF0C6, 0xF0C7, 0xF0C8, 0xF0C9, 0xF0CA, 0xF0CB, 0xF0CC, 0xF0CD, 0xF0CE, 0xF0CF,
+    0xF0D0, 0xF0D1, 0xF0D2, 0xF0D3, 0xF0D4, 0xF0D5, 0xF0D6, 0xF0D7, 0xF0D8, 0xF0D9, 0xF0DA, 0xF0DB, 0xF0DC, 0xF0DD, 0xF0DE, 0xF0DF,
+    0xF0E0, 0xF0E1, 0xF0E2, 0xF0E3, 0xF0E4, 0xF0E5, 0xF0E6, 0xF0E7, 0xF0E8, 0xF0E9, 0xF0EA, 0xF0EB, 0xF0EC, 0xF0ED, 0xF0EE, 0xF0EF,
+    0xF0F0, 0xF0F1, 0xF0F2, 0xF0F3, 0xF0F4, 0xF0F5, 0xF0F6, 0xF0F7, 0xF0F8, 0xF0F9, 0xF0FA, 0xF0FB, 0xF0FC, 0xF0FD, 0xF0FE, 0xF0FF,
+};
+
+static unsigned short  CP_437 [256] = { // MS-DOS: US
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
+    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_500 [256] = { // ???
+    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
+    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
+    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x005B, 0x002E, 0x003C, 0x0028, 0x002B, 0x0021,
+    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x005D, 0x0024, 0x002A, 0x0029, 0x003B, 0x005E,
+    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
+    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
+    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
+    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
+    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
+    0x00A2, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x00AC, 0x007C, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
+    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
+    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
+    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
+};
+
+static unsigned short  CP_850 [256] = { // MS-DOS Latin 1
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
+    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
+    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
+    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
+    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_860 [256] = { // MS-DOS: Portuguese
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
+    0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_861 [256] = { // MS-DOS: Iceland
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
+    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_863 [256] = { // MS-DOS: Canadian French
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7,
+    0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
+    0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_865 [256] = { // MS-DOS: Nordic
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
+    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
+    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
+    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
+    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
+    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
+    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
+    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
+};
+
+static unsigned short  CP_874 [256] = { // MS-DOS: Thai
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x0082, 0x0083, 0x0084, 0x2026, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
+    0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
+    0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
+    0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
+    0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0xF8C1, 0xF8C2, 0xF8C3, 0xF8C4, 0x0E3F,
+    0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
+    0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xF8C5, 0xF8C6, 0xF8C7, 0xF8C8,
+};
+
+static unsigned short  CP_1250 [256] = { // Windows: Latin 2
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
+    0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
+    0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
+    0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
+    0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
+    0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
+    0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9,
+};
+
+static unsigned short  CP_1251 [256] = { // Windows: Cyrillic
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
+    0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
+    0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
+    0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
+    0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
+    0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
+    0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
+    0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
+};
+
+static unsigned short  CP_1252 [256] = { // Windows: Latin 1
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
+    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
+    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
+    0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
+    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
+    0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF,
+};
+
+static unsigned short  CP_1253 [256] = { // Windows: Greek
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
+    0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0xF8F9, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
+    0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
+    0x03A0, 0x03A1, 0xF8FA, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
+    0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
+    0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xF8FB,
+};
+
+static unsigned short  CP_1254 [256] = { // Windows: Latin 5
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
+    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
+    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
+    0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
+    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
+    0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF,
+};
+
+static unsigned short  CP_1255 [256] = { // Windows: Hebrew
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
+    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
+    0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BA, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
+    0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0xF88D, 0xF88E, 0xF88F, 0xF890, 0xF891, 0xF892, 0xF893,
+    0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
+    0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xF894, 0xF895, 0x200E, 0x200F, 0xF896,
+};
+
+static unsigned short  CP_1256 [256] = { // Windows: Arabic
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
+    0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
+    0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
+    0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
+    0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
+    0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
+    0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2,
+};
+
+static unsigned short  CP_1257 [256] = { // Windows: Baltic
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x00A8, 0x02C7, 0x00B8,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x00AF, 0x02DB, 0x009F,
+    0x00A0, 0xF8FC, 0x00A2, 0x00A3, 0x00A4, 0xF8FD, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
+    0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
+    0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
+    0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
+    0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9,
+};
+
+static unsigned short  CP_1258 [256] = { // Windows: Vietnam
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
+    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
+    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
+    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
+    0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
+    0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
+    0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
+    0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF,
+};
+
+static unsigned short  CP_10000 [256] = { // Apple Macintosh
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
+    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
+    0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
+    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
+    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
+    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
+    0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
+    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
+};
+
+static unsigned short  CP_10079 [256] = { // ???
+    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
+    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
+    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
+    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
+    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
+    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
+    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
+    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
+    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
+    0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
+    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
+    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
+    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x00A4, 0x00D0, 0x00F0, 0x00DE, 0x00FE,
+    0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
+    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
+};
+
+#endif
+
+
+/*
+ *  Resets Item Counter
+ *  Do frees any memory.
+ */
+
+void
+Init_Tags ( void )
+{
+    int  i;
+
+    for ( i = 0; i < (int)TagCount; i++ ) {
+        if ( T[i].key != NULL )
+            free ( T[i].key   );
+        T[i].key = NULL;
+        if ( T[i].value != NULL )
+            free ( T[i].value );
+        T[i].value = NULL;
+    }
+    TagCount = 0;
+}
+
+
+int
+gettag ( const char* key, char* dst, size_t len )
+{
+    size_t  valuelen;
+    size_t  keylen = strlen (key);
+    int     i;
+
+    for ( i = 0; i < (int)TagCount; i++ )
+        if ( keylen == T[i].keylen &&  0 == memcmp (T[i].key, key, keylen) ) {
+            valuelen = len-1 > T[i].valuelen  ?  T[i].valuelen  :  len-1 ;
+            memcpy ( dst, T[i].value, valuelen );
+            dst [valuelen] = '\0';
+            return 0;
+        }
+
+    memset ( dst, 0, len );
+    return -1;
+}
+
+
+static unsigned char*
+utf8char ( unsigned char* dst, unsigned long value )
+{
+    if      ( value == '\r'  ||  value == 0xFFFE  ||  value == 0xFFFF ) {
+        ;
+    }
+    else if ( value < 0x80 ) {
+        *dst++ = value;
+    }
+    else if ( value < 0x800 ) {
+        *dst++ = 0xC0 + ((value >>  6) & 0x1F);
+        *dst++ = 0x80 + ((value >>  0) & 0x3F);
+    }
+    else if ( value < 0x10000 ) {
+        *dst++ = 0xE0 + ((value >> 12) & 0x0F);
+        *dst++ = 0x80 + ((value >>  6) & 0x3F);
+        *dst++ = 0x80 + ((value >>  0) & 0x3F);
+    }
+    else if ( value < 0x200000 ) {
+        *dst++ = 0xF0 + ((value >> 18) & 0x07);
+        *dst++ = 0x80 + ((value >> 12) & 0x3F);
+        *dst++ = 0x80 + ((value >>  6) & 0x3F);
+        *dst++ = 0x80 + ((value >>  0) & 0x3F);
+    }
+    else if ( value < 0x4000000 ) {
+        *dst++ = 0xF8 + ((value >> 24) & 0x03);
+        *dst++ = 0x80 + ((value >> 18) & 0x3F);
+        *dst++ = 0x80 + ((value >> 12) & 0x3F);
+        *dst++ = 0x80 + ((value >>  6) & 0x3F);
+        *dst++ = 0x80 + ((value >>  0) & 0x3F);
+    }
+    else if ( value < 0x80000000 ) {
+        *dst++ = 0xFC + ((value >> 30) & 0x01);
+        *dst++ = 0x80 + ((value >> 24) & 0x3F);
+        *dst++ = 0x80 + ((value >> 18) & 0x3F);
+        *dst++ = 0x80 + ((value >> 12) & 0x3F);
+        *dst++ = 0x80 + ((value >>  6) & 0x3F);
+        *dst++ = 0x80 + ((value >>  0) & 0x3F);
+    }
+
+    return dst;
+}
+
+
+/*
+ *  IsUnicode()
+ *
+ *  Gets a memory block and tries to find out whether this is binary data or a valid Windows Unicode file.
+ *  When return 1, it is very likely (but not 100% secure) that the content is Unicode encoded.
+ */
+
+static int
+IsUnicode ( const unsigned char* src, size_t len )
+{
+    if ( len <= 2 )
+        return 0;
+
+    if ( len & 1 )                                              // odd number of bytes?
+        return 0;
+
+    if ( src [0] != 0xFF  ||  src [1] != 0xFE )                 // Microsoft Unicode preample (also useful to detect endianess, but currently only little endian is supported)
+        return 0;
+
+    for ( len >>= 1; len > 0; len--, src += 2 ) {               // Check for invalid codes (FFFE, FFFF, DC00...DFFF without a prepend D800...DBFF, D800...DBFF without a n appended DC00...DFFF)
+        if ( ( src [1] & 0xFC ) == 0xDC )
+            return 0;
+        if ( src [1] == 0xFF  &&  ( src [0] & 0xFE ) == 0xFE )
+            return 0;
+        if ( ( src [1] & 0xFC ) == 0xD8 ) {
+            if ( len < 2  ||  ( src [3] & 0xFC ) != 0xDC )
+                return 0;
+        }
+        else {
+            len--;
+            src += 2;
+        }
+    }
+
+    return 1;                                                   // good chance to be a UTF-8
+}
+
+/*
+ *  addtag()
+ *
+ *  Add a item to the item list of a tag. Item key is given by (key,keylen), item value by (value,valuelen).
+ *
+ *  The following value translation modes are possible:
+ *    0: no translation at all
+ *    1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
+ *    2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
+ *    3: like 1), but convert ';' to null character
+ *    4: UTF-16 LE => translate to UTF-8
+ *    5: translate from ISO-8859-1 to UTF-8
+ *    6: like 1), but convert from OEM codepage (Win32)
+ *  (should become an enum)
+ *
+ *  Note:
+ *    Windows 95/98/ME has no usable NLS support
+ *
+ */
+
+int
+addtag ( const char*           key,             // the item key
+         size_t                keylen,          // length of item key, or 0 for auto-determine
+         const unsigned char*  value,           // the item value
+         size_t                valuelen,        // the length of the item value (before any possible translation)
+         int                   converttoutf8,   // convert flags of item value
+         int                   flags )          // item flags proposal
+{
+    unsigned char*  p;
+    unsigned char*  q;
+    unsigned char   ch;
+    size_t          i;
+#ifdef _WIN32
+    const unsigned short*  CP_ptr;
+    unsigned int           Codepage;
+
+    if ( converttoutf8 == 6 ) {
+        Codepage      = GetOEMCP ();
+        converttoutf8 = 1;
+    }
+    else {
+        Codepage      = GetACP ();
+    }
+
+    switch ( Codepage ) {
+    case CP_ACP:        CP_ptr =  CP_1252; break;
+    case CP_OEMCP:      CP_ptr =   CP_850; break;
+    case CP_MACCP:      CP_ptr = CP_10000; break;
+    case CP_THREAD_ACP: CP_ptr =  CP_1252; break;
+    default:    CP_ptr =   CP_850; break;
+    case    37: CP_ptr =    CP_37; break;
+    case    42: CP_ptr =    CP_42; break;
+    case   437: CP_ptr =   CP_437; break;
+    case   500: CP_ptr =   CP_500; break;
+    case   850: CP_ptr =   CP_850; break;
+    case   860: CP_ptr =   CP_860; break;
+    case   861: CP_ptr =   CP_861; break;
+    case   863: CP_ptr =   CP_863; break;
+    case   865: CP_ptr =   CP_865; break;
+    case   874: CP_ptr =   CP_874; break;
+    case  1250: CP_ptr =  CP_1250; break;
+    case  1251: CP_ptr =  CP_1251; break;
+    case  1252: CP_ptr =  CP_1252; break;
+    case  1253: CP_ptr =  CP_1253; break;
+    case  1254: CP_ptr =  CP_1254; break;
+    case  1255: CP_ptr =  CP_1255; break;
+    case  1256: CP_ptr =  CP_1256; break;
+    case  1257: CP_ptr =  CP_1257; break;
+    case  1258: CP_ptr =  CP_1258; break;
+    case 10000: CP_ptr = CP_10000; break;
+    case 10079: CP_ptr = CP_10079; break;
+    }
+#endif
+
+
+    if ( converttoutf8 == 2  &&  IsUnicode ( value, valuelen ) ) {
+        converttoutf8 = 4;
+        value        += 2;                      // remove first two bytes (zero width space 0xFEFF)
+        valuelen      = ( valuelen - 2) >> 1;
+        flags        &= ~2;                     // reset binary flag (it's now text)
+    }
+
+    if ( keylen == 0 )
+        keylen = strlen ( key );
+
+    p = malloc ( keylen );
+    memcpy ( p, key, keylen );
+    T [TagCount] . key    = p;
+    T [TagCount] . keylen = keylen;
+
+    switch ( converttoutf8 ) {
+    default:
+        p = malloc ( 1 * valuelen );    // copy
+        break;
+    case 1:                             // at most 1 native character => 3 UTF bytes
+    case 4:                             // at 1 wide => 3, 2 wide => 4
+        p = malloc ( 3 * valuelen );
+        break;
+    }
+
+    q = p;
+
+    for ( i = 0; i < valuelen; i++ ) {
+        ch = value [i];
+        switch ( converttoutf8 ) {
+        default:                        // 0: no translation at all --or-- 2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
+            *q++ = ch;
+            break;
+
+        case 5:                         // 5: translate from ISO-8859-1 to UTF-8
+            q = utf8char ( q, ch );
+            break;
+
+        case 3:                         // 3: like 1), but convert ';' to null character
+            if ( ch == ';' )
+                ch = '\0';
+            /* fall through */
+
+        case 1:                         // 1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
+#if defined __TURBOC__
+            q = utf8char ( q, CP_850 [ch] );
+#elif defined _WIN32
+            // fprintf ( stderr, "%c  %02X  U+%04X\n", ch, ch, CP_ptr [ch] );
+            q = utf8char ( q, CP_ptr [ch] );
+#elif defined USE_WIDECHAR
+            {
+            int      ret;
+            wchar_t  wch = 0;
+            ret = mbtowc ( &wch, value + i, valuelen - i );
+            if ( ret > 0 )
+                q = utf8char ( q, wch ), i += ret - 1;
+            }
+#else
+            q = utf8char ( q, ch );
+#endif
+            break;
+
+        case 4:                         // 4: UTF-16 LE => translate to UTF-8
+            if ( (value [i+i+1] & 0xFC ) == 0xD8  &&  (value [i+i+3] & 0xFC ) == 0xDC ) {   // UTF-16 code (2x16 bit for Unicodes 0x010000...0x10FFFF)
+                q = utf8char ( q, ((value [i+i] + (value [i+i+1] << 8) - 0xD800) << 10) + (value [i+i+2] + (value [i+i+3] << 8) - 0xDC00) + 0x10000 );
+                i++;
+            }
+            else {
+                q = utf8char ( q, value [i+i] + (value [i+i+1] << 8) );
+            }
+            break;
+        }
+    }
+
+    p = realloc ( p, valuelen = q-p );
+
+    for ( i = 0; i < TagCount; i++ )
+        if ( T [i].keylen == T [TagCount].keylen  &&  0 == strncasecmp (T [i].key, T [TagCount].key, T [i].keylen ) ) {    // found old tag with the same name => replace
+            free ( T [TagCount].key   );
+            free ( T [i].value );
+            goto set;
+        }
+
+    i = TagCount++;
+set:
+    T [i] . value    = p;
+    T [i] . valuelen = valuelen;
+    T [i] . flags    = flags;
+    return 0;
+}
+
+
+static int Cdecl
+cmpfn2 ( const void* p1, const void* p2 )
+{
+    const TagItem_t*  q1 = (TagItem_t*) p1;
+    const TagItem_t*  q2 = (TagItem_t*) p2;
+
+    return q1 -> valuelen - q2 -> valuelen;
+}
+
+/*
+ *  Writes collect tag items and write it to a file.
+ *  Items are destroyed, so tags can only be written once.
+ */
+
+int
+FinalizeTags ( FILE* fp, unsigned int Version )
+{
+    static unsigned char  H [32] = "APETAGEX";
+    unsigned char         dw [8];
+    unsigned long         estimatedbytes =  32; // 32 byte footer + all items, these are the 32 bytes footer, the items are added later
+    unsigned long         writtenbytes   = -32; // actually writtenbytes-32, which should be equal to estimatedbytes (= footer + all items)
+    unsigned int          i;
+
+    if ( TagCount == 0 )
+        return 0;
+
+    qsort ( T, TagCount, sizeof (*T), cmpfn2 );
+
+    for ( i = 0; i < TagCount; i++ )
+        estimatedbytes += 9 + T[i] . keylen + T[i] . valuelen;
+
+    if ( estimatedbytes >= 8192 + 103 )
+        stderr_printf ( "\nTag is %.1f Kbyte long. This is longer than the maximum recommended 8 KByte.\n\a", estimatedbytes/1024. );
+
+    H [ 8] = Version >>  0;
+    H [ 9] = Version >>  8;
+    H [10] = Version >> 16;
+    H [11] = Version >> 24;
+    H [12] = estimatedbytes >>  0;
+    H [13] = estimatedbytes >>  8;
+    H [14] = estimatedbytes >> 16;
+    H [15] = estimatedbytes >> 24;
+    H [16] = TagCount >>  0;
+    H [17] = TagCount >>  8;
+    H [18] = TagCount >> 16;
+    H [19] = TagCount >> 24;
+
+    H [23] = 0x80 | 0x20;
+    writtenbytes += fwrite ( H, 1, 32, fp );
+
+    for ( i = 0; i < TagCount; i++ ) {
+        dw [0] = T [i] . valuelen >>  0;
+        dw [1] = T [i] . valuelen >>  8;
+        dw [2] = T [i] . valuelen >> 16;
+        dw [3] = T [i] . valuelen >> 24;
+        dw [4] = T [i] . flags >>  0;
+        dw [5] = T [i] . flags >>  8;
+        dw [6] = T [i] . flags >> 16;
+        dw [7] = T [i] . flags >> 24;
+        writtenbytes += fwrite ( dw        , 1, 8            , fp );
+        writtenbytes += fwrite ( T[i].key  , 1, T[i].keylen  , fp );
+        writtenbytes += fwrite ( ""        , 1, 1            , fp );
+        if ( T[i].valuelen > 0 )
+            writtenbytes += fwrite ( T[i].value, 1, T[i].valuelen, fp );
+    }
+
+    H [23] = 0x80;
+    writtenbytes += fwrite ( H, 1, 32, fp );
+
+    if ( estimatedbytes != writtenbytes )
+        stderr_printf ( "\nError writing APE tag.\n" );
+
+    TagCount = 0;
+    return 0;
+}
+
+
+static int
+TagKeyExists ( const char* key, size_t keylen )
+{
+    unsigned int  i;
+
+    if ( keylen == 0 )
+        keylen = strlen ( key );
+
+    for ( i = 0; i < TagCount; i++ )
+        if ( T [i].keylen == keylen  &&  0 == strncasecmp (T [i].key, key, keylen ) )
+            return 1;
+
+    return 0;
+}
+
+
+/*
+ *  Copies src to dst. Copying is stopped at `\0' char is detected or if
+ *  len chars are copied.
+ *  Trailing blanks are removed and the string is `\0` terminated.
+ */
+
+static void
+memcpy_crop ( const char* key, char* src, size_t len, int flags )
+{
+    while ( len > 0  &&  ( src [len-1] == ' '  ||  src [len-1] == '\0' ) )
+        len--;
+
+    if ( len > 0 )
+        if ( ! TagKeyExists ( key, 0 ) )
+            addtag ( key, 0, src, len, 1, flags );
+}
+
+
+static int
+CopyTags_ID3 ( FILE* fp )
+{
+    Uint8_t  tmp [128];
+
+    if ( -1 == SEEK ( fp, -128L, SEEK_END ) )
+        return -1;
+
+    if ( 128 != READ ( fp, tmp, 128 ) )
+        return -1;
+
+    if ( 0 != memcmp ( tmp, "TAG", 3 ) ) {
+        return -1;
+    }
+
+    if ( !tmp[3]  &&  !tmp[33]  &&  !tmp[63]  &&  !tmp[93]  &&  !tmp[97] )
+        return -1;
+
+    memcpy_crop  ( "Title"  , tmp +  3, 30, 0 );
+    memcpy_crop  ( "Artist" , tmp + 33, 30, 0 );
+    memcpy_crop  ( "Album"  , tmp + 63, 30, 0 );
+    memcpy_crop  ( "Year"   , tmp + 93,  4, 0 );
+    memcpy_crop  ( "Comment", tmp + 97, 30, 0 );
+
+    if ( tmp[127] < sizeof(GenreList)/sizeof(*GenreList) )
+        if ( ! TagKeyExists ( "Genre", 0 ) )
+            addtag ("Genre", 0, GenreList [tmp[127]], strlen (GenreList [tmp[127]]), 0, 0 );
+
+    if ( tmp[125] == 0  &&  tmp[126] != 0 )
+        if ( ! TagKeyExists ( "Track", 0 ) ) {
+            sprintf ( tmp, "%u",  tmp[126] );
+            addtag ("Track", 0, tmp, strlen (tmp), 0, 0 );
+        }
+
+    return 0;
+}
+
+
+static unsigned int
+Read_LE_Uint32 ( const unsigned char* p )
+{
+    return ((Uint32_t)p[0] <<  0) |
+           ((Uint32_t)p[1] <<  8) |
+           ((Uint32_t)p[2] << 16) |
+           ((Uint32_t)p[3] << 24);
+}
+
+
+static int
+CopyTags_APE ( FILE* fp )
+{
+    Uint32_t                   len;
+    Uint32_t                   flags;
+    Uint32_t                   version;
+    unsigned char              buff [32768];
+    unsigned char              key [257];
+    unsigned char*             p;
+    struct APETagFooterStruct  T;
+    Uint32_t                   TagLen;
+    Uint32_t                   TagCount;
+    // Uint32_t                   tmp;
+
+    if ( -1 == SEEK ( fp, -(long)sizeof T, SEEK_END ) )
+        return -1;
+    if ( sizeof(T) != READ ( fp, &T, sizeof T ) )
+        return -1;
+    if ( memcmp ( T.ID, "APETAGEX", sizeof(T.ID) ) != 0 )
+        return -1;
+    version = Read_LE_Uint32 (T.Version);
+    if ( version != 1000  &&  version != 2000 )
+        return -1;
+    TagLen = Read_LE_Uint32 (T.Length);
+    if ( TagLen <= sizeof T )
+        return -1;
+    if ( -1 == SEEK ( fp, -(long)TagLen, SEEK_END ) )
+        return -1;
+    memset ( buff, 0, sizeof(buff) );
+    if ( TagLen - sizeof T != READ ( fp, buff, TagLen - sizeof T ) )
+        return -1;
+
+    TagCount = Read_LE_Uint32 (T.TagCount);
+    for ( p = buff; TagCount--; ) {
+        len   = Read_LE_Uint32 ( p );        p += 4;
+        flags = Read_LE_Uint32 ( p );        p += 4;
+        strcpy ( key, p );                   p += strlen (key) + 1;
+        if ( ! TagKeyExists ( key, 0 ) )
+            addtag ( key, 0, p, len > 0  &&  p [len-1] == '\0'  ?  len-1  :  len, version >= 2000  ?  0  :  5, flags );
+                                             p += len;
+    }
+
+    return 0;
+}
+
+static void
+FullPathName ( char* dst, size_t dstlen, const char* filename )         // Can contain stuff like ".." and "."
+{
+    // const char*  p;
+    char*        q     = dst;
+
+#if DRIVE_SEP != '\0'
+    int          drive = 0;
+
+    if ( isalpha (filename[0])  &&  filename[1] == DRIVE_SEP  &&  filename[2] != PATH_SEP ) {
+        drive     = filename[0] & 0x1F;
+        filename += 2;
+    }
+#endif
+
+    if ( filename[0] != PATH_SEP ) {
+#ifdef _WIN32
+        _getdcwd( drive, dst, dstlen );
+#else
+        getcwd ( dst, dstlen );
+#endif
+        q += strlen (q);
+#ifdef _WIN32
+        if ( dst[0] != PATH_SEP  ||  dst[1] != '\0' )
+#else
+        if ( dst[2] != PATH_SEP  ||  dst[3] != '\0' )
+#endif
+            *q++ = PATH_SEP;
+    }
+
+    strcpy ( q, filename );
+    return;
+}
+
+/********************************************************************************************/
+
+/*
+
+" "                             ' '
+" - "                           '-'
+"."                             '.'
+"/"                             '/'
+" -- "                          '_'
+"[#0]"                          '0'
+"[#n]"  [number]                'n'
+"#n"    number                  'M'
+"(#N)"  (CD x)                  'N'             it should also be possible: (CD x/x), (DVD x), (DVD x/x)
+"#A"    Artist                  'A'
+"#C"    CD/Album                'C'
+"#T"    Title                   'T'
+"#x"    extention               'x'
+
+
+/#C -- [#n] #A -- #T#x      | Acid Jazz/100% Acid Jazz -- [04] Leena Conquest (and Hip Hop Fingers) -- Boundaries (Radio Edit).pac
+/#C -- [#n] #A -- #C -- #T#x| Meditation/Jade Collection (1998) -- [10] Rhian -- Red Sun, Blue River -- The Miracle Song.mpc
+/#A/#C -- [#n] #T#x         | Andreas Vollenweider/Eolian Minstrel -- [02] Across the Iron River.pac
+/#A/#C#N -- [#n] #T#x       | Barbra Streisand/The Concert (CD 1) -- [01] Overture
+/#A -- #C -- [#n] #T#x      | Friedemann/Friedemann -- Aquamarin -- [09] In the Court of the Mermaid.pac
+/#C/[#n] #A -- #T#x         | Jazz Lyrik Prosa/[11] Eberhard Esche -- Anektode.pac
+/#A -- #T#x                 | Lais/Lais -- 06.pac
+/#C/(#N) -- [#n] #A -- #T#x | Tanz- und Folkfest 2001 -- Klingende Post/(CD 2) -- [09] Andy Irvine -- Gladiators.pac
+/#A -- #C -- [#0]#x         | Friedemann/Friedemann -- Aquamarin -- [00].pac
+/#A/#C (#N) -- [#0]#x       | Tangerine Dream/The Warsaw Concert (CD 2) -- [00].pac
+/#A/#T#x                    | Heinz-Rudolf Kunze/Dein ist mein ganzes Herz.pac
+/#A/#C -- [#0]#x            | Sting/Nada como el Sol -- [00].mpc
+
+*/
+
+static const char* const  parser_strings [] = {
+    "/A_Tx",
+    "/A/Tx",
+    "/A_C_0x",
+    "/C_n A_Tx",
+    "/C_n A_C_Tx",              // new
+    "/A/C_n Tx",
+    "/A/C N_n Tx",
+    "/A_C_n Tx",
+    "/C/n A_Tx",
+    "/C/N_n A_Tx",
+    "/A/C N_0x",
+    "/A/C_0x",
+};
+
+
+static void
+copy ( char* dst, const char* src, size_t len )
+{
+    memcpy ( dst, src, len );
+    dst [len] = '\0';
+}
+
+/*
+ *    dst[0] = Artist
+ *    dst[1] = CD
+ *    dst[2] = Title
+ *    dst[3] = +CD
+ *    dst[4] = number
+ *    dst[5] = ext
+ */
+
+#ifndef isdigit
+# define isdigit(x)         ((unsigned int)((x) - '0') < 10)
+#endif
+
+static int
+parse ( char** dst, const char* src, const char* format )
+{
+    int          i;
+    const char*  srcend = src + strlen(src);
+    const char*  p;
+    char*        q;
+
+    for ( i = 0; i < 6; i++)
+        dst[i][0] = '\0';
+
+    for ( i = strlen(format); i-- > 0; ) {
+        p = srcend;
+#ifndef STFU
+        stderr_printf ( "%c: ", format[i] );
+#endif
+        switch ( format[i] ) {
+        case '.':
+        case ' ':
+        case '/':                               // !!!!!!!
+            if (p[-1] != format[i])
+                return 1;
+            p--;
+            break;
+        case '_':
+            if (0 != memcmp (p-4, " -- ", 4))
+                return 1;
+            p -= 4;
+            break;
+        case '-':
+            if (0 != memcmp (p-3, " - ", 3))
+                return 1;
+            p -= 3;
+            break;
+        case '0':
+            if (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
+                return 1;
+            copy (dst[4], p-3, 2);
+            p -= 4;
+            break;
+        case 'n':
+            if (p[-1] != ']' || !isdigit(p[-2]) || !isdigit(p[-3]) || p[-4] != '[')
+                return 1;
+            copy (dst[4], p-3, 2);
+            p -= 4;
+            break;
+        case 'M':
+            if ( !isdigit(p[-1]) || !isdigit(p[-2]) )
+                return 1;
+            copy (dst[4], p-2, 2);
+            p -= 2;
+            break;
+        case 'N':
+            if (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')
+                return 1;
+            dst[3][0] = ' ';
+            copy (dst[3]+1, p-6, 6);
+            p -= 6;
+            break;
+        case 'A':
+            q = dst[0]; goto big;
+        case 'C':
+            q = dst[1]; goto big;
+        case 'T':
+            q = dst[2]; goto big;
+        big:
+            while ( 0 == memcmp (p-4, "/mpc", 4)  ||
+                    0 == memcmp (p-4, "/mp3", 4)  ||
+                    0 == memcmp (p-4, "/pac", 4)  ||
+                    0 == memcmp (p-4, "/ape", 4)  ||
+                    0 == memcmp (p-4, "/pac", 4)  ||
+                    0 == memcmp (p-3, "/.." , 3)  ||
+                    0 == memcmp (p-2, "/."  , 2)
+                  ) {
+                      do {
+                          p--;
+                          srcend--;
+                      } while ( *p != PATH_SEP );
+                }
+            while ( p[-1] != PATH_SEP  &&
+                    p[-1] != DRIVE_SEP &&
+                    0 != memcmp (p-4, " -- ", 4 )  &&
+                    (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')  &&
+                    (p[-1] != ' ' || p[-2] != ']' || !isdigit(p[-3]) || !isdigit(p[-4]) || p[-5] != '[') &&
+                    (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
+                  )
+                p--;
+            copy ( q, p, srcend - p );
+            break;
+        case 'x':
+            do {
+                p--;
+                if (p[0] == PATH_SEP || p[0] == DRIVE_SEP)
+                    return -1;
+            } while (*p != '.');
+            copy (dst[5], p, srcend-p );
+            break;
+        }
+#ifndef STFU
+        stderr_printf ( "%*.*s\033[7m%*.*s\033[0m\n", p-src, p-src, src, srcend-p, srcend-p, p );
+#endif
+        srcend = p;
+    }
+    return 0;
+}
+
+static int
+hexdigit ( const char s )
+{
+    if ( (unsigned char)(s-'0') < 10u )
+        return s-'0';
+    if ( (unsigned char)(s-'A') <  6u )
+        return s-'A'+10;
+    return -1;
+}
+
+static void
+spaceconverting ( char* dst, const char* src )          // can work inplace
+{
+    for ( ; src[0] != '\0' ; src++) {
+        if      ( src[0] == '_' )
+            *dst++ = ' ';
+        else if ( src[0] == '%'  &&  hexdigit(src[1]) >= 0  &&  hexdigit(src[2]) >= 0 )
+            *dst++ = hexdigit(src[1]) * 16 + hexdigit(src[2]), src += 2;
+        else
+            *dst++ = *src;
+    }
+    *dst = '\0';
+}
+
+
+static int
+Parser ( const char* src )
+{
+    size_t  i;
+    char    tmp  [6] [1024];
+    char*   buff [6] = { tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5] };
+    char    merge [1024];
+    char*   q;
+
+#ifndef STFU
+    stderr_printf ( "\n  »%s«\n", src );
+#endif
+
+    memset ( tmp  , 0, sizeof tmp   );
+    memset ( merge, 0, sizeof merge );
+
+    for ( i = 0; i < sizeof(parser_strings)/sizeof(*parser_strings); i++ ) {
+        if ( 0 == parse ( buff, src, parser_strings[i] ) ) {
+            sprintf ( merge, "%s%s", tmp[1], tmp[3] );
+            q = merge + strlen (merge);
+
+            if ( q-7 >= merge  &&  q[-7]==' '  &&  q[-6]=='('  && atoi(q-5) >= 1900  &&  atoi(q-5) < 2050  &&  q[-1] == ')' ) {
+                q[-1] = '\0';
+                q[-7] = '\0';
+                q -= 5;
+            }
+            else {
+                q = NULL;
+            }
+
+            spaceconverting ( tmp[0], tmp[0] );
+            spaceconverting ( merge , merge );
+            spaceconverting ( tmp[2], tmp[2] );
+            spaceconverting ( tmp[4], tmp[4] );
+            spaceconverting ( tmp[5], tmp[5] );
+
+            stderr_printf ("\n");
+            stderr_printf ("Artist = »%s«\n", tmp[0] );
+            stderr_printf ("CD     = »%s«\n", merge  );
+            stderr_printf ("Title  = »%s«\n", tmp[2] );
+            stderr_printf ("No#    = »%s«\n", tmp[4] );
+            stderr_printf ("Extent = »%s«\n", tmp[5] );
+            stderr_printf ("Year   = »%s«\n", q  ?  q  :  "????" );
+#if 1
+            if ( tmp[0][0]  &&  ! TagKeyExists ( "Artist", 0 ) ) addtag ( "Artist", 0, tmp[0], strlen (tmp[0]), 5, 0 );
+            if ( merge[0]   &&  ! TagKeyExists ( "Album" , 0 ) ) addtag ( "Album" , 0, merge , strlen (merge) , 5, 0 );
+            if ( tmp[2][0]  &&  ! TagKeyExists ( "Title" , 0 ) ) addtag ( "Title" , 0, tmp[2], strlen (tmp[2]), 5, 0 );
+            if ( tmp[4][0]  &&  ! TagKeyExists ( "Track" , 0 ) ) addtag ( "Track" , 0, tmp[4], strlen (tmp[4]), 5, 0 );
+            if ( q != NULL  &&  ! TagKeyExists ( "Year"  , 0 ) ) addtag ( "Year"  , 0, q     , 4              , 5, 0 );
+#endif
+            return 1;
+        }
+#ifndef STFU
+        stderr_printf ("???\n--\n");
+#endif
+    }
+
+    return 0;
+}
+
+
+/*******************************************************************************/
+
+
+static int
+CopyTags_Name ( const char* filename )
+{
+    char         buff [4096];
+
+    FullPathName  ( buff, sizeof buff, filename );
+    Parser        ( buff );
+    return 0;
+}
+
+
+int
+CopyTags ( const char* filename )
+{
+    FILE*  fp;
+
+    if ( 0 == strncmp (filename, "/dev/", 5 ) )
+        return 0;
+
+    fp = fopen ( filename, "rb" );
+    if ( fp == NULL )
+        return -1;
+
+    CopyTags_APE  (fp);                 // APE tags have higher priority than ID3V1 tags
+    CopyTags_ID3  (fp);
+    CopyTags_Name (filename);
+
+    fclose (fp);
+    return 0;
+}
+
+/* end of tags.c */
Index: /mppenc/trunk/src/tools.c
===================================================================
--- /mppenc/trunk/src/tools.c	(revision 97)
+++ /mppenc/trunk/src/tools.c	(revision 97)
@@ -0,0 +1,598 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ *  A list of different mixed tools
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *  Read_LittleEndians()
+ *      Portable file handling
+ *  Requantize_MidSideStereo(), Requantize_IntensityStereo()
+ *      Requantisation of quantized samples for synthesis filter
+ *  Resort_HuffTable(), Make_HuffTable(), Make_LookupTable()
+ *      Generating and sorting Huffman tables, making fast lookup tables
+ */
+
+#include <string.h>
+#include <errno.h>
+#include "mppdec.h"
+
+
+#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
+
+size_t
+complete_read ( int fd, void* dest, size_t bytes )
+{
+    size_t  bytesread = 0;
+    size_t  ret;
+
+    while ( bytes > 0 ) {
+#if defined _WIN32  &&  defined USE_HTTP  &&  !defined MPP_ENCODER
+        ret = fd & 0x4000  ?  recv ( fd & 0x3FFF, dest, bytes, 0)  :  read ( fd, dest, bytes );
+#else
+        ret = read ( fd, dest, bytes );
+#endif
+        if ( ret == 0  ||  ret == (size_t)-1 )
+            break;
+        dest       = (void*)(((char*)dest) + ret);
+        bytes     -= ret;
+        bytesread += ret;
+    }
+    return bytesread;
+}
+
+#endif
+
+
+int
+isdir ( const char* Name )
+{
+#if FILEIO == 1
+    return 1;
+#else
+    STRUCT_STAT  st;
+
+    if ( STAT_CMD ( Name, &st ) != 0 )
+        return 0;
+    return S_ISDIR ( st.st_mode );
+#endif
+}
+
+
+/*
+ *  Change_Endian32() changes the endianess of a 32-bit memory block in-place
+ *  by swapping the byte order. This is a little bit tricky, but a well
+ *  known method which is much much faster than byte picking, especially on modern CPUs,
+ *  because it avoids memory aliasing. Note that this method
+ *  is poison for old 16-bit compilers!
+ */
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+
+static void
+Change_Endian32 ( Uint32_t* dst, size_t words32bit )
+{
+    ENTER(160);
+
+    for ( ; words32bit--; dst++ ) {
+# if  INT_MAX >= 2147483647L
+        Uint32_t  tmp = *dst;
+        tmp  = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
+        tmp  = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
+        *dst = tmp;
+# else
+        Uint8_t  tmp;
+        tmp                = ((Uint8_t*)dst)[0];
+        ((Uint8_t*)dst)[0] = ((Uint8_t*)dst)[3];
+        ((Uint8_t*)dst)[3] = tmp;
+        tmp                = ((Uint8_t*)dst)[1];
+        ((Uint8_t*)dst)[1] = ((Uint8_t*)dst)[2];
+        ((Uint8_t*)dst)[2] = tmp;
+# endif
+    }
+    LEAVE(160);
+    return;
+}
+
+#endif /* ENDIAN == HAVE_BIG_ENDIAN */
+
+
+/*
+ *  Read_LittleEndians() reads little endian 32-bit ints from the stream
+ *  'fp'.  Quantities are selected in 32-bit items. On big endian machines
+ *  the byte order is changed in-place after reading the data, so all is
+ *  okay.
+ */
+
+size_t
+Read_LittleEndians ( FILE_T fp, Uint32_t* dst, size_t words32bit )
+{
+    size_t  wordsread;
+
+    ENTER(161);
+    wordsread = READ ( fp, dst, words32bit * sizeof(*dst) ) / sizeof(*dst);
+
+#if ENDIAN == HAVE_BIG_ENDIAN
+    Change_Endian32 ( dst, wordsread );
+#endif
+
+    LEAVE(161);
+    return wordsread;
+}
+
+#ifndef MPP_ENCODER
+
+/*
+ *  This is the main requantisation routine which does the following things:
+ *
+ *      - rescaling the quantized values (int) to their original value (float)
+ *      - recalculating both stereo channels for MS stereo
+ *
+ *  See also: Requantize_IntensityStereo()
+ *
+ *  For performance reasons all cases are programmed separately and the code
+ *  is unrolled.
+ *
+ *  Input is:
+ *      - Stop_Band:
+ *          the last band using MS or LR stereo
+ *      - used_MS[Band]:
+ *          MS or LR stereo flag for every band (0...Stop_Band), Value is 1
+ *          for MS and 0 for LR stereo.
+ *      - Res[Band].{L,R}:
+ *          Quantisation resolution for every band (0...Stop_Band) and
+ *          channels (L, R). Value is 0...17.
+ *      - SCF_Index[3][Band].{L,R}:
+ *          Scale factor for every band (0...Stop_Band), subframe (0...2)
+ *          and channel (L, R).
+ *      - Q[Band].{L,R}[36]
+ *          36 subband samples for every band (0...Stop_Band) and channel (L, R).
+ *      - SCF[64], Cc[18], Dc[18]:
+ *          Lookup tables for Scale factor and Quantisation resolution.
+ *
+ *   Output is:
+ *     - Y_L:  Left  channel subband signals
+ *     - Y_R:  Right channel subband signals
+ *
+ *   These signals are used for the synthesis filter in the synth*.[ch]
+ *   files to generate the PCM output signal.
+ */
+
+static const float ISMatrix [32] [2] = {
+    {  1.00000000f,  0.00000000f },
+    {  0.98078528f,  0.19509032f },
+    {  0.92387953f,  0.38268343f },
+    {  0.83146961f,  0.55557023f },
+    {  0.70710678f,  0.70710678f },
+    {  0.55557023f,  0.83146961f },
+    {  0.38268343f,  0.92387953f },
+    {  0.19509032f,  0.98078528f },
+    {  0.00000000f,  1.00000000f },
+    { -0.19509032f,  0.98078528f },
+    { -0.38268343f,  0.92387953f },
+    { -0.55557023f,  0.83146961f },
+    { -0.70710678f,  0.70710678f },
+    { -0.83146961f,  0.55557023f },
+    { -0.92387953f,  0.38268343f },
+    { -0.98078528f,  0.19509032f },
+    { -1.00000000f,  0.00000000f },
+    { -0.98078528f, -0.19509032f },
+    { -0.92387953f, -0.38268343f },
+    { -0.83146961f, -0.55557023f },
+    { -0.70710678f, -0.70710678f },
+    { -0.55557023f, -0.83146961f },
+    { -0.38268343f, -0.92387953f },
+    { -0.19509032f, -0.98078528f },
+    { -0.00000000f, -1.00000000f },
+    {  0.19509032f, -0.98078528f },
+    {  0.38268343f, -0.92387953f },
+    {  0.55557023f, -0.83146961f },
+    {  0.70710678f, -0.70710678f },
+    {  0.83146961f, -0.55557023f },
+    {  0.92387953f, -0.38268343f },
+    {  0.98078528f, -0.19509032f },
+};
+
+
+void
+Requantize_MidSideStereo ( Int Stop_Band, const Bool_t* used_MS )
+{
+    Int    Band;  // 0...Stop_Band
+    Uint   k;     // 0...35
+    Float  ML;
+    Float  MR;
+    Float  mid;
+    Float  side;
+
+    ENTER(162);
+
+    for ( Band = 0; Band <= Stop_Band; Band++ ) {
+
+        if ( used_MS[Band] )  // MidSide coded: left channel contains Mid signal, right channel Side signal
+            if      ( Res[Band].R < -1 ) {
+                k  = 0;
+                ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
+                do {
+                    mid = Q[Band].L[k] * ML;
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 12);
+                ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
+                do {
+                    mid = Q[Band].L[k] * ML;
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 24);
+                ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
+                do {
+                    mid = Q[Band].L[k] * ML;
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 36);
+            }
+            else if ( Res[Band].L < -1 ) {
+                k  = 0;
+                ML = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
+                do {
+                    mid = Q[Band].R[k] * ML;
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 12);
+                ML = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
+                do {
+                    mid = Q[Band].R[k] * ML;
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 24);
+                ML = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
+                do {
+                    mid = Q[Band].R[k] * ML;
+                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
+                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
+                } while (++k < 36);
+            }
+            else if ( Res[Band].L )
+                if ( Res[Band].R ) {     //  M!=0, S!=0
+                    k  = 0;
+                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
+                        Y_L[k][Band] = mid + side;
+                    } while (++k < 12);
+                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
+                        Y_L[k][Band] = mid + side;
+                    } while (++k < 24);
+                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
+                        Y_L[k][Band] = mid + side;
+                    } while (++k < 36);
+                } else {                 //  M!=0, S=0
+                    k  = 0;
+                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] =
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 12);
+                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] =
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 24);
+                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] =
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 36);
+                }
+            else
+                if ( Res[Band].R ) {     //  M==0, S!=0
+                    k  = 0;
+                    ML = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = - (
+                        Y_L[k][Band] = Q[Band].R[k] * ML );
+                    } while (++k < 12);
+                    ML = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = - (
+                        Y_L[k][Band] = Q[Band].R[k] * ML );
+                    } while (++k < 24);
+                    ML = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = - (
+                        Y_L[k][Band] = Q[Band].R[k] * ML );
+                    } while (++k < 36);
+                } else {                 //  M==0, S==0
+                    for (k=0; k<36; k++) {
+                        Y_R[k][Band] =
+                        Y_L[k][Band] = 0.f;
+                    }
+                }
+
+        else                  // Left/Right coded: left channel contains left, right the right signal
+
+            if ( Res[Band].L )
+                if ( Res[Band].R ) {     //  L!=0, R!=0
+                    k  = 0;
+                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 12);
+                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 24);
+                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
+                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 36);
+                } else {                 //  L!=0, R==0
+                    k  = 0;
+                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] = 0.f;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 12);
+                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] = 0.f;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 24);
+                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
+                    do {
+                        Y_R[k][Band] = 0.f;
+                        Y_L[k][Band] = Q[Band].L[k] * ML;
+                    } while (++k < 36);
+                }
+            else
+                if ( Res[Band].R ) {     //  L==0, R!=0
+                    k  = 0;
+                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = 0.f;
+                    } while (++k < 12);
+                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = 0.f;
+                    } while (++k < 24);
+                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
+                    do {
+                        Y_R[k][Band] = Q[Band].R[k] * MR;
+                        Y_L[k][Band] = 0.f;
+                    } while (++k < 36);
+                } else {                 //  L==0, R==0
+                    for (k=0; k<36; k++) {
+                        Y_R[k][Band] =
+                        Y_L[k][Band] = 0.f;
+                    }
+                }
+
+    }
+
+    LEAVE(162);
+    return;
+}
+
+
+/*
+ *  This is the main requantisation routine for Intensity Stereo.
+ *  It does the same as Requantize_MidSideStereo() but for IS.
+ *
+ *  Input is:
+ *      - Stop_Band:
+ *          the last band using MS or LR stereo
+ *      - Res[Band].L:
+ *          Quantisation resolution for every band (0...Stop_Band) and
+ *          the left channel which is used for both channels. Value is 0...17.
+ *      - SCF_Index[3][Band].{L,R}:
+ *          Scale factor for every band (0...Stop_Band), subframe (0...2)
+ *          and channel (L, R).
+ *      - Q[Band].L[36]
+ *          36 subband samples for every band (0...Stop_Band), both channels use
+ *          the of the left channel
+ *      - SCF[64], Cc[18], Dc[18]:
+ *          Lookup tables for Scale factor and Quantisation resolution.
+ *
+ *   Output is:
+ *     - Y_L:  Left  channel subband signals
+ *     - Y_R:  Right channel subband signals
+ *
+ *   These signals are used for the synthesis filter in the synth*.[ch]
+ *   files to generate the PCM output signal.
+ */
+
+void
+Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band )
+{
+    Int    Band;  // Start_Band...Stop_Band
+    Uint   k;     // 0...35
+    Float  ML;
+    Float  MR;
+
+    ENTER(163);
+
+    for ( Band = Start_Band; Band <= Stop_Band; Band++ ) {
+
+        if ( Res[Band].L ) {
+            k  = 0;
+            ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L] * SS05;
+            MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].L] * SS05;
+            do {
+                Y_R[k][Band] = Q[Band].L[k] * MR;
+                Y_L[k][Band] = Q[Band].L[k] * ML;
+            } while (++k < 12);
+            ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L] * SS05;
+            MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].L] * SS05;
+            do {
+                Y_R[k][Band] = Q[Band].L[k] * MR;
+                Y_L[k][Band] = Q[Band].L[k] * ML;
+            } while (++k < 24);
+            ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L] * SS05;
+            MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].L] * SS05;
+            do {
+                Y_R[k][Band] = Q[Band].L[k] * MR;
+                Y_L[k][Band] = Q[Band].L[k] * ML;
+            } while (++k < 36);
+        } else {
+            for (k=0; k<36; k++) {
+                Y_R[k][Band] =
+                Y_L[k][Band] = 0.f;
+            }
+        }
+
+    }
+    LEAVE(163);
+    return;
+}
+
+
+/*
+ *  Helper function for the qsort() in Resort_HuffTable() to sort a Huffman table
+ *  by its codes.
+ */
+
+static int Cdecl
+cmp_fn ( const void* p1, const void* p2 )
+{
+    if ( ((const Huffman_t*)p1) -> Code < ((const Huffman_t*)p2) -> Code ) return +1;
+    if ( ((const Huffman_t*)p1) -> Code > ((const Huffman_t*)p2) -> Code ) return -1;
+    return 0;
+}
+
+
+/*
+ *  This functions sorts a Huffman table by its codes. It has also two other functions:
+ *
+ *    - The table contains LSB aligned codes, these are first MSB aligned.
+ *    - The value entry is filled by its position plus 'offset' (Note that
+ *      Make_HuffTable() don't fill this item. Offset can be used to offset
+ *      range for instance from 0...6 to -3...+3.
+ *
+ *  Note that this function generates trash if you call it twice!
+ */
+
+void
+Resort_HuffTable ( Huffman_t* const Table, const size_t elements, Int offset )
+{
+    size_t  i;
+
+    for ( i = 0; i < elements; i++ ) {
+        Table[i].Value  = i + offset;
+        Table[i].Code <<= (32 - Table[i].Length);
+    }
+
+    qsort ( Table, elements, sizeof(*Table), cmp_fn );
+    return;
+}
+
+#endif /* MPP_ENCODER */
+
+
+/*
+ *  Fills out the items Code and Length (but not Value) of a Huffman table
+ *  from a bit packed Huffman table 'src'. Table is not sorted, so this is
+ *  the table which is suitable for an encoder. Be careful: To get a table
+ *  usable for a decoder you must use Resort_HuffTable() after this
+ *  function. It's a little bit dangerous to divide the functionality, maybe
+ *  there is a more secure and handy solution to this problem.
+ */
+
+void
+Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, size_t len )
+{
+    size_t  i;
+
+    for ( i = 0; i < len; i++,src++,dst++ ) {
+        dst->Code   = src->Code  ;
+        dst->Length = src->Length;
+    }
+}
+
+
+/*
+ *  Generates a Lookup table for quick Huffman decoding. This table must
+ *  have a size of a power of 2. Input is the pre-sorted Huffman table,
+ *  sorted by Resort_HuffTable() and its length, and the length of the
+ *  lookup table. Output is the Lookup table. It can be used for table based
+ *  decoding (Huffman_decode_fastest) which fully decodes by means of the
+ *  LUT. This is only handy for small huffman codes up to 9...10 bit
+ *  maximum length. For longer codes partial lookup is possible with
+ *  Huffman_decode_faster() which first estimates possible codes by means
+ *  of LUT and then searches the exact code like the tableless version
+ *  Huffman_decode().
+ */
+
+void
+Make_LookupTable ( Uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
+{
+    size_t    i;
+    size_t    idx  = elements;
+    Uint32_t  dval = (Uint32_t)0x80000000L / LUT_len * 2;
+    Uint32_t  val  = dval - 1;
+
+    for ( i = 0; i < LUT_len; i++, val += dval ) {
+        while ( idx > 0  &&  val >= Table[idx-1].Code )
+            idx--;
+        *LUT++ = (Uint8_t)idx;
+    }
+
+    return;
+}
+
+
+void
+Init_FPU ( void )
+{
+    Uint16_t  cw;
+
+#if   defined __i386__  &&  defined _FPU_GETCW  &&  defined _FPU_SETCW
+    _FPU_GETCW ( cw );
+    cw  &=  ~0x300;
+    _FPU_SETCW ( cw );
+#elif defined __i386__  &&  defined  FPU_GETCW  &&  defined  FPU_SETCW
+    FPU_GETCW ( cw );
+    cw  &=  ~0x300;
+    FPU_SETCW ( cw );
+#elif defined __MINGW32__
+    __asm__ ("fnstcw %0" : "=m" (*&cw));
+    cw  &=  ~0x300;
+    __asm__ ("fldcw %0" : : "m" (*&cw));
+#elif defined(_WIN32) && !defined(_WIN64)
+    _asm { fstcw cw };
+    cw  &=  ~0x300;
+    _asm { fldcw cw };
+#else
+    ;
+#endif
+}
+
+/* end of tools.c */
Index: /mppenc/trunk/src/wave_in.c
===================================================================
--- /mppenc/trunk/src/wave_in.c	(revision 97)
+++ /mppenc/trunk/src/wave_in.c	(revision 97)
@@ -0,0 +1,657 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+
+static int
+init_in ( const int  SampleCount,
+          const int  SampleFreq,
+          const int  Channels,
+          const int  BitsPerSample );
+static size_t
+get_in ( void* DataPtr );
+
+
+#if defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO
+static void
+Set_Realtime ( void )
+{
+# if defined USE_NICE
+    seteuid     ( 0 );
+    setpriority ( PRIO_PROCESS, getpid(), -20 );
+    seteuid     ( getuid() );
+# endif
+}
+#endif /* USE_OSS_AUDIO || USE_ESD_AUDIO || USE_SUN_AUDIO */
+
+
+#define EXT(x)  (0 == strcasecmp (ext, #x))
+
+int
+Open_WAV_Header ( wave_t* type, const char* filename )
+{
+    const char*  ext = strrchr ( filename, '.');
+    FILE*        fp;
+
+    type -> raw = 0;
+
+    if ( 0 == strcmp ( filename, "-")  ||  0 == strcmp ( filename, "/dev/stdin") ) {
+        fp = SETBINARY_IN ( stdin );
+    }
+#ifndef _WIN32
+#ifndef NO_DEV_AUDIO
+    else if ( 0 == strncmp ( filename, "/dev/", 5) ) {
+        int          fd;
+        int          arg;
+        int          org;
+
+        fd = open (filename, O_RDONLY);
+        if ( fd < 0 )
+            return -1;
+
+        type->Channels = org = arg = 2;
+        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_CHANNELS, &arg ) )
+            return -1;
+        if (arg != org)
+            return -1;
+
+        type->BitsPerSample = org = arg = 16;
+        type->BytesPerSample = 2;
+        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_BITS, &arg ) )
+            return -1;
+        if (arg != org)
+            return -1;
+
+        org = arg = AFMT_S16_LE;
+        if ( -1 == ioctl ( fd, SNDCTL_DSP_SETFMT, &arg ) )
+            return -1;
+        if ((arg & org) == 0)
+            return -1;
+
+        type->SampleFreq = org = arg = 44100.;
+        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_RATE, &arg ) )
+            return -1;
+        if ( 23.609375 * abs(arg-org) > abs(arg+org) )    // Sample frequency: Accept 40.5...48.0 kHz for 44.1 kHz
+            return -1;
+
+        type->raw        = 1;
+        type->PCMOffset  = 0;
+        type->PCMBytes   = 0xFFFFFFFF;
+        type->PCMSamples = 86400 * type->SampleFreq;
+
+        fp = fdopen (fd, "rb");
+        Set_Realtime ();
+    }
+#endif
+#else
+    else if ( 0 == strncmp ( filename, "/dev/audio", 10 ) ) {
+        int     tmp;
+        int     fs  = 44100;
+        double  dur = 86400.;
+
+        sscanf ( filename, "%*[^:]:%u:%lf", &fs, &dur );
+
+        fp                     = (FILE*)-1;
+        type -> Channels       =  2;
+        type -> BitsPerSample  = 16;
+        type -> BytesPerSample =  2;
+        type -> SampleFreq     = fs;
+        type -> PCMOffset      =  0;
+        type -> PCMBytes       = 0xFFFFFFFF;
+        type -> PCMSamples     = dur * type -> SampleFreq;
+        type -> raw            = 1;
+        tmp  = init_in ( 1152, (int) floor (type -> SampleFreq + 0.5), type -> Channels, type -> BitsPerSample );
+        if ( tmp )
+            return -1;
+# if   defined USE_REALTIME
+        SetPriorityClass ( GetCurrentProcess (), REALTIME_PRIORITY_CLASS );
+# elif defined USE_NICE
+        SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
+# endif
+    }
+#endif
+    else if ( ext == NULL ) {
+        fp = NULL;
+    }
+    else if ( EXT(.wav) ) {
+        fp = fopen ( filename, "rb" );
+    }
+    else if ( EXT(.wv) ) {                              // wavpack (www.wavpack.com)
+        fp = pipeopen ( "wvunpack # -", filename );
+    }
+    else if ( EXT(.la) ) {                              // lossless-audio (www.lossless-audio.com)
+        fp = pipeopen ( "la -console #", filename );
+    }
+    else if ( EXT(.raw)  ||  EXT(.cdr)  ||  EXT(.pcm) ) {
+        fp = fopen ( filename, "rb" );
+        type->Channels       = 2;
+        type->BitsPerSample  = 16;
+        type->BytesPerSample = 2;
+        type->SampleFreq     = 44100.;
+        type->raw            = 1;
+        type->PCMOffset      = 0;
+        type->PCMBytes       = 0xFFFFFFFF;
+        type->PCMSamples     = 86400 * type->SampleFreq;
+    }
+    else if ( EXT(.pac)  ||  EXT(.lpac)  ||  EXT(.lpa) ) {
+        fp = pipeopen ( "lpac -o -x #", filename );
+    }
+    else if ( EXT(.fla)  ||  EXT(.flac) ) {
+#ifdef _WIN32
+        stderr_printf ( "*** Install at least version 1.03 of FLAC.EXE. Thanks! ***\n\n" );
+#endif
+        fp = pipeopen ( "flac -d -s -c - < #", filename );
+    }
+    else if ( EXT(.rka)  ||  EXT(.rkau) ) {
+        fp = pipeopen ( "rkau # -", filename );
+    }
+    else if ( EXT(.sz) ) {
+        fp = pipeopen ( "szip -d < #", filename );
+    }
+    else if ( EXT(.sz2) ) {
+        fp = pipeopen ( "szip2 -d < #", filename );
+    }
+    else if ( EXT(.ofr) ) {
+        fp = pipeopen ( "optimfrog d # -", filename );
+    }
+    else if ( EXT(.ape) ) {
+        fp = pipeopen ( "mac # - -d", filename );
+    }
+    else if ( EXT(.shn)  ||  EXT(.shorten) ) {
+#ifdef _WIN32
+        stderr_printf ( "*** Install at least version 3.4 of Shorten.exe. Thanks! ***\n\n" );
+#endif
+        fp = pipeopen ( "shorten -x # -", filename );           // Test if it's okay !!!!
+        if ( fp == NULL )
+            fp = pipeopen ( "shortn32 -x # -", filename );
+    }
+    else if ( EXT(.mod) ) {
+        fp = pipeopen ( "xmp -b16 -c -f44100 --stereo -o- #", filename );
+        type->Channels       = 2;
+        type->BitsPerSample  = 16;
+        type->BytesPerSample = 2;
+        type->SampleFreq     = 44100.;
+        type->raw            = 1;
+        type->PCMOffset      = 0;
+        type->PCMBytes       = 0xFFFFFFFF;
+        type->PCMSamples     = 86400 * type->SampleFreq;
+    }
+    else {
+        fp = NULL;
+    }
+
+    type -> fp  = fp;
+    return fp == NULL  ?  -1  :  0;
+}
+
+#undef EXT
+
+
+static float f0  ( const void* p )
+{
+    return (void)p, 0.;
+}
+
+static float f8  ( const void* p )
+{
+    return (((unsigned char*)p)[0] - 128) * 256.;
+}
+
+static float f16 ( const void* p )
+{
+    return ((unsigned char*)p)[0] + 256. * ((signed char*)p)[1];
+}
+
+static float f24 ( const void* p )
+{
+    return ((unsigned char*)p)[0]*(1./256) + ((unsigned char*)p)[1] + 256 * ((signed char*)p)[2];
+}
+
+static float f32 ( const void* p )
+{
+    return ((unsigned char*)p)[0]*(1./65536) + ((unsigned char*)p)[1]*(1./256) + ((unsigned char*)p)[2] + 256 * ((signed char*)p)[3];
+}
+
+
+typedef float (*rf_t) (const void*);
+
+static int
+DigitalSilence ( void* buffer, size_t len )
+{
+    unsigned long*  pl;
+    unsigned char*  pc;
+    size_t          loops;
+
+    for ( pl = buffer, loops = len >> 3; loops--; pl += 2 )
+        if ( pl[0] | pl[1] )
+            return 0;
+
+    for ( pc = (unsigned char*)pl, loops = len & 7; loops--; pc++ )
+        if ( pc[0] )
+            return 0;
+
+    return 1;
+}
+
+
+size_t
+Read_WAV_Samples ( wave_t*          t,
+                   const size_t     RequestedSamples,
+                   PCMDataTyp*      data,
+                   const ptrdiff_t  offset,
+                   const float      scalel,
+                   const float      scaler,
+                   int*             Silence )
+{
+    static const rf_t rf [5] = { f0, f8, f16, f24, f32 };
+    short   Buffer [8 * 32/16 * BLOCK]; // read buffer, up to 8 channels, up to 32 bit
+    size_t  ReadSamples;                // returns number of read samples
+    size_t  i;
+    short*  b = (short*) Buffer;
+    char*   c = (char*) Buffer;
+    float*  l = data -> L + offset;
+    float*  r = data -> R + offset;
+    float*  m = data -> M + offset;
+    float*  s = data -> S + offset;
+
+    ENTER(120);
+
+    // Read PCM data
+#ifdef _WIN32
+    if ( t->fp != (FILE*)-1 ) {
+        ReadSamples = fread ( b, t->BytesPerSample * t->Channels, RequestedSamples, t->fp );
+    }
+    else {
+        while (1) {
+            ReadSamples = get_in (b) / ( t->Channels * t->BytesPerSample );
+            if ( ReadSamples != 0 )
+                break;
+            Sleep (10);
+        }
+    }
+#else
+    ReadSamples = fread ( b, t->BytesPerSample * t->Channels, RequestedSamples, t->fp );
+#endif
+
+
+    *Silence    = DigitalSilence ( b, ReadSamples * t->BytesPerSample * t->Channels );
+
+    // Add Null Samples if EOF is reached
+    if ( ReadSamples != RequestedSamples )
+        //memset ( b + ReadSamples * t->Channels, 0, (RequestedSamples - ReadSamples) * (sizeof(short) * t->Channels) );
+		memset ( c + ReadSamples * t->Channels * t->BytesPerSample, t->BytesPerSample == 1 ? 0x80 : 0, (RequestedSamples - ReadSamples) * (t->BytesPerSample * t->Channels) );
+
+    // Convert to float and calculate M=(L+R)/2 and S=(L-R)/2 signals
+#if ENDIAN == HAVE_LITTLE_ENDIAN
+    if ( t->BytesPerSample == 2 ) {
+        switch ( t->Channels ) {
+        case 1:
+            for ( i = 0; i < RequestedSamples; i++, b++ ) {
+				float temp = b[0] * scalel;
+				l[i] = temp + MPPENC_DENORMAL_FIX_LEFT;
+				r[i] = temp + MPPENC_DENORMAL_FIX_RIGHT;
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        case 2:
+            for ( i = 0; i < RequestedSamples; i++, b += 2 ) {
+                l[i] = b[0] * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
+                r[i] = b[1] * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        case 5:
+        case 6:
+        case 7:
+        case 8:
+            for ( i = 0; i < RequestedSamples; i++, b += t->Channels ) {
+                l[i] = (0.4142 * b[0] + 0.2928 * b[1] + 0.2928 * b[3] - 0.1464 * b[4]) * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
+                r[i] = (0.4142 * b[2] + 0.2928 * b[1] + 0.2928 * b[4] - 0.1464 * b[3]) * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        default:
+            for ( i = 0; i < RequestedSamples; i++, b += t->Channels ) {
+                l[i] = b[0] * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
+                r[i] = b[1] * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        }
+    }
+    else
+#endif
+         {
+        unsigned int  bytes = t->BytesPerSample;
+        rf_t          f     = rf [bytes];
+
+        c = (char*)b;
+        switch ( t->Channels ) {
+        case 1:
+            for ( i = 0; i < RequestedSamples; i++, c += bytes ) {
+				float temp = f(c) * scalel;
+				l[i] = temp + MPPENC_DENORMAL_FIX_LEFT;
+				r[i] = temp + MPPENC_DENORMAL_FIX_RIGHT;
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        case 2:
+            for ( i = 0; i < RequestedSamples; i++, c += 2*bytes ) {
+                l[i] = f(c)       * scalel + MPPENC_DENORMAL_FIX_LEFT;     // left
+                r[i] = f(c+bytes) * scaler + MPPENC_DENORMAL_FIX_RIGHT;     // right
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        default:
+            for ( i = 0; i < RequestedSamples; i++, c += bytes * t->Channels ) {
+                l[i] = f(c)       * scalel + MPPENC_DENORMAL_FIX_LEFT;     // left
+                r[i] = f(c+bytes) * scaler + MPPENC_DENORMAL_FIX_RIGHT;     // right
+                m[i] = (l[i] + r[i]) * 0.5f;
+                s[i] = (l[i] - r[i]) * 0.5f;
+            }
+            break;
+        }
+    }
+
+    LEAVE(120);
+    return ReadSamples;
+}
+
+
+// read WAVE header
+
+static unsigned short
+Read16 ( FILE* fp )
+{
+    unsigned char  buff [2];
+
+    if (fread ( buff, 1, 2, fp ) != 2 )
+        return -1;
+    return buff[0] | (buff[1] << 8);
+}
+
+static unsigned long
+Read32 ( FILE* fp )
+{
+    unsigned char  buff [4];
+
+    if ( fread ( buff, 1, 4, fp ) != 4 )
+        return -1;
+    return (buff[0] | (buff[1] << 8)) | ((unsigned long)(buff[2] | (buff[3] << 8)) << 16);
+}
+
+
+int
+Read_WAV_Header ( wave_t* type )
+{
+	int bytealign;
+
+    FILE*  fp = type->fp;
+
+    if ( type->raw )
+        return 0;
+
+    fseek ( fp, 0, SEEK_SET );
+    if ( Read32 (fp) != 0x46464952 ) {                  // 4 Byte: check for "RIFF"
+        stderr_printf ( Read32(fp) == -1  ?  " ERROR: Empty file or no data from coprocess!\n\n"
+                                          :  " ERROR: 'RIFF' not found in WAVE header!\n\n");
+        return -1;
+    }
+    Read32 (fp);                                        // 4 Byte: chunk size (ignored)
+    if ( Read32 (fp) != 0x45564157 ) {                  // 4 Byte: check for "WAVE"
+        stderr_printf ( " ERROR: 'WAVE' not found in WAVE header!\n\n");
+        return -1;
+    }
+    if ( Read32 (fp) != 0x20746D66 ) {                  // 4 Byte: check for "fmt "
+        stderr_printf ( " ERROR: 'fmt ' not found in WAVE header!\n\n");
+        return -1;
+    }
+    Read32 (fp);                                        // 4 Byte: read chunk-size (ignored)
+    if ( Read16 (fp) != 0x0001 ) {                      // 2 Byte: check for linear PCM
+        stderr_printf ( " ERROR: WAVE file has no linear PCM format!\n\n");
+        return -1;
+    }
+    type -> Channels    = Read16 (fp);                  // 2 Byte: read no. of channels
+    type -> SampleFreq  = Read32 (fp);                  // 4 Byte: read sampling frequency
+    Read32 (fp);                                        // 4 Byte: read avg. blocksize (fs*channels*bytepersample)
+    bytealign = Read16 (fp);							// 2 Byte: read byte-alignment (channels*bytepersample)
+    type->BitsPerSample = Read16 (fp);                  // 2 Byte: read bits per sample
+    type->BytesPerSample= (type->BitsPerSample + 7) / 8;
+    while ( 1 ) {                                       // search for "data"
+        if ( feof (fp) )
+            return -1;
+        if ( Read16 (fp) != 0x6164 )
+            continue;
+        if ( Read16 (fp) == 0x6174 )
+            break;
+    }
+    type->PCMBytes      = Read32 (fp);                  // 4 Byte: no. of byte in file
+    if ( feof (fp) ) return -1;
+
+														// finally calculate number of samples
+    if (type->PCMBytes >= 0xFFFFFF00  ||  
+			type->PCMBytes == 0  ||  
+			(Uint32_t)type->PCMBytes % (type -> Channels * type->BytesPerSample) != 0) {
+		type->PCMSamples = 36000000 * type->SampleFreq;
+	}
+	else {
+		type->PCMSamples = type->PCMBytes / bytealign;
+	}
+    type->PCMOffset     = ftell (fp);
+    return 0;
+}
+
+
+#ifdef _WIN32
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <stdio.h>
+#include <windows.h>
+#include <winbase.h>
+#include <mmsystem.h>
+#ifndef __MINGW32__
+#include <mmreg.h>
+#endif
+#include <io.h>
+#include <fcntl.h>
+
+
+#define NBLK  383               // 10 sec of audio
+
+
+typedef struct {
+    int      active;
+    char*    data;
+    size_t   datalen;
+    WAVEHDR  hdr;
+} oblk_t;
+
+static HWAVEIN       Input_WAVHandle;
+static HWAVEOUT      Output_WAVHandle;
+static size_t        BufferBytes;
+static WAVEHDR       whi    [NBLK];
+static char*         data   [NBLK];
+static oblk_t        array  [NBLK];
+static unsigned int  NextInputIndex;
+static unsigned int  NextOutputIndex;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int
+init_in ( const int  SampleCount,
+          const int  SampleFreq,
+          const int  Channels,
+          const int  BitsPerSample )
+{
+
+    WAVEFORMATEX  pwf;
+    MMRESULT      r;
+    int           i;
+
+    pwf.wFormatTag      = WAVE_FORMAT_PCM;
+    pwf.nChannels       = Channels;
+    pwf.nSamplesPerSec  = SampleFreq;
+    pwf.nAvgBytesPerSec = SampleFreq * Channels * ((BitsPerSample + 7) / 8);
+    pwf.nBlockAlign     = Channels * ((BitsPerSample + 7) / 8);
+    pwf.wBitsPerSample  = BitsPerSample;
+    pwf.cbSize          = 0;
+
+    r = waveInOpen ( &Input_WAVHandle, WAVE_MAPPER, &pwf, 0, 0, CALLBACK_EVENT );
+    if ( r != MMSYSERR_NOERROR ) {
+        fprintf ( stderr, "waveInOpen failed: ");
+        switch (r) {
+        case MMSYSERR_ALLOCATED:   fprintf ( stderr, "resource already allocated\n" );                                  break;
+        case MMSYSERR_INVALPARAM:  fprintf ( stderr, "invalid Params\n" );                                              break;
+        case MMSYSERR_BADDEVICEID: fprintf ( stderr, "device identifier out of range\n" );                              break;
+        case MMSYSERR_NODRIVER:    fprintf ( stderr, "no device driver present\n" );                                    break;
+        case MMSYSERR_NOMEM:       fprintf ( stderr, "unable to allocate or lock memory\n" );                           break;
+        case WAVERR_BADFORMAT:     fprintf ( stderr, "attempted to open with an unsupported waveform-audio format\n" ); break;
+        case WAVERR_SYNC:          fprintf ( stderr, "device is synchronous but waveOutOpen was\n" );                   break;
+        default:                   fprintf ( stderr, "unknown error code: %#X\n", r );                                  break;
+        }
+        return -1;
+    }
+
+    BufferBytes = SampleCount * Channels * ((BitsPerSample + 7) / 8);
+
+    for ( i = 0; i < NBLK; i++ ) {
+        whi [i].lpData         = data [i] = malloc (BufferBytes);
+        whi [i].dwBufferLength = BufferBytes;
+        whi [i].dwFlags        = 0;
+        whi [i].dwLoops        = 0;
+
+        r = waveInPrepareHeader ( Input_WAVHandle, whi + i, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInPrepareHeader  (%u) failed\n", i );  return -1; }
+        r = waveInAddBuffer     ( Input_WAVHandle, whi + i, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInAddBuffer      (%u) failed\n", i );  return -1; }
+    }
+    NextInputIndex = 0;
+    waveInStart (Input_WAVHandle);
+    return 0;
+}
+
+
+size_t
+get_in ( void* DataPtr )
+{
+    MMRESULT  r;
+    size_t    Bytes;
+
+    if ( whi [NextInputIndex].dwFlags & WHDR_DONE ) {
+        Bytes = whi [NextInputIndex].dwBytesRecorded;
+        memcpy ( DataPtr, data [NextInputIndex], Bytes );
+
+        r = waveInUnprepareHeader ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInUnprepareHeader (%d) failed\n", NextInputIndex ); return -1; }
+        whi [NextInputIndex].lpData         = data [NextInputIndex];
+        whi [NextInputIndex].dwBufferLength = BufferBytes;
+        whi [NextInputIndex].dwFlags        = 0;
+        whi [NextInputIndex].dwLoops        = 0;
+        r = waveInPrepareHeader   ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInPrepareHeader   (%d) failed\n", NextInputIndex ); return -1; }
+        r = waveInAddBuffer       ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInAddBuffer       (%d) failed\n", NextInputIndex ); return -1; }
+        NextInputIndex = (NextInputIndex + 1) % NBLK;
+        return  Bytes;
+    }
+    return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+int
+init_out ( const int  SampleCount,
+           const int  SampleFreq,
+           const int  Channels,
+           const int  BitsPerSample )
+{
+    WAVEFORMATEX  pwf;
+    MMRESULT      r;
+    int           i;
+
+    pwf.wFormatTag      = WAVE_FORMAT_PCM;
+    pwf.nChannels       = Channels;
+    pwf.nSamplesPerSec  = SampleFreq;
+    pwf.nAvgBytesPerSec = SampleFreq * Channels * ((BitsPerSample + 7) / 8);
+    pwf.nBlockAlign     = Channels * ((BitsPerSample + 7) / 8);
+    pwf.wBitsPerSample  = BitsPerSample;
+    pwf.cbSize          = 0;
+
+    r = waveOutOpen ( &Output_WAVHandle, WAVE_MAPPER, &pwf, 0, 0, CALLBACK_EVENT );
+    if ( r != MMSYSERR_NOERROR ) {
+        fprintf ( stderr, "waveOutOpen failed\n" );
+        switch (r) {
+        case MMSYSERR_ALLOCATED:   fprintf ( stderr, "resource already allocated\n" );                                  break;
+        case MMSYSERR_INVALPARAM:  fprintf ( stderr, "invalid Params\n" );                                              break;
+        case MMSYSERR_BADDEVICEID: fprintf ( stderr, "device identifier out of range\n" );                              break;
+        case MMSYSERR_NODRIVER:    fprintf ( stderr, "no device driver present\n" );                                    break;
+        case MMSYSERR_NOMEM:       fprintf ( stderr, "unable to allocate or lock memory\n" );                           break;
+        case WAVERR_BADFORMAT:     fprintf ( stderr, "attempted to open with an unsupported waveform-audio format\n" ); break;
+        case WAVERR_SYNC:          fprintf ( stderr, "device is synchronous but waveOutOpen was\n" );                   break;
+        default:                   fprintf ( stderr, "unknown error code: %#X\n", r );                                  break;
+        }
+        return -1;
+    }
+
+    BufferBytes = SampleCount * Channels * ((BitsPerSample + 7) / 8);
+
+    for ( i = 0; i < NBLK; i++ ) {
+        array [i].active = 0;
+        array [i].data   = malloc (BufferBytes);
+    }
+    NextOutputIndex = 0;
+    return 0;
+}
+
+
+int
+put_out ( const void*   DataPtr,
+          const size_t  Bytes )
+{
+    MMRESULT  r;
+    int       i = NextOutputIndex;
+
+    if ( array [i].active )
+        while ( ! (array [i].hdr.dwFlags & WHDR_DONE) )
+            Sleep (26);
+
+    r = waveOutUnprepareHeader ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutUnprepareHeader (%d) failed\n", i ); return -1; }
+
+    array [i].active             = 1;
+    array [i].hdr.lpData         = array [i].data;
+    array [i].hdr.dwBufferLength = Bytes;
+    array [i].hdr.dwFlags        = 0;
+    array [i].hdr.dwLoops        = 0;
+    memcpy ( array [i].data, DataPtr, Bytes );
+
+    r = waveOutPrepareHeader   ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutPrepareHeader   (%d) failed\n", i ); return -1; }
+    r = waveOutWrite           ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutAddBuffer       (%d) failed\n", i ); return -1; }
+
+    NextInputIndex = (NextInputIndex + 1) % NBLK;
+    return Bytes;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif
+
+/* end of wave_in.c */
Index: /mppenc/trunk/src/winmsg.c
===================================================================
--- /mppenc/trunk/src/winmsg.c	(revision 97)
+++ /mppenc/trunk/src/winmsg.c	(revision 97)
@@ -0,0 +1,91 @@
+/*
+ * Musepack audio compression
+ * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "mppenc.h"
+
+#ifdef _WIN32
+
+#include <windows.h>
+
+static HWND  FrontEndHandle;
+
+
+int
+SearchForFrontend ( void )
+{
+    FrontEndHandle = FindWindow ( NULL, "mpcdispatcher" );      // check for dispatcher window and (send startup-message???)
+
+    return FrontEndHandle != 0;
+}
+
+
+static void
+SendMsg ( const char* s )
+{
+    COPYDATASTRUCT  MsgData;
+
+    MsgData.dwData = 3;         // build message
+    MsgData.lpData = (char*)s;
+    MsgData.cbData = strlen(s) + 1;
+
+    SendMessage ( FrontEndHandle, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &MsgData );  // send message
+}
+
+
+void
+SendStartupMessage ( const char*  Version,
+                     const int    SV,
+                     const char*  Build )
+{
+    char  startup [120];
+
+    sprintf ( startup, "#START#MP+ v%s SV%i %s#", Version, SV, Build );   // fill startup-message
+    SendMsg ( startup );
+}
+
+
+void
+SendQuitMessage ( void )
+{
+    SendMsg ("#EOF#");
+}
+
+
+void
+SendModeMessage ( const int Profile )
+{
+    char  message [32];
+
+    sprintf ( message, "#PARAM#%d#", Profile-8 );  // fill message
+    SendMsg ( message );
+}
+
+
+void                                            /* sends progress information to the frontend */
+SendProgressMessage ( const int    bitrate,
+                      const float  speed,
+                      const float  percent )
+{
+    char  message [64];
+
+    sprintf ( message, "#STAT#%4ik %5.2fx %5.1f%%#", bitrate, speed, percent );
+    SendMsg ( message );
+}
+
+#endif /* _WIN32 */
Index: penc/trunk/stderr.c
===================================================================
--- /mppenc/trunk/stderr.c	(revision 96)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- *  stderr - Message output system
- *
- *  (C) Frank Klemm, Janne Hyvärinen 2002. All rights reserved.
- *
- *  Principles:
- *
- *  History:
- *    2001              created
- *    2002 Spring       added functionality to switch on and off printing to easily allow silent modes
- *    2002-10-10        Escape sequence handling for Windows added.
- *
- *  Global functions:
- *    - SetStderrSilent()
- *    - GetStderrSilent()
- *    - stderr_printf()
- *
- *  TODO:
- *    -
- */
-
-#include "mppdec.h"
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-
-static Bool_t  stderr_silent = 0;
-
-
-void
-SetStderrSilent ( Bool_t state )
-{
-    stderr_silent = state;
-}
-
-
-Bool_t
-GetStderrSilent ( void )
-{
-    return stderr_silent;
-}
-
-
-int Cdecl
-stderr_printf ( const char* format, ... )
-{
-    char     buff [2 * PATHLEN_MAX + 3072];
-    char*    p = buff;
-    char*    q;
-    int      ret;
-    va_list  v;
-
-    /* print to a buffer */
-    va_start ( v, format );
-    ret = vsprintf ( p, format, v );
-    va_end ( v );
-
-    if ( !stderr_silent ) {
-
-#if   defined __unix__  ||  defined __UNIX__
-
-        WRITE ( STDERR, buff, ret );
-
-#elif defined _WIN32
-
-# define FOREGROUND_ALL         ( FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED )
-# define BACKGROUND_ALL         ( BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED )
-
-        // for Windows systems we must merge carriage returns into the stream to avoid staircases
-        // Also escape sequences must be detected and replaced (incomplete now)
-
-        char                            buff [128];
-        static int                      init = 0;
-        CONSOLE_SCREEN_BUFFER_INFO      con_info;
-        static HANDLE                   hSTDERR;
-        static WORD                     attr;
-        static WORD                     attr_initial;
-        DWORD                           written;
-
-        if ( init == 0 ) {
-            hSTDERR = GetStdHandle ( STD_ERROR_HANDLE );
-            attr    = hSTDERR == INVALID_HANDLE_VALUE  ||  GetConsoleScreenBufferInfo ( hSTDERR, &con_info ) == 0
-                      ?  FOREGROUND_ALL  :  con_info.wAttributes;
-            attr_initial = attr;
-            init    = 1;
-        }
-
-        if ( hSTDERR == INVALID_HANDLE_VALUE ) {
-            while ( ( q = strchr (p, '\n')) != NULL ) {
-                WRITE ( STDERR, p, q-p );
-                WRITE ( STDERR, "\r\n", 2 );
-                p = q+1;
-            }
-            WRITE ( STDERR, p, strlen (p) );
-        }
-        else {
-            for ( ; *p; p++ ) {
-                switch ( *p ) {
-                case '\n':
-                    SetConsoleTextAttribute ( hSTDERR, attr_initial );
-                    fprintf ( stderr, "\r\n" );
-                    SetConsoleTextAttribute ( hSTDERR, attr );
-                    break;
-
-                case '\x1B':
-                    if ( p[1] == '[' ) {
-                        unsigned int  tmp;
-
-                        p++;
-                cont:   p++;
-                        for ( tmp = 0; (unsigned int)( *p - '0' ) < 10u; p++ )
-                            tmp = 10 * tmp + ( *p - '0' );
-
-                        switch ( *p ) {
-                        case ';':
-                        case 'm':
-                            switch ( tmp ) {
-                            case  0: attr  =  FOREGROUND_ALL;                                                   break; // reset defaults
-                            case  1: attr |=  FOREGROUND_INTENSITY;                                             break; // high intensity on
-                            case  2: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_INTENSITY;                     break; // (very) low intensity
-                            case  3:                                                                            break; // italic on
-                            case  4:                                                                            break; // underline on
-                            case  5:                                                                            break; // blinking on
-                            case  7:                                                                            break; // reverse
-                            case  8: attr  =  0;                                                                break; // invisible
-                            case 30: attr &= ~FOREGROUND_ALL;                                                   break;
-                            case 31: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED;                           break;
-                            case 32: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_GREEN;                         break;
-                            case 33: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED | FOREGROUND_GREEN;        break;
-                            case 34: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_BLUE;                          break;
-                            case 35: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_RED | FOREGROUND_BLUE;         break;
-                            case 36: attr &= ~FOREGROUND_ALL; attr |= FOREGROUND_GREEN | FOREGROUND_BLUE;       break;
-                            case 37: case 39:                 attr |= FOREGROUND_ALL;                           break;
-                            case 40: case 49:
-                                     attr &= ~BACKGROUND_ALL;                                                   break;
-                            case 41: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED;                           break;
-                            case 42: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_GREEN;                         break;
-                            case 43: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED | BACKGROUND_GREEN;        break;
-                            case 44: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_BLUE;                          break;
-                            case 45: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_RED | BACKGROUND_BLUE;         break;
-                            case 46: attr &= ~BACKGROUND_ALL; attr |= BACKGROUND_GREEN | BACKGROUND_BLUE;       break;
-                            case 47:                          attr |= BACKGROUND_ALL;                           break;
-                            }
-                            SetConsoleTextAttribute ( hSTDERR, attr );
-                            if ( *p == ';' )
-                                goto cont;
-                            break;
-
-                        default:
-                            WriteFile ( hSTDERR, buff, sprintf ( buff, "Unknown escape sequence ending with '%c'\n", *p ), &written, NULL );
-                            break;
-                        }
-                        break;
-                    }
-                default:
-                    fputc ( *p, stderr );
-                    break;
-                }
-            } /* end for */
-        }
-
-#else
-
-        // for non-Unix systems we must merge carriage returns into the stream to avoid staircases
-        while ( ( q = strchr (p, '\n')) != NULL ) {
-            WRITE ( STDERR, p, q-p );
-            WRITE ( STDERR, "\r\n", 2 );
-            p = q+1;
-        }
-        WRITE ( STDERR, p, strlen (p) );
-
-#endif
-
-    }
-
-    return ret;
-}
-
-/* end of stderr.c */
Index: penc/trunk/streamserver.c
===================================================================
--- /mppenc/trunk/streamserver.c	(revision 96)
+++ 	(revision )
@@ -1,327 +1,0 @@
-/* struct linger zu ein- ausschalten von Lingering */
-
-/*
- *  Missing:
- *      Can't handle multiple clients
- *      UDP support
- *      Client can't choose audio file
- *      unbind/unconnect on signals
- *      change send and receiver buffers for TCP/IP
- */
-
-#include "mppdec.h"
-
-#ifndef _WIN32
-# include <arpa/inet.h>
-# include <netdb.h>      /* gethostbyaddr()              */
-# include <netinet/tcp.h>
-#endif
-
-
-#ifndef _WIN32
-# include <signal.h>
-#endif
-
-
-#define PORT        1088                        /* port of server */
-#ifdef _WIN32
-# define FILENAME    "D:\\Archive\\1.mpc"       /* default file   */
-#else
-# define FILENAME    "/Archive/1.mpc"           /* default file   */
-#endif
-#define BUFFERSIZE  (40 * 1452)
-#define TIME_OUT    300
-
-
-#undef REPORT
-#ifdef VERBOSE
-# define REPORT(x)      (x)
-#else
-# define REPORT(x)
-#endif
-
-
-#ifdef _WIN32
-
-static int
-InitWinSocket ( void )
-{
-    WORD     VersionRequested;
-    WSADATA  wsaData;
-    int      err;
-
-    VersionRequested = MAKEWORD (2, 2);
-
-    err = WSAStartup ( VersionRequested, &wsaData );
-    if ( err != 0 ) {                                     // Tell the user that we could not find a usable WinSock DLL
-        fprintf ( stderr, "Can't find WinSock DLL\n");
-        return -1;
-    }
-
-    // Confirm that the WinSock DLL supports 2.2.
-    // Note that if the DLL supports versions greater than 2.2 in addition to 2.2,
-    // it will still return 2.2 in Version since that is the version we requested.
-
-    if ( LOBYTE (wsaData.wVersion)  != 2  ||  HIBYTE (wsaData.wVersion) != 2 ) {
-        // Tell the user that we could not find a usable WinSock DLL.
-        fprintf ( stderr, "Wrong version of WinSock DLL: %d.%d\n", HIBYTE (wsaData.wVersion), LOBYTE (wsaData.wVersion) );
-        WSACleanup ();
-        return -1;
-    }
-    return 0;
-}
-
-#endif
-
-
-
-
-int rc, cs;
-
-static void
-handler ( int signalno )
-{
-    fprintf (stderr, "\nSignal %2d captured\a\n\n", signalno );
-    shutdown (cs, 2);
-    shutdown (rc, 2);
-    _exit (1);
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    static char         okay []  = "HTTP/1.0 200 OK\r\nContent-Type: application/octet-stream\r\n\r\n";
-    char                timestring [sizeof("2000-00-00 00:00:00")];
-    int                 tries;     /* used for timeout (2 min.) */
-
-    int                 socket_fd; /* socket descriptor */
-#if 0
-    int                 cs;        /* new connection's socket descriptor */
-    int                 rc;        /* system calls return value storage */
-#endif
-    struct sockaddr_in  sa;        /* internet address struct */
-    struct sockaddr_in  csa;       /* client's address struct */
-    size_t              size_csa;  /* size of client's address struct */
-
-    struct hostent*     entry;     /* host entry */
-
-    time_t              epoch;
-    struct tm*          tm;
-
-    FILE*               fp;
-    const char*         file;
-    unsigned char       buff1 [BUFFERSIZE];
-    unsigned char       buff2 [1024];
-    ssize_t             bytes_read;
-    ssize_t             bytes_wrote;
-    Int64_t             total_bytes_written;
-    int                 state;
-
-#ifndef _WIN32
-    struct sigaction    act;
-    struct sigaction    oact;
-#endif
-
-    TIME_T              start;
-    TIME_T              end;
-    double              dur;
-
-    int                 opt;
-    size_t              len;
-
-#ifdef _WIN32
-    LINGER              ling;
-#else
-    struct linger       ling;
-#endif
-
-#ifdef _WIN32
-    static int          init = 0;
-
-    if ( init == 0  &&  InitWinSocket () != 0 )
-        return -1;
-    init = 1;
-#endif
-
-
-
-#ifndef _WIN32
-    act.sa_handler = handler;
-    if ( 0 != sigaction (SIGPIPE, &act, &oact) ) {
-        fprintf ( stderr, "*** Fatal Error: Installation of SIGPIPE handler failed.\n");
-        return -1;
-    }
-    act.sa_handler = handler;
-    if ( 0 != sigaction (SIGINT, &act, &oact) ) {
-        fprintf ( stderr, "*** Fatal Error: Installation of SIGINT handler failed.\n");
-        return -1;
-    }
-#endif
-
-    switch ( argc ) {
-    case 1:
-        file = FILENAME;
-        break;
-    case 2:
-        file = argv[1];
-        break;
-    default:
-        fprintf ( stderr, "usage: %s [filename]\n", argv[0] );
-        return 1;
-    }
-
-    setvbuf ( stdout, NULL, _IONBF, 0 );
-    setvbuf ( stderr, NULL, _IONBF, 0 );
-
-    /* initiate machine's internet address structure */
-
-    memset ( &sa, 0, sizeof (sa) );     /* first clear out the struct, to avoid garbage */
-    sa.sin_family      = AF_INET;       /* using internet address family */
-    sa.sin_port        = htons (PORT);  /* copy port number in network byte order */
-    sa.sin_addr.s_addr = INADDR_ANY;    /* we will accept connections coming through any IP address that belongs to our host, using the INADDR_ANY wild-card */
-
-    /* allocate a free socket, internet address family, stream socket */
-    tries = 120;
-    while ( (socket_fd = socket (AF_INET, SOCK_STREAM, 0)) < 0 ) {
-        perror ("socket: allocation failed");
-        sleep (1);
-        if (--tries <= 0)
-            return -1;
-    }
-
-    opt = 1;
-    if (setsockopt ( socket_fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&opt, sizeof(opt) ) != 0 ) {
-        perror ("setsockopt NODELAY");
-    }
-
-    opt = 1;
-    if (setsockopt ( socket_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&opt, sizeof(opt) ) != 0 ) {
-        perror ("setsockopt REUSE");
-    }
-#if 0
-    ling.l_onoff  = 1;
-    ling.l_linger = 1;
-
-    if (setsockopt ( socket_fd, SOL_SOCKET, SO_LINGER, (const char*)&ling, sizeof(ling) ) != 0 ) {
-        perror ("setsockopt LINGER");
-    }
-#endif
-    opt = 1;
-    if (setsockopt ( socket_fd, SOL_SOCKET, SO_KEEPALIVE, (const char*)&opt, sizeof(opt) ) != 0 ) {
-        perror ("setsockopt KEEP");
-    }
-
-    /* bind the socket to the newly formed address */
-    tries = 3600;
-    while ( (rc = bind (socket_fd, (struct sockaddr*)&sa, sizeof (sa))) != 0 ) {
-        perror ("bind");
-        sleep (1);
-        if (--tries <= 0)
-            return -1;
-    }
-
-    /*
-     *  ask the system to listen for incoming connections to the address we just bound. specify that up to 5 pending connection
-     *  requests will be queued by the system, if we are not directly awaiting them using the accept() system call, when they arrive.
-     */
-
-    tries = 120;
-    while ( (rc = listen (socket_fd, 5)) != 0 ) {
-        perror ("listen");
-        sleep (1);
-        if (--tries <= 0)
-            return -1;
-    }
-
-    /* remember size for later usage */
-    size_csa = sizeof (csa);
-
-    printf ( "Serving file '%s' at port %d.\n", file, PORT );
-    printf ( "Server running.\n\n");
-
-    while ( 1 ) {
-        /*
-         * the accept() system call will wait for a connection, and when one is established, a new socket will be created to form
-         * it, and the csa variable will hold the address of the client that just connected to us. the old socket, s, will still
-         * be available for future accept() statements.
-         */
-        /* check for errors -- if any, enter accept mode again */
-        if ( (cs = accept (socket_fd, (struct sockaddr*)&csa, &size_csa)) < 0 ) {
-            continue;
-        }
-
-#if 1
-        len = READ_SOCKET (cs, buff2, sizeof(buff2) );
-        write (2, "-------------------------------------------------------------------------------\n", 80 );
-        write (2, buff2, len );
-        write (2, "-------------------------------------------------------------------------------\n", 80 );
-#endif
-
-        TIME ( start );
-
-        /* ok, we got a new connection. do the job ...  */
-        time ( &epoch );            /* time since 1970  */
-        tm = localtime ( &epoch );  /* fill time-struct */
-        snprintf ( timestring, sizeof (timestring), "%04d-%02d-%02d %02d:%02d:%02d",
-                   tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
-                   tm->tm_hour,        tm->tm_min,     tm->tm_sec );
-
-        /* log connection */
-        printf ( "%s Connection from %s ", timestring, inet_ntoa ( /*(struct in_addr)*/ csa.sin_addr ) );
-
-        /* get the host entry */
-        if ( NULL == ( entry = gethostbyaddr ( (char*)&csa.sin_addr, sizeof (csa.sin_addr), AF_INET ) ) ) {
-#ifdef __linux__
-            herror ("gethostbyaddr"          );
-#else
-            printf ("(no host address info).");
-#endif
-        } else {
-            printf ( "(%s) ... ", entry->h_name );
-        }
-
-        WRITE_SOCKET ( cs, okay, sizeof (okay)-1 );
-
-        /* service connection */
-        total_bytes_written = 0;
-
-        if ( ( fp = fopen (file, "rb") ) == NULL ) {
-            fprintf (stderr, "*** Fatal Error: Could not open file %s.\n", file);
-        }
-        else {
-            do {
-                state      = 0;
-                bytes_read = fread (buff1, 1, sizeof (buff1), fp);
-
-                if ( bytes_read > 0 ) {
-                    total_bytes_written += bytes_wrote = WRITE_SOCKET (cs, buff1, (size_t)bytes_read );
-                    REPORT (fprintf (stderr, " %s: %lld bytes sent.\r", inet_ntoa ((struct in_addr)csa.sin_addr), total_bytes_written));
-                    if (bytes_wrote == bytes_read) {
-                        state = 1;
-                    } else {
-                        REPORT (fprintf (stderr, " Connection closed by foreign host (%d out of %d written).\n", bytes_wrote, bytes_read ));
-                    }
-                }
-
-            } while ( state );
-
-            fclose (fp);
-        }
-
-        /* now close the connection */
-        shutdown (cs, 0);
-        while ( READ_SOCKET (cs, buff2, sizeof(buff2)) > 0 )
-            ;
-        close (cs);
-        TIME ( end );
-
-        dur = DTIME (start, end);
-
-        printf ("\b\b\b\b\b, done. (%ld KBytes sent in %.2f sec = %.2f KB/s)\a\n", (long)(total_bytes_written >> 10), dur, total_bytes_written / dur * 1.e-3 );
-    }
-
-    return 0;
-}
-
-/* end of streamserver.c */
Index: penc/trunk/streamserver.dsp
===================================================================
--- /mppenc/trunk/streamserver.dsp	(revision 96)
+++ 	(revision )
@@ -1,102 +1,0 @@
-# Microsoft Developer Studio Project File - Name="streamserver" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=streamserver - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "streamserver.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "streamserver.mak" CFG="streamserver - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "streamserver - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "streamserver - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "streamserver - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "streamserver - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "streamserver - Win32 Release"
-# Name "streamserver - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\streamserver.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/streamserver.vcproj
===================================================================
--- /mppenc/trunk/streamserver.vcproj	(revision 96)
+++ 	(revision )
@@ -1,168 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="streamserver"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/streamserver.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib ws2_32.lib"
-				OutputFile=".\Release/streamserver.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/streamserver.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/streamserver.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/streamserver.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib ws2_32.lib"
-				OutputFile=".\Debug/streamserver.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/streamserver.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/streamserver.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="streamserver.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/synth.c
===================================================================
--- /mppenc/trunk/synth.c	(revision 96)
+++ 	(revision )
@@ -1,1004 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *  PCM Synthesis (quantized subband samples => PCM output)
- *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  - synth.c/synth.h
- *      portable synthesis routines
- *      nonportable synthesis routines using subroutines in synth_asm.nas
- *
- *  - synth_tab.c/synth_tab.h
- *      2 tables for synthesis routines in C
- *
- *  - synth_asm.nas/synth.h
- *      special subroutines for AMD's 3DNow! and Intel's SIMD
- *      2 more tables for synthesis routines (reordered tables from synth_tab.c)
- *
- *  Note: To fully understand this module you must understand the math behind
- *  subband analysis and subband synthesis.
- */
-
-#include <string.h>
-#include "mppdec.h"
-
-
-#ifdef HAVE_IEEE754_FLOAT
-# define ROUND32(x)   ( floattmp = (x) + (Int32_t)0x00FD8000L, *(Int32_t*)(&floattmp) - (Int32_t)0x4B7D8000L )
-#else
-# define ROUND32(x)   ( (Int32_t) floor ((x) + 0.5) )
-#endif
-
-#ifdef HAVE_IEEE754_DOUBLE
-# define ROUND64(x)   ( doubletmp = (x) + Dither.Add + (Int64_t)0x001FFFFD80000000L, *(Int64_t*)(&doubletmp) - (Int64_t)0x433FFFFD80000000L )
-#else
-# define ROUND64(x)   ( (Int64_t) floor ((x) + Dither.Add) )
-#endif
-
-
-static dither_t  Dither;
-
-#if !defined USE_ASM  ||  defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-
-static void
-Calculate_New_V ( register const Float* Sample, register Float* V )
-{
-    // Calculating of new V-buffer values for left channel (see ISO-11172-3, p. 39)
-    // based on an algorithm by Byeong Gi Lee
-
-    register const Float*  C = Cos64;
-    Float         A00, A01, A02, A03, A04, A05, A06, A07, A08, A09, A10, A11, A12, A13, A14, A15;
-    Float         B00, B01, B02, B03, B04, B05, B06, B07, B08, B09, B10, B11, B12, B13, B14, B15;
-    Float         tmp;
-    Float         tmp2;
-    Uint32_t      togg;
-
-    ENTER(163);
-
-    V += 32;
-
-    A00 = Sample[ 0] + Sample[31];
-    A01 = Sample[ 1] + Sample[30];
-    A02 = Sample[ 3] + Sample[28];
-    A03 = Sample[ 2] + Sample[29];
-    A04 = Sample[ 7] + Sample[24];
-    A05 = Sample[ 6] + Sample[25];
-    A06 = Sample[ 4] + Sample[27];
-    A07 = Sample[ 5] + Sample[26];
-    A08 = Sample[15] + Sample[16];
-    A09 = Sample[14] + Sample[17];
-    A10 = Sample[12] + Sample[19];
-    A11 = Sample[13] + Sample[18];
-    A12 = Sample[ 8] + Sample[23];
-    A13 = Sample[ 9] + Sample[22];
-    A14 = Sample[11] + Sample[20];
-    A15 = Sample[10] + Sample[21];
-
-    B00 =  A00 + A08;
-    B01 =  A01 + A09;
-    B02 =  A02 + A10;
-    B03 =  A03 + A11;
-    B04 =  A04 + A12;
-    B05 =  A05 + A13;
-    B06 =  A06 + A14;
-    B07 =  A07 + A15;
-    B08 = (A00 - A08) * C[ 2];
-    B09 = (A01 - A09) * C[ 6];
-    B10 = (A02 - A10) * C[14];
-    B11 = (A03 - A11) * C[10];
-    B12 = (A04 - A12) * C[30];
-    B13 = (A05 - A13) * C[26];
-    B14 = (A06 - A14) * C[18];
-    B15 = (A07 - A15) * C[22];
-
-    A00 =  B00 + B04;
-    A01 =  B01 + B05;
-    A02 =  B02 + B06;
-    A03 =  B03 + B07;
-    A04 = (B00 - B04) * C[ 4];
-    A05 = (B01 - B05) * C[12];
-    A06 = (B02 - B06) * C[28];
-    A07 = (B03 - B07) * C[20];
-    A08 =  B08 + B12;
-    A09 =  B09 + B13;
-    A10 =  B10 + B14;
-    A11 =  B11 + B15;
-    A12 = (B08 - B12) * C[ 4];
-    A13 = (B09 - B13) * C[12];
-    A14 = (B10 - B14) * C[28];
-    A15 = (B11 - B15) * C[20];
-
-    B00 =  A00 + A02;
-    B01 =  A01 + A03;
-    B02 = (A00 - A02) * C[ 8];
-    B03 = (A01 - A03) * C[24];
-    B04 =  A04 + A06;
-    B05 =  A05 + A07;
-    B06 = (A04 - A06) * C[ 8];
-    B07 = (A05 - A07) * C[24];
-    B08 =  A08 + A10;
-    B09 =  A09 + A11;
-    B10 = (A08 - A10) * C[ 8];
-    B11 = (A09 - A11) * C[24];
-    B12 =  A12 + A14;
-    B13 =  A13 + A15;
-    B14 = (A12 - A14) * C[ 8];
-    B15 = (A13 - A15) * C[24];
-
-    A00 =  B00 + B01;
-    A01 = (B00 - B01) * C[16];
-    A02 =  B02 + B03;
-    A03 = (B02 - B03) * C[16];
-    A04 =  B04 + B05;
-    A05 = (B04 - B05) * C[16];
-    A06 =  B06 + B07;
-    A07 = (B06 - B07) * C[16];
-    A08 =  B08 + B09;
-    A09 = (B08 - B09) * C[16];
-    A10 =  B10 + B11;
-    A11 = (B10 - B11) * C[16];
-    A12 =  B12 + B13;
-    A13 = (B12 - B13) * C[16];
-    A14 =  B14 + B15;
-    A15 = (B14 - B15) * C[16];
-
-    V[48-32] = -A00;
-    V[ 0-32] =  A01;
-    V[40-32] = -A02 - (V[ 8-32] = A03);
-
-    V[36-32] = -((V[ 4-32] = A05 + (V[12-32] = A07)) + A06);
-    V[44-32] = - A04 - A06 - A07;
-
-    V[ 6-32] = (V[10-32] = A11 + (V[14-32] = A15)) + A13;
-    V[38-32] = (V[34-32] = -(V[ 2-32] = A09 + A13 + A15) - A14) + A09 - A10 - A11;
-    V[46-32] = (tmp = -(A12 + A14 + A15)) - A08;
-    V[42-32] = tmp - A10 - A11;
-
-    A00 = (Sample[ 0] - Sample[31]) * C[ 1];
-    A01 = (Sample[ 1] - Sample[30]) * C[ 3];
-    A02 = (Sample[ 3] - Sample[28]) * C[ 7];
-    A03 = (Sample[ 2] - Sample[29]) * C[ 5];
-    A04 = (Sample[ 7] - Sample[24]) * C[15];
-    A05 = (Sample[ 6] - Sample[25]) * C[13];
-    A06 = (Sample[ 4] - Sample[27]) * C[ 9];
-    A07 = (Sample[ 5] - Sample[26]) * C[11];
-    A08 = (Sample[15] - Sample[16]) * C[31];
-    A09 = (Sample[14] - Sample[17]) * C[29];
-    A10 = (Sample[12] - Sample[19]) * C[25];
-    A11 = (Sample[13] - Sample[18]) * C[27];
-    A12 = (Sample[ 8] - Sample[23]) * C[17];
-    A13 = (Sample[ 9] - Sample[22]) * C[19];
-    A14 = (Sample[11] - Sample[20]) * C[23];
-    A15 = (Sample[10] - Sample[21]) * C[21];
-
-    B00 =  A00 + A08;
-    B01 =  A01 + A09;
-    B02 =  A02 + A10;
-    B03 =  A03 + A11;
-    B04 =  A04 + A12;
-    B05 =  A05 + A13;
-    B06 =  A06 + A14;
-    B07 =  A07 + A15;
-    B08 = (A00 - A08) * C[ 2];
-    B09 = (A01 - A09) * C[ 6];
-    B10 = (A02 - A10) * C[14];
-    B11 = (A03 - A11) * C[10];
-    B12 = (A04 - A12) * C[30];
-    B13 = (A05 - A13) * C[26];
-    B14 = (A06 - A14) * C[18];
-    B15 = (A07 - A15) * C[22];
-
-    A00 =  B00 + B04;
-    A01 =  B01 + B05;
-    A02 =  B02 + B06;
-    A03 =  B03 + B07;
-    A04 = (B00 - B04) * C[ 4];
-    A05 = (B01 - B05) * C[12];
-    A06 = (B02 - B06) * C[28];
-    A07 = (B03 - B07) * C[20];
-    A08 =  B08 + B12;
-    A09 =  B09 + B13;
-    A10 =  B10 + B14;
-    A11 =  B11 + B15;
-    A12 = (B08 - B12) * C[ 4];
-    A13 = (B09 - B13) * C[12];
-    A14 = (B10 - B14) * C[28];
-    A15 = (B11 - B15) * C[20];
-
-    B00 =  A00 + A02;
-    B01 =  A01 + A03;
-    B02 = (A00 - A02) * C[ 8];
-    B03 = (A01 - A03) * C[24];
-    B04 =  A04 + A06;
-    B05 =  A05 + A07;
-    B06 = (A04 - A06) * C[ 8];
-    B07 = (A05 - A07) * C[24];
-    B08 =  A08 + A10;
-    B09 =  A09 + A11;
-    B10 = (A08 - A10) * C[ 8];
-    B11 = (A09 - A11) * C[24];
-    B12 =  A12 + A14;
-    B13 =  A13 + A15;
-    B14 = (A12 - A14) * C[ 8];
-    B15 = (A13 - A15) * C[24];
-
-    A00 =  B00 + B01;
-    A01 = (B00 - B01) * C[16];
-    A02 =  B02 + B03;
-    A03 = (B02 - B03) * C[16];
-    A04 =  B04 + B05;
-    A05 = (B04 - B05) * C[16];
-    A06 =  B06 + B07;
-    A07 = (B06 - B07) * C[16];
-    A08 =  B08 + B09;
-    A09 = (B08 - B09) * C[16];
-    A10 =  B10 + B11;
-    A11 = (B10 - B11) * C[16];
-    A12 =  B12 + B13;
-    A13 = (B12 - B13) * C[16];
-    A14 =  B14 + B15;
-    A15 = (B14 - B15) * C[16];
-
-    V[ 5-32] = (V[11-32] = (V[13-32] = A07 + (V[15-32] = A15)) + A11) + A05 + A13;
-    V[ 7-32] = (V[ 9-32] = A03 + A11 + A15) + A13;
-    V[33-32] = -(V[ 1-32] = A01 + (tmp = A09 + A13 + A15)) - A14;
-    V[35-32] = -(V[ 3-32] = A05 + A07 + tmp) - A06 - A14;
-
-    V[37-32] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07;
-    V[39-32] = tmp - A02 - A03;
-    V[41-32] = (tmp += A13 - A12) - A02 - A03;
-    V[43-32] = tmp - (tmp2 = A04 + A06 + A07);
-
-    V[47-32] = (tmp = -(A08 + A12 + A14 + A15)) - A00;
-    V[45-32] = tmp - tmp2;
-
-#if 1  &&  (SIZEOF_Float == 4)
-    // a little improvement in speed is possible if both values directly stored by the code above
-    // this would make this code unnecessary, but enlarges code above.
-    togg = (Uint32_t)0x80000000L;
-    ((Uint32_t*)V)[32-32] = togg + ((Uint32_t*)V)[ 0-32];
-    ((Uint32_t*)V)[31-32] = togg + ((Uint32_t*)V)[ 1-32];
-    ((Uint32_t*)V)[30-32] = togg + ((Uint32_t*)V)[ 2-32];
-    ((Uint32_t*)V)[29-32] = togg + ((Uint32_t*)V)[ 3-32];
-    ((Uint32_t*)V)[28-32] = togg + ((Uint32_t*)V)[ 4-32];
-    ((Uint32_t*)V)[27-32] = togg + ((Uint32_t*)V)[ 5-32];
-    ((Uint32_t*)V)[26-32] = togg + ((Uint32_t*)V)[ 6-32];
-    ((Uint32_t*)V)[25-32] = togg + ((Uint32_t*)V)[ 7-32];
-    ((Uint32_t*)V)[24-32] = togg + ((Uint32_t*)V)[ 8-32];
-    ((Uint32_t*)V)[23-32] = togg + ((Uint32_t*)V)[ 9-32];
-    ((Uint32_t*)V)[22-32] = togg + ((Uint32_t*)V)[10-32];
-    ((Uint32_t*)V)[21-32] = togg + ((Uint32_t*)V)[11-32];
-    ((Uint32_t*)V)[20-32] = togg + ((Uint32_t*)V)[12-32];
-    ((Uint32_t*)V)[19-32] = togg + ((Uint32_t*)V)[13-32];
-    ((Uint32_t*)V)[18-32] = togg + ((Uint32_t*)V)[14-32];
-    ((Uint32_t*)V)[17-32] = togg + ((Uint32_t*)V)[15-32];
-
-    ((Uint32_t*)V)[63-32] = ((Uint32_t*)V)[33-32];
-    ((Uint32_t*)V)[62-32] = ((Uint32_t*)V)[34-32];
-    ((Uint32_t*)V)[61-32] = ((Uint32_t*)V)[35-32];
-    ((Uint32_t*)V)[60-32] = ((Uint32_t*)V)[36-32];
-    ((Uint32_t*)V)[59-32] = ((Uint32_t*)V)[37-32];
-    ((Uint32_t*)V)[58-32] = ((Uint32_t*)V)[38-32];
-    ((Uint32_t*)V)[57-32] = ((Uint32_t*)V)[39-32];
-    ((Uint32_t*)V)[56-32] = ((Uint32_t*)V)[40-32];
-    ((Uint32_t*)V)[55-32] = ((Uint32_t*)V)[41-32];
-    ((Uint32_t*)V)[54-32] = ((Uint32_t*)V)[42-32];
-    ((Uint32_t*)V)[53-32] = ((Uint32_t*)V)[43-32];
-    ((Uint32_t*)V)[52-32] = ((Uint32_t*)V)[44-32];
-    ((Uint32_t*)V)[51-32] = ((Uint32_t*)V)[45-32];
-    ((Uint32_t*)V)[50-32] = ((Uint32_t*)V)[46-32];
-    ((Uint32_t*)V)[49-32] = ((Uint32_t*)V)[47-32];
-#else
-    V[32-32] = -V[ 0-32];
-    V[31-32] = -V[ 1-32];
-    V[30-32] = -V[ 2-32];
-    V[29-32] = -V[ 3-32];
-    V[28-32] = -V[ 4-32];
-    V[27-32] = -V[ 5-32];
-    V[26-32] = -V[ 6-32];
-    V[25-32] = -V[ 7-32];
-    V[24-32] = -V[ 8-32];
-    V[23-32] = -V[ 9-32];
-    V[22-32] = -V[10-32];
-    V[21-32] = -V[11-32];
-    V[20-32] = -V[12-32];
-    V[19-32] = -V[13-32];
-    V[18-32] = -V[14-32];
-    V[17-32] = -V[15-32];
-
-    V[63-32] =  V[33-32];
-    V[62-32] =  V[34-32];
-    V[61-32] =  V[35-32];
-    V[60-32] =  V[36-32];
-    V[59-32] =  V[37-32];
-    V[58-32] =  V[38-32];
-    V[57-32] =  V[39-32];
-    V[56-32] =  V[40-32];
-    V[55-32] =  V[41-32];
-    V[54-32] =  V[42-32];
-    V[53-32] =  V[43-32];
-    V[52-32] =  V[44-32];
-    V[51-32] =  V[45-32];
-    V[50-32] =  V[46-32];
-    V[49-32] =  V[47-32];
-#endif
-    LEAVE(163);
-}
-
-#endif
-
-
-#if !defined USE_ASM  &&  !defined MAKE_16BIT  &&  !defined MAKE_24BIT  &&  !defined MAKE_32BIT
-
-
-void
-Synthese_Filter_16_C ( register Int2x16_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi )
-{
-    Int               n;
-    register Int      k;
-    register Int32_t  Sum;
-    const Float       (*D)[16];
-    const Float*      V;
-#ifdef HAVE_IEEE754_FLOAT
-    Float32_t         floattmp;
-#endif
-
-    ENTER(164);
-    for ( n = 0; n < 36; n++, Yi++ ) {
-        // shifting 64 indices upwards
-        if ( (*offset -= 64) < 0 ) {
-            *offset += 64*VIRT_SHIFT;
-            ENTER(170);
-            memmove ( Vi+64*VIRT_SHIFT, Vi, (16-1)*64*sizeof(*Vi) );
-            LEAVE(170);
-        }
-
-        Calculate_New_V ( *Yi, (Float*)(V = Vi + *offset) );
-
-        // vectoring & windowing & calculating PCM-Output
-        D = Di_opt;
-        for ( k = 0; k < 32; k++, V++, D++ ) {
-            Sum = ROUND32 ( V [  0] * D [0][ 0]
-                          + V [ 96] * D [0][ 1]
-                          + V [128] * D [0][ 2]
-                          + V [224] * D [0][ 3]
-                          + V [256] * D [0][ 4]
-                          + V [352] * D [0][ 5]
-                          + V [384] * D [0][ 6]
-                          + V [480] * D [0][ 7]
-                          + V [512] * D [0][ 8]
-                          + V [608] * D [0][ 9]
-                          + V [640] * D [0][10]
-                          + V [736] * D [0][11]
-                          + V [768] * D [0][12]
-                          + V [864] * D [0][13]
-                          + V [896] * D [0][14]
-                          + V [992] * D [0][15] );
-
-            // copy to PCM
-            if (Sum != (Int16_t)Sum ) {            // prevent from wrap around
-                Dither.Overdrives++;
-                if ( Sum > +Dither.MaxLevel ) Dither.MaxLevel = +Sum;
-                if ( Sum < -Dither.MaxLevel ) Dither.MaxLevel = -Sum;
-                Sum = (Sum >> 31) ^ 0x7FFF;
-            }
-
-            Stream [0] [0] = (Int16_t)Sum;
-            Stream++;
-        }
-    }
-    LEAVE(164);
-    return;
-}
-
-
-#endif
-
-
-#if defined USE_ASM  &&  !defined MAKE_16BIT  &&  !defined MAKE_24BIT  &&  !defined MAKE_32BIT
-
-static void
-Synthese_Filter_16_i387 ( Int2x16_t* Stream, Int* const offset, Float* Vi, const Float Yi[][32] )
-{
-    Int           n;
-    Int           k;
-    register Int32_t  Sum;
-    const Float*  V;
-    Int32_t       scratch [32+8];
-    Int32_t*      scratchptr = (Int32_t*) ALIGN ( scratch, 0x20 );
-
-    ENTER(171);
-    for ( n = 0; n < 36; n++, Yi++ ) {
-        // shifting 64 indices upwards
-        if ( (*offset -= 64) < 0 ) {
-            *offset += 64*VIRT_SHIFT;
-            ENTER(170);
-            memmove ( Vi+64*VIRT_SHIFT, Vi, (16-1)*64*sizeof(*Vi) );
-            LEAVE(170);
-        }
-
-        ENTER(172);
-        Calculate_New_V_i387 ( *Yi, (Float*)(V = Vi + *offset) );
-        LEAVE(172);
-
-        // vectoring & windowing & calculating PCM-Output
-        VectorMult_i387 ( scratchptr, V );
-        for ( k = 0; k < 32; k++ ) {
-            Sum = scratchptr[k] - (Int32_t)0x4B7D8000L;
-            if (Sum != (Int16_t)Sum ) {            // prevent from wrap-around
-                Dither.Overdrives++;
-                if ( Sum > +Dither.MaxLevel ) Dither.MaxLevel = +Sum;
-                if ( Sum < -Dither.MaxLevel ) Dither.MaxLevel = -Sum;
-                Sum = (Sum >> 31) ^ 0x7FFF;
-            }
-
-            Stream [0] [0] = (Int16_t) Sum;
-            Stream++;
-        }
-    }
-
-    LEAVE(171);
-    return;
-}
-
-
-static void
-Synthese_Filter_16_3DNow ( Int2x16_t* Stream, Int* const offset, Float* Vi, const Float Yi[][32] )
-{
-    Int           n;
-    Int           k;
-    const Float*  V;
-    Int32_t       scratch [32+8];
-    Int32_t*      scratchptr = (Int32_t*) ALIGN ( scratch, 0x20 );
-
-    ENTER(171);
-    for ( n = 0; n < 36; n++, Yi++ ) {
-        // shifting 64 indices upwards
-        if ( (*offset -= 64) < 0 ) {
-            *offset += 64*VIRT_SHIFT;
-            ENTER(170);
-            memcpy_dn_MMX ( Vi+64*VIRT_SHIFT, Vi, (16-1)*sizeof(*Vi) );
-            //memmove ( Vi+64*VIRT_SHIFT, Vi, (16-1)*64*sizeof(*Vi) );
-            LEAVE(170);
-        }
-
-        ENTER(172);
-        Calculate_New_V_3DNow ( *Yi, (Float*)(V = Vi + *offset) );
-        LEAVE(172);
-
-        // vectoring & windowing & calculating PCM-Output
-        VectorMult_3DNow ( scratchptr, V );
-        for ( k = 0; k < 32; k++ ) {
-            Stream [0] [0] = (Int16_t)(scratchptr[k] >> 16);  // access differently to make shifts obsolete ???
-            Stream++;
-        }
-    }
-    Reset_FPU_3DNow ();
-
-    LEAVE(171);
-    return;
-}
-
-
-static void
-Calculate_New_V_SIMD ( const Float* Sample, Float* V )
-{
-    // Calculating of new V-buffer values for left channel (see ISO-11172-3, p. 39)
-    // based on an algorithm by Byeong Gi Lee
-
-    Float     __A [32 + 8];
-    Float*    A = (Float*) ALIGN ( __A, 0x20 );
-    Float     tmp;
-    Float     tmp2;
-    Uint32_t  togg;
-
-    ENTER(163);
-
-    V += 32;
-
-    New_V_Helper2 ( A, Sample );
-
-    V[48-32] = -A[ 0];
-    V[ 0-32] =  A[ 1];
-    V[40-32] = -A[ 2] - (V[ 8-32] = A[ 3]);
-
-    V[36-32] = -((V[ 4-32] = A[ 5] + (V[12-32] = A[ 7])) + A[ 6]);
-    V[44-32] = - A[ 4] - A[ 6] - A[ 7];
-
-    V[ 6-32] = (V[10-32] = A[11] + (V[14-32] = A[15])) + A[13];
-    V[38-32] = (V[34-32] = -(V[ 2-32] = A[ 9] + A[13] + A[15]) - A[14]) + A[ 9] - A[10] - A[11];
-    V[46-32] = (tmp = -(A[12] + A[14] + A[15])) - A[ 8];
-    V[42-32] = tmp - A[10] - A[11];
-
-    New_V_Helper3 ( A, Sample );
-
-    V[ 5-32] = (V[11-32] = (V[13-32] = A[ 7] + (V[15-32] = A[15])) + A[11]) + A[ 5] + A[13];
-    V[ 7-32] = (V[ 9-32] = A[ 3] + A[11] + A[15]) + A[13];
-    V[33-32] = -(V[ 1-32] = A[ 1] + (tmp = A[ 9] + A[13] + A[15])) - A[14];
-    V[35-32] = -(V[ 3-32] = A[ 5] + A[ 7] + tmp) - A[ 6] - A[14];
-
-    V[37-32] = (tmp = -(A[10] + A[11] + A[13] + A[14] + A[15])) - A[ 5] - A[ 6] - A[ 7];
-    V[39-32] = tmp - A[ 2] - A[ 3];
-    V[41-32] = (tmp += A[13] - A[12]) - A[ 2] - A[ 3];
-    V[43-32] = tmp - (tmp2 = A[ 4] + A[ 6] + A[ 7]);
-
-    V[47-32] = (tmp = -(A[ 8] + A[12] + A[14] + A[15])) - A[ 0];
-    V[45-32] = tmp - tmp2;
-
-#if 0
-    New_V_Helper4 ( V );                                            // slower
-#elif 1
-    // a little improvement in speed is possible if both values directly stored by the code above
-    // this would make this code unnecessary, but enlarges code above.
-    togg = (Uint32_t)0x80000000L;
-    ((Uint32_t*)V)[32-32] = togg + ((Uint32_t*)V)[ 0-32];
-    ((Uint32_t*)V)[31-32] = togg + ((Uint32_t*)V)[ 1-32];
-    ((Uint32_t*)V)[30-32] = togg + ((Uint32_t*)V)[ 2-32];
-    ((Uint32_t*)V)[29-32] = togg + ((Uint32_t*)V)[ 3-32];
-    ((Uint32_t*)V)[28-32] = togg + ((Uint32_t*)V)[ 4-32];
-    ((Uint32_t*)V)[27-32] = togg + ((Uint32_t*)V)[ 5-32];
-    ((Uint32_t*)V)[26-32] = togg + ((Uint32_t*)V)[ 6-32];
-    ((Uint32_t*)V)[25-32] = togg + ((Uint32_t*)V)[ 7-32];
-    ((Uint32_t*)V)[24-32] = togg + ((Uint32_t*)V)[ 8-32];
-    ((Uint32_t*)V)[23-32] = togg + ((Uint32_t*)V)[ 9-32];
-    ((Uint32_t*)V)[22-32] = togg + ((Uint32_t*)V)[10-32];
-    ((Uint32_t*)V)[21-32] = togg + ((Uint32_t*)V)[11-32];
-    ((Uint32_t*)V)[20-32] = togg + ((Uint32_t*)V)[12-32];
-    ((Uint32_t*)V)[19-32] = togg + ((Uint32_t*)V)[13-32];
-    ((Uint32_t*)V)[18-32] = togg + ((Uint32_t*)V)[14-32];
-    ((Uint32_t*)V)[17-32] = togg + ((Uint32_t*)V)[15-32];
-
-    ((Uint32_t*)V)[63-32] = ((Uint32_t*)V)[33-32];
-    ((Uint32_t*)V)[62-32] = ((Uint32_t*)V)[34-32];
-    ((Uint32_t*)V)[61-32] = ((Uint32_t*)V)[35-32];
-    ((Uint32_t*)V)[60-32] = ((Uint32_t*)V)[36-32];
-    ((Uint32_t*)V)[59-32] = ((Uint32_t*)V)[37-32];
-    ((Uint32_t*)V)[58-32] = ((Uint32_t*)V)[38-32];
-    ((Uint32_t*)V)[57-32] = ((Uint32_t*)V)[39-32];
-    ((Uint32_t*)V)[56-32] = ((Uint32_t*)V)[40-32];
-    ((Uint32_t*)V)[55-32] = ((Uint32_t*)V)[41-32];
-    ((Uint32_t*)V)[54-32] = ((Uint32_t*)V)[42-32];
-    ((Uint32_t*)V)[53-32] = ((Uint32_t*)V)[43-32];
-    ((Uint32_t*)V)[52-32] = ((Uint32_t*)V)[44-32];
-    ((Uint32_t*)V)[51-32] = ((Uint32_t*)V)[45-32];
-    ((Uint32_t*)V)[50-32] = ((Uint32_t*)V)[46-32];
-    ((Uint32_t*)V)[49-32] = ((Uint32_t*)V)[47-32];
-#else
-    V[32-32] = -V[ 0-32];
-    V[31-32] = -V[ 1-32];
-    V[30-32] = -V[ 2-32];
-    V[29-32] = -V[ 3-32];
-    V[28-32] = -V[ 4-32];
-    V[27-32] = -V[ 5-32];
-    V[26-32] = -V[ 6-32];
-    V[25-32] = -V[ 7-32];
-    V[24-32] = -V[ 8-32];
-    V[23-32] = -V[ 9-32];
-    V[22-32] = -V[10-32];
-    V[21-32] = -V[11-32];
-    V[20-32] = -V[12-32];
-    V[19-32] = -V[13-32];
-    V[18-32] = -V[14-32];
-    V[17-32] = -V[15-32];
-
-    V[63-32] =  V[33-32];
-    V[62-32] =  V[34-32];
-    V[61-32] =  V[35-32];
-    V[60-32] =  V[36-32];
-    V[59-32] =  V[37-32];
-    V[58-32] =  V[38-32];
-    V[57-32] =  V[39-32];
-    V[56-32] =  V[40-32];
-    V[55-32] =  V[41-32];
-    V[54-32] =  V[42-32];
-    V[53-32] =  V[43-32];
-    V[52-32] =  V[44-32];
-    V[51-32] =  V[45-32];
-    V[50-32] =  V[46-32];
-    V[49-32] =  V[47-32];
-#endif
-    LEAVE(163);
-}
-
-
-static void
-Synthese_Filter_16_SIMD ( Int2x16_t* Stream, Int* const offset, Float* Vi, const Float Yi[][32] )
-{
-    Int           n;
-    Int           k;
-    Int32_t       Sum;
-    const Float*  V;
-    Int32_t       scratch [32+8];
-    Int32_t*      scratchptr = (Int32_t*) ALIGN ( scratch, 0x20 );
-
-    ENTER(241);
-    for ( n = 0; n < 36; n++, Yi++ ) {
-        // shifting 64 indices upwards
-        if ( (*offset -= 64) < 0 ) {
-            *offset += 64*VIRT_SHIFT;
-            ENTER(240);
-#if 0
-            memcpy_dn_SIMD ( Vi+64*VIRT_SHIFT, Vi, (16-1)*sizeof(*Vi)/2 );  // is slower!!!
-#else
-            memcpy_dn_MMX ( Vi+64*VIRT_SHIFT, Vi, (16-1)*sizeof(*Vi) );
-            Reset_FPU ();
-#endif
-            LEAVE(240);
-        }
-
-        ENTER(242);
-        Calculate_New_V_SIMD ( *Yi, (Float*)(V = Vi + *offset) );
-        LEAVE(242);
-
-        // vectoring & windowing & calculating PCM-Output
-        VectorMult_SIMD ( scratchptr, V );
-        for ( k = 0; k < 32; k++ ) {
-            Sum = scratchptr [k] - (Int32_t)0x537D8000L;
-            if (Sum != (Int16_t)Sum ) {            // prevent from wrap around
-                Dither.Overdrives++;
-                if ( Sum > +Dither.MaxLevel ) Dither.MaxLevel = +Sum;
-                if ( Sum < -Dither.MaxLevel ) Dither.MaxLevel = -Sum;
-                Sum = (Sum >> 31) ^ 0x7FFF;
-            }
-
-            Stream [0] [0] = (Int16_t)Sum;
-            Stream++;
-        }
-    }
-
-    LEAVE(241);
-    return;
-}
-
-#pragma warning ( disable: 4550 )
-SyntheseFilter16_t
-Get_Synthese_Filter ( void )
-{
-#ifdef USE_ASM
-    if ( Has_3DNow () )
-        return Synthese_Filter_16_3DNow;
-    if ( Has_SIMD  () )
-        return Synthese_Filter_16_SIMD;
-    return Synthese_Filter_16_i387;
-#else
-    return Synthese_Filter_16_C;
-#endif
-}
-#pragma warning ( default: 4550 )
-
-
-#endif
-
-
-static const  Uchar    Parity [256] = {  // parity
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
-    1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
-};
-
-static Uint32_t  __r1 = 1;
-static Uint32_t  __r2 = 1;
-
-
-/*
- *  This is a simple random number generator with good quality for audio purposes.
- *  It consists of two polycounters with opposite rotation direction and different
- *  periods. The periods are coprime, so the total period is the product of both.
- *
- *     -------------------------------------------------------------------------------------------------
- * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
- * |   -------------------------------------------------------------------------------------------------
- * |                                                                             |  |  |  |     |     |
- * |                                                                             +--+--+-XOR----+-----+
- * |                                                                                      |
- * +--------------------------------------------------------------------------------------+
- *
- *     -------------------------------------------------------------------------------------------------
- *     |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
- *     -------------------------------------------------------------------------------------------------   |
- *       |  |           |  |                                                                               |
- *       +--+----XOR----+--+                                                                               |
- *                |                                                                                        |
- *                +----------------------------------------------------------------------------------------+
- *
- *
- *  The first has a period of 3*5*17*257*65537, the second of 7*47*73*178481,
- *  which gives a period of 18.410.713.077.675.721.215. The result is the
- *  XORed values of both generators.
- */
-
-static void
-set_seed ( Uint32_t  seed )
-{
-    __r1 = seed != 0 ? seed : 1;                // 0 is a forbidden value which locks the generator
-    __r2 = 1;                                   // the are several (8389119) forbidden codes. 1 is not one of them
-}
-
-
-Uint32_t
-random_int ( void )
-{
-#if 1
-    Uint32_t  t1, t2, t3, t4;
-
-    t3   = t1 = __r1;   t4   = t2 = __r2;       // Parity calculation is done via table lookup, this is also available
-    t1  &= 0xF5;        t2 >>= 25;              // on CPUs without parity, can be implemented in C and avoid unpredictable
-    t1   = Parity [t1]; t2  &= 0x63;            // jumps and slow rotate through the carry flag operations.
-    t1 <<= 31;          t2   = Parity [t2];
-
-    return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
-#else
-    return (__r1 = (__r1 >> 1) | ((Uint32_t)Parity [__r1 & 0xF5] << 31) ) ^
-           (__r2 = (__r2 << 1) |  (Uint32_t)Parity [(__r2 >> 25) & 0x63] );
-#endif
-}
-
-
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-
-/***********************************************************************************************************************/
-
-static Double
-Random_Equi ( Double mult )                     // gives an equally distributed random number
-{                                               // between -2^31*mult and +2^31*mult
-    return mult * (Int32_t) random_int ();
-}
-
-static Double
-Random_Triangular ( Double mult )               // gives a triangular-distributed random number
-{                                               // between -2^32*mult and +2^32*mult
-    return mult * ( (Double) (Int32_t) random_int () + (Double) (Int32_t) random_int () );
-}
-
-
-/*********************************************************************************************************************/
-
-static const Float  F44_0 [16 + 32] = {
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0,
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0,
-
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0,
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0,
-
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0,
-    (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0, (Float)0
-};
-
-
-static const Float  F44_1 [16 + 32] = {  /* SNR(w) = 4.843163 dB, SNR = -3.192134 dB */
-    (Float) 0.85018292704024355931, (Float) 0.29089597350995344721, (Float)-0.05021866022121039450, (Float)-0.23545456294599161833,
-    (Float)-0.58362726442227032096, (Float)-0.67038978965193036429, (Float)-0.38566861572833459221, (Float)-0.15218663390367969967,
-    (Float)-0.02577543084864530676, (Float) 0.14119295297688728127, (Float) 0.22398848581628781612, (Float) 0.15401727203382084116,
-    (Float) 0.05216161232906000929, (Float)-0.00282237820999675451, (Float)-0.03042794608323867363, (Float)-0.03109780942998826024,
-
-    (Float) 0.85018292704024355931, (Float) 0.29089597350995344721, (Float)-0.05021866022121039450, (Float)-0.23545456294599161833,
-    (Float)-0.58362726442227032096, (Float)-0.67038978965193036429, (Float)-0.38566861572833459221, (Float)-0.15218663390367969967,
-    (Float)-0.02577543084864530676, (Float) 0.14119295297688728127, (Float) 0.22398848581628781612, (Float) 0.15401727203382084116,
-    (Float) 0.05216161232906000929, (Float)-0.00282237820999675451, (Float)-0.03042794608323867363, (Float)-0.03109780942998826024,
-
-    (Float) 0.85018292704024355931, (Float) 0.29089597350995344721, (Float)-0.05021866022121039450, (Float)-0.23545456294599161833,
-    (Float)-0.58362726442227032096, (Float)-0.67038978965193036429, (Float)-0.38566861572833459221, (Float)-0.15218663390367969967,
-    (Float)-0.02577543084864530676, (Float) 0.14119295297688728127, (Float) 0.22398848581628781612, (Float) 0.15401727203382084116,
-    (Float) 0.05216161232906000929, (Float)-0.00282237820999675451, (Float)-0.03042794608323867363, (Float)-0.03109780942998826024,
-};
-
-
-static const Float  F44_2 [16 + 32] = {  /* SNR(w) = 10.060213 dB, SNR = -12.766730 dB */
-    (Float) 1.78827593892108555290, (Float) 0.95508210637394326553, (Float)-0.18447626783899924429, (Float)-0.44198126506275016437,
-    (Float)-0.88404052492547413497, (Float)-1.42218907262407452967, (Float)-1.02037566838362314995, (Float)-0.34861755756425577264,
-    (Float)-0.11490230170431934434, (Float) 0.12498899339968611803, (Float) 0.38065885268563131927, (Float) 0.31883491321310506562,
-    (Float) 0.10486838686563442765, (Float)-0.03105361685110374845, (Float)-0.06450524884075370758, (Float)-0.02939198261121969816,
-
-    (Float) 1.78827593892108555290, (Float) 0.95508210637394326553, (Float)-0.18447626783899924429, (Float)-0.44198126506275016437,
-    (Float)-0.88404052492547413497, (Float)-1.42218907262407452967, (Float)-1.02037566838362314995, (Float)-0.34861755756425577264,
-    (Float)-0.11490230170431934434, (Float) 0.12498899339968611803, (Float) 0.38065885268563131927, (Float) 0.31883491321310506562,
-    (Float) 0.10486838686563442765, (Float)-0.03105361685110374845, (Float)-0.06450524884075370758, (Float)-0.02939198261121969816,
-
-    (Float) 1.78827593892108555290, (Float) 0.95508210637394326553, (Float)-0.18447626783899924429, (Float)-0.44198126506275016437,
-    (Float)-0.88404052492547413497, (Float)-1.42218907262407452967, (Float)-1.02037566838362314995, (Float)-0.34861755756425577264,
-    (Float)-0.11490230170431934434, (Float) 0.12498899339968611803, (Float) 0.38065885268563131927, (Float) 0.31883491321310506562,
-    (Float) 0.10486838686563442765, (Float)-0.03105361685110374845, (Float)-0.06450524884075370758, (Float)-0.02939198261121969816,
-};
-
-
-static const Float  F44_3 [16 + 32] = {  /* SNR(w) = 15.382598 dB, SNR = -29.402334 dB */
-    (Float) 2.89072132015058161445, (Float) 2.68932810943698754106, (Float) 0.21083359339410251227, (Float)-0.98385073324997617515,
-    (Float)-1.11047823227097316719, (Float)-2.18954076314139673147, (Float)-2.36498032881953056225, (Float)-0.95484132880101140785,
-    (Float)-0.23924057925542965158, (Float)-0.13865235703915925642, (Float) 0.43587843191057992846, (Float) 0.65903257226026665927,
-    (Float) 0.24361815372443152787, (Float)-0.00235974960154720097, (Float) 0.01844166574603346289, (Float) 0.01722945988740875099,
-
-    (Float) 2.89072132015058161445, (Float) 2.68932810943698754106, (Float) 0.21083359339410251227, (Float)-0.98385073324997617515,
-    (Float)-1.11047823227097316719, (Float)-2.18954076314139673147, (Float)-2.36498032881953056225, (Float)-0.95484132880101140785,
-    (Float)-0.23924057925542965158, (Float)-0.13865235703915925642, (Float) 0.43587843191057992846, (Float) 0.65903257226026665927,
-    (Float) 0.24361815372443152787, (Float)-0.00235974960154720097, (Float) 0.01844166574603346289, (Float) 0.01722945988740875099,
-
-    (Float) 2.89072132015058161445, (Float) 2.68932810943698754106, (Float) 0.21083359339410251227, (Float)-0.98385073324997617515,
-    (Float)-1.11047823227097316719, (Float)-2.18954076314139673147, (Float)-2.36498032881953056225, (Float)-0.95484132880101140785,
-    (Float)-0.23924057925542965158, (Float)-0.13865235703915925642, (Float) 0.43587843191057992846, (Float) 0.65903257226026665927,
-    (Float) 0.24361815372443152787, (Float)-0.00235974960154720097, (Float) 0.01844166574603346289, (Float) 0.01722945988740875099
-};
-
-
-static Double
-scalar16 ( const Float* x, const Float* y )
-{
-    return x[ 0]*y[ 0] + x[ 1]*y[ 1] + x[ 2]*y[ 2] + x[ 3]*y[ 3]
-         + x[ 4]*y[ 4] + x[ 5]*y[ 5] + x[ 6]*y[ 6] + x[ 7]*y[ 7]
-         + x[ 8]*y[ 8] + x[ 9]*y[ 9] + x[10]*y[10] + x[11]*y[11]
-         + x[12]*y[12] + x[13]*y[13] + x[14]*y[14] + x[15]*y[15];
-}
-
-
-void
-Init_Dither ( Int bits, int shapingtype, Double dither )
-{
-    static Uint8_t        default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67,  0,  0 };
-    static const Float*   F              [] = { F44_0, F44_1, F44_2, F44_3 };
-    int                   index;
-
-    if (bits > SAMPLE_SIZE)
-        bits = SAMPLE_SIZE;
-
-    if (shapingtype < 0) shapingtype = 0;
-    if (shapingtype > 3) shapingtype = 3;
-    index = bits - 11 - shapingtype;
-    if (index < 0) index = 0;
-    if (index > 9) index = 9;
-
-    memset ( Dither.ErrorHistory , 0, sizeof (Dither.ErrorHistory ) );
-    memset ( Dither.DitherHistory, 0, sizeof (Dither.DitherHistory) );
-
-    Dither.FilterCoeff = F [shapingtype];
-    Dither.Mask   = ((Uint64_t)-1) << (32 - bits);
-#ifdef HAVE_IEEE754_DOUBLE
-    Dither.Add    = 0.5     * ((1L << (32 - bits)) - 1);
-#else
-    Dither.Add    = 0.5     * ((1L << (32 - bits)) - 0);
-#endif
-    Dither.Dither = (dither >= 0.00 ? dither : 0.01*default_dither[index]) / (((Int64_t)1) << bits);
-    Dither.NoShaping = shapingtype == 0;
-}
-
-
-void
-Synthese_Filter_32_C ( register Int2x32_t* Stream, Int* const offset, Float* Vi, const FloatArray* Yi, Uint channel )
-{
-    Int               n;
-    register Int      k;
-    Double            Sum;
-    Double            Sum2;
-    Int64_t           val;
-    const Float       (*D)[16];
-    const Float*      V;
-#ifdef HAVE_IEEE754_DOUBLE
-    Float64_t         doubletmp;
-#endif
-
-    ENTER(167);
-    for ( n = 0; n < 36; n++, Yi++ ) {
-
-        // shifting upwards by 64 Indices
-        if ( (*offset -= 64) < 0 ) {
-            *offset += 64*VIRT_SHIFT;
-            ENTER(170);
-            memmove ( Vi+64*VIRT_SHIFT, Vi, (16-1)*64*sizeof(*Vi) );
-            LEAVE(170);
-        }
-
-        Calculate_New_V ( *Yi, (Float*)(V = Vi + *offset) );
-
-        // vectoring & windowing & calculating PCM-Output
-        D = Di_opt;
-        for ( k = 0; k < 32; k++, V++, D++ ) {
-            Sum = ( V [  0] * D [0][ 0]
-                  + V [ 96] * D [0][ 1]
-                  + V [128] * D [0][ 2]
-                  + V [224] * D [0][ 3]
-                  + V [256] * D [0][ 4]
-                  + V [352] * D [0][ 5]
-                  + V [384] * D [0][ 6]
-                  + V [480] * D [0][ 7]
-                  + V [512] * D [0][ 8]
-                  + V [608] * D [0][ 9]
-                  + V [640] * D [0][10]
-                  + V [736] * D [0][11]
-                  + V [768] * D [0][12]
-                  + V [864] * D [0][13]
-                  + V [896] * D [0][14]
-                  + V [992] * D [0][15] ) * 65536.;
-
-#if 1
-            // Noise shaping and dithering
-            if ( Dither.NoShaping ) {
-                Double  tmp = Random_Equi ( Dither.Dither );
-                Sum2 = tmp - Dither.LastRandomNumber [channel];
-                Dither.LastRandomNumber [channel] = tmp;
-                Sum2 = Sum += Sum2;
-            }
-            else {
-                Sum2  = Random_Triangular ( Dither.Dither ) - scalar16 ( Dither.DitherHistory[channel], Dither.FilterCoeff + k );
-                Sum  += Dither.DitherHistory [channel] [(-1-k)&15] = Sum2;
-                Sum2  = Sum + scalar16 ( Dither.ErrorHistory [channel], Dither.FilterCoeff + k );
-            }
-
-            val = ROUND64 (Sum2)  &  Dither.Mask;
-            if ( val != (Int32_t) val ) {
-                memset ( Dither.ErrorHistory [channel], 0, sizeof (Dither.ErrorHistory[0]) );
-                Dither.Overdrives++;
-                if ( val > +Dither.MaxLevel ) Dither.MaxLevel = +val;
-                if ( val < -Dither.MaxLevel ) Dither.MaxLevel = -val;
-                val = (val >> 63) ^ 0x7FFFFFFF;
-            } else {
-                Dither.ErrorHistory [channel] [(-1-k)&15] = (Float)(Sum - val);
-            }
-#else
-            // Noise shaping and dithering
-            Sum2  = Random ( Dither.Dither ) - scalar16 ( Dither.DitherHistory[channel], Dither.FilterCoeff );
-            memmove ( Dither.DitherHistory [channel] + 1, Dither.DitherHistory [channel] + 0, sizeof(Dither.DitherHistory[0]) - sizeof(Dither.DitherHistory[0][0]) );
-            Dither.DitherHistory [channel] [0] = Sum2;
-
-            Sum   = Sum + Dither.DitherHistory [channel] [0];
-            Sum2  = Sum + scalar16 ( Dither.ErrorHistory [channel], Dither.FilterCoeff );
-            val   = (Int64_t) (floor ( Sum2 + Dither.Add ))  &  Dither.Mask;
-            if ( val != (Int32_t) val ) {
-                memset ( Dither.ErrorHistory [channel], 0, sizeof (Dither.ErrorHistory[0]) );
-                Dither.Overdrives++;
-                if ( val > +Dither.MaxLevel ) Dither.MaxLevel = +val;
-                if ( val < -Dither.MaxLevel ) Dither.MaxLevel = -val;
-                val = (val >> 63) ^ 0x7FFFFFFF;
-            } else {
-                memmove ( Dither.ErrorHistory [channel] + 1, Dither.ErrorHistory [channel] + 0, sizeof(Dither.ErrorHistory[0]) - sizeof(Dither.ErrorHistory[0][0]) );
-                Dither.ErrorHistory [channel] [0] = Sum - val;
-            }
-#endif
-
-            // copy to PCM
-            Stream [0] [0] = (Int32_t)val;
-            Stream++;
-        }
-    }
-    LEAVE(167);
-    return;
-}
-
-#endif /* defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT */
-
-
-void
-OverdriveReport ( void )
-{
-    if ( Dither.Overdrives > 0 ) {
-#if defined MAKE_16BIT  ||  defined MAKE_24BIT  ||  defined MAKE_32BIT
-        stderr_printf ( "\n%5lu Overdrive%s, maximum level %.1f, rerun with --scale %.5f\n",
-                        (Ulong)Dither.Overdrives, Dither.Overdrives==1 ? "" : "s", (Double)(Int64_t)Dither.MaxLevel*(1/65536.), (Int64_t)(Dither.Mask & 0x7FFFFFFFL)/((Double)(Int64_t)Dither.MaxLevel+1) - 0.5e-5 );
-#else
-        stderr_printf ( "\n%5lu Overdrive%s, maximum level %lu, rerun with --scale %.5f\n",
-                        (Ulong)Dither.Overdrives, Dither.Overdrives==1 ? "" : "s", (Ulong)Dither.MaxLevel, (Double)0x7FFF/(Dither.MaxLevel+1) - 0.5e-5 );
-#endif
-        Dither.Overdrives = 0;
-        Dither.MaxLevel   = 0;
-    }
-}
-
-/* end of synth.c */
Index: penc/trunk/synthasm.nas
===================================================================
--- /mppenc/trunk/synthasm.nas	(revision 96)
+++ 	(revision )
@@ -1,2227 +1,0 @@
-; Musepack audio compression
-; Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
-; 
-; This library is free software; you can redistribute it and/or
-; modify it under the terms of the GNU Lesser General Public
-; License as published by the Free Software Foundation; either
-; version 2.1 of the License, or (at your option) any later version.
-; 
-; This library is distributed in the hope that it will be useful,
-; but WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-; Lesser General Public License for more details.
-; 
-; You should have received a copy of the GNU Lesser General Public
-; License along with this library; if not, write to the Free Software
-; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-;%define USE_FXCH
-
-%include "tools.inc"
-;
-
-;*************************************************************************
-
-                segment_data
-
-                align   32
-Di_opt_SIMD     dd      0.0,     -1.0,     -1.0,     -1.0
-                dd    -29.0,    -31.0,    -35.0,    -38.0
-                dd    213.0,    218.0,    222.0,    225.0
-                dd   -459.0,   -519.0,   -581.0,   -645.0
-                dd   2037.0,   2000.0,   1952.0,   1893.0
-                dd  -5153.0,  -5517.0,  -5879.0,  -6237.0
-                dd   6574.0,   5959.0,   5288.0,   4561.0
-                dd -37489.0, -39336.0, -41176.0, -43006.0
-                dd  75038.0,  74992.0,  74856.0,  74630.0
-                dd  37489.0,  35640.0,  33791.0,  31947.0
-                dd   6574.0,   7134.0,   7640.0,   8092.0
-                dd   5153.0,   4788.0,   4425.0,   4063.0
-                dd   2037.0,   2063.0,   2080.0,   2087.0
-                dd    459.0,    401.0,    347.0,    294.0
-                dd    213.0,    208.0,    202.0,    196.0
-                dd     29.0,     26.0,     24.0,     21.0
-
-                dd     -1.0,     -1.0,     -1.0,     -2.0
-                dd    -41.0,    -45.0,    -49.0,    -53.0
-                dd    227.0,    228.0,    228.0,    227.0
-                dd   -711.0,   -779.0,   -848.0,   -919.0
-                dd   1822.0,   1739.0,   1644.0,   1535.0
-                dd  -6589.0,  -6935.0,  -7271.0,  -7597.0
-                dd   3776.0,   2935.0,   2037.0,   1082.0
-                dd -44821.0, -46617.0, -48390.0, -50137.0
-                dd  74313.0,  73908.0,  73415.0,  72835.0
-                dd  30112.0,  28289.0,  26482.0,  24694.0
-                dd   8492.0,   8840.0,   9139.0,   9389.0
-                dd   3705.0,   3351.0,   3004.0,   2663.0
-                dd   2085.0,   2075.0,   2057.0,   2032.0
-                dd    244.0,    197.0,    153.0,    111.0
-                dd    190.0,    183.0,    176.0,    169.0
-                dd     19.0,     17.0,     16.0,     14.0
-
-                dd     -2.0,     -2.0,     -2.0,     -3.0
-                dd    -58.0,    -63.0,    -68.0,    -73.0
-                dd    224.0,    221.0,    215.0,    208.0
-                dd   -991.0,  -1064.0,  -1137.0,  -1210.0
-                dd   1414.0,   1280.0,   1131.0,    970.0
-                dd  -7910.0,  -8209.0,  -8491.0,  -8755.0
-                dd     70.0,   -998.0,  -2122.0,  -3300.0
-                dd -51853.0, -53534.0, -55178.0, -56778.0
-                dd  72169.0,  71420.0,  70590.0,  69679.0
-                dd  22929.0,  21189.0,  19478.0,  17799.0
-                dd   9592.0,   9750.0,   9863.0,   9935.0
-                dd   2330.0,   2006.0,   1692.0,   1388.0
-                dd   2001.0,   1962.0,   1919.0,   1870.0
-                dd     72.0,     36.0,      2.0,    -29.0
-                dd    161.0,    154.0,    147.0,    139.0
-                dd     13.0,     11.0,     10.0,      9.0
-
-                dd     -3.0,     -4.0,     -4.0,     -5.0
-                dd    -79.0,    -85.0,    -91.0,    -97.0
-                dd    200.0,    189.0,    177.0,    163.0
-                dd  -1283.0,  -1356.0,  -1428.0,  -1498.0
-                dd    794.0,    605.0,    402.0,    185.0
-                dd  -8998.0,  -9219.0,  -9416.0,  -9585.0
-                dd  -4533.0,  -5818.0,  -7154.0,  -8540.0
-                dd -58333.0, -59838.0, -61289.0, -62684.0
-                dd  68692.0,  67629.0,  66494.0,  65290.0
-                dd  16155.0,  14548.0,  12980.0,  11455.0
-                dd   9966.0,   9959.0,   9916.0,   9838.0
-                dd   1095.0,    814.0,    545.0,    288.0
-                dd   1817.0,   1759.0,   1698.0,   1634.0
-                dd    -57.0,    -83.0,   -106.0,   -127.0
-                dd    132.0,    125.0,    117.0,    111.0
-                dd      8.0,      7.0,      7.0,      6.0
-
-                dd     -5.0,     -6.0,     -7.0,     -7.0
-                dd   -104.0,   -111.0,   -117.0,   -125.0
-                dd    146.0,    127.0,    106.0,     83.0
-                dd  -1567.0,  -1634.0,  -1698.0,  -1759.0
-                dd    -45.0,   -288.0,   -545.0,   -814.0
-                dd  -9727.0,  -9838.0,  -9916.0,  -9959.0
-                dd  -9975.0, -11455.0, -12980.0, -14548.0
-                dd -64019.0, -65290.0, -66494.0, -67629.0
-                dd  64019.0,  62684.0,  61289.0,  59838.0
-                dd   9975.0,   8540.0,   7154.0,   5818.0
-                dd   9727.0,   9585.0,   9416.0,   9219.0
-                dd     45.0,   -185.0,   -402.0,   -605.0
-                dd   1567.0,   1498.0,   1428.0,   1356.0
-                dd   -146.0,   -163.0,   -177.0,   -189.0
-                dd    104.0,     97.0,     91.0,     85.0
-                dd      5.0,      5.0,      4.0,      4.0
-
-                dd     -8.0,     -9.0,    -10.0,    -11.0
-                dd   -132.0,   -139.0,   -147.0,   -154.0
-                dd     57.0,     29.0,     -2.0,    -36.0
-                dd  -1817.0,  -1870.0,  -1919.0,  -1962.0
-                dd  -1095.0,  -1388.0,  -1692.0,  -2006.0
-                dd  -9966.0,  -9935.0,  -9863.0,  -9750.0
-                dd -16155.0, -17799.0, -19478.0, -21189.0
-                dd -68692.0, -69679.0, -70590.0, -71420.0
-                dd  58333.0,  56778.0,  55178.0,  53534.0
-                dd   4533.0,   3300.0,   2122.0,    998.0
-                dd   8998.0,   8755.0,   8491.0,   8209.0
-                dd   -794.0,   -970.0,  -1131.0,  -1280.0
-                dd   1283.0,   1210.0,   1137.0,   1064.0
-                dd   -200.0,   -208.0,   -215.0,   -221.0
-                dd     79.0,     73.0,     68.0,     63.0
-                dd      3.0,      3.0,      2.0,      2.0
-
-                dd    -13.0,    -14.0,    -16.0,    -17.0
-                dd   -161.0,   -169.0,   -176.0,   -183.0
-                dd    -72.0,   -111.0,   -153.0,   -197.0
-                dd  -2001.0,  -2032.0,  -2057.0,  -2075.0
-                dd  -2330.0,  -2663.0,  -3004.0,  -3351.0
-                dd  -9592.0,  -9389.0,  -9139.0,  -8840.0
-                dd -22929.0, -24694.0, -26482.0, -28289.0
-                dd -72169.0, -72835.0, -73415.0, -73908.0
-                dd  51853.0,  50137.0,  48390.0,  46617.0
-                dd    -70.0,  -1082.0,  -2037.0,  -2935.0
-                dd   7910.0,   7597.0,   7271.0,   6935.0
-                dd  -1414.0,  -1535.0,  -1644.0,  -1739.0
-                dd    991.0,    919.0,    848.0,    779.0
-                dd   -224.0,   -227.0,   -228.0,   -228.0
-                dd     58.0,     53.0,     49.0,     45.0
-                dd      2.0,      2.0,      1.0,      1.0
-
-                dd    -19.0,    -21.0,    -24.0,    -26.0
-                dd   -190.0,   -196.0,   -202.0,   -208.0
-                dd   -244.0,   -294.0,   -347.0,   -401.0
-                dd  -2085.0,  -2087.0,  -2080.0,  -2063.0
-                dd  -3705.0,  -4063.0,  -4425.0,  -4788.0
-                dd  -8492.0,  -8092.0,  -7640.0,  -7134.0
-                dd -30112.0, -31947.0, -33791.0, -35640.0
-                dd -74313.0, -74630.0, -74856.0, -74992.0
-                dd  44821.0,  43006.0,  41176.0,  39336.0
-                dd  -3776.0,  -4561.0,  -5288.0,  -5959.0
-                dd   6589.0,   6237.0,   5879.0,   5517.0
-                dd  -1822.0,  -1893.0,  -1952.0,  -2000.0
-                dd    711.0,    645.0,    581.0,    519.0
-                dd   -227.0,   -225.0,   -222.0,   -218.0
-                dd     41.0,     38.0,     35.0,     31.0
-                dd      1.0,      1.0,      1.0,      1.0
-
-                externdef  Di_opt
-
-%define C00     0.500000000000000000000000
-%define C01     0.500602998235196301334178
-%define C02     0.502419286188155705518560
-%define C03     0.505470959897543659956626
-%define C04     0.509795579104159168925062
-%define C05     0.515447309922624546962323
-%define C06     0.522498614939688880640101
-%define C07     0.531042591089784174473998
-%define C08     0.541196100146196984405269
-%define C09     0.553103896034444527838540
-%define C10     0.566944034816357703685831
-%define C11     0.582934968206133873665654
-%define C12     0.601344886935045280535340
-%define C13     0.622504123035664816182728
-%define C14     0.646821783359990129535794
-%define C15     0.674808341455005746033820
-%define C16     0.707106781186547524436104
-%define C17     0.744536271002298449773679
-%define C18     0.788154623451250224773056
-%define C19     0.839349645415527038721463
-%define C20     0.899976223136415704611808
-%define C21     0.972568237861960693780520
-%define C22     1.060677685990347471323668
-%define C23     1.169439933432884955134476
-%define C24     1.306562964876376527851784
-%define C25     1.484164616314166277319733
-%define C26     1.722447098238333927796261
-%define C27     2.057781009953411550808880
-%define C28     2.562915447741506178719328
-%define C29     3.407608418468718785698107
-%define C30     5.101148618689163857960189
-%define C31    10.190008123548056810994678
-
-                align   32
-                dd  -C31, -C29                ; -C(31),-C(29)
-                dd  -C25, -C27                ; -C(25),-C(27)
-                dd  -C17, -C19                ; -C(17),-C(19)
-                dd  -C23, -C21                ; -C(23),-C(21)
-                dd   1.0,  1.0, -C08, -C24    ;  CM110824 = 1, 1, -C( 8), -C(24)
-                dd   1.0,  1.0,  C08,  C24    ;  CP110824 = 1, 1,  C( 8),  C(24)
-                dd   1.0, -C16,  1.0, -C16    ;  CM116116 = 1, -C(16), 1, -C(16)
-                dd   1.0,  C16,  1.0,  C16    ;  CP116116 = 1,  C(16), 1,  C(16)
-C               dd   C16, -C16                ;  C(16),-C(16)
-                dd   C08,  C24                ;  C( 8), C(24)
-                dd   C04,  C12                ;  C( 4), C(12)
-                dd   C28,  C20                ;  C(28), C(20)
-                dd   C02,  C06                ;  C( 2), C( 6)
-                dd   C14,  C10                ;  C(14), C(10)
-                dd   C30,  C26                ;  C(30), C(26)
-                dd   C18,  C22                ;  C(18), C(22)
-                dd   C01,  C03                ;  C( 1), C( 3)
-                dd   C07,  C05                ;  C( 7), C( 5)
-                dd   C15,  C13                ;  C(15), C(13)
-                dd   C09,  C11                ;  C( 9), C(11)
-                dd   C31,  C29                ;  C(31), C(29)
-                dd   C25,  C27                ;  C(25), C(27)
-                dd   C17,  C19                ;  C(17), C(19)
-                dd   C23,  C21                ;  C(23), C(21)
-
-%undef C00
-%undef C01
-%undef C02
-%undef C03
-%undef C04
-%undef C05
-%undef C06
-%undef C07
-%undef C08
-%undef C09
-%undef C10
-%undef C11
-%undef C12
-%undef C13
-%undef C14
-%undef C15
-%undef C16
-%undef C17
-%undef C18
-%undef C19
-%undef C20
-%undef C21
-%undef C22
-%undef C23
-%undef C24
-%undef C25
-%undef C26
-%undef C27
-%undef C28
-%undef C29
-%undef C30
-%undef C31
-
-; eax hat auf C zu zeigen, dann können die folgenden
-; Makros zum Zugriff auf die Konstanten benutzt werden
-
-%define CM31     [ eax - 12*8 ]
-%define CM17     [ eax - 10*8 ]
-%define CM110824 [ eax -  8*8 ]
-%define CP110824 [ eax -  6*8 ]
-%define CM116116 [ eax -  4*8 ]
-%define CP116116 [ eax -  2*8 ]
-%define CC04     [ eax +  2*8 ]
-%define CC02     [ eax +  4*8 ]
-%define CC30     [ eax +  6*8 ]
-%define CC01     [ eax +  8*8 ]
-%define CC15     [ eax + 10*8 ]
-
-%define C16      qword [ eax +  0*8 ]
-%define C08      qword [ eax +  1*8 ]
-%define C04      qword [ eax +  2*8 ]
-%define C28      qword [ eax +  3*8 ]
-%define C02      qword [ eax +  4*8 ]
-%define C14      qword [ eax +  5*8 ]
-%define C30      qword [ eax +  6*8 ]
-%define C18      qword [ eax +  7*8 ]
-%define C01      qword [ eax +  8*8 ]
-%define C07      qword [ eax +  9*8 ]
-%define C15      qword [ eax + 10*8 ]
-%define C09      qword [ eax + 11*8 ]
-%define C31      qword [ eax + 12*8 ]
-%define C25      qword [ eax + 13*8 ]
-%define C17      qword [ eax + 14*8 ]
-%define C23      qword [ eax + 15*8 ]
-
-%define _C16     dword [ eax +  0*4 ]
-%define _C08     dword [ eax +  2*4 ]
-%define _C24     dword [ eax +  3*4 ]
-%define _C04     dword [ eax +  4*4 ]
-%define _C12     dword [ eax +  5*4 ]
-%define _C28     dword [ eax +  6*4 ]
-%define _C20     dword [ eax +  7*4 ]
-%define _C02     dword [ eax +  8*4 ]
-%define _C06     dword [ eax +  9*4 ]
-%define _C14     dword [ eax + 10*4 ]
-%define _C10     dword [ eax + 11*4 ]
-%define _C30     dword [ eax + 12*4 ]
-%define _C26     dword [ eax + 13*4 ]
-%define _C18     dword [ eax + 14*4 ]
-%define _C22     dword [ eax + 15*4 ]
-%define _C01     dword [ eax + 16*4 ]
-%define _C03     dword [ eax + 17*4 ]
-%define _C07     dword [ eax + 18*4 ]
-%define _C05     dword [ eax + 19*4 ]
-%define _C15     dword [ eax + 20*4 ]
-%define _C13     dword [ eax + 21*4 ]
-%define _C09     dword [ eax + 22*4 ]
-%define _C11     dword [ eax + 23*4 ]
-%define _C31     dword [ eax + 24*4 ]
-%define _C29     dword [ eax + 25*4 ]
-%define _C25     dword [ eax + 26*4 ]
-%define _C27     dword [ eax + 27*4 ]
-%define _C17     dword [ eax + 28*4 ]
-%define _C19     dword [ eax + 29*4 ]
-%define _C23     dword [ eax + 30*4 ]
-%define _C21     dword [ eax + 31*4 ]
-
-                align   32
-bias            dd          32768.0,         32768.0,         32768.0,         32768.0
-;bias2          dd  1097364144128.0, 1097364144128.0, 1097364144128.0, 1097364144128.0
-bias2           dd  1088774209536.0, 1088774209536.0, 1088774209536.0, 1088774209536.0
-negativ         dd       0x80000000,      0x80000000,      0x80000000,      0x80000000
-;               dd       0x80000000,      0x80000000,      0x80000000,      0x80000000          ; is line this necessary?
-bias3           dd       16613376.0
-
-;***************************************************************************
-
-%macro          muladdi 2
-                fld     dword [edx+4*(%2)]
-                fmul    dword [ecx+4*(%1)]
-                faddp   st1
-%endmacro
-
-                segment_code
-                align   32
-                times   7 nop
-proc            VectorMult_i387
-$buff0          arg     4
-$V0             arg     4
-                pushd   ebx
-                mov     ebx, [sp($buff0)]
-                mov     ecx, [sp($V0)]
-                mov     edx, Di_opt_SIMD
-                mov     eax, 32
-                fld     dword [bias3]
-lbl9:
-                fld     st0
-%ifndef USE_FXCH
-                muladdi   0,  0
-                muladdi  96,  1
-                muladdi 128,  2
-                muladdi 224,  3
-                muladdi 256,  4
-                muladdi 352,  5
-                muladdi 384,  6
-                muladdi 480,  7
-                muladdi 512,  8
-                muladdi 608,  9
-                muladdi 640, 10
-                muladdi 736, 11
-                muladdi 768, 12
-                muladdi 864, 13
-                muladdi 896, 14
-                muladdi 992, 15
-%else
-                fld     dword [ecx+4*  0]
-                fmul    dword [edx+4* 0]        ; prod   accu
-                fld     dword [ecx+4* 96]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 1]        ; prod   accu
-                fld     dword [ecx+4*128]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 2]        ; prod   accu
-                fld     dword [ecx+4*224]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 3]        ; prod   accu
-                fld     dword [ecx+4*256]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 4]        ; prod   accu
-                fld     dword [ecx+4*352]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 5]        ; prod   accu
-                fld     dword [ecx+4*384]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 6]        ; prod   accu
-                fld     dword [ecx+4*480]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 7]        ; prod   accu
-                fld     dword [ecx+4*512]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 8]        ; prod   accu
-                fld     dword [ecx+4*608]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4* 9]        ; prod   accu
-                fld     dword [ecx+4*640]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*10]        ; prod   accu
-                fld     dword [ecx+4*736]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*11]        ; prod   accu
-                fld     dword [ecx+4*768]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*12]        ; prod   accu
-                fld     dword [ecx+4*864]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*13]        ; prod   accu
-                fld     dword [ecx+4*896]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*14]        ; prod   accu
-                fld     dword [ecx+4*992]       ; s1     prod   accu
-                fxch    st1                     ; prod   s1     accu
-                faddp   st2                     ; s1     accu
-                fmul    dword [edx+4*15]        ; prod   accu
-                faddp   st1                     ; accu
-%endif
-                lea     edx, [edx + 64]
-                lea     ecx, [ecx +  4]
-
-                fstp    dword [ebx]
-                lea     ebx, [ebx +  4]
-                dec     eax
-                jnz     near lbl9
-
-                fstp    st0
-
-                popd    ebx
-endproc
-
-
-;***************************************************************************
-
-%macro          muladd3 2
-                pmov    mm2, qword [ecx+4*(%1)]
-                pmov    mm3, qword [ecx+4*(%1)+8]
-                pfmul   mm2, qword [edx+4*(%2)]
-                pfmul   mm3, qword [edx+4*(%2)+8]
-                pfadd   mm0, mm2
-                pfadd   mm1, mm3
-%endmacro
-
-                segment_code
-                align   32
-                times   6 nop
-proc            VectorMult_3DNow
-$buff1          arg     4
-$V1             arg     4
-                pushd   ebx
-                mov     ebx, [sp($buff1)]
-                mov     ecx, [sp($V1)]
-                mov     edx, Di_opt_SIMD
-                mov     eax, 8
-                pmov    mm4, qword [bias]
-lbl1:
-                pmov    mm0, qword [ecx]
-                pmov    mm1, qword [ecx+8]
-                pfmul   mm0, qword [edx]
-                pfmul   mm1, qword [edx+8]
-                pfadd   mm0, mm4
-                pfadd   mm1, mm4
-
-                muladd3  96,  4
-                muladd3 128,  8
-                muladd3 224, 12
-                muladd3 256, 16
-                muladd3 352, 20
-                muladd3 384, 24
-                muladd3 480, 28
-                sub     edx, byte -128
-                muladd3 512,  0
-                muladd3 608,  4
-                muladd3 640,  8
-                muladd3 736, 12
-                muladd3 768, 16
-                muladd3 864, 20
-                muladd3 896, 24
-                muladd3 992, 28
-                sub     edx, byte -128
-                ;add     ecx, byte 16
-                lea     ecx, [ecx+16]
-
-                pf2id   mm0, mm0
-                pf2id   mm1, mm1
-                pmov    qword [ebx], mm0
-                pmov    qword [ebx+8], mm1
-                ;add     ebx, byte 16
-                lea     ebx, [ebx+16]
-                dec     eax
-                jnz     near lbl1
-
-                popd    ebx
-endproc
-
-;
-;***************************************************************************************
-;
-%macro          muladdS 2
-                movaps  xmm0, [ecx+4*(%1)]
-                mulps   xmm0, [edx+4*(%2)]
-                addps   xmm2, xmm0
-%endmacro
-
-                align   32
-                times   6 nop
-proc            VectorMult_SIMD
-$buff2          arg     4
-$V2             arg     4
-                pushd   ebx
-                mov     ebx, [sp($buff1)]
-                mov     ecx, [sp($V2)]
-                mov     edx, Di_opt_SIMD
-                mov     eax, 8
-                movaps  xmm4, [bias2]
-lbl2:
-                movaps  xmm2, [ecx]
-                mulps   xmm2, [edx]
-
-                muladdS  96,  4
-                muladdS 128,  8
-                muladdS 224, 12
-                muladdS 256, 16
-                muladdS 352, 20
-                muladdS 384, 24
-                muladdS 480, 28
-                sub     edx, byte -128
-                muladdS 512,  0
-                muladdS 608,  4
-                muladdS 640,  8
-                muladdS 736, 12
-                muladdS 768, 16
-                muladdS 864, 20
-                muladdS 896, 24
-                muladdS 992, 28
-                sub     edx, byte -128
-                add     ecx, byte 16
-                addps   xmm2, xmm4
-
-                movups  [ebx], xmm2
-                add     ebx, byte 16
-                dec     eax
-                jnz     near lbl2
-
-                popd    ebx
-endproc
-
-;***************************************************************************************
-;
-
-%define A(x)    qword [ ebp + 4*(x) ]
-%define _A(x)   dword [ ebp + 4*(x) ]
-%define B(x)    qword [ ebp + 64 + 4*(x) ]
-%define _B(x)   dword [ ebp + 64 + 4*(x) ]
-%define S(x)    qword [ ecx + 4*(x) ]
-%define _S(x)   dword [ ecx + 4*(x) ]
-%define V(x)    qword [ edx + 4*(x) - 128]
-%define _V(x)   dword [ edx + 4*(x) - 128]
-
-%macro          turn 2                          ; dst, tmp
-                punpckldq       %2, %1          ; tmp = src.l | tmp.l
-                punpckhdq       %1, %2          ; src = src.l | src.h
-%endmacro
-
-%macro          copy2 2
-                mov     eax, _V(%2)
-                mov     ebx, _V(%2+1)
-                mov     _V(%1), eax
-                mov     _V(%1-1), ebx
-%endmacro
-
-%macro          copy1 2
-                mov     eax, _V(%2)
-                mov     _V(%1), eax
-%endmacro
-
-%macro          invcopy2 2
-                mov     eax, _V(%2)
-                mov     ebx, _V(%2+1)
-                add     eax, ecx
-                add     ebx, ecx
-                ;lea    eax, [eax+ecx]
-                ;lea    ebx, [ebx+ecx]
-                mov     _V(%1), eax
-                mov     _V(%1-1), ebx
-%endmacro
-
-
-;**************************************************************************************
-
-%macro          tu_was31  0
-
-;   B00 =  A00 + A08;
-;   B01 =  A01 + A09;
-;   B02 =  A02 + A10;
-;   B03 =  A03 + A11;
-
-                pmov    mm0, A(0)
-                pmov    mm1, A(2)
-                pfadd   mm0, A(8)
-                pfadd   mm1, A(10)
-                pmov    B(0), mm0
-                pmov    B(2), mm1
-
-;   B04 =  A04 + A12;
-;   B05 =  A05 + A13;
-;   B06 =  A06 + A14;
-;   B07 =  A07 + A15;
-
-                pmov    mm0, A(4)
-                pmov    mm1, A(6)
-                pfadd   mm0, A(12)
-                pfadd   mm1, A(14)
-                pmov    B(4), mm0
-                pmov    B(6), mm1
-
-;   B08 = (A00 - A08) * C[ 2];
-;   B09 = (A01 - A09) * C[ 6];
-;   B10 = (A02 - A10) * C[14];
-;   B11 = (A03 - A11) * C[10];
-
-                pmov    mm0, A(0)
-                pmov    mm1, A(2)
-                pfsub   mm0, A(8)
-                pfsub   mm1, A(10)
-                pfmul   mm0, C02
-                pfmul   mm1, C14
-                pmov    B(8), mm0
-                pmov    B(10), mm1
-
-;   B12 = (A04 - A12) * C[30];
-;   B13 = (A05 - A13) * C[26];
-;   B14 = (A06 - A14) * C[18];
-;   B15 = (A07 - A15) * C[22];
-
-                pmov    mm0, A(4)
-                pmov    mm1, A(6)
-                pfsub   mm0, A(12)
-                pfsub   mm1, A(14)
-                pfmul   mm0, C30
-                pfmul   mm1, C18
-                pmov    B(12), mm0
-                pmov    B(14), mm1
-%endmacro
-
-%macro          tu_was32  0
-
-;   A00 =  B00 + B04;
-;   A01 =  B01 + B05;
-;   A02 =  B02 + B06;
-;   A03 =  B03 + B07;
-
-                pmov    mm0, B(0)
-                pmov    mm1, B(2)
-                pfadd   mm0, B(4)
-                pfadd   mm1, B(6)
-                pmov    A(0), mm0
-                pmov    A(2), mm1
-
-;   A04 = (B00 - B04) * C[ 4];
-;   A05 = (B01 - B05) * C[12];
-;   A06 = (B02 - B06) * C[28];
-;   A07 = (B03 - B07) * C[20];
-
-                pmov    mm0, B(0)
-                pmov    mm1, B(2)
-                pfsub   mm0, B(4)
-                pfsub   mm1, B(6)
-                pfmul   mm0, C04
-                pfmul   mm1, C28
-                pmov    A(4), mm0
-                pmov    A(6), mm1
-
-;   A08 =  B08 + B12;
-;   A09 =  B09 + B13;
-;   A10 =  B10 + B14;
-;   A11 =  B11 + B15;
-
-                pmov    mm0, B(8)
-                pmov    mm1, B(10)
-                pfadd   mm0, B(12)
-                pfadd   mm1, B(14)
-                pmov    A(8), mm0
-                pmov    A(10), mm1
-
-;   A12 = (B08 - B12) * C[ 4];
-;   A13 = (B09 - B13) * C[12];
-;   A14 = (B10 - B14) * C[28];
-;   A15 = (B11 - B15) * C[20];
-
-                pmov    mm0, B(8)
-                pmov    mm1, B(10)
-                pfsub   mm0, B(12)
-                pfsub   mm1, B(14)
-                pfmul   mm0, C04
-                pfmul   mm1, C28
-                pmov    A(12), mm0
-                pmov    A(14), mm1
-
-%endmacro
-
-%macro          tu_was33  0
-
-;   B00 =  A00 + A02;
-;   B01 =  A01 + A03;
-;   B02 = (A00 - A02) * C[ 8];
-;   B03 = (A01 - A03) * C[24];
-
-                pmov    mm6, C08
-
-                pmov    mm0, A(0)
-                pmov    mm1, A(2)
-                pmov    mm2, mm0
-                pfsub   mm0, mm1
-                pfadd   mm2, mm1
-                pfmul   mm0, mm6
-                pmov    B(0), mm2
-                pmov    B(2), mm0
-
-;   B04 =  A04 + A06;
-;   B05 =  A05 + A07;
-;   B06 = (A04 - A06) * C[ 8];
-;   B07 = (A05 - A07) * C[24];
-
-                pmov    mm0, A(4)
-                pmov    mm1, A(6)
-                pmov    mm2, mm0
-                pfsub   mm0, mm1
-                pfadd   mm2, mm1
-                pfmul   mm0, mm6
-                pmov    B(4), mm2
-                pmov    B(6), mm0
-
-;   B08 =  A08 + A10;
-;   B09 =  A09 + A11;
-;   B10 = (A08 - A10) * C[ 8];
-;   B11 = (A09 - A11) * C[24];
-
-                pmov    mm0, A(8)
-                pmov    mm1, A(10)
-                pmov    mm2, mm0
-                pfsub   mm0, mm1
-                pfadd   mm2, mm1
-                pfmul   mm0, mm6
-                pmov    B(8), mm2
-                pmov    B(10), mm0
-
-;   B12 =  A12 + A14;
-;   B13 =  A13 + A15;
-;   B14 = (A12 - A14) * C[ 8];
-;   B15 = (A13 - A15) * C[24];
-
-                pmov    mm0, A(12)
-                pmov    mm1, A(14)
-                pmov    mm2, mm0
-                pfsub   mm0, mm1
-                pfadd   mm2, mm1
-                pfmul   mm0, mm6
-                pmov    B(12), mm2
-                pmov    B(14), mm0
-
-%endmacro
-
-%macro          tu_was34  0
-
-;   A00 =  B00 + B01;
-;   A01 = (B00 - B01) * C[16];
-;   A02 =  B02 + B03;
-;   A03 = (B02 - B03) * C[16];
-
-                pmov    mm6, C16
-
-                pmov    mm0, B(0)
-                pmov    mm1, B(2)
-                pmov    mm2, mm0
-                pmov    mm3, mm1
-                pfmul   mm0, mm6
-                pfmul   mm1, mm6
-                pfacc   mm2, mm0
-                pfacc   mm3, mm1
-                pmov    A(0), mm2
-                pmov    A(2), mm3
-
-;   A04 =  B04 + B05;
-;   A05 = (B04 - B05) * C[16];
-;   A06 =  B06 + B07;
-;   A07 = (B06 - B07) * C[16];
-
-                pmov    mm0, B(4)
-                pmov    mm1, B(6)
-                pmov    mm2, mm0
-                pmov    mm3, mm1
-                pfmul   mm0, mm6
-                pfmul   mm1, mm6
-                pfacc   mm2, mm0
-                pfacc   mm3, mm1
-                pmov    A(4), mm2
-                pmov    A(6), mm3
-
-;   A08 =  B08 + B09;
-;   A09 = (B08 - B09) * C[16];
-;   A10 =  B10 + B11;
-;   A11 = (B10 - B11) * C[16];
-
-                pmov    mm0, B(8)
-                pmov    mm1, B(10)
-                pmov    mm2, mm0
-                pmov    mm3, mm1
-                pfmul   mm0, mm6
-                pfmul   mm1, mm6
-                pfacc   mm2, mm0
-                pfacc   mm3, mm1
-                pmov    A(8), mm2
-                pmov    A(10), mm3
-
-;   A12 =  B12 + B13;
-;   A13 = (B12 - B13) * C[16];
-;   A14 =  B14 + B15;
-;   A15 = (B14 - B15) * C[16];
-
-                pmov    mm0, B(12)
-                pmov    mm1, B(14)
-                pmov    mm2, mm0
-                pmov    mm3, mm1
-                pfmul   mm0, mm6
-                pfmul   mm1, mm6
-                pfacc   mm2, mm0
-                pfacc   mm3, mm1
-                pmov    A(12), mm2
-                pmov    A(14), mm3
-
-%endmacro
-
-;***************************************************************************
-
-                align   32
-proc            Calculate_New_V_3DNow
-$S4             arg     4
-$V4             arg     4
-                mov     ecx, [sp($S4)]
-                mov     edx, [sp($V4)]
-                sub     edx, byte -128
-                push    ebx
-                push    ebp
-                mov     eax, C
-                mov     ebx, esp
-                add     esp, byte -128
-                and     esp, byte 0xFFFFFFC0
-                mov     ebp, esp
-
-;   A00 = S[ 0] + S[31];
-;   A01 = S[ 1] + S[30];
-;   A02 = S[ 3] + S[28];
-;   A03 = S[ 2] + S[29];
-
-                pmov    mm0, S(30)
-                pmov    mm1, S(2)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfadd   mm0, S(0)
-                pfadd   mm1, S(28)
-                pmov    A(0), mm0
-                pmov    A(2), mm1
-
-;   A04 = S[ 7] + S[24];
-;   A05 = S[ 6] + S[25];
-;   A06 = S[ 4] + S[27];
-;   A07 = S[ 5] + S[26];
-
-                pmov    mm0, S(6)
-                pmov    mm1, S(26)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfadd   mm0, S(24)
-                pfadd   mm1, S(4)
-                pmov    A(4), mm0
-                pmov    A(6), mm1
-
-;   A08 = S[15] + S[16];
-;   A09 = S[14] + S[17];
-;   A10 = S[12] + S[19];
-;   A11 = S[13] + S[18];
-
-                pmov    mm0, S(14)
-                pmov    mm1, S(18)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfadd   mm0, S(16)
-                pfadd   mm1, S(12)
-                pmov    A(8), mm0
-                pmov    A(10), mm1
-
-;   A12 = S[ 8] + S[23];
-;   A13 = S[ 9] + S[22];
-;   A14 = S[11] + S[20];
-;   A15 = S[10] + S[21];
-
-                pmov    mm0, S(22)
-                pmov    mm1, S(10)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfadd   mm0, S(8)
-                pfadd   mm1, S(20)
-                pmov    A(12), mm0
-                pmov    A(14), mm1
-
-                tu_was31
-                tu_was32
-                tu_was33
-                tu_was34
-
-                pmov    mm7, qword [negativ]
-
-;   V[48] = -A00;
-;   V[ 0] =  A01;
-;   V[40] = -A02 - (V[ 8] = A03);
-                                                 ; 0     1       2       3       4       5       6       7
-                movd    mm2, _A(3)               ;               3                                       -
-                movd    mm0, _A(0)               ; 0             3                                       -
-                movd    _V(8), mm2
-                movd    mm1, _A(1)               ; 0     1       3                                       -
-                pfadd   mm2, A(2)                ; 0     1       2+3                                     -
-                pxor    mm0, mm7                 ; -0    1       2+3                                     -
-                pxor    mm2, mm7                 ; -0    1       -2-3                                    -
-                movd    _V(0), mm1
-                movd    _V(48), mm0
-                movd    _V(40), mm2
-
-;   V[36] = -((V[ 4] = A05 + (V[12] = A07)) + A06);
-;   V[44] = - A04 - A06 - A07;
-
-                movd    mm0, _A(7)               ; 7                                                     -
-                pmov    mm1, A(6)                ; 7     6                                               -
-                movd    _V(12), mm0
-                pfadd   mm0, A(5)                ; 5+7   6                                               -
-                movd    _V(4), mm0
-                pfadd   mm0, mm1                 ; 5+6+7 6                                               -
-                pfacc   mm1, mm1                 ; 5+6+7 6+7                                             -
-                pfadd   mm1, A(4)                ; 5+6+7 4+6+7                                           -
-                pxor    mm0, mm7                 ;-5-6-7 4+6+7                                           -
-                pxor    mm1, mm7                 ;-5-6-7 -4-6-7                                          -
-                movd    _V(36), mm0
-                movd    _V(44), mm1
-
-;   V[ 6] = (V[10] = A11 + (V[14] = A15)) + A13;
-;   V[38] = (V[34] = -(V[ 2] = A09 + A13 + A15) - A14) + A09 - A10 - A11;
-
-                movd    mm2, _A(15)              ;               15
-                movd    mm0, _A(9)               ; 9             15
-                movd    _V(14), mm2
-                pfadd   mm0, A(13)               ; 9+13          15
-                pfadd   mm0, mm2                 ; 9+13+15
-                movd    _V(2), mm0
-                pfadd   mm2, A(11)               ; 9+13+15       11+15
-                pfadd   mm0, A(14)               ; 9+13+14+15
-                movd    _V(10), mm2
-                pxor    mm0, mm7                 ;-9-13-14-15
-                pfadd   mm2, A(13)               ;-9-13-14-15    11+13+15
-                pmov    mm6, A(10)               ;-9-13-14-15    11+13+15                10
-                movd    _V(34), mm0
-                pfacc   mm6, mm6                 ;-9-13-14-15    11+13+15                10+11
-                movd    _V(6), mm2
-                pfadd   mm0, A(9)                ;-13-14-15      11+13+15                10+11
-                pfsub   mm0, mm6                 ;-10-11-13-14-15
-                movd    _V(38), mm0
-
-;   V[46] = (tmp = -(A12 + A14 + A15)) - A08;
-
-                movd    mm1, _A(12)              ;       12
-                pfadd   mm1, A(14)               ;       12+14
-                pfadd   mm1, A(15)               ;       12+14+15
-                pxor    mm1, mm7                 ;       -12-14-15
-                pfsubr  mm6, mm1                 ;       -12-14-15                       -10-11-12-14-15
-                pfsub   mm1, A(8)                ;       -8-12-14-15
-                movd    _V(46), mm1
-
-;   V[42] = tmp - A10 - A11;                            // abhängig vom Befehl drüber
-
-                movd    _V(42), mm6
-
-;   A00 = (S[ 0] - S[31]) * C[ 1];
-;   A01 = (S[ 1] - S[30]) * C[ 3];
-;   A02 = (S[ 3] - S[28]) * C[ 7];
-;   A03 = (S[ 2] - S[29]) * C[ 5];
-
-                pmov    mm0, S(30)
-                pmov    mm1, S(2)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfsubr  mm0, S(0)
-                pfsub   mm1, S(28)
-                pfmul   mm0, C01
-                pfmul   mm1, C07
-                pmov    A(0), mm0
-                pmov    A(2), mm1
-
-;   A04 = (S[ 7] - S[24]) * C[15];
-;   A05 = (S[ 6] - S[25]) * C[13];
-;   A06 = (S[ 4] - S[27]) * C[ 9];
-;   A07 = (S[ 5] - S[26]) * C[11];
-
-                pmov    mm0, S(6)
-                pmov    mm1, S(26)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfsub   mm0, S(24)
-                pfsubr  mm1, S(4)
-                pfmul   mm0, C15
-                pfmul   mm1, C09
-                pmov    A(4), mm0
-                pmov    A(6), mm1
-
-;   A08 = (S[15] - S[16]) * C[31];
-;   A09 = (S[14] - S[17]) * C[29];
-;   A10 = (S[12] - S[19]) * C[25];
-;   A11 = (S[13] - S[18]) * C[27];
-
-                pmov    mm0, S(14)
-                pmov    mm1, S(18)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfsub   mm0, S(16)
-                pfsubr  mm1, S(12)
-                pfmul   mm0, C31
-                pfmul   mm1, C25
-                pmov    A(8), mm0
-                pmov    A(10), mm1
-
-;   A12 = (S[ 8] - S[23]) * C[17];
-;   A13 = (S[ 9] - S[22]) * C[19];
-;   A14 = (S[11] - S[20]) * C[23];
-;   A15 = (S[10] - S[21]) * C[21];
-
-                pmov    mm0, S(22)
-                pmov    mm1, S(10)
-                turn    mm0, mm6
-                turn    mm1, mm7
-                pfsubr  mm0, S(8)
-                pfsub   mm1, S(20)
-                pfmul   mm0, C17
-                pfmul   mm1, C23
-                pmov    A(12), mm0
-                pmov    A(14), mm1
-
-                tu_was31
-                tu_was32
-                tu_was33
-                tu_was34
-
-                pmov    mm7, qword [negativ]
-
-;   V[ 5] = (V[11] = (V[13] = A07 + (V[15] = A15)) + A11) + A05 + A13;
-
-                movd    mm0, _A(15)
-                movd    _V(15), mm0
-                pfadd   mm0, A(7)
-                movd    _V(13), mm0
-                pfadd   mm0, A(11)
-                movd    _V(11), mm0
-                pfadd   mm0, A(5)
-                pfadd   mm0, A(13)
-                movd    _V(5), mm0
-
-;   V[ 7] = (V[ 9] = A03 + A11 + A15) + A13;
-
-                movd    mm1, _A(3)
-                pfadd   mm1, A(11)
-                pfadd   mm1, A(15)
-                movd    _V(9), mm1
-                pfadd   mm1, A(13)
-                movd    _V(7), mm1
-
-;   V[33] = -(V[ 1] = A01 + A09 + A13 + A15) - A14;
-
-                movd    mm4, _A(9)
-                pfadd   mm4, A(13)
-                pfadd   mm4, A(15)
-                movd    mm2, _A(1)
-                pfadd   mm2, mm4
-                movd    _V(1), mm2
-                pfadd   mm2, A(14)
-                pxor    mm2, mm7
-                movd    _V(33), mm2
-
-;   V[35] = -(V[ 3] = A05 + A07 + A09 + A13 + A15) - A06 - A14;
-
-                pfadd   mm4, A(5)
-                pfadd   mm4, A(7)
-                movd    _V(3), mm4
-                pxor    mm4, mm7
-                pfsub   mm4, A(6)
-                pfsub   mm4, A(14)
-                movd    _V(35), mm4
-
-;   V[37] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07;
-
-                pmov    mm1, A(10)
-                pmov    mm2, A(14)
-                pfacc   mm1, mm2
-                pfacc   mm1, mm1
-                pfadd   mm1, A(13)
-                pxor    mm1, mm7
-                pmov    mm4, A(6)
-                pmov    mm6, mm1
-                pfacc   mm4, mm4
-                pfsub   mm1, A(5)
-                pfsub   mm1, mm4
-                movd    _V(37), mm1
-
-;   V[39] = tmp - A02 - A03;                                            // abhängig vom Befehl drüber
-
-                pmov    mm3, A(2)
-                pmov    mm2, mm6
-                pfacc   mm3, mm3
-                pfsub   mm2, mm3
-                movd    _V(39), mm2
-
-;   V[41] = (tmp += A13 - A12) - A02 - A03;                             // abhängig vom Befehl 2 drüber
-
-                pfadd   mm6, A(13)
-                pfsub   mm6, A(12)
-                pfsubr  mm3, mm6
-                movd    _V(41), mm3
-
-;   V[43] = tmp - A04 - A06 - A07;                                      // abhängig von Befehlen 1 und 3 drüber
-
-                movd    mm5, _A(4)
-                pfadd   mm5, mm4
-                pfsub   mm6, mm5
-                movd    _V(43), mm6
-
-;   V[47] = (tmp = -(A08 + A12 + A14 + A15)) - A00;
-
-                movd    mm1, _A(8)
-                pfadd   mm1, A(12)
-                pfadd   mm1, A(14)
-                pfadd   mm1, A(15)
-                pxor    mm1, mm7
-                pmov    mm6, mm1
-                pfsub   mm1, A(0)
-                movd    _V(47), mm1
-
-;   V[45] = tmp - A04 - A06 - A07;                                      // abhängig vom Befehl drüber
-
-                pfsub   mm6, mm5
-                movd    _V(45), mm6
-
-                mov     esp, ebx
-
-;   V[32] = -V[ 0];
-;   V[31] = -V[ 1];
-;   V[30] = -V[ 2];
-;   V[29] = -V[ 3];
-;   V[28] = -V[ 4];
-;   V[27] = -V[ 5];
-;   V[26] = -V[ 6];
-;   V[25] = -V[ 7];
-;   V[24] = -V[ 8];
-;   V[23] = -V[ 9];
-;   V[22] = -V[10];
-;   V[21] = -V[11];
-;   V[20] = -V[12];
-;   V[19] = -V[13];
-;   V[18] = -V[14];
-;   V[17] = -V[15];
-
-                mov     ecx, 80000000h
-                invcopy2 32,  0
-                invcopy2 30,  2
-                invcopy2 28,  4
-                invcopy2 26,  6
-                invcopy2 24,  8
-                invcopy2 22, 10
-                invcopy2 20, 12
-                invcopy2 18, 14
-
-;   V[63] =  V[33];
-;   V[62] =  V[34];
-;   V[61] =  V[35];
-;   V[60] =  V[36];
-;   V[59] =  V[37];
-;   V[58] =  V[38];
-;   V[57] =  V[39];
-;   V[56] =  V[40];
-;   V[55] =  V[41];
-;   V[54] =  V[42];
-;   V[53] =  V[43];
-;   V[52] =  V[44];
-;   V[51] =  V[45];
-;   V[50] =  V[46];
-;   V[49] =  V[47];
-
-                add     edx, 33*4
-                copy2   30,  0
-                copy2   28,  2
-                copy2   26,  4
-                copy2   24,  6
-                copy2   22,  8
-                copy2   20, 10
-                copy2   18, 12
-                copy1   16, 14
-
-                pop     ebp
-                pop     ebx
-endproc
-;****************************************************************************
-
-%macro          tu_wasS  0
-
-;   B00 =  A00 + A08;
-;   B01 =  A01 + A09;
-;   B02 =  A02 + A10;
-;   B03 =  A03 + A11;
-;   B04 =  A04 + A12;
-;   B05 =  A05 + A13;
-;   B06 =  A06 + A14;
-;   B07 =  A07 + A15;
-
-                movaps  xmm2, xmm0
-                movaps  xmm3, xmm1
-                addps   xmm0, xmm4
-                addps   xmm1, xmm5
-
-;   B08 = (A00 - A08) * C[ 2];
-;   B09 = (A01 - A09) * C[ 6];
-;   B10 = (A02 - A10) * C[14];
-;   B11 = (A03 - A11) * C[10];
-;   B12 = (A04 - A12) * C[30];
-;   B13 = (A05 - A13) * C[26];
-;   B14 = (A06 - A14) * C[18];
-;   B15 = (A07 - A15) * C[22];
-
-                subps   xmm2, xmm4
-                subps   xmm3, xmm5
-                mulps   xmm2, CC02
-                mulps   xmm3, CC30
-
-;   A00 =  B00 + B04;
-;   A01 =  B01 + B05;
-;   A02 =  B02 + B06;
-;   A03 =  B03 + B07;
-;   A04 = (B00 - B04) * C[ 4];
-;   A05 = (B01 - B05) * C[12];
-;   A06 = (B02 - B06) * C[28];
-;   A07 = (B03 - B07) * C[20];
-
-                movaps  xmm5, xmm0
-                movaps  xmm4, xmm0
-                subps   xmm5, xmm1
-                addps   xmm4, xmm1
-                mulps   xmm5, CC04
-
-;   A08 =  B08 + B12;
-;   A09 =  B09 + B13;
-;   A10 =  B10 + B14;
-;   A11 =  B11 + B15;
-;   A12 = (B08 - B12) * C[ 4];
-;   A13 = (B09 - B13) * C[12];
-;   A14 = (B10 - B14) * C[28];
-;   A15 = (B11 - B15) * C[20];
-
-                movaps  xmm7, xmm2
-                movaps  xmm6, xmm2
-                subps   xmm7, xmm3
-                addps   xmm6, xmm3
-                mulps   xmm7, CC04
-
-;   B00 =  A00 + A02;                   B00 = A00 * 1    + A02 * 1
-;   B01 =  A01 + A03;                   B01 = A01 * 1    + A03 * 1
-;   B02 = (A00 - A02) * C[ 8];          B02 = A02 * -C8  + A00 * C8
-;   B03 = (A01 - A03) * C[24];          B03 = A03 * -C24 + A01 * C24
-;   B04 =  A04 + A06;
-;   B05 =  A05 + A07;
-;   B06 = (A04 - A06) * C[ 8];
-;   B07 = (A05 - A07) * C[24];
-;   B08 =  A08 + A10;
-;   B09 =  A09 + A11;
-;   B10 = (A08 - A10) * C[ 8];
-;   B11 = (A09 - A11) * C[24];
-;   B12 =  A12 + A14;
-;   B13 =  A13 + A15;
-;   B14 = (A12 - A14) * C[ 8];
-;   B15 = (A13 - A15) * C[24];
-
-                movaps  xmm0, xmm4
-                shufps  xmm4, xmm4, 0x4E   ; 4#1032# = 0x4E
-                mulps   xmm0, CM110824
-                mulps   xmm4, CP110824
-                addps   xmm0, xmm4
-
-                movaps  xmm1, xmm5
-                shufps  xmm5, xmm5, 0x4E   ; 4#1032# = 0x4E
-                mulps   xmm1, CM110824
-                mulps   xmm5, CP110824
-                addps   xmm1, xmm5
-
-                movaps  xmm2, xmm6
-                shufps  xmm6, xmm6, 0x4E   ; 4#1032# = 0x4E
-                mulps   xmm2, CM110824
-                mulps   xmm6, CP110824
-                addps   xmm2, xmm6
-
-                movaps  xmm3, xmm7
-                shufps  xmm7, xmm7, 0x4E   ; 4#1032# = 0x4E
-                mulps   xmm3, CM110824
-                mulps   xmm7, CP110824
-                addps   xmm3, xmm7
-
-;   A00 =  B00 + B01;                   A00 = B00 * 1    + B01 * 1
-;   A01 = (B00 - B01) * C[16];          A01 = B01 * -C16 + B00 * C16
-;   A02 =  B02 + B03;                   A02 = B02 * 1    + B03 * 1
-;   A03 = (B02 - B03) * C[16];          A03 = B03 * -C16 + B02 * C16
-;   A04 =  B04 + B05;
-;   A05 = (B04 - B05) * C[16];
-;   A06 =  B06 + B07;
-;   A07 = (B06 - B07) * C[16];
-;   A08 =  B08 + B09;
-;   A09 = (B08 - B09) * C[16];
-;   A10 =  B10 + B11;
-;   A11 = (B10 - B11) * C[16];
-;   A12 =  B12 + B13;
-;   A13 = (B12 - B13) * C[16];
-;   A14 =  B14 + B15;
-;   A15 = (B14 - B15) * C[16];
-
-                movaps  xmm4, xmm0
-                shufps  xmm0, xmm0, 0xB1   ; 4#2301# = 0xB1
-                mulps   xmm4, CM116116
-                mulps   xmm0, CP116116
-                addps   xmm4, xmm0
-
-                movaps  xmm5, xmm1
-                shufps  xmm1, xmm1, 0xB1   ; 4#2301# = 0xB1
-                mulps   xmm5, CM116116
-                mulps   xmm1, CP116116
-                addps   xmm5, xmm1
-
-                movaps  xmm6, xmm2
-                shufps  xmm2, xmm2, 0xB1   ; 4#2301# = 0xB1
-                mulps   xmm6, CM116116
-                mulps   xmm2, CP116116
-                addps   xmm6, xmm2
-
-                movaps  xmm7, xmm3
-                shufps  xmm3, xmm3, 0xB1   ; 4#2301# = 0xB1
-                mulps   xmm7, CM116116
-                mulps   xmm3, CP116116
-                addps   xmm7, xmm3
-
-;   Store
-
-                movaps  [edx+4* 0], xmm4
-                movaps  [edx+4* 4], xmm5
-                movaps  [edx+4* 8], xmm6
-                movaps  [edx+4*12], xmm7
-%endmacro
-
-                align   32
-proc            New_V_Helper2
-$A6             arg     4
-$Sample6        arg     4
-                mov     ecx, [sp($Sample6)]
-                mov     edx, [sp($A6)]
-                mov     eax, C
-
-;    A[ 0] = Sample[ 0] + Sample[31];
-;    A[ 1] = Sample[ 1] + Sample[30];
-;    A[ 2] = Sample[ 3] + Sample[28];
-;    A[ 3] = Sample[ 2] + Sample[29];
-;    A[ 4] = Sample[ 7] + Sample[24];
-;    A[ 5] = Sample[ 6] + Sample[25];
-;    A[ 6] = Sample[ 4] + Sample[27];
-;    A[ 7] = Sample[ 5] + Sample[26];
-;    A[ 8] = Sample[15] + Sample[16];
-;    A[ 9] = Sample[14] + Sample[17];
-;    A[10] = Sample[12] + Sample[19];
-;    A[11] = Sample[13] + Sample[18];
-;    A[12] = Sample[ 8] + Sample[23];
-;    A[13] = Sample[ 9] + Sample[22];
-;    A[14] = Sample[11] + Sample[20];
-;    A[15] = Sample[10] + Sample[21];
-
-                movaps  xmm0, [ecx+  0]
-                shufps  xmm0, xmm0, 0xB4   ; 4#2310# = 0xB4
-                movaps  xmm1, [ecx+ 16]
-                shufps  xmm1, xmm1, 0x4B   ; 4#1023# = 0x4B
-                movaps  xmm2, [ecx+ 32]
-                shufps  xmm2, xmm2, 0xB4   ; 4#2310# = 0xB4
-                movaps  xmm3, [ecx+ 48]
-                shufps  xmm3, xmm3, 0x4B   ; 4#1023# = 0x4B
-                movaps  xmm4, [ecx+ 64]
-                shufps  xmm4, xmm4, 0xB4   ; 4#2310# = 0xB4
-                addps   xmm4, xmm3
-                movaps  xmm5, [ecx+ 80]
-                shufps  xmm5, xmm5, 0x4B   ; 4#1023# = 0x4B
-                addps   xmm5, xmm2
-                movaps  xmm6, [ecx+ 96]
-                shufps  xmm6, xmm6, 0xB4   ; 4#2310# = 0xB4
-                addps   xmm1, xmm6
-                movaps  xmm7, [ecx+112]
-                shufps  xmm7, xmm7, 0x4B   ; 4#1023# = 0x4B
-                addps   xmm0, xmm7
-
-                tu_wasS
-endproc
-
-;*********************************************************************************************
-
-                align   32
-proc            New_V_Helper3
-$A7             arg     4
-$Sample7        arg     4
-                mov     ecx, [sp($Sample7)]
-                mov     edx, [sp($A7)]
-                mov     eax, C
-
-;    A[ 0] = (Sample[ 0] - Sample[31]) * C[ 1];         Sample[ 0] + Sample[31];
-;    A[ 1] = (Sample[ 1] - Sample[30]) * C[ 3];         Sample[ 1] + Sample[30];
-;    A[ 2] = (Sample[ 3] - Sample[28]) * C[ 7];         Sample[ 3] + Sample[28];
-;    A[ 3] = (Sample[ 2] - Sample[29]) * C[ 5];         Sample[ 2] + Sample[29];
-;    A[ 4] = (Sample[ 7] - Sample[24]) * C[15];         Sample[ 7] + Sample[24];
-;    A[ 5] = (Sample[ 6] - Sample[25]) * C[13];         Sample[ 6] + Sample[25];
-;    A[ 6] = (Sample[ 4] - Sample[27]) * C[ 9];         Sample[ 4] + Sample[27];
-;    A[ 7] = (Sample[ 5] - Sample[26]) * C[11];         Sample[ 5] + Sample[26];
-;    A[ 8] = (Sample[15] - Sample[16]) * C[31];         Sample[15] + Sample[16];
-;    A[ 9] = (Sample[14] - Sample[17]) * C[29];         Sample[14] + Sample[17];
-;    A[10] = (Sample[12] - Sample[19]) * C[25];         Sample[12] + Sample[19];
-;    A[11] = (Sample[13] - Sample[18]) * C[27];         Sample[13] + Sample[18];
-;    A[12] = (Sample[ 8] - Sample[23]) * C[17];         Sample[ 8] + Sample[23];
-;    A[13] = (Sample[ 9] - Sample[22]) * C[19];         Sample[ 9] + Sample[22];
-;    A[14] = (Sample[11] - Sample[20]) * C[23];         Sample[11] + Sample[20];
-;    A[15] = (Sample[10] - Sample[21]) * C[21];         Sample[10] + Sample[21];
-
-                movaps  xmm0, [ecx+  0]
-                shufps  xmm0, xmm0, 0xB4   ; 4#2310# = 0xB4
-                movaps  xmm1, [ecx+ 16]
-                shufps  xmm1, xmm1, 0x4B   ; 4#1023# = 0x4B
-                movaps  xmm2, [ecx+ 32]
-                shufps  xmm2, xmm2, 0xB4   ; 4#2310# = 0xB4
-                movaps  xmm3, [ecx+ 48]
-                shufps  xmm3, xmm3, 0x4B   ; 4#1023# = 0x4B
-                movaps  xmm4, [ecx+ 64]
-                shufps  xmm4, xmm4, 0xB4   ; 4#2310# = 0xB4
-                subps   xmm4, xmm3
-                mulps   xmm4, CM31
-                movaps  xmm5, [ecx+ 80]
-                shufps  xmm5, xmm5, 0x4B   ; 4#1023# = 0x4B
-                subps   xmm5, xmm2
-                mulps   xmm5, CM17
-                movaps  xmm6, [ecx+ 96]
-                shufps  xmm6, xmm6, 0xB4   ; 4#2310# = 0xB4
-                subps   xmm1, xmm6
-                mulps   xmm1, CC15
-                movaps  xmm7, [ecx+112]
-                shufps  xmm7, xmm7, 0x4B   ; 4#1023# = 0x4B
-                subps   xmm0, xmm7
-                mulps   xmm0, CC01
-
-                tu_wasS
-endproc
-
-;*********************************************************************************************
-
-                align   32
-proc            New_V_Helper4
-$V8             arg     4
-                mov     edx,[sp($V8)]
-
-;    V[32] = -V[ 0];
-;    V[31] = -V[ 1];
-;    V[30] = -V[ 2];
-;    V[29] = -V[ 3];
-;    V[28] = -V[ 4];
-;    V[27] = -V[ 5];
-;    V[26] = -V[ 6];
-;    V[25] = -V[ 7];
-;    V[24] = -V[ 8];
-;    V[23] = -V[ 9];
-;    V[22] = -V[10];
-;    V[21] = -V[11];
-;    V[20] = -V[12];
-;    V[19] = -V[13];
-;    V[18] = -V[14];
-;    V[17] = -V[15];
-;    V[63] =  V[33];
-;    V[62] =  V[34];
-;    V[61] =  V[35];
-;    V[60] =  V[36];
-;    V[59] =  V[37];
-;    V[58] =  V[38];
-;    V[57] =  V[39];
-;    V[56] =  V[40];
-;    V[55] =  V[41];
-;    V[54] =  V[42];
-;    V[53] =  V[43];
-;    V[52] =  V[44];
-;    V[51] =  V[45];
-;    V[50] =  V[46];
-;    V[49] =  V[47];
-
-                movaps  xmm7, [negativ]
-                movaps  xmm0, [edx+ 0*4]
-                xorps   xmm0, xmm7
-                movaps  xmm1, [edx+ 4*4]
-                xorps   xmm1, xmm7
-                movaps  xmm2, [edx+ 8*4]
-                xorps   xmm2, xmm7
-                movaps  xmm3, [edx+12*4]
-                xorps   xmm3, xmm7
-                shufps  xmm0, xmm0, 0x1B   ; 4#0123# = 0x1B
-                shufps  xmm1, xmm1, 0x1B
-                shufps  xmm2, xmm2, 0x1B
-                shufps  xmm3, xmm3, 0x1B
-                movups  xmm4, [edx+45*4]
-                shufps  xmm4, xmm4, 0x1B   ; 4#0123# = 0x1B
-                movups  xmm5, [edx+41*4]
-                shufps  xmm5, xmm5, 0x1B
-                movups  xmm6, [edx+37*4]
-                shufps  xmm6, xmm6, 0x1B
-                movups  xmm7, [edx+33*4]
-                shufps  xmm7, xmm7, 0x1B
-
-                movups  [edx+29*4], xmm0
-                movups  [edx+25*4], xmm1
-                movups  [edx+21*4], xmm2
-                movups  [edx+17*4], xmm3
-                movaps  [edx+48*4], xmm4
-                movaps  [edx+52*4], xmm5
-                movaps  [edx+56*4], xmm6
-                movaps  [edx+60*4], xmm7
-
-endproc
-
-
-;  . . . . . . . .   . . . . . . . -
-;  + . . . . . . .   . . . . . . . .
-;  . . . . . . . .   . . . - . . . .
-;  . . . . + . . .   . . . - . . . .
-;  . . . . . . . .   . . . . . - . .
-;  . . + . . . . .   . - . . . . . .
-;  . . . . . . . .   . - . . . - . .
-;  . . + . . . + .   . - . . . - . .
-;  . . . . . . . .   . . . . . . - .
-;  . + . . . . . .   - . . . . . . .
-;  . . . . . . . .   . . - . - . . .
-;  . . . + . + . .   . . - . - . . .
-;  . . . . . . . .   . . . . - . - .
-;  . + . + . . . .   - . - . . . . .
-;  . . . . . . . .   - . - . - . - .
-;  . + . + . + . +   - . - . - . - .
-
-
-;  . . . . . . . .   . . . . . . . -
-;  + . . . . . . .   - . . . . . . .
-;  . . . . . . . .   . . . - - . . .
-;  . . . + + . . .   . . . - - . . .
-;  . . . . . . . .   . . . . . - - .
-;  . + + . . . . .   . - - . . . . .
-;  . . . . . . . .   . - - . . - - .
-;  . + + . . + + .   . - - . . - - .
-;  . . . . . . . .   . . . . . . - -
-;  + + . . . . . .   - - . . . . . .
-;  . . . . . . . .   . . - - - - . .
-;  . . + + + + . .   . . - - - - . .
-;  . . . . . . . .   . . . . - - - -
-;  + + + + . . . .   - - - - . . . .
-;  . . . . . . . .   - - - - - - - -
-;  + + + + + + + +   - - - - - - - -
-
-
-;****************************************************************************
-
-                align 4
-proc            Reset_FPU_3DNow
-                femms
-endproc
-
-;*****************************************************************************
-
-                align 4
-proc            Reset_FPU
-                emms
-endproc
-
-;******************************************************************************
-
-                align   32
-                times   5 nop
-proc            memcpy_dn_MMX
-$dst1           arg     4
-$src1           arg     4
-$words1         arg     4
-                mov     eax, [sp($dst1)]
-                mov     edx, [sp($src1)]
-                mov     ecx, [sp($words1)]
-                shl     ecx, 6
-                lea     edx, [edx+ecx-64]
-                lea     eax, [eax+ecx-64]
-                mov     ecx, [sp($words1)]
-lbl3:
-                pmov    mm0, qword [edx+ 0]
-                pmov    mm1, qword [edx+ 8]
-                pmov    mm2, qword [edx+16]
-                pmov    mm3, qword [edx+24]
-                pmov    mm4, qword [edx+32]
-                pmov    mm5, qword [edx+40]
-                pmov    mm6, qword [edx+48]
-                pmov    mm7, qword [edx+56]
-                add     edx, byte -64
-
-                pmov    qword [eax+ 0], mm0
-                pmov    qword [eax+ 8], mm1
-                pmov    qword [eax+16], mm2
-                pmov    qword [eax+24], mm3
-                pmov    qword [eax+32], mm4
-                pmov    qword [eax+40], mm5
-                pmov    qword [eax+48], mm6
-                pmov    qword [eax+56], mm7
-                add     eax, byte -64
-
-                dec     ecx
-                jnz     short lbl3
-endproc
-
-;********************************************************************************
-
-                align   32
-                times   5 nop
-proc            memcpy_dn_SIMD
-$dst2           arg     4
-$src2           arg     4
-$words2         arg     4
-                mov     eax, [sp($dst2)]
-                mov     edx, [sp($src2)]
-                mov     ecx, [sp($words2)]
-                shl     ecx, 7
-                lea     edx, [edx+ecx-128]
-                lea     eax, [eax+ecx-128]
-                mov     ecx, [sp($words2)]
-lbl4:
-                movaps  xmm0, [edx+  0]
-                movaps  xmm1, [edx+ 16]
-                movaps  xmm2, [edx+ 32]
-                movaps  xmm3, [edx+ 48]
-                movaps  xmm4, [edx+ 64]
-                movaps  xmm5, [edx+ 80]
-                movaps  xmm6, [edx+ 96]
-                movaps  xmm7, [edx+112]
-                add     edx, byte -128
-
-                movaps  [eax+  0], xmm0
-                movaps  [eax+ 16], xmm1
-                movaps  [eax+ 32], xmm2
-                movaps  [eax+ 48], xmm3
-                movaps  [eax+ 64], xmm4
-                movaps  [eax+ 80], xmm5
-                movaps  [eax+ 96], xmm6
-                movaps  [eax+112], xmm7
-                add     eax, byte -128
-
-                dec     ecx
-                jnz     short lbl4
-endproc
-
-
-;##################################################################################################################
-
-
-                align   32
-proc            Calculate_New_V_i387
-$S9             arg     4
-$V9             arg     4
-                mov     ecx, [sp($S9)]
-                mov     edx, [sp($V9)]
-                sub     edx, byte -128
-                push    ebp
-                mov     eax, C
-                add     esp, byte -128
-                mov     ebp, esp
-
-%macro          op1     2
-                fld     _S(%1)          ; S00
-                fadd    _S(31-%1)       ; A00
-                fld     _S(15-%1)       ; S15           A00
-                fadd    _S(16+%1)       ; A08           A00
-                fld     st1             ; A00           A08     A00
-                fsub    st0, st1        ; A00-A08       A08     A00
-                fmul    %2              ; B08           A08     A00
-                fxch    st2             ; A00           A08     B08
-                faddp   st1             ; B00           B08
-%endmacro
-
-%macro          opx     2               ; B04           B12     B00     B08
-                fld     st2             ; B00           B04     B12     B00     B08
-                fsub    st0, st1        ; B00-B04       B04     B12     B00     B08
-                fmul    %2              ; A04           B04     B12     B00     B08
-                fstp    _A(%1+4)        ; B04           B12     B00     B08
-                fld     st3             ; B08           B04     B12     B00     B08
-                fsub    st0, st2        ; B08-B12       B04     B12     B00     B08
-                fmul    %2              ; A12           B04     B12     B00     B08
-                fstp    _A(%1+12)       ; B04           B12     B00     B08
-                faddp   st2             ; B12           A00     B08
-                faddp   st2             ; A00           A08
-                fstp    _A(%1)          ; A08
-                fstp    _A(%1+8)        ;
-%endmacro
-
-;    A00 = Sample[ 0] + Sample[31];
-;    A08 = Sample[15] + Sample[16];
-;    B00 =  A00 + A08;
-;    B08 = (A00 - A08) * C[ 2];
-;    A04 = Sample[ 7] + Sample[24];
-;    A12 = Sample[ 8] + Sample[23];
-;    B04 =  A04 + A12;
-;    B12 = (A04 - A12) * C[30];
-
-                op1      0, _C02
-                op1      7, _C30
-
-;   A00 =  B00 + B04;
-;   A04 = (B00 - B04) * C[ 4];
-;   A08 =  B08 + B12;
-;   A12 = (B08 - B12) * C[ 4];
-
-                opx      0, _C04
-
-;    A01 = Sample[ 1] + Sample[30];
-;    A09 = Sample[14] + Sample[17];
-;    B01 =  A01 + A09;
-;    B09 = (A01 - A09) * C[ 6];
-;    A05 = Sample[ 6] + Sample[25];
-;    A13 = Sample[ 9] + Sample[22];
-;    B05 =  A05 + A13;
-;    B13 = (A05 - A13) * C[26];
-
-                op1      1, _C06
-                op1      6, _C26
-
-;    A01 =  B01 + B05;
-;    A05 = (B01 - B05) * C[12];
-;    A09 =  B09 + B13;
-;    A13 = (B09 - B13) * C[12];
-
-                opx      1, _C12
-
-;    A02 = Sample[ 3] + Sample[28];
-;    A10 = Sample[12] + Sample[19];
-;    B02 =  A02 + A10;
-;    B10 = (A02 - A10) * C[14];
-;    A06 = Sample[ 4] + Sample[27];
-;    A14 = Sample[11] + Sample[20];
-;    B06 =  A06 + A14;
-;    B14 = (A06 - A14) * C[18];
-
-                op1      3, _C14
-                op1      4, _C18
-
-;    A02 =  B02 + B06;
-;    A06 = (B02 - B06) * C[28];
-;    A10 =  B10 + B14;
-;    A14 = (B10 - B14) * C[28];
-
-                opx      2, _C28
-
-;    A03 = Sample[ 2] + Sample[29];
-;    A11 = Sample[13] + Sample[18];
-;    B03 =  A03 + A11;
-;    B11 = (A03 - A11) * C[10];
-;    A07 = Sample[ 5] + Sample[26];
-;    A15 = Sample[10] + Sample[21];
-;    B07 =  A07 + A15;
-;    B15 = (A07 - A15) * C[22];
-
-                op1      2, _C10
-                op1      5, _C22
-
-;    A03 =  B03 + B07;
-;    A07 = (B03 - B07) * C[20];
-;    A11 =  B11 + B15;
-;    A15 = (B11 - B15) * C[20];
-
-                opx      3, _C20
-
-
-%macro          op2     1
-                fld     _A(%1)          ; A00
-                fadd    _A(%1+2)        ; B00
-                fld     _A(%1+1)        ; A01           B00
-                fadd    _A(%1+3)        ; B01           B00
-                fld     st1             ; B00           B01     B00
-                fsub    st0, st1        ; B00-B01       B01     B00
-                fmul    _C16            ; A01           B01     B00
-                fstp    _B(%1+1)        ; B01           B00
-                faddp   st1             ; A00
-                fstp    _B(%1)          ;
-                fld     _A(%1)          ; A00
-                fsub    _A(%1+2)        ; A00-A02
-                fmul    _C08            ; B02
-                fld     _A(%1+1)        ; A01           B02
-                fsub    _A(%1+3)        ; A01-A03       B02
-                fmul    _C24            ; B03           B02
-                fld     st1             ; B02           B03     B02
-                fsub    st0, st1        ; B02-B03       B03     B02
-                fmul    _C16            ; A03           B03     B02
-                fstp    _B(%1+3)        ; B03           B02
-                faddp   st1             ; A02
-                fstp    _B(%1+2)        ;
-%endmacro
-
-;    B00 =  A00 + A02;
-;    B01 =  A01 + A03;
-;    A00 =  B00 + B01;
-;    A01 = (B00 - B01) * C[16];
-;    B02 = (A00 - A02) * C[ 8];
-;    B03 = (A01 - A03) * C[24];
-;    A02 =  B02 + B03;
-;    A03 = (B02 - B03) * C[16];
-
-                op2     0
-
-;    B04 =  A04 + A06;
-;    B05 =  A05 + A07;
-;    A04 =  B04 + B05;
-;    A05 = (B04 - B05) * C[16];
-;    B06 = (A04 - A06) * C[ 8];
-;    B07 = (A05 - A07) * C[24];
-;    A06 =  B06 + B07;
-;    A07 = (B06 - B07) * C[16];
-
-                op2     4
-
-;    B08 =  A08 + A10;
-;    B09 =  A09 + A11;
-;    A08 =  B08 + B09;
-;    A09 = (B08 - B09) * C[16];
-;    B10 = (A08 - A10) * C[ 8];
-;    B11 = (A09 - A11) * C[24];
-;    A10 =  B10 + B11;
-;    A11 = (B10 - B11) * C[16];
-
-                op2     8
-
-;    B12 =  A12 + A14;
-;    B13 =  A13 + A15;
-;    A12 =  B12 + B13;
-;    A13 = (B12 - B13) * C[16];
-;    B14 = (A12 - A14) * C[ 8];
-;    B15 = (A13 - A15) * C[24];
-;    A14 =  B14 + B15;
-;    A15 = (B14 - B15) * C[16];
-
-                op2     12
-
-;   V[48] = -A00;
-;   V[ 0] =  A01;
-;   V[40] = -A02 - (V[ 8] = A03);
-
-                fld     _B(0)
-                fchs
-                fstp    _V(48)
-                fld     _B(1)
-                fstp    _V(0)
-                fld     _B(3)
-                fst     _V(8)
-                fadd    _B(2)
-                fchs
-                fstp    _V(40)
-
-;   V[36] = -((V[ 4] = A05 + (V[12] = A07)) + A06);
-;   V[44] = - A04 - A06 - A07;
-
-                fld     _B(7)
-                fst     _V(12)
-                fadd    _B(5)
-                fst     _V(4)
-                fadd    _B(6)
-                fchs
-                fstp    _V(36)
-                fld     _B(4)
-                fadd    _B(6)
-                fadd    _B(7)
-                fchs
-                fstp    _V(44)
-
-;   V[ 6] = (V[10] = A11 + (V[14] = A15)) + A13;
-;   V[38] = (V[34] = -(V[ 2] = A09 + A13 + A15) - A14) + A09 - A10 - A11;
-
-                fld     _B(15)
-                fst     _V(14)
-                fadd    _B(11)
-                fst     _V(10)
-                fadd    _B(13)
-                fstp    _V(6)
-                fld     _B(9)
-                fadd    _B(13)
-                fadd    _B(15)
-                fst     _V(2)
-                fadd    _B(14)
-                fchs
-                fst     _V(34)
-                fadd    _B(9)
-                fsub    _B(10)
-                fsub    _B(11)
-                fstp    _V(38)
-
-;   V[46] = (tmp = -(A12 + A14 + A15)) - A08;
-
-                fld     _B(12)
-                fadd    _B(14)
-                fadd    _B(15)
-                fchs
-                fld     st0
-                fsub    _B(8)
-                fstp    _V(46)
-
-;   V[42] = tmp - A10 - A11;                            // abhängig vom Befehl drüber
-
-                fsub    _B(10)
-                fsub    _B(11)
-                fstp    _V(42)
-
-
-%macro          op4     4
-                fld     _S(%1)          ; S00
-                fsub    _S(31-%1)       ; A00
-                fmul    %2
-                fld     _S(15-%1)       ; S15           A00
-                fsub    _S(16+%1)       ; A08           A00
-                fmul    %3
-                fld     st1             ; A00           A08     A00
-                fsub    st0, st1        ; A00-A08       A08     A00
-                fmul    %4              ; B08           A08     A00
-                fxch    st2             ; A00           A08     B08
-                faddp   st1             ; B00           B08
-%endmacro
-
-;    A00 = (Sample[ 0] - Sample[31]) * C[ 1];
-;    A08 = (Sample[15] - Sample[16]) * C[31];
-;    B00 =  A00 + A08;
-;    B08 = (A00 - A08) * C[ 2];
-;    A04 = (Sample[ 7] - Sample[24]) * C[15];
-;    A12 = (Sample[ 8] - Sample[23]) * C[17];
-;    B04 =  A04 + A12;
-;    B12 = (A04 - A12) * C[30];
-
-                op4      0, _C01, _C31, _C02
-                op4      7, _C15, _C17, _C30
-
-;   A00 =  B00 + B04;
-;   A04 = (B00 - B04) * C[ 4];
-;   A08 =  B08 + B12;
-;   A12 = (B08 - B12) * C[ 4];
-
-                opx      0, _C04
-
-;    A01 = (Sample[ 1] - Sample[30]) * C[ 3];
-;    A09 = (Sample[14] - Sample[17]) * C[29];
-;    B01 =  A01 + A09;
-;    B09 = (A01 - A09) * C[ 6];
-;    A05 = (Sample[ 6] - Sample[25]) * C[13];
-;    A13 = (Sample[ 9] - Sample[22]) * C[19];
-;    B05 =  A05 + A13;
-;    B13 = (A05 - A13) * C[26];
-
-                op4      1, _C03, _C29, _C06
-                op4      6, _C13, _C19, _C26
-
-;    A01 =  B01 + B05;
-;    A05 = (B01 - B05) * C[12];
-;    A09 =  B09 + B13;
-;    A13 = (B09 - B13) * C[12];
-
-                opx      1, _C12
-
-;    A02 = (Sample[ 3] - Sample[28]) * C[ 7];
-;    A10 = (Sample[12] - Sample[19]) * C[25];
-;    B02 =  A02 + A10;
-;    B10 = (A02 - A10) * C[14];
-;    A06 = (Sample[ 4] - Sample[27]) * C[ 9];
-;    A14 = (Sample[11] - Sample[20]) * C[23];
-;    B06 =  A06 + A14;
-;    B14 = (A06 - A14) * C[18];
-
-                op4      3, _C07, _C25, _C14
-                op4      4, _C09, _C23, _C18
-
-;    A02 =  B02 + B06;
-;    A06 = (B02 - B06) * C[28];
-;    A10 =  B10 + B14;
-;    A14 = (B10 - B14) * C[28];
-
-                opx      2, _C28
-
-;    A03 = (Sample[ 2] - Sample[29]) * C[ 5];
-;    A11 = (Sample[13] - Sample[18]) * C[27];
-;    B03 =  A03 + A11;
-;    B11 = (A03 - A11) * C[10];
-;    A07 = (Sample[ 5] - Sample[26]) * C[11];
-;    A15 = (Sample[10] - Sample[21]) * C[21];
-;    B07 =  A07 + A15;
-;    B15 = (A07 - A15) * C[22];
-
-                op4      2, _C05, _C27, _C10
-                op4      5, _C11, _C21, _C22
-
-;    A03 =  B03 + B07;
-;    A07 = (B03 - B07) * C[20];
-;    A11 =  B11 + B15;
-;    A15 = (B11 - B15) * C[20];
-
-                opx      3, _C20
-
-;    B00 =  A00 + A02;
-;    B01 =  A01 + A03;
-;    A00 =  B00 + B01;
-;    A01 = (B00 - B01) * C[16];
-;    B02 = (A00 - A02) * C[ 8];
-;    B03 = (A01 - A03) * C[24];
-;    A02 =  B02 + B03;
-;    A03 = (B02 - B03) * C[16];
-
-                op2     0
-
-;    B04 =  A04 + A06;
-;    B05 =  A05 + A07;
-;    A04 =  B04 + B05;
-;    A05 = (B04 - B05) * C[16];
-;    B06 = (A04 - A06) * C[ 8];
-;    B07 = (A05 - A07) * C[24];
-;    A06 =  B06 + B07;
-;    A07 = (B06 - B07) * C[16];
-
-                op2     4
-
-;    B08 =  A08 + A10;
-;    B09 =  A09 + A11;
-;    A08 =  B08 + B09;
-;    A09 = (B08 - B09) * C[16];
-;    B10 = (A08 - A10) * C[ 8];
-;    B11 = (A09 - A11) * C[24];
-;    A10 =  B10 + B11;
-;    A11 = (B10 - B11) * C[16];
-
-                op2     8
-
-;    B12 =  A12 + A14;
-;    B13 =  A13 + A15;
-;    A12 =  B12 + B13;
-;    A13 = (B12 - B13) * C[16];
-;    B14 = (A12 - A14) * C[ 8];
-;    B15 = (A13 - A15) * C[24];
-;    A14 =  B14 + B15;
-;    A15 = (B14 - B15) * C[16];
-
-                op2     12
-
-;   V[ 5] = (V[11] = (V[13] = A07 + (V[15] = A15)) + A11) + A05 + A13;
-
-                fld     _B(15)
-                fst     _V(15)
-                fadd    _B(7)
-                fst     _V(13)
-                fadd    _B(11)
-                fst     _V(11)
-                fadd    _B(5)
-                fadd    _B(13)
-                fstp    _V(5)
-
-;   V[ 7] = (V[ 9] = A03 + A11 + A15) + A13;
-
-                fld     _B(3)
-                fadd    _B(11)
-                fadd    _B(15)
-                fst     _V(9)
-                fadd    _B(13)
-                fstp    _V(7)
-
-;   V[33] = -(V[ 1] = A01 + A09 + A13 + A15) - A14;
-
-                fld     _B(1)
-                fadd    _B(9)
-                fadd    _B(13)
-                fadd    _B(15)
-                fst     _V(1)
-                fadd    _B(14)
-                fchs
-                fstp    _V(33)
-
-;   V[35] = -(V[ 3] = A05 + A07 + A09 + A13 + A15) - A06 - A14;
-
-                fld     _B(5)
-                fadd    _B(7)
-                fadd    _B(9)
-                fadd    _B(13)
-                fadd    _B(15)
-                fst     _V(3)
-                fadd    _B(6)
-                fadd    _B(14)
-                fchs
-                fstp    _V(35)
-
-;   V[37] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07;
-
-                fld     _B(10)
-                fadd    _B(11)
-                fadd    _B(13)
-                fadd    _B(14)
-                fadd    _B(15)
-                fchs
-                fld     st0
-                fsub    _B(5)
-                fsub    _B(6)
-                fsub    _B(7)
-                fstp    _V(37)
-
-;   V[39] = tmp - A02 - A03;                                            // abhängig vom Befehl drüber
-
-                fld     st0
-                fsub    _B(2)
-                fsub    _B(3)
-                fstp    _V(39)
-
-;   V[41] = (tmp += A13 - A12) - A02 - A03;                             // abhängig vom Befehl 2 drüber
-
-                fadd    _B(13)
-                fsub    _B(12)
-                fld     st0
-                fsub    _B(2)
-                fsub    _B(3)
-                fstp    _V(41)
-
-;   V[43] = tmp - A04 - A06 - A07;                                      // abhängig von Befehlen 1 und 3 drüber
-
-                fsub    _B(4)
-                fsub    _B(6)
-                fsub    _B(7)
-                fstp    _V(43)
-
-;   V[47] = (tmp = -(A08 + A12 + A14 + A15)) - A00;
-
-                fld     _B(8)
-                fadd    _B(12)
-                fadd    _B(14)
-                fadd    _B(15)
-                fchs
-                fld     st0
-                fsub    _B(0)
-                fstp    _V(47)
-
-;   V[45] = tmp - A04 - A06 - A07;                                      // abhängig vom Befehl drüber
-
-                fsub    _B(4)
-                fsub    _B(6)
-                fsub    _B(7)
-                fstp    _V(45)
-
-;    ((Uint32_t*)V)[32-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 0-32];
-;    ((Uint32_t*)V)[31-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 1-32];
-;    ((Uint32_t*)V)[30-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 2-32];
-;    ((Uint32_t*)V)[29-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 3-32];
-;    ((Uint32_t*)V)[28-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 4-32];
-;    ((Uint32_t*)V)[27-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 5-32];
-;    ((Uint32_t*)V)[26-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 6-32];
-;    ((Uint32_t*)V)[25-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 7-32];
-;    ((Uint32_t*)V)[24-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 8-32];
-;    ((Uint32_t*)V)[23-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[ 9-32];
-;    ((Uint32_t*)V)[22-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[10-32];
-;    ((Uint32_t*)V)[21-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[11-32];
-;    ((Uint32_t*)V)[20-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[12-32];
-;    ((Uint32_t*)V)[19-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[13-32];
-;    ((Uint32_t*)V)[18-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[14-32];
-;    ((Uint32_t*)V)[17-32] = (Uint32_t)0x80000000L + ((Uint32_t*)V)[15-32];
-
-                mov     ecx, 0x80000000
-%assign i 0
-%rep 16
-                mov     eax, _V(i)
-                add     eax, ecx
-                mov     _V(32-i), eax
-%assign i i+1
-%endrep
-
-;    ((Uint32_t*)V)[63-32] = ((Uint32_t*)V)[33-32];
-;    ((Uint32_t*)V)[62-32] = ((Uint32_t*)V)[34-32];
-;    ((Uint32_t*)V)[61-32] = ((Uint32_t*)V)[35-32];
-;    ((Uint32_t*)V)[60-32] = ((Uint32_t*)V)[36-32];
-;    ((Uint32_t*)V)[59-32] = ((Uint32_t*)V)[37-32];
-;    ((Uint32_t*)V)[58-32] = ((Uint32_t*)V)[38-32];
-;    ((Uint32_t*)V)[57-32] = ((Uint32_t*)V)[39-32];
-;    ((Uint32_t*)V)[56-32] = ((Uint32_t*)V)[40-32];
-;    ((Uint32_t*)V)[55-32] = ((Uint32_t*)V)[41-32];
-;    ((Uint32_t*)V)[54-32] = ((Uint32_t*)V)[42-32];
-;    ((Uint32_t*)V)[53-32] = ((Uint32_t*)V)[43-32];
-;    ((Uint32_t*)V)[52-32] = ((Uint32_t*)V)[44-32];
-;    ((Uint32_t*)V)[51-32] = ((Uint32_t*)V)[45-32];
-;    ((Uint32_t*)V)[50-32] = ((Uint32_t*)V)[46-32];
-;    ((Uint32_t*)V)[49-32] = ((Uint32_t*)V)[47-32];
-
-%assign i 1
-%rep 15
-                mov     eax, _V(32+i)
-                mov     _V(64-i), eax
-%assign i i+1
-%endrep
-
-                sub     esp, byte -128
-                pop     ebp
-endproc
-
-;
-; end of synthasm.nas
-;
Index: penc/trunk/synthtab.c
===================================================================
--- /mppenc/trunk/synthtab.c	(revision 96)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppdec.h"
-
-/*
- *  Description
- *  Cos64[i] = 0.5 / cos (pi*i/64)
- */
-
-const Float  Cos64 [32] = {
-    C00, C01, C02, C03, C04, C05, C06, C07, C08, C09, C10, C11, C12, C13, C14, C15,
-    C16, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29, C30, C31
-};
-
-
-/*
- *  Synthesis-filter-coefficients for the normal C-Code.
- *  Values are all multiples of 1/65536.
- *  Values are between  -1.144... und +1.144...
- *  16 adjoined (side by side) coefficients make up one filter.
- */
-
-#undef _
-#define _(value)  (Float)(value##.##L / 0x10000)
-
-const Float  Di_opt [32] [16] = {
-   { _(  0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _(  6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) },
-   { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _(  5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) },
-   { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _(  5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) },
-   { _( -1), _( -38), _( 225), _( -645), _( 1893), _(-6237), _(  4561), _(-43006), _(74630), _(31947), _(8092), _( 4063), _(2087), _( 294), _(196), _(21) },
-   { _( -1), _( -41), _( 227), _( -711), _( 1822), _(-6589), _(  3776), _(-44821), _(74313), _(30112), _(8492), _( 3705), _(2085), _( 244), _(190), _(19) },
-   { _( -1), _( -45), _( 228), _( -779), _( 1739), _(-6935), _(  2935), _(-46617), _(73908), _(28289), _(8840), _( 3351), _(2075), _( 197), _(183), _(17) },
-   { _( -1), _( -49), _( 228), _( -848), _( 1644), _(-7271), _(  2037), _(-48390), _(73415), _(26482), _(9139), _( 3004), _(2057), _( 153), _(176), _(16) },
-   { _( -2), _( -53), _( 227), _( -919), _( 1535), _(-7597), _(  1082), _(-50137), _(72835), _(24694), _(9389), _( 2663), _(2032), _( 111), _(169), _(14) },
-   { _( -2), _( -58), _( 224), _( -991), _( 1414), _(-7910), _(    70), _(-51853), _(72169), _(22929), _(9592), _( 2330), _(2001), _(  72), _(161), _(13) },
-   { _( -2), _( -63), _( 221), _(-1064), _( 1280), _(-8209), _(  -998), _(-53534), _(71420), _(21189), _(9750), _( 2006), _(1962), _(  36), _(154), _(11) },
-   { _( -2), _( -68), _( 215), _(-1137), _( 1131), _(-8491), _( -2122), _(-55178), _(70590), _(19478), _(9863), _( 1692), _(1919), _(   2), _(147), _(10) },
-   { _( -3), _( -73), _( 208), _(-1210), _(  970), _(-8755), _( -3300), _(-56778), _(69679), _(17799), _(9935), _( 1388), _(1870), _( -29), _(139), _( 9) },
-   { _( -3), _( -79), _( 200), _(-1283), _(  794), _(-8998), _( -4533), _(-58333), _(68692), _(16155), _(9966), _( 1095), _(1817), _( -57), _(132), _( 8) },
-   { _( -4), _( -85), _( 189), _(-1356), _(  605), _(-9219), _( -5818), _(-59838), _(67629), _(14548), _(9959), _(  814), _(1759), _( -83), _(125), _( 7) },
-   { _( -4), _( -91), _( 177), _(-1428), _(  402), _(-9416), _( -7154), _(-61289), _(66494), _(12980), _(9916), _(  545), _(1698), _(-106), _(117), _( 7) },
-   { _( -5), _( -97), _( 163), _(-1498), _(  185), _(-9585), _( -8540), _(-62684), _(65290), _(11455), _(9838), _(  288), _(1634), _(-127), _(111), _( 6) },
-   { _( -5), _(-104), _( 146), _(-1567), _(  -45), _(-9727), _( -9975), _(-64019), _(64019), _( 9975), _(9727), _(   45), _(1567), _(-146), _(104), _( 5) },
-   { _( -6), _(-111), _( 127), _(-1634), _( -288), _(-9838), _(-11455), _(-65290), _(62684), _( 8540), _(9585), _( -185), _(1498), _(-163), _( 97), _( 5) },
-   { _( -7), _(-117), _( 106), _(-1698), _( -545), _(-9916), _(-12980), _(-66494), _(61289), _( 7154), _(9416), _( -402), _(1428), _(-177), _( 91), _( 4) },
-   { _( -7), _(-125), _(  83), _(-1759), _( -814), _(-9959), _(-14548), _(-67629), _(59838), _( 5818), _(9219), _( -605), _(1356), _(-189), _( 85), _( 4) },
-   { _( -8), _(-132), _(  57), _(-1817), _(-1095), _(-9966), _(-16155), _(-68692), _(58333), _( 4533), _(8998), _( -794), _(1283), _(-200), _( 79), _( 3) },
-   { _( -9), _(-139), _(  29), _(-1870), _(-1388), _(-9935), _(-17799), _(-69679), _(56778), _( 3300), _(8755), _( -970), _(1210), _(-208), _( 73), _( 3) },
-   { _(-10), _(-147), _(  -2), _(-1919), _(-1692), _(-9863), _(-19478), _(-70590), _(55178), _( 2122), _(8491), _(-1131), _(1137), _(-215), _( 68), _( 2) },
-   { _(-11), _(-154), _( -36), _(-1962), _(-2006), _(-9750), _(-21189), _(-71420), _(53534), _(  998), _(8209), _(-1280), _(1064), _(-221), _( 63), _( 2) },
-   { _(-13), _(-161), _( -72), _(-2001), _(-2330), _(-9592), _(-22929), _(-72169), _(51853), _(  -70), _(7910), _(-1414), _( 991), _(-224), _( 58), _( 2) },
-   { _(-14), _(-169), _(-111), _(-2032), _(-2663), _(-9389), _(-24694), _(-72835), _(50137), _(-1082), _(7597), _(-1535), _( 919), _(-227), _( 53), _( 2) },
-   { _(-16), _(-176), _(-153), _(-2057), _(-3004), _(-9139), _(-26482), _(-73415), _(48390), _(-2037), _(7271), _(-1644), _( 848), _(-228), _( 49), _( 1) },
-   { _(-17), _(-183), _(-197), _(-2075), _(-3351), _(-8840), _(-28289), _(-73908), _(46617), _(-2935), _(6935), _(-1739), _( 779), _(-228), _( 45), _( 1) },
-   { _(-19), _(-190), _(-244), _(-2085), _(-3705), _(-8492), _(-30112), _(-74313), _(44821), _(-3776), _(6589), _(-1822), _( 711), _(-227), _( 41), _( 1) },
-   { _(-21), _(-196), _(-294), _(-2087), _(-4063), _(-8092), _(-31947), _(-74630), _(43006), _(-4561), _(6237), _(-1893), _( 645), _(-225), _( 38), _( 1) },
-   { _(-24), _(-202), _(-347), _(-2080), _(-4425), _(-7640), _(-33791), _(-74856), _(41176), _(-5288), _(5879), _(-1952), _( 581), _(-222), _( 35), _( 1) },
-   { _(-26), _(-208), _(-401), _(-2063), _(-4788), _(-7134), _(-35640), _(-74992), _(39336), _(-5959), _(5517), _(-2000), _( 519), _(-218), _( 31), _( 1) }
-};
-
-#undef  _
-
-/* end of synthtab.c */
Index: penc/trunk/tagger.c
===================================================================
--- /mppenc/trunk/tagger.c	(revision 96)
+++ 	(revision )
@@ -1,295 +1,0 @@
-/*
-
-" "
-"."                             .
-"/"                             /
-" -- "                          _
-"[#0]"                          0
-"[#n]"  [number]                n
-"(#N)"  (CD x)                  N
-"#A"    Artist                  A
-"#C"    CD                      C
-"#T"    Title                   T
-"#x"    extention               x
-
-
-/#C -- [#n] #A -- #T#x      | Acid Jazz/100% Acid Jazz -- [04] Leena Conquest (and Hip Hop Fingers) -- Boundaries (Radio Edit).pac
-/#A/#C -- [#n] #T#x         | Andreas Vollenweider/Eolian Minstrel -- [02] Across the Iron River.pac
-/#A/#C#N -- [#n] #T#x       | Barbra Streisand/The Concert (CD 1) -- [01] Overture
-/#A -- #C -- [#n] #T#x      | Friedemann/Friedemann -- Aquamarin -- [09] In the Court of the Mermaid.pac
-/#C/[#n] #A -- #T#x         | Jazz Lyrik Prosa/[11] Eberhard Esche -- Anektode.pac
-/#A -- #T#x                 | Lais/Lais -- 06.pac
-/#C/(#N) -- [#n] #A -- #T#x | Tanz- und Folkfest 2001 -- Klingende Post/(CD 2) -- [09] Andy Irvine -- Gladiators.pac
-/#A -- #C -- [#0]#x         | Friedemann/Friedemann -- Aquamarin -- [00].pac
-/#A/#C (#N) -- [#0]#x       | Tangerine Dream/The Warsaw Concert (CD 2) -- [00].pac
-/#A/#T#x                    | Heinz-Rudolf Kunze/Dein ist mein ganzes Herz.pac
-/#A/#C -- [#0]#x            | Sting/Nada como el Sol -- [00].mpc
-
-*/
-
-#include <ctype.h>
-#include "mppdec.h"
-
-
-#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
-
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
-
-    while ( bytes > 0 ) {
-        ret = read ( fd, dest, bytes );
-        if ( ret == 0  ||  ret == (size_t)-1 )
-            break;
-        dest       = (void*)(((char*)dest) + ret);
-        bytes     -= ret;
-        bytesread += ret;
-    }
-    return bytesread;
-}
-
-#endif
-
-
-
-static int
-tag ( const char* filename, const char* Artist, const char* CD, const char* Title, int no )
-{
-    FILE_T      fp;
-    char        tmp [128];
-
-    // sleep (1);
-    fp = OPENRW (filename);
-    if ( fp == INVALID_FILEDESC )
-        return -1;
-    if ( -1 == SEEK ( fp, -128L, SEEK_END ) )
-        return -1;
-    if ( 128 != READ ( fp, tmp, 128 ) )
-        return 0;
-
-    if ( 0 != memcmp ( tmp, "TAG", 3 ) ) {
-        SEEK ( fp,   -0L, SEEK_END );
-        printf ("*** Add Tag ***\n");
-        memset (tmp, 0, sizeof(tmp));
-    } else {
-        SEEK ( fp, -128L, SEEK_END );
-        printf ("*** Modify Tag ***\n");
-    }
-    printf ("------------------\nArtist=%s\nCD    =%s\nTitle =%s\nNo    =%u\n-----------------\n", Artist, CD, Title, no );
-
-    strncpy  ( tmp +  0, "TAG" ,  3 );
-    strncpy  ( tmp +  3, Title , 30 );
-    strncpy  ( tmp + 33, Artist, 30 );
-    strncpy  ( tmp + 63, CD    , 30 );
-    strncpy  ( tmp + 93, "    ",  4 );
-    // memcpy  ( tip->Comment, tmp + 97, 30 );
-    tmp[125] = '\0';
-    tmp[126] = no;
-    tmp[127] = (char)-1;
-
-    if ( 128 != WRITE ( fp, tmp, 128 ) )
-        return 0;
-    CLOSE (fp);
-    printf ( "Okay\n\n");
-
-    return 0;
-}
-
-
-static void
-copy ( char* dst, const char* src, size_t len )
-{
-   memcpy ( dst, src, len );
-   dst[len] = '\0';
-}
-
-/*
- *    dst[0] = Artist
- *    dst[1] = CD
- *    dst[2] = Title
- *    dst[3] = +CD
- *    dst[4] = number
- *    dst[5] = ext
- */
-
-static int
-parse ( char** dst, const char* src, const char* format )
-{
-    int          i;
-    const char*  srcend = src + strlen(src);
-    const char*  p;
-    char*        q;
-
-    for ( i = 0; i < 6; i++)
-        dst[i][0] = '\0';
-
-    for ( i = strlen(format); i-- > 0; ) {
-        p = srcend;
-        printf ("%c: ", format[i] );
-
-        switch ( format[i] ) {
-        case '.':
-        case ' ':
-        case '/':                               // !!!!!!!
-            if (p[-1] != format[i])
-                return 1;
-            p--;
-            break;
-        case '_':
-            if (0 != memcmp (p-4, " -- ", 4))
-                return 1;
-            p -= 4;
-            break;
-        case '0':
-            if (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                return 1;
-            p -= 4;
-            break;
-        case 'n':
-            if (p[-1] != ']' || !isdigit(p[-2]) || !isdigit(p[-3]) || p[-4] != '[')
-                return 1;
-            copy (dst[4], p-3, 2);
-            p -= 4;
-            break;
-        case 'N':
-            if (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')
-                return 1;
-            dst[3][0] = ' ';
-            copy (dst[3]+1, p-6, 6);
-            p -= 6;
-            break;
-        case 'A':
-            q = dst[0]; goto big;
-        case 'C':
-            q = dst[1]; goto big;
-        case 'T':
-            q = dst[2]; goto big;
-        big:
-            while ( 0 == memcmp (p-4, "/mpc", 4)  ||
-                    0 == memcmp (p-4, "/mp3", 4)  ||
-                    0 == memcmp (p-4, "/pac", 4)
-                  )
-                srcend -= 4, p -= 4;
-            while ( p[-1] != PATH_SEP  &&
-                    p[-1] != DRIVE_SEP &&
-                    0 != memcmp (p-4, " -- ", 4 )  &&
-                    (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')  &&
-                    (p[-1] != ' ' || p[-2] != ']' || !isdigit(p[-3]) || !isdigit(p[-4]) || p[-5] != '[') &&
-                    (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                  )
-                p--;
-            copy ( q, p, srcend - p );
-            break;
-        case 'x':
-            do {
-                p--;
-                if (p[0] == PATH_SEP || p[0] == DRIVE_SEP)
-                    return -1;
-            } while (*p != '.');
-            copy (dst[5], p, srcend-p );
-            break;
-        }
-        printf ("%*.*s\033[7m%*.*s\033[0m\n", p-src, p-src, src, srcend-p, srcend-p, p );
-        srcend = p;
-    }
-    return 0;
-}
-
-static int
-hexdigit ( const char s )
-{
-    if ( (unsigned char)(s-'0') < 10u )
-        return s-'0';
-    if ( (unsigned char)(s-'A') <  6u )
-        return s-'A'+10;
-    return -1;
-}
-
-static void
-spaceconverting ( char* dst, const char* src )
-{
-    for ( ; src[0] != '\0' ; src++) {
-        if      ( src[0] == '_' )
-            *dst++ = ' ';
-        else if ( src[0] == '%'  &&  hexdigit(src[1]) >= 0  &&  hexdigit(src[2]) >= 0 )
-            *dst++ = hexdigit(src[1]) * 16 + hexdigit(src[2]), src += 2;
-        else
-            *dst++ = *src;
-    }
-    *dst = '\0';
-}
-
-void doitwith ( const char* filename, const char* src )
-{
-    static const char*  parser [] = {
-        "/A_Tx",
-        "/A/Tx",
-        "/A_C_0x",
-        "/C_n A_Tx",
-        "/A/C_n Tx",
-        "/A/C#N_n Tx",
-        "/A_C_n Tx",
-        "/C/n A_Tx",
-        "/C/N_n A_Tx",
-        "/A/C N_0x",
-        "/A/C_0x",
-};
-    size_t  i;
-    int     no  =  0;
-    int     idx = -1;
-    char    tmp  [6] [1024];
-    char*   buff [6] = { tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5] };
-
-    printf ("  »%s«\n", src );
-    for ( i = 0; i < sizeof(parser)/sizeof(*parser); i++ ) {
-        if ( 0 == parse ( buff, src, parser[i] ) ) {
-            no++;
-            idx = i;
-            printf ("Artist = »%s«\n", tmp[0]);
-            printf ("CD     = »%s%s«\n", tmp[1], tmp[3]);
-            printf ("Title  = »%s«\n", tmp[2]);
-            printf ("No#    = »%s«\n", tmp[4]);
-            printf ("Extent = »%s«\n", tmp[5]);
-        }
-        printf ("\n");
-    }
-
-    if ( no != 1 ) {
-        printf ("%u matches\a\n\n", no ), sleep (2);
-    }
-    {
-        char  merge [1024];
-        parse ( buff, src, parser[idx] );
-        sprintf (merge,"%s%s", tmp[1], tmp[3]);
-        tag ( filename, tmp[0], merge, tmp[2], atoi(tmp[4]));
-    }
-
-    printf ("\n");
-}
-
-int Cdecl
-main ( int argc, char** argv )
-{
-    char  buff1 [32768];
-    char  buff2 [32768];
-    char  buff3 [32768];
-
-    getcwd ( buff1, sizeof(buff1) );
-
-    while ( *++argv ) {
-        spaceconverting ( buff3, *argv );
-        if (**argv == PATH_SEP)
-            sprintf ( buff2, "%s", buff3 );
-        else if (buff3[0] == '.' && buff3[1] == PATH_SEP)
-            sprintf ( buff2, "%s%c%s", buff1, PATH_SEP, buff3+2 );
-        else
-            sprintf ( buff2, "%s%c%s", buff1, PATH_SEP, buff3 );
-        doitwith ( *argv, buff2 );
-    }
-
-    return 0;
-}
-
-/* end of tagger.c */
Index: penc/trunk/tagger.dsp
===================================================================
--- /mppenc/trunk/tagger.dsp	(revision 96)
+++ 	(revision )
@@ -1,101 +1,0 @@
-# Microsoft Developer Studio Project File - Name="tagger" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=tagger - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "tagger.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "tagger.mak" CFG="tagger - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "tagger - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "tagger - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "tagger - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "tagger - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MPP_ENCODER" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "tagger - Win32 Release"
-# Name "tagger - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\tagger.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/tagger.vcproj
===================================================================
--- /mppenc/trunk/tagger.vcproj	(revision 96)
+++ 	(revision )
@@ -1,167 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="tagger"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="NDEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/tagger.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/tagger.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/tagger.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/tagger.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="_DEBUG;WIN32;_CONSOLE;MPP_ENCODER"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/tagger.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib setargv.obj"
-				OutputFile=".\Debug/tagger.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/tagger.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/tagger.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="tagger.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/tags.c
===================================================================
--- /mppenc/trunk/tags.c	(revision 96)
+++ 	(revision )
@@ -1,1332 +1,0 @@
-/*
- *  Encoder tag handling
- *
- *  (C) Frank Klemm 2002. Janne Hyvärinen 2002. All rights reserved.
- *
- *  Principles:
- *
- *
- *  History:
- *    2002-06     created
- *    2002-08-12  added translation method 5 to addtag()
- *                Tags taken from source file can't overwrite already existing items
- *                added Init_Tags()
- *    2002-08-13  Added all windows code pages
- *    2002-10-09  Added code to parse tags from filename
- *
- *  Global functions:
- *    - addtag()
- *
- *  TODO:
- *    - '/' and '\' should be possible as PATH_SEP
- */
-
-#include "mppenc.h"
-
-#ifdef USE_WIDECHAR
-# include <wchar.h>
-#endif
-
-
-static const char*  GenreList [] = {
-    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
-    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
-    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
-    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
-    "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
-    "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
-    "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
-    "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
-    "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
-    "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
-    "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
-    "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
-    "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
-    "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion",
-    "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
-    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
-    "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
-    "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
-    "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
-    "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
-    "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
-    "Dance Hall", "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
-    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", "Christian Gangsta",
-    "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
-    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
-    "SynthPop"
-};
-
-
-struct APETagFooterStruct {
-    Uint8_t   ID       [8];    // should equal 'APETAGEX'
-    Uint8_t   Version  [4];    // currently 1000 (version 1.000)
-    Uint8_t   Length   [4];    // the complete size of the tag, including this footer
-    Uint8_t   TagCount [4];    // the number of fields in the tag
-    Uint8_t   Flags    [4];    // the tag flags (none currently defined)
-    Uint8_t   Reserved [8];    // reserved for later use
-};
-
-
-typedef struct {
-    char*           key;
-    size_t          keylen;
-    unsigned char*  value;
-    size_t          valuelen;
-    unsigned int    flags;
-} TagItem_t;
-
-
-static TagItem_t       T [256];                        // up to 256 items, otherwise program crashs
-static unsigned int    TagCount = 0;
-
-#if defined __TURBOC__
-
-static unsigned short  CP_850 [256] = {
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
-    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
-    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
-    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
-};
-
-#elif defined _WIN32
-
-static unsigned short  CP_37 [256] = {  // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
-    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
-    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
-    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC,
-    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
-    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
-    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
-    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
-    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
-    0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
-    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
-    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
-    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
-};
-
-static unsigned short  CP_42 [256] = { // CP_SYMBOLS
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0xF020, 0xF021, 0xF022, 0xF023, 0xF024, 0xF025, 0xF026, 0xF027, 0xF028, 0xF029, 0xF02A, 0xF02B, 0xF02C, 0xF02D, 0xF02E, 0xF02F,
-    0xF030, 0xF031, 0xF032, 0xF033, 0xF034, 0xF035, 0xF036, 0xF037, 0xF038, 0xF039, 0xF03A, 0xF03B, 0xF03C, 0xF03D, 0xF03E, 0xF03F,
-    0xF040, 0xF041, 0xF042, 0xF043, 0xF044, 0xF045, 0xF046, 0xF047, 0xF048, 0xF049, 0xF04A, 0xF04B, 0xF04C, 0xF04D, 0xF04E, 0xF04F,
-    0xF050, 0xF051, 0xF052, 0xF053, 0xF054, 0xF055, 0xF056, 0xF057, 0xF058, 0xF059, 0xF05A, 0xF05B, 0xF05C, 0xF05D, 0xF05E, 0xF05F,
-    0xF060, 0xF061, 0xF062, 0xF063, 0xF064, 0xF065, 0xF066, 0xF067, 0xF068, 0xF069, 0xF06A, 0xF06B, 0xF06C, 0xF06D, 0xF06E, 0xF06F,
-    0xF070, 0xF071, 0xF072, 0xF073, 0xF074, 0xF075, 0xF076, 0xF077, 0xF078, 0xF079, 0xF07A, 0xF07B, 0xF07C, 0xF07D, 0xF07E, 0xF07F,
-    0xF080, 0xF081, 0xF082, 0xF083, 0xF084, 0xF085, 0xF086, 0xF087, 0xF088, 0xF089, 0xF08A, 0xF08B, 0xF08C, 0xF08D, 0xF08E, 0xF08F,
-    0xF090, 0xF091, 0xF092, 0xF093, 0xF094, 0xF095, 0xF096, 0xF097, 0xF098, 0xF099, 0xF09A, 0xF09B, 0xF09C, 0xF09D, 0xF09E, 0xF09F,
-    0xF0A0, 0xF0A1, 0xF0A2, 0xF0A3, 0xF0A4, 0xF0A5, 0xF0A6, 0xF0A7, 0xF0A8, 0xF0A9, 0xF0AA, 0xF0AB, 0xF0AC, 0xF0AD, 0xF0AE, 0xF0AF,
-    0xF0B0, 0xF0B1, 0xF0B2, 0xF0B3, 0xF0B4, 0xF0B5, 0xF0B6, 0xF0B7, 0xF0B8, 0xF0B9, 0xF0BA, 0xF0BB, 0xF0BC, 0xF0BD, 0xF0BE, 0xF0BF,
-    0xF0C0, 0xF0C1, 0xF0C2, 0xF0C3, 0xF0C4, 0xF0C5, 0xF0C6, 0xF0C7, 0xF0C8, 0xF0C9, 0xF0CA, 0xF0CB, 0xF0CC, 0xF0CD, 0xF0CE, 0xF0CF,
-    0xF0D0, 0xF0D1, 0xF0D2, 0xF0D3, 0xF0D4, 0xF0D5, 0xF0D6, 0xF0D7, 0xF0D8, 0xF0D9, 0xF0DA, 0xF0DB, 0xF0DC, 0xF0DD, 0xF0DE, 0xF0DF,
-    0xF0E0, 0xF0E1, 0xF0E2, 0xF0E3, 0xF0E4, 0xF0E5, 0xF0E6, 0xF0E7, 0xF0E8, 0xF0E9, 0xF0EA, 0xF0EB, 0xF0EC, 0xF0ED, 0xF0EE, 0xF0EF,
-    0xF0F0, 0xF0F1, 0xF0F2, 0xF0F3, 0xF0F4, 0xF0F5, 0xF0F6, 0xF0F7, 0xF0F8, 0xF0F9, 0xF0FA, 0xF0FB, 0xF0FC, 0xF0FD, 0xF0FE, 0xF0FF,
-};
-
-static unsigned short  CP_437 [256] = { // MS-DOS: US
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_500 [256] = { // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
-    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
-    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x005B, 0x002E, 0x003C, 0x0028, 0x002B, 0x0021,
-    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x005D, 0x0024, 0x002A, 0x0029, 0x003B, 0x005E,
-    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
-    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
-    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
-    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
-    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
-    0x00A2, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x00AC, 0x007C, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
-    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
-    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
-    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
-};
-
-static unsigned short  CP_850 [256] = { // MS-DOS Latin 1
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
-    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
-    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
-    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_860 [256] = { // MS-DOS: Portuguese
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
-    0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_861 [256] = { // MS-DOS: Iceland
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_863 [256] = { // MS-DOS: Canadian French
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7,
-    0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
-    0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_865 [256] = { // MS-DOS: Nordic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_874 [256] = { // MS-DOS: Thai
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x0082, 0x0083, 0x0084, 0x2026, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
-    0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
-    0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
-    0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0xF8C1, 0xF8C2, 0xF8C3, 0xF8C4, 0x0E3F,
-    0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
-    0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xF8C5, 0xF8C6, 0xF8C7, 0xF8C8,
-};
-
-static unsigned short  CP_1250 [256] = { // Windows: Latin 2
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
-    0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
-    0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
-    0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
-    0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
-    0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
-    0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9,
-};
-
-static unsigned short  CP_1251 [256] = { // Windows: Cyrillic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
-    0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
-    0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
-    0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
-    0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
-    0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
-    0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
-    0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
-};
-
-static unsigned short  CP_1252 [256] = { // Windows: Latin 1
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
-    0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
-    0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF,
-};
-
-static unsigned short  CP_1253 [256] = { // Windows: Greek
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0xF8F9, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
-    0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
-    0x03A0, 0x03A1, 0xF8FA, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
-    0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
-    0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xF8FB,
-};
-
-static unsigned short  CP_1254 [256] = { // Windows: Latin 5
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
-    0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
-    0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF,
-};
-
-static unsigned short  CP_1255 [256] = { // Windows: Hebrew
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BA, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
-    0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0xF88D, 0xF88E, 0xF88F, 0xF890, 0xF891, 0xF892, 0xF893,
-    0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
-    0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xF894, 0xF895, 0x200E, 0x200F, 0xF896,
-};
-
-static unsigned short  CP_1256 [256] = { // Windows: Arabic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
-    0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
-    0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
-    0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
-    0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
-    0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
-    0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2,
-};
-
-static unsigned short  CP_1257 [256] = { // Windows: Baltic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x00A8, 0x02C7, 0x00B8,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x00AF, 0x02DB, 0x009F,
-    0x00A0, 0xF8FC, 0x00A2, 0x00A3, 0x00A4, 0xF8FD, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
-    0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
-    0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
-    0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
-    0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9,
-};
-
-static unsigned short  CP_1258 [256] = { // Windows: Vietnam
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
-    0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
-    0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF,
-};
-
-static unsigned short  CP_10000 [256] = { // Apple Macintosh
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
-    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
-    0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
-    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
-    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
-    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
-    0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
-    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
-};
-
-static unsigned short  CP_10079 [256] = { // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
-    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
-    0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
-    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
-    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
-    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x00A4, 0x00D0, 0x00F0, 0x00DE, 0x00FE,
-    0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
-    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
-};
-
-#endif
-
-
-/*
- *  Resets Item Counter
- *  Do frees any memory.
- */
-
-void
-Init_Tags ( void )
-{
-    int  i;
-
-    for ( i = 0; i < (int)TagCount; i++ ) {
-        if ( T[i].key != NULL )
-            free ( T[i].key   );
-        T[i].key = NULL;
-        if ( T[i].value != NULL )
-            free ( T[i].value );
-        T[i].value = NULL;
-    }
-    TagCount = 0;
-}
-
-
-int
-gettag ( const char* key, char* dst, size_t len )
-{
-    size_t  valuelen;
-    size_t  keylen = strlen (key);
-    int     i;
-
-    for ( i = 0; i < (int)TagCount; i++ )
-        if ( keylen == T[i].keylen &&  0 == memcmp (T[i].key, key, keylen) ) {
-            valuelen = len-1 > T[i].valuelen  ?  T[i].valuelen  :  len-1 ;
-            memcpy ( dst, T[i].value, valuelen );
-            dst [valuelen] = '\0';
-            return 0;
-        }
-
-    memset ( dst, 0, len );
-    return -1;
-}
-
-
-static unsigned char*
-utf8char ( unsigned char* dst, unsigned long value )
-{
-    if      ( value == '\r'  ||  value == 0xFFFE  ||  value == 0xFFFF ) {
-        ;
-    }
-    else if ( value < 0x80 ) {
-        *dst++ = value;
-    }
-    else if ( value < 0x800 ) {
-        *dst++ = 0xC0 + ((value >>  6) & 0x1F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x10000 ) {
-        *dst++ = 0xE0 + ((value >> 12) & 0x0F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x200000 ) {
-        *dst++ = 0xF0 + ((value >> 18) & 0x07);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x4000000 ) {
-        *dst++ = 0xF8 + ((value >> 24) & 0x03);
-        *dst++ = 0x80 + ((value >> 18) & 0x3F);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x80000000 ) {
-        *dst++ = 0xFC + ((value >> 30) & 0x01);
-        *dst++ = 0x80 + ((value >> 24) & 0x3F);
-        *dst++ = 0x80 + ((value >> 18) & 0x3F);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-
-    return dst;
-}
-
-
-/*
- *  IsUnicode()
- *
- *  Gets a memory block and tries to find out whether this is binary data or a valid Windows Unicode file.
- *  When return 1, it is very likely (but not 100% secure) that the content is Unicode encoded.
- */
-
-static int
-IsUnicode ( const unsigned char* src, size_t len )
-{
-    if ( len <= 2 )
-        return 0;
-
-    if ( len & 1 )                                              // odd number of bytes?
-        return 0;
-
-    if ( src [0] != 0xFF  ||  src [1] != 0xFE )                 // Microsoft Unicode preample (also useful to detect endianess, but currently only little endian is supported)
-        return 0;
-
-    for ( len >>= 1; len > 0; len--, src += 2 ) {               // Check for invalid codes (FFFE, FFFF, DC00...DFFF without a prepend D800...DBFF, D800...DBFF without a n appended DC00...DFFF)
-        if ( ( src [1] & 0xFC ) == 0xDC )
-            return 0;
-        if ( src [1] == 0xFF  &&  ( src [0] & 0xFE ) == 0xFE )
-            return 0;
-        if ( ( src [1] & 0xFC ) == 0xD8 ) {
-            if ( len < 2  ||  ( src [3] & 0xFC ) != 0xDC )
-                return 0;
-        }
-        else {
-            len--;
-            src += 2;
-        }
-    }
-
-    return 1;                                                   // good chance to be a UTF-8
-}
-
-/*
- *  addtag()
- *
- *  Add a item to the item list of a tag. Item key is given by (key,keylen), item value by (value,valuelen).
- *
- *  The following value translation modes are possible:
- *    0: no translation at all
- *    1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
- *    2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
- *    3: like 1), but convert ';' to null character
- *    4: UTF-16 LE => translate to UTF-8
- *    5: translate from ISO-8859-1 to UTF-8
- *    6: like 1), but convert from OEM codepage (Win32)
- *  (should become an enum)
- *
- *  Note:
- *    Windows 95/98/ME has no usable NLS support
- *
- */
-
-int
-addtag ( const char*           key,             // the item key
-         size_t                keylen,          // length of item key, or 0 for auto-determine
-         const unsigned char*  value,           // the item value
-         size_t                valuelen,        // the length of the item value (before any possible translation)
-         int                   converttoutf8,   // convert flags of item value
-         int                   flags )          // item flags proposal
-{
-    unsigned char*  p;
-    unsigned char*  q;
-    unsigned char   ch;
-    size_t          i;
-#ifdef _WIN32
-    const unsigned short*  CP_ptr;
-    unsigned int           Codepage;
-
-    if ( converttoutf8 == 6 ) {
-        Codepage      = GetOEMCP ();
-        converttoutf8 = 1;
-    }
-    else {
-        Codepage      = GetACP ();
-    }
-
-    switch ( Codepage ) {
-    case CP_ACP:        CP_ptr =  CP_1252; break;
-    case CP_OEMCP:      CP_ptr =   CP_850; break;
-    case CP_MACCP:      CP_ptr = CP_10000; break;
-    case CP_THREAD_ACP: CP_ptr =  CP_1252; break;
-    default:    CP_ptr =   CP_850; break;
-    case    37: CP_ptr =    CP_37; break;
-    case    42: CP_ptr =    CP_42; break;
-    case   437: CP_ptr =   CP_437; break;
-    case   500: CP_ptr =   CP_500; break;
-    case   850: CP_ptr =   CP_850; break;
-    case   860: CP_ptr =   CP_860; break;
-    case   861: CP_ptr =   CP_861; break;
-    case   863: CP_ptr =   CP_863; break;
-    case   865: CP_ptr =   CP_865; break;
-    case   874: CP_ptr =   CP_874; break;
-    case  1250: CP_ptr =  CP_1250; break;
-    case  1251: CP_ptr =  CP_1251; break;
-    case  1252: CP_ptr =  CP_1252; break;
-    case  1253: CP_ptr =  CP_1253; break;
-    case  1254: CP_ptr =  CP_1254; break;
-    case  1255: CP_ptr =  CP_1255; break;
-    case  1256: CP_ptr =  CP_1256; break;
-    case  1257: CP_ptr =  CP_1257; break;
-    case  1258: CP_ptr =  CP_1258; break;
-    case 10000: CP_ptr = CP_10000; break;
-    case 10079: CP_ptr = CP_10079; break;
-    }
-#endif
-
-
-    if ( converttoutf8 == 2  &&  IsUnicode ( value, valuelen ) ) {
-        converttoutf8 = 4;
-        value        += 2;                      // remove first two bytes (zero width space 0xFEFF)
-        valuelen      = ( valuelen - 2) >> 1;
-        flags        &= ~2;                     // reset binary flag (it's now text)
-    }
-
-    if ( keylen == 0 )
-        keylen = strlen ( key );
-
-    p = malloc ( keylen );
-    memcpy ( p, key, keylen );
-    T [TagCount] . key    = p;
-    T [TagCount] . keylen = keylen;
-
-    switch ( converttoutf8 ) {
-    default:
-        p = malloc ( 1 * valuelen );    // copy
-        break;
-    case 1:                             // at most 1 native character => 3 UTF bytes
-    case 4:                             // at 1 wide => 3, 2 wide => 4
-        p = malloc ( 3 * valuelen );
-        break;
-    }
-
-    q = p;
-
-    for ( i = 0; i < valuelen; i++ ) {
-        ch = value [i];
-        switch ( converttoutf8 ) {
-        default:                        // 0: no translation at all --or-- 2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
-            *q++ = ch;
-            break;
-
-        case 5:                         // 5: translate from ISO-8859-1 to UTF-8
-            q = utf8char ( q, ch );
-            break;
-
-        case 3:                         // 3: like 1), but convert ';' to null character
-            if ( ch == ';' )
-                ch = '\0';
-            /* fall through */
-
-        case 1:                         // 1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
-#if defined __TURBOC__
-            q = utf8char ( q, CP_850 [ch] );
-#elif defined _WIN32
-            // fprintf ( stderr, "%c  %02X  U+%04X\n", ch, ch, CP_ptr [ch] );
-            q = utf8char ( q, CP_ptr [ch] );
-#elif defined USE_WIDECHAR
-            {
-            int      ret;
-            wchar_t  wch = 0;
-            ret = mbtowc ( &wch, value + i, valuelen - i );
-            if ( ret > 0 )
-                q = utf8char ( q, wch ), i += ret - 1;
-            }
-#else
-            q = utf8char ( q, ch );
-#endif
-            break;
-
-        case 4:                         // 4: UTF-16 LE => translate to UTF-8
-            if ( (value [i+i+1] & 0xFC ) == 0xD8  &&  (value [i+i+3] & 0xFC ) == 0xDC ) {   // UTF-16 code (2x16 bit for Unicodes 0x010000...0x10FFFF)
-                q = utf8char ( q, ((value [i+i] + (value [i+i+1] << 8) - 0xD800) << 10) + (value [i+i+2] + (value [i+i+3] << 8) - 0xDC00) + 0x10000 );
-                i++;
-            }
-            else {
-                q = utf8char ( q, value [i+i] + (value [i+i+1] << 8) );
-            }
-            break;
-        }
-    }
-
-    p = realloc ( p, valuelen = q-p );
-
-    for ( i = 0; i < TagCount; i++ )
-        if ( T [i].keylen == T [TagCount].keylen  &&  0 == strncasecmp (T [i].key, T [TagCount].key, T [i].keylen ) ) {    // found old tag with the same name => replace
-            free ( T [TagCount].key   );
-            free ( T [i].value );
-            goto set;
-        }
-
-    i = TagCount++;
-set:
-    T [i] . value    = p;
-    T [i] . valuelen = valuelen;
-    T [i] . flags    = flags;
-    return 0;
-}
-
-
-static int Cdecl
-cmpfn2 ( const void* p1, const void* p2 )
-{
-    const TagItem_t*  q1 = (TagItem_t*) p1;
-    const TagItem_t*  q2 = (TagItem_t*) p2;
-
-    return q1 -> valuelen - q2 -> valuelen;
-}
-
-/*
- *  Writes collect tag items and write it to a file.
- *  Items are destroyed, so tags can only be written once.
- */
-
-int
-FinalizeTags ( FILE* fp, unsigned int Version )
-{
-    static unsigned char  H [32] = "APETAGEX";
-    unsigned char         dw [8];
-    unsigned long         estimatedbytes =  32; // 32 byte footer + all items, these are the 32 bytes footer, the items are added later
-    unsigned long         writtenbytes   = -32; // actually writtenbytes-32, which should be equal to estimatedbytes (= footer + all items)
-    unsigned int          i;
-
-    if ( TagCount == 0 )
-        return 0;
-
-    qsort ( T, TagCount, sizeof (*T), cmpfn2 );
-
-    for ( i = 0; i < TagCount; i++ )
-        estimatedbytes += 9 + T[i] . keylen + T[i] . valuelen;
-
-    if ( estimatedbytes >= 8192 + 103 )
-        stderr_printf ( "\nTag is %.1f Kbyte long. This is longer than the maximum recommended 8 KByte.\n\a", estimatedbytes/1024. );
-
-    H [ 8] = Version >>  0;
-    H [ 9] = Version >>  8;
-    H [10] = Version >> 16;
-    H [11] = Version >> 24;
-    H [12] = estimatedbytes >>  0;
-    H [13] = estimatedbytes >>  8;
-    H [14] = estimatedbytes >> 16;
-    H [15] = estimatedbytes >> 24;
-    H [16] = TagCount >>  0;
-    H [17] = TagCount >>  8;
-    H [18] = TagCount >> 16;
-    H [19] = TagCount >> 24;
-
-    H [23] = 0x80 | 0x20;
-    writtenbytes += fwrite ( H, 1, 32, fp );
-
-    for ( i = 0; i < TagCount; i++ ) {
-        dw [0] = T [i] . valuelen >>  0;
-        dw [1] = T [i] . valuelen >>  8;
-        dw [2] = T [i] . valuelen >> 16;
-        dw [3] = T [i] . valuelen >> 24;
-        dw [4] = T [i] . flags >>  0;
-        dw [5] = T [i] . flags >>  8;
-        dw [6] = T [i] . flags >> 16;
-        dw [7] = T [i] . flags >> 24;
-        writtenbytes += fwrite ( dw        , 1, 8            , fp );
-        writtenbytes += fwrite ( T[i].key  , 1, T[i].keylen  , fp );
-        writtenbytes += fwrite ( ""        , 1, 1            , fp );
-        if ( T[i].valuelen > 0 )
-            writtenbytes += fwrite ( T[i].value, 1, T[i].valuelen, fp );
-    }
-
-    H [23] = 0x80;
-    writtenbytes += fwrite ( H, 1, 32, fp );
-
-    if ( estimatedbytes != writtenbytes )
-        stderr_printf ( "\nError writing APE tag.\n" );
-
-    TagCount = 0;
-    return 0;
-}
-
-
-static int
-TagKeyExists ( const char* key, size_t keylen )
-{
-    unsigned int  i;
-
-    if ( keylen == 0 )
-        keylen = strlen ( key );
-
-    for ( i = 0; i < TagCount; i++ )
-        if ( T [i].keylen == keylen  &&  0 == strncasecmp (T [i].key, key, keylen ) )
-            return 1;
-
-    return 0;
-}
-
-
-/*
- *  Copies src to dst. Copying is stopped at `\0' char is detected or if
- *  len chars are copied.
- *  Trailing blanks are removed and the string is `\0` terminated.
- */
-
-static void
-memcpy_crop ( const char* key, char* src, size_t len, int flags )
-{
-    while ( len > 0  &&  ( src [len-1] == ' '  ||  src [len-1] == '\0' ) )
-        len--;
-
-    if ( len > 0 )
-        if ( ! TagKeyExists ( key, 0 ) )
-            addtag ( key, 0, src, len, 1, flags );
-}
-
-
-static int
-CopyTags_ID3 ( FILE* fp )
-{
-    Uint8_t  tmp [128];
-
-    if ( -1 == SEEK ( fp, -128L, SEEK_END ) )
-        return -1;
-
-    if ( 128 != READ ( fp, tmp, 128 ) )
-        return -1;
-
-    if ( 0 != memcmp ( tmp, "TAG", 3 ) ) {
-        return -1;
-    }
-
-    if ( !tmp[3]  &&  !tmp[33]  &&  !tmp[63]  &&  !tmp[93]  &&  !tmp[97] )
-        return -1;
-
-    memcpy_crop  ( "Title"  , tmp +  3, 30, 0 );
-    memcpy_crop  ( "Artist" , tmp + 33, 30, 0 );
-    memcpy_crop  ( "Album"  , tmp + 63, 30, 0 );
-    memcpy_crop  ( "Year"   , tmp + 93,  4, 0 );
-    memcpy_crop  ( "Comment", tmp + 97, 30, 0 );
-
-    if ( tmp[127] < sizeof(GenreList)/sizeof(*GenreList) )
-        if ( ! TagKeyExists ( "Genre", 0 ) )
-            addtag ("Genre", 0, GenreList [tmp[127]], strlen (GenreList [tmp[127]]), 0, 0 );
-
-    if ( tmp[125] == 0  &&  tmp[126] != 0 )
-        if ( ! TagKeyExists ( "Track", 0 ) ) {
-            sprintf ( tmp, "%u",  tmp[126] );
-            addtag ("Track", 0, tmp, strlen (tmp), 0, 0 );
-        }
-
-    return 0;
-}
-
-
-static unsigned int
-Read_LE_Uint32 ( const unsigned char* p )
-{
-    return ((Uint32_t)p[0] <<  0) |
-           ((Uint32_t)p[1] <<  8) |
-           ((Uint32_t)p[2] << 16) |
-           ((Uint32_t)p[3] << 24);
-}
-
-
-static int
-CopyTags_APE ( FILE* fp )
-{
-    Uint32_t                   len;
-    Uint32_t                   flags;
-    Uint32_t                   version;
-    unsigned char              buff [32768];
-    unsigned char              key [257];
-    unsigned char*             p;
-    struct APETagFooterStruct  T;
-    Uint32_t                   TagLen;
-    Uint32_t                   TagCount;
-    // Uint32_t                   tmp;
-
-    if ( -1 == SEEK ( fp, -(long)sizeof T, SEEK_END ) )
-        return -1;
-    if ( sizeof(T) != READ ( fp, &T, sizeof T ) )
-        return -1;
-    if ( memcmp ( T.ID, "APETAGEX", sizeof(T.ID) ) != 0 )
-        return -1;
-    version = Read_LE_Uint32 (T.Version);
-    if ( version != 1000  &&  version != 2000 )
-        return -1;
-    TagLen = Read_LE_Uint32 (T.Length);
-    if ( TagLen <= sizeof T )
-        return -1;
-    if ( -1 == SEEK ( fp, -(long)TagLen, SEEK_END ) )
-        return -1;
-    memset ( buff, 0, sizeof(buff) );
-    if ( TagLen - sizeof T != READ ( fp, buff, TagLen - sizeof T ) )
-        return -1;
-
-    TagCount = Read_LE_Uint32 (T.TagCount);
-    for ( p = buff; TagCount--; ) {
-        len   = Read_LE_Uint32 ( p );        p += 4;
-        flags = Read_LE_Uint32 ( p );        p += 4;
-        strcpy ( key, p );                   p += strlen (key) + 1;
-        if ( ! TagKeyExists ( key, 0 ) )
-            addtag ( key, 0, p, len > 0  &&  p [len-1] == '\0'  ?  len-1  :  len, version >= 2000  ?  0  :  5, flags );
-                                             p += len;
-    }
-
-    return 0;
-}
-
-static void
-FullPathName ( char* dst, size_t dstlen, const char* filename )         // Can contain stuff like ".." and "."
-{
-    // const char*  p;
-    char*        q     = dst;
-
-#if DRIVE_SEP != '\0'
-    int          drive = 0;
-
-    if ( isalpha (filename[0])  &&  filename[1] == DRIVE_SEP  &&  filename[2] != PATH_SEP ) {
-        drive     = filename[0] & 0x1F;
-        filename += 2;
-    }
-#endif
-
-    if ( filename[0] != PATH_SEP ) {
-#ifdef _WIN32
-        _getdcwd( drive, dst, dstlen );
-#else
-        getcwd ( dst, dstlen );
-#endif
-        q += strlen (q);
-#ifdef _WIN32
-        if ( dst[0] != PATH_SEP  ||  dst[1] != '\0' )
-#else
-        if ( dst[2] != PATH_SEP  ||  dst[3] != '\0' )
-#endif
-            *q++ = PATH_SEP;
-    }
-
-    strcpy ( q, filename );
-    return;
-}
-
-/********************************************************************************************/
-
-/*
-
-" "                             ' '
-" - "                           '-'
-"."                             '.'
-"/"                             '/'
-" -- "                          '_'
-"[#0]"                          '0'
-"[#n]"  [number]                'n'
-"#n"    number                  'M'
-"(#N)"  (CD x)                  'N'             it should also be possible: (CD x/x), (DVD x), (DVD x/x)
-"#A"    Artist                  'A'
-"#C"    CD/Album                'C'
-"#T"    Title                   'T'
-"#x"    extention               'x'
-
-
-/#C -- [#n] #A -- #T#x      | Acid Jazz/100% Acid Jazz -- [04] Leena Conquest (and Hip Hop Fingers) -- Boundaries (Radio Edit).pac
-/#C -- [#n] #A -- #C -- #T#x| Meditation/Jade Collection (1998) -- [10] Rhian -- Red Sun, Blue River -- The Miracle Song.mpc
-/#A/#C -- [#n] #T#x         | Andreas Vollenweider/Eolian Minstrel -- [02] Across the Iron River.pac
-/#A/#C#N -- [#n] #T#x       | Barbra Streisand/The Concert (CD 1) -- [01] Overture
-/#A -- #C -- [#n] #T#x      | Friedemann/Friedemann -- Aquamarin -- [09] In the Court of the Mermaid.pac
-/#C/[#n] #A -- #T#x         | Jazz Lyrik Prosa/[11] Eberhard Esche -- Anektode.pac
-/#A -- #T#x                 | Lais/Lais -- 06.pac
-/#C/(#N) -- [#n] #A -- #T#x | Tanz- und Folkfest 2001 -- Klingende Post/(CD 2) -- [09] Andy Irvine -- Gladiators.pac
-/#A -- #C -- [#0]#x         | Friedemann/Friedemann -- Aquamarin -- [00].pac
-/#A/#C (#N) -- [#0]#x       | Tangerine Dream/The Warsaw Concert (CD 2) -- [00].pac
-/#A/#T#x                    | Heinz-Rudolf Kunze/Dein ist mein ganzes Herz.pac
-/#A/#C -- [#0]#x            | Sting/Nada como el Sol -- [00].mpc
-
-*/
-
-static const char* const  parser_strings [] = {
-    "/A_Tx",
-    "/A/Tx",
-    "/A_C_0x",
-    "/C_n A_Tx",
-    "/C_n A_C_Tx",              // new
-    "/A/C_n Tx",
-    "/A/C N_n Tx",
-    "/A_C_n Tx",
-    "/C/n A_Tx",
-    "/C/N_n A_Tx",
-    "/A/C N_0x",
-    "/A/C_0x",
-};
-
-
-static void
-copy ( char* dst, const char* src, size_t len )
-{
-    memcpy ( dst, src, len );
-    dst [len] = '\0';
-}
-
-/*
- *    dst[0] = Artist
- *    dst[1] = CD
- *    dst[2] = Title
- *    dst[3] = +CD
- *    dst[4] = number
- *    dst[5] = ext
- */
-
-#ifndef isdigit
-# define isdigit(x)         ((unsigned int)((x) - '0') < 10)
-#endif
-
-static int
-parse ( char** dst, const char* src, const char* format )
-{
-    int          i;
-    const char*  srcend = src + strlen(src);
-    const char*  p;
-    char*        q;
-
-    for ( i = 0; i < 6; i++)
-        dst[i][0] = '\0';
-
-    for ( i = strlen(format); i-- > 0; ) {
-        p = srcend;
-#ifndef STFU
-        stderr_printf ( "%c: ", format[i] );
-#endif
-        switch ( format[i] ) {
-        case '.':
-        case ' ':
-        case '/':                               // !!!!!!!
-            if (p[-1] != format[i])
-                return 1;
-            p--;
-            break;
-        case '_':
-            if (0 != memcmp (p-4, " -- ", 4))
-                return 1;
-            p -= 4;
-            break;
-        case '-':
-            if (0 != memcmp (p-3, " - ", 3))
-                return 1;
-            p -= 3;
-            break;
-        case '0':
-            if (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                return 1;
-            copy (dst[4], p-3, 2);
-            p -= 4;
-            break;
-        case 'n':
-            if (p[-1] != ']' || !isdigit(p[-2]) || !isdigit(p[-3]) || p[-4] != '[')
-                return 1;
-            copy (dst[4], p-3, 2);
-            p -= 4;
-            break;
-        case 'M':
-            if ( !isdigit(p[-1]) || !isdigit(p[-2]) )
-                return 1;
-            copy (dst[4], p-2, 2);
-            p -= 2;
-            break;
-        case 'N':
-            if (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')
-                return 1;
-            dst[3][0] = ' ';
-            copy (dst[3]+1, p-6, 6);
-            p -= 6;
-            break;
-        case 'A':
-            q = dst[0]; goto big;
-        case 'C':
-            q = dst[1]; goto big;
-        case 'T':
-            q = dst[2]; goto big;
-        big:
-            while ( 0 == memcmp (p-4, "/mpc", 4)  ||
-                    0 == memcmp (p-4, "/mp3", 4)  ||
-                    0 == memcmp (p-4, "/pac", 4)  ||
-                    0 == memcmp (p-4, "/ape", 4)  ||
-                    0 == memcmp (p-4, "/pac", 4)  ||
-                    0 == memcmp (p-3, "/.." , 3)  ||
-                    0 == memcmp (p-2, "/."  , 2)
-                  ) {
-                      do {
-                          p--;
-                          srcend--;
-                      } while ( *p != PATH_SEP );
-                }
-            while ( p[-1] != PATH_SEP  &&
-                    p[-1] != DRIVE_SEP &&
-                    0 != memcmp (p-4, " -- ", 4 )  &&
-                    (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')  &&
-                    (p[-1] != ' ' || p[-2] != ']' || !isdigit(p[-3]) || !isdigit(p[-4]) || p[-5] != '[') &&
-                    (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                  )
-                p--;
-            copy ( q, p, srcend - p );
-            break;
-        case 'x':
-            do {
-                p--;
-                if (p[0] == PATH_SEP || p[0] == DRIVE_SEP)
-                    return -1;
-            } while (*p != '.');
-            copy (dst[5], p, srcend-p );
-            break;
-        }
-#ifndef STFU
-        stderr_printf ( "%*.*s\033[7m%*.*s\033[0m\n", p-src, p-src, src, srcend-p, srcend-p, p );
-#endif
-        srcend = p;
-    }
-    return 0;
-}
-
-static int
-hexdigit ( const char s )
-{
-    if ( (unsigned char)(s-'0') < 10u )
-        return s-'0';
-    if ( (unsigned char)(s-'A') <  6u )
-        return s-'A'+10;
-    return -1;
-}
-
-static void
-spaceconverting ( char* dst, const char* src )          // can work inplace
-{
-    for ( ; src[0] != '\0' ; src++) {
-        if      ( src[0] == '_' )
-            *dst++ = ' ';
-        else if ( src[0] == '%'  &&  hexdigit(src[1]) >= 0  &&  hexdigit(src[2]) >= 0 )
-            *dst++ = hexdigit(src[1]) * 16 + hexdigit(src[2]), src += 2;
-        else
-            *dst++ = *src;
-    }
-    *dst = '\0';
-}
-
-
-static int
-Parser ( const char* src )
-{
-    size_t  i;
-    char    tmp  [6] [1024];
-    char*   buff [6] = { tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5] };
-    char    merge [1024];
-    char*   q;
-
-#ifndef STFU
-    stderr_printf ( "\n  »%s«\n", src );
-#endif
-
-    memset ( tmp  , 0, sizeof tmp   );
-    memset ( merge, 0, sizeof merge );
-
-    for ( i = 0; i < sizeof(parser_strings)/sizeof(*parser_strings); i++ ) {
-        if ( 0 == parse ( buff, src, parser_strings[i] ) ) {
-            sprintf ( merge, "%s%s", tmp[1], tmp[3] );
-            q = merge + strlen (merge);
-
-            if ( q-7 >= merge  &&  q[-7]==' '  &&  q[-6]=='('  && atoi(q-5) >= 1900  &&  atoi(q-5) < 2050  &&  q[-1] == ')' ) {
-                q[-1] = '\0';
-                q[-7] = '\0';
-                q -= 5;
-            }
-            else {
-                q = NULL;
-            }
-
-            spaceconverting ( tmp[0], tmp[0] );
-            spaceconverting ( merge , merge );
-            spaceconverting ( tmp[2], tmp[2] );
-            spaceconverting ( tmp[4], tmp[4] );
-            spaceconverting ( tmp[5], tmp[5] );
-
-            stderr_printf ("\n");
-            stderr_printf ("Artist = »%s«\n", tmp[0] );
-            stderr_printf ("CD     = »%s«\n", merge  );
-            stderr_printf ("Title  = »%s«\n", tmp[2] );
-            stderr_printf ("No#    = »%s«\n", tmp[4] );
-            stderr_printf ("Extent = »%s«\n", tmp[5] );
-            stderr_printf ("Year   = »%s«\n", q  ?  q  :  "????" );
-#if 1
-            if ( tmp[0][0]  &&  ! TagKeyExists ( "Artist", 0 ) ) addtag ( "Artist", 0, tmp[0], strlen (tmp[0]), 5, 0 );
-            if ( merge[0]   &&  ! TagKeyExists ( "Album" , 0 ) ) addtag ( "Album" , 0, merge , strlen (merge) , 5, 0 );
-            if ( tmp[2][0]  &&  ! TagKeyExists ( "Title" , 0 ) ) addtag ( "Title" , 0, tmp[2], strlen (tmp[2]), 5, 0 );
-            if ( tmp[4][0]  &&  ! TagKeyExists ( "Track" , 0 ) ) addtag ( "Track" , 0, tmp[4], strlen (tmp[4]), 5, 0 );
-            if ( q != NULL  &&  ! TagKeyExists ( "Year"  , 0 ) ) addtag ( "Year"  , 0, q     , 4              , 5, 0 );
-#endif
-            return 1;
-        }
-#ifndef STFU
-        stderr_printf ("???\n--\n");
-#endif
-    }
-
-    return 0;
-}
-
-
-/*******************************************************************************/
-
-
-static int
-CopyTags_Name ( const char* filename )
-{
-    char         buff [4096];
-
-    FullPathName  ( buff, sizeof buff, filename );
-    Parser        ( buff );
-    return 0;
-}
-
-
-int
-CopyTags ( const char* filename )
-{
-    FILE*  fp;
-
-    if ( 0 == strncmp (filename, "/dev/", 5 ) )
-        return 0;
-
-    fp = fopen ( filename, "rb" );
-    if ( fp == NULL )
-        return -1;
-
-    CopyTags_APE  (fp);                 // APE tags have higher priority than ID3V1 tags
-    CopyTags_ID3  (fp);
-    CopyTags_Name (filename);
-
-    fclose (fp);
-    return 0;
-}
-
-/* end of tags.c */
Index: penc/trunk/tags.c-old
===================================================================
--- /mppenc/trunk/tags.c-old	(revision 96)
+++ 	(revision )
@@ -1,1283 +1,0 @@
-/*
- *  Encoder tag handling
- *
- *  (C) Frank Klemm 2002. Janne Hyvärinen 2002. All rights reserved.
- *
- *  Principles:
- *
- *
- *  History:
- *    2002-06     created
- *    2002-08-12  added translation method 5 to addtag()
- *                Tags taken from source file can't overwrite already existing items
- *                added Init_Tags()
- *    2002-08-13  Added all windows code pages
- *    2002-10-09  Added code to parse tags from filename
- *
- *  Global functions:
- *    - addtag()
- *
- *  TODO:
- *    - '/' and '\' should be possible as PATH_SEP
- */
-
-#include "mppenc.h"
-
-#ifdef USE_WIDECHAR
-# include <wchar.h>
-#endif
-
-
-static const char*  GenreList [] = {
-    "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
-    "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
-    "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
-    "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
-    "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
-    "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
-    "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
-    "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
-    "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
-    "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
-    "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
-    "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
-    "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
-    "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion",
-    "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
-    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
-    "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
-    "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
-    "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
-    "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
-    "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
-    "Dance Hall", "Goa", "Drum & Bass", "Club House", "Hardcore", "Terror",
-    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat", "Christian Gangsta",
-    "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
-    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
-    "SynthPop"
-};
-
-
-struct APETagFooterStruct {
-    Uint8_t   ID       [8];    // should equal 'APETAGEX'
-    Uint8_t   Version  [4];    // currently 1000 (version 1.000)
-    Uint8_t   Length   [4];    // the complete size of the tag, including this footer
-    Uint8_t   TagCount [4];    // the number of fields in the tag
-    Uint8_t   Flags    [4];    // the tag flags (none currently defined)
-    Uint8_t   Reserved [8];    // reserved for later use
-};
-
-
-typedef struct {
-    char*           key;
-    size_t          keylen;
-    unsigned char*  value;
-    size_t          valuelen;
-    unsigned int    flags;
-} TagItem_t;
-
-
-static TagItem_t       T [256];                        // up to 256 items, otherwise program crashs
-static unsigned int    TagCount = 0;
-
-#if defined __TURBOC__
-
-static unsigned short  CP_850 [256] = {
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
-    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
-    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
-    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
-};
-
-#elif defined _WIN32
-
-static unsigned short  CP_37 [256] = {  // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
-    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
-    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
-    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC,
-    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
-    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
-    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
-    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
-    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
-    0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
-    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
-    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
-    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
-};
-
-static unsigned short  CP_42 [256] = { // CP_SYMBOLS
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0xF020, 0xF021, 0xF022, 0xF023, 0xF024, 0xF025, 0xF026, 0xF027, 0xF028, 0xF029, 0xF02A, 0xF02B, 0xF02C, 0xF02D, 0xF02E, 0xF02F,
-    0xF030, 0xF031, 0xF032, 0xF033, 0xF034, 0xF035, 0xF036, 0xF037, 0xF038, 0xF039, 0xF03A, 0xF03B, 0xF03C, 0xF03D, 0xF03E, 0xF03F,
-    0xF040, 0xF041, 0xF042, 0xF043, 0xF044, 0xF045, 0xF046, 0xF047, 0xF048, 0xF049, 0xF04A, 0xF04B, 0xF04C, 0xF04D, 0xF04E, 0xF04F,
-    0xF050, 0xF051, 0xF052, 0xF053, 0xF054, 0xF055, 0xF056, 0xF057, 0xF058, 0xF059, 0xF05A, 0xF05B, 0xF05C, 0xF05D, 0xF05E, 0xF05F,
-    0xF060, 0xF061, 0xF062, 0xF063, 0xF064, 0xF065, 0xF066, 0xF067, 0xF068, 0xF069, 0xF06A, 0xF06B, 0xF06C, 0xF06D, 0xF06E, 0xF06F,
-    0xF070, 0xF071, 0xF072, 0xF073, 0xF074, 0xF075, 0xF076, 0xF077, 0xF078, 0xF079, 0xF07A, 0xF07B, 0xF07C, 0xF07D, 0xF07E, 0xF07F,
-    0xF080, 0xF081, 0xF082, 0xF083, 0xF084, 0xF085, 0xF086, 0xF087, 0xF088, 0xF089, 0xF08A, 0xF08B, 0xF08C, 0xF08D, 0xF08E, 0xF08F,
-    0xF090, 0xF091, 0xF092, 0xF093, 0xF094, 0xF095, 0xF096, 0xF097, 0xF098, 0xF099, 0xF09A, 0xF09B, 0xF09C, 0xF09D, 0xF09E, 0xF09F,
-    0xF0A0, 0xF0A1, 0xF0A2, 0xF0A3, 0xF0A4, 0xF0A5, 0xF0A6, 0xF0A7, 0xF0A8, 0xF0A9, 0xF0AA, 0xF0AB, 0xF0AC, 0xF0AD, 0xF0AE, 0xF0AF,
-    0xF0B0, 0xF0B1, 0xF0B2, 0xF0B3, 0xF0B4, 0xF0B5, 0xF0B6, 0xF0B7, 0xF0B8, 0xF0B9, 0xF0BA, 0xF0BB, 0xF0BC, 0xF0BD, 0xF0BE, 0xF0BF,
-    0xF0C0, 0xF0C1, 0xF0C2, 0xF0C3, 0xF0C4, 0xF0C5, 0xF0C6, 0xF0C7, 0xF0C8, 0xF0C9, 0xF0CA, 0xF0CB, 0xF0CC, 0xF0CD, 0xF0CE, 0xF0CF,
-    0xF0D0, 0xF0D1, 0xF0D2, 0xF0D3, 0xF0D4, 0xF0D5, 0xF0D6, 0xF0D7, 0xF0D8, 0xF0D9, 0xF0DA, 0xF0DB, 0xF0DC, 0xF0DD, 0xF0DE, 0xF0DF,
-    0xF0E0, 0xF0E1, 0xF0E2, 0xF0E3, 0xF0E4, 0xF0E5, 0xF0E6, 0xF0E7, 0xF0E8, 0xF0E9, 0xF0EA, 0xF0EB, 0xF0EC, 0xF0ED, 0xF0EE, 0xF0EF,
-    0xF0F0, 0xF0F1, 0xF0F2, 0xF0F3, 0xF0F4, 0xF0F5, 0xF0F6, 0xF0F7, 0xF0F8, 0xF0F9, 0xF0FA, 0xF0FB, 0xF0FC, 0xF0FD, 0xF0FE, 0xF0FF,
-};
-
-static unsigned short  CP_437 [256] = { // MS-DOS: US
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_500 [256] = { // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F, 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087, 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
-    0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004, 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
-    0x0020, 0x00A0, 0x00E2, 0x00E4, 0x00E0, 0x00E1, 0x00E3, 0x00E5, 0x00E7, 0x00F1, 0x005B, 0x002E, 0x003C, 0x0028, 0x002B, 0x0021,
-    0x0026, 0x00E9, 0x00EA, 0x00EB, 0x00E8, 0x00ED, 0x00EE, 0x00EF, 0x00EC, 0x00DF, 0x005D, 0x0024, 0x002A, 0x0029, 0x003B, 0x005E,
-    0x002D, 0x002F, 0x00C2, 0x00C4, 0x00C0, 0x00C1, 0x00C3, 0x00C5, 0x00C7, 0x00D1, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
-    0x00F8, 0x00C9, 0x00CA, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
-    0x00D8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00AB, 0x00BB, 0x00F0, 0x00FD, 0x00FE, 0x00B1,
-    0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x00AA, 0x00BA, 0x00E6, 0x00B8, 0x00C6, 0x00A4,
-    0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00A1, 0x00BF, 0x00D0, 0x00DD, 0x00DE, 0x00AE,
-    0x00A2, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC, 0x00BD, 0x00BE, 0x00AC, 0x007C, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
-    0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00AD, 0x00F4, 0x00F6, 0x00F2, 0x00F3, 0x00F5,
-    0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x00B9, 0x00FB, 0x00FC, 0x00F9, 0x00FA, 0x00FF,
-    0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x00B2, 0x00D4, 0x00D6, 0x00D2, 0x00D3, 0x00D5,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00B3, 0x00DB, 0x00DC, 0x00D9, 0x00DA, 0x009F,
-};
-
-static unsigned short  CP_850 [256] = { // MS-DOS Latin 1
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
-    0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
-    0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
-    0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_860 [256] = { // MS-DOS: Portugese
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
-    0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_861 [256] = { // MS-DOS: Iceland
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_863 [256] = { // MS-DOS: Canadian French
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x2017, 0x00C0, 0x00A7,
-    0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
-    0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00B8, 0x00B3, 0x00AF, 0x00CE, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_865 [256] = { // MS-DOS: Nordic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
-    0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
-    0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
-    0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
-    0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
-    0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
-    0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
-    0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0,
-};
-
-static unsigned short  CP_874 [256] = { // MSDOS: Thai
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x0082, 0x0083, 0x0084, 0x2026, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
-    0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
-    0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
-    0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0xF8C1, 0xF8C2, 0xF8C3, 0xF8C4, 0x0E3F,
-    0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
-    0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xF8C5, 0xF8C6, 0xF8C7, 0xF8C8,
-};
-
-static unsigned short  CP_1250 [256] = { // Windows: Latin 2
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
-    0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
-    0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
-    0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
-    0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
-    0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
-    0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9,
-};
-
-static unsigned short  CP_1251 [256] = { // Windows: Cyrillic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
-    0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
-    0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
-    0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
-    0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
-    0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
-    0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
-    0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
-};
-
-static unsigned short  CP_1252 [256] = { // Windows: Latin 1
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
-    0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
-    0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF,
-};
-
-static unsigned short  CP_1253 [256] = { // Windows: Greek
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0xF8F9, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
-    0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
-    0x03A0, 0x03A1, 0xF8FA, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
-    0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
-    0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xF8FB,
-};
-
-static unsigned short  CP_1254 [256] = { // Windows: Latin 5
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
-    0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
-    0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF,
-};
-
-static unsigned short  CP_1255 [256] = { // Windows: Hebrew
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x008C, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x009C, 0x009D, 0x009E, 0x009F,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BA, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
-    0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0xF88D, 0xF88E, 0xF88F, 0xF890, 0xF891, 0xF892, 0xF893,
-    0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
-    0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xF894, 0xF895, 0x200E, 0x200F, 0xF896,
-};
-
-static unsigned short  CP_1256 [256] = { // Windows: Arabic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
-    0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
-    0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
-    0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
-    0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
-    0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
-    0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2,
-};
-
-static unsigned short  CP_1257 [256] = { // Windows: Baltic
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0083, 0x201E, 0x2026, 0x2020, 0x2021, 0x0088, 0x2030, 0x008A, 0x2039, 0x008C, 0x00A8, 0x02C7, 0x00B8,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0098, 0x2122, 0x009A, 0x203A, 0x009C, 0x00AF, 0x02DB, 0x009F,
-    0x00A0, 0xF8FC, 0x00A2, 0x00A3, 0x00A4, 0xF8FD, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
-    0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
-    0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
-    0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
-    0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9,
-};
-
-static unsigned short  CP_1258 [256] = { // Windows: Vietnam
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x008A, 0x2039, 0x0152, 0x008D, 0x008E, 0x008F,
-    0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x009A, 0x203A, 0x0153, 0x009D, 0x009E, 0x0178,
-    0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
-    0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
-    0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
-    0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
-    0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
-    0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF,
-};
-
-static unsigned short  CP_10000 [256] = { // Apple Macintosh
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
-    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
-    0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
-    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
-    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
-    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
-    0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
-    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
-};
-
-static unsigned short  CP_10079 [256] = { // ???
-    0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
-    0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
-    0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
-    0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
-    0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
-    0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F,
-    0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
-    0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F,
-    0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
-    0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
-    0x00DD, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
-    0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211, 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x2126, 0x00E6, 0x00F8,
-    0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB, 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
-    0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA, 0x00FF, 0x0178, 0x2044, 0x00A4, 0x00D0, 0x00F0, 0x00DE, 0x00FE,
-    0x00FD, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1, 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
-    0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC, 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
-};
-
-#endif
-
-
-/*
- *  Resets Item Counter
- *  Do not frees any memory.
- */
-
-void
-Init_Tags ( void )
-{
-    TagCount = 0;
-}
-
-
-static unsigned char*
-utf8char ( unsigned char* dst, unsigned long value )
-{
-    if      ( value == '\r'  ||  value == 0xFFFE  ||  value == 0xFFFF ) {
-        ;
-    }
-    else if ( value < 0x80 ) {
-        *dst++ = value;
-    }
-    else if ( value < 0x800 ) {
-        *dst++ = 0xC0 + ((value >>  6) & 0x1F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x10000 ) {
-        *dst++ = 0xE0 + ((value >> 12) & 0x0F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x200000 ) {
-        *dst++ = 0xF0 + ((value >> 18) & 0x07);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x4000000 ) {
-        *dst++ = 0xF8 + ((value >> 24) & 0x03);
-        *dst++ = 0x80 + ((value >> 18) & 0x3F);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-    else if ( value < 0x80000000 ) {
-        *dst++ = 0xFC + ((value >> 30) & 0x01);
-        *dst++ = 0x80 + ((value >> 24) & 0x3F);
-        *dst++ = 0x80 + ((value >> 18) & 0x3F);
-        *dst++ = 0x80 + ((value >> 12) & 0x3F);
-        *dst++ = 0x80 + ((value >>  6) & 0x3F);
-        *dst++ = 0x80 + ((value >>  0) & 0x3F);
-    }
-
-    return dst;
-}
-
-
-/*
- *  IsUnicode()
- *
- *  Gets a memory block and tries to find out whether this is binary data or a valid Windows Unicode file.
- *  When return 1, it is very likely (but not 100% secure) that the contents is Unicode encoded.
- */
-
-static int
-IsUnicode ( const unsigned char* src, size_t len )
-{
-    if ( len <= 2 )
-        return 0;
-
-    if ( len & 1 )                                              // odd number of bytes?
-        return 0;
-
-    if ( src [0] != 0xFF  ||  src [1] != 0xFE )                 // Microsoft Unicode preample (also useful to detect endianess, but currently only little endian is supported)
-        return 0;
-
-    for ( len >>= 1; len > 0; len--, src += 2 ) {               // Check for invalid codes (FFFE, FFFF, DC00...DFFF without a prepend D800...DBFF, D800...DBFF without a n appended DC00...DFFF)
-        if ( ( src [1] & 0xFC ) == 0xDC )
-            return 0;
-        if ( src [1] == 0xFF  &&  ( src [0] & 0xFE ) == 0xFE )
-            return 0;
-        if ( ( src [1] & 0xFC ) == 0xD8 )
-            if ( len < 2  ||  ( src [3] & 0xFC ) != 0xDC )
-                return 0;
-        else
-            len--, src += 2;
-    }
-
-    return 1;                                                   // good chance to be a UTF-8
-}
-
-/*
- *  addtag()
- *
- *  Add a item to the item list of a tag. Item key is given by (key,keylen), item value by (value,valuelen).
- *
- *  The following value translation modes are possible:
- *    0: no translation at all
- *    1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
- *    2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
- *    3: like 1), but convert ';' to null character
- *    4: UTF-16 LE => translate to UTF-8
- *    5: translate from ISO-8859-1 to UTF-8
- *    6: like 1), but convert from OEM codepage (Win32)
- *  (should become an enum)
- *
- *  Note:
- *    Windows 95/98/ME has no usable NLS support
- *
- */
-
-int
-addtag ( const char*           key,             // the item key
-         size_t                keylen,          // length of item key, or 0 for auto-determine
-         const unsigned char*  value,           // the item value
-         size_t                valuelen,        // the length of the item value (before any possible translation)
-         int                   converttoutf8,   // convert flags of item value
-         int                   flags )          // item flags proposal
-{
-    unsigned char*  p;
-    unsigned char*  q;
-    unsigned char   ch;
-    size_t          i;
-#ifdef _WIN32
-    const unsigned short*  CP_ptr;
-    unsigned int           Codepage;
-
-    if ( converttoutf8 == 6 ) {
-        Codepage      = GetOEMCP ();
-        converttoutf8 = 1;
-    } else {
-        Codepage      = GetACP ();
-    }
-
-    switch ( Codepage ) {
-    case CP_ACP:        CP_ptr =  CP_1252; break;
-    case CP_OEMCP:      CP_ptr =   CP_850; break;
-    case CP_MACCP:      CP_ptr = CP_10000; break;
-    case CP_THREAD_ACP: CP_ptr =  CP_1252; break;
-    default:    CP_ptr =   CP_850; break;
-    case    37: CP_ptr =    CP_37; break;
-    case    42: CP_ptr =    CP_42; break;
-    case   437: CP_ptr =   CP_437; break;
-    case   500: CP_ptr =   CP_500; break;
-    case   850: CP_ptr =   CP_850; break;
-    case   860: CP_ptr =   CP_860; break;
-    case   861: CP_ptr =   CP_861; break;
-    case   863: CP_ptr =   CP_863; break;
-    case   865: CP_ptr =   CP_865; break;
-    case   874: CP_ptr =   CP_874; break;
-    case  1250: CP_ptr =  CP_1250; break;
-    case  1251: CP_ptr =  CP_1251; break;
-    case  1252: CP_ptr =  CP_1252; break;
-    case  1253: CP_ptr =  CP_1253; break;
-    case  1254: CP_ptr =  CP_1254; break;
-    case  1255: CP_ptr =  CP_1255; break;
-    case  1256: CP_ptr =  CP_1256; break;
-    case  1257: CP_ptr =  CP_1257; break;
-    case  1258: CP_ptr =  CP_1258; break;
-    case 10000: CP_ptr = CP_10000; break;
-    case 10079: CP_ptr = CP_10079; break;
-    }
-#endif
-
-
-    if ( converttoutf8 == 2  &&  IsUnicode ( value, valuelen ) ) {
-        converttoutf8 = 4;
-        value        += 2;                      // remove first two bytes (zero width space 0xFEFF)
-        valuelen      = ( valuelen - 2) >> 1;
-        flags        &= ~2;                     // reset binary flag (it's now text)
-    }
-
-    if ( keylen == 0 )
-        keylen = strlen ( key );
-
-    p = malloc ( keylen );
-    memcpy ( p, key, keylen );
-    T [TagCount] . key    = p;
-    T [TagCount] . keylen = keylen;
-
-    switch ( converttoutf8 ) {
-    default:
-        p = malloc ( 1 * valuelen );    // copy
-        break;
-    case 1:                             // at most 1 native character => 3 UTF bytes
-    case 4:                             // at 1 wide => 3, 2 wide => 4
-        p = malloc ( 3 * valuelen );
-        break;
-    }
-
-    q = p;
-
-    for ( i = 0; i < valuelen; i++ ) {
-        ch = value [i];
-        switch ( converttoutf8 ) {
-        default:                        // 0: no translation at all --or-- 2: auto detect: contents is a valid Window Unicode File => translate to UTF-8, else no translation at all
-            *q++ = ch;
-            break;
-
-        case 5:                         // 5: translate from ISO-8859-1 to UTF-8
-            q = utf8char ( q, ch );
-            break;
-
-        case 3:                         // 3: like 1), but convert ';' to null character
-            if ( ch == ';' )
-                ch = '\0';
-            /* fall through */
-
-        case 1:                         // 1: translate from console charset to UTF-8 (currently ISO-8859-1 for non-Windows and non-DOS OS)
-#if defined __TURBOC__
-            q = utf8char ( q, CP_850 [ch] );
-#elif defined _WIN32
-            // fprintf ( stderr, "%c  %02X  U+%04X\n", ch, ch, CP_ptr [ch] );
-            q = utf8char ( q, CP_ptr [ch] );
-#elif defined USE_WIDECHAR
-            {
-            int      ret;
-            wchar_t  wch = 0;
-            ret = mbtowc ( &wch, value + i, valuelen - i );
-            if ( ret > 0 )
-                q = utf8char ( q, wch ), i += ret - 1;
-            }
-#else
-            q = utf8char ( q, ch );
-#endif
-            break;
-
-        case 4:                         // 4: UTF-16 LE => translate to UTF-8
-            if ( (value [i+i+1] & 0xFC ) == 0xD8  &&  (value [i+i+3] & 0xFC ) == 0xDC ) {   // UTF-16 code (2x16 bit for Unicodes 0x010000...0x10FFFF)
-                q = utf8char ( q, ((value [i+i] + (value [i+i+1] << 8) - 0xD800) << 10) + (value [i+i+2] + (value [i+i+3] << 8) - 0xDC00) + 0x10000 );
-                i++;
-            }
-            else {
-                q = utf8char ( q, value [i+i] + (value [i+i+1] << 8) );
-            }
-            break;
-        }
-    }
-
-    p = realloc ( p, valuelen = q-p );
-
-    for ( i = 0; i < TagCount; i++ )
-        if ( T [i].keylen == T [TagCount].keylen  &&  0 == memcmp (T [i].key, T [TagCount].key, T [i].keylen ) ) {    // found old tag with the same name => replace
-            free ( T [TagCount].key   );
-            free ( T [i].value );
-            goto set;
-        }
-
-    i = TagCount++;
-set:
-    T [i] . value    = p;
-    T [i] . valuelen = valuelen;
-    T [i] . flags    = flags;
-    return 0;
-}
-
-
-static int Cdecl
-cmpfn2 ( const void* p1, const void* p2 )
-{
-    const TagItem_t*  q1 = (TagItem_t*) p1;
-    const TagItem_t*  q2 = (TagItem_t*) p2;
-
-    return q1 -> valuelen - q2 -> valuelen;
-}
-
-/*
- *  Writes collect tag items and write it to a file.
- *  Items are destroyed, so tags can only be written once.
- */
-
-int
-FinalizeTags ( FILE* fp, unsigned int Version )
-{
-    static unsigned char  H [32] = "APETAGEX";
-    unsigned char         dw [8];
-    unsigned long         estimatedbytes =  32; // 32 byte footer + all items, these are the 32 bytes footer, the items are added later
-    unsigned long         writtenbytes   = -32; // actually writtenbytes-32, which should be equal to estimatedbytes (= footer + all items)
-    unsigned int          i;
-
-    if ( TagCount == 0 )
-        return 0;
-
-    qsort ( T, TagCount, sizeof (*T), cmpfn2 );
-
-    for ( i = 0; i < TagCount; i++ )
-        estimatedbytes += 9 + T[i] . keylen + T[i] . valuelen;
-
-    if ( estimatedbytes >= 8192 + 103 )
-        stderr_printf ( "\nTag is %.1f Kbyte long. This is longer than the maximum recommended 8 KByte.\n\a", estimatedbytes/1024. );
-
-    H [ 8] = Version >>  0;
-    H [ 9] = Version >>  8;
-    H [10] = Version >> 16;
-    H [11] = Version >> 24;
-    H [12] = estimatedbytes >>  0;
-    H [13] = estimatedbytes >>  8;
-    H [14] = estimatedbytes >> 16;
-    H [15] = estimatedbytes >> 24;
-    H [16] = TagCount >>  0;
-    H [17] = TagCount >>  8;
-    H [18] = TagCount >> 16;
-    H [19] = TagCount >> 24;
-
-    H [23] = 0x80 | 0x20;
-    writtenbytes += fwrite ( H, 1, 32, fp );
-
-    for ( i = 0; i < TagCount; i++ ) {
-        dw [0] = T [i] . valuelen >>  0;
-        dw [1] = T [i] . valuelen >>  8;
-        dw [2] = T [i] . valuelen >> 16;
-        dw [3] = T [i] . valuelen >> 24;
-        dw [4] = T [i] . flags >>  0;
-        dw [5] = T [i] . flags >>  8;
-        dw [6] = T [i] . flags >> 16;
-        dw [7] = T [i] . flags >> 24;
-        writtenbytes += fwrite ( dw        , 1, 8            , fp );
-        writtenbytes += fwrite ( T[i].key  , 1, T[i].keylen  , fp );
-        writtenbytes += fwrite ( ""        , 1, 1            , fp );
-        if ( T[i].valuelen > 0 )
-            writtenbytes += fwrite ( T[i].value, 1, T[i].valuelen, fp );
-        if ( T[i].key != NULL )
-            free ( T[i].key   );
-        if ( T[i].value != NULL )
-            free ( T[i].value );
-    }
-
-    H [23] = 0x80;
-    writtenbytes += fwrite ( H, 1, 32, fp );
-
-    if ( estimatedbytes != writtenbytes )
-        stderr_printf ( "\nError writing APE tag.\n" );
-
-    TagCount = 0;
-    return 0;
-}
-
-
-static int
-TagKeyExists ( const char* key, size_t keylen )
-{
-    unsigned int  i;
-
-    if ( keylen == 0 )
-        keylen = strlen ( key );
-
-    for ( i = 0; i < TagCount; i++ )
-        if ( T [i].keylen == keylen  &&  0 == memcmp (T [i].key, key, keylen ) )
-            return 1;
-
-    return 0;
-}
-
-
-/*
- *  Copies src to dst. Copying is stopped at `\0' char is detected or if
- *  len chars are copied.
- *  Trailing blanks are removed and the string is `\0` terminated.
- */
-
-static void
-memcpy_crop ( const char* key, char* src, size_t len, int flags )
-{
-    while ( len > 0  &&  ( src [len-1] == ' '  ||  src [len-1] == '\0' ) )
-        len--;
-
-    if ( len > 0 )
-        if ( ! TagKeyExists ( key, 0 ) )
-            addtag ( key, 0, src, len, 1, flags );
-}
-
-
-static int
-CopyTags_ID3 ( FILE* fp )
-{
-    Uint8_t  tmp [128];
-
-    if ( -1 == SEEK ( fp, -128L, SEEK_END ) )
-        return -1;
-
-    if ( 128 != READ ( fp, tmp, 128 ) )
-        return -1;
-
-    if ( 0 != memcmp ( tmp, "TAG", 3 ) ) {
-        return -1;
-    }
-
-    if ( !tmp[3]  &&  !tmp[33]  &&  !tmp[63]  &&  !tmp[93]  &&  !tmp[97] )
-        return -1;
-
-    memcpy_crop  ( "Title"  , tmp +  3, 30, 0 );
-    memcpy_crop  ( "Artist" , tmp + 33, 30, 0 );
-    memcpy_crop  ( "Album"  , tmp + 63, 30, 0 );
-    memcpy_crop  ( "Year"   , tmp + 93,  4, 0 );
-    memcpy_crop  ( "Comment", tmp + 97, 30, 0 );
-
-    if ( tmp[127] < sizeof(GenreList)/sizeof(*GenreList) )
-        if ( ! TagKeyExists ( "Genre", 0 ) )
-            addtag ("Genre", 0, GenreList [tmp[127]], strlen (GenreList [tmp[127]]), 0, 0 );
-
-    if ( tmp[125] == 0  &&  tmp[126] != 0 )
-        if ( ! TagKeyExists ( "Track", 0 ) ) {
-            sprintf ( tmp, "%u",  tmp[126] );
-            addtag ("Track", 0, tmp, strlen (tmp), 0, 0 );
-        }
-
-    return 0;
-}
-
-
-static unsigned int
-Read_LE_Uint32 ( const unsigned char* p )
-{
-    return ((Uint32_t)p[0] <<  0) |
-           ((Uint32_t)p[1] <<  8) |
-           ((Uint32_t)p[2] << 16) |
-           ((Uint32_t)p[3] << 24);
-}
-
-
-static int
-CopyTags_APE ( FILE* fp )
-{
-    Uint32_t                   len;
-    Uint32_t                   flags;
-    unsigned char              buff [32768];
-    unsigned char              key [257];
-    unsigned char*             p;
-    struct APETagFooterStruct  T;
-    Uint32_t                   TagLen;
-    Uint32_t                   TagCount;
-    Uint32_t                   tmp;
-
-    if ( -1 == SEEK ( fp, -(long)sizeof T, SEEK_END ) )
-        return -1;
-    if ( sizeof(T) != READ ( fp, &T, sizeof T ) )
-        return -1;
-    if ( memcmp ( T.ID, "APETAGEX", sizeof(T.ID) ) != 0 )
-        return -1;
-    tmp = Read_LE_Uint32 (T.Version);
-    if (  tmp != 1000  &&  tmp != 2000 )
-        return -1;
-    TagLen = Read_LE_Uint32 (T.Length);
-    if ( TagLen <= sizeof T )
-        return -1;
-    if ( -1 == SEEK ( fp, -(long)TagLen, SEEK_END ) )
-        return -1;
-    memset ( buff, 0, sizeof(buff) );
-    if ( TagLen - sizeof T != READ ( fp, buff, TagLen - sizeof T ) )
-        return -1;
-
-    TagCount = Read_LE_Uint32 (T.TagCount);
-    for ( p = buff; TagCount--; ) {
-        len   = Read_LE_Uint32 ( p );        p += 4;
-        flags = Read_LE_Uint32 ( p );        p += 4;
-        strcpy ( key, p );                   p += strlen (key) + 1;
-        if ( ! TagKeyExists ( key, 0 ) )
-            addtag ( key, 0, p, len > 0  &&  p [len-1] == '\0'  ?  len-1  :  len, 5, flags );
-                                             p += len;
-    }
-
-    return 0;
-}
-
-static void
-FullPathName ( char* dst, size_t dstlen, const char* filename )         // Can contain stuff like ".." and "."
-{
-    const char*  p;
-    char*        q     = dst;
-
-#if DRIVE_SEP != '\0'
-    int          drive = 0;
-
-    if ( isalpha (filename[0])  &&  filename[1] == DRIVE_SEP  &&  filename[2] != PATH_SEP ) {
-        drive     = filename[0] & 0x1F;
-        filename += 2;
-    }
-#endif
-
-    if ( filename[0] != PATH_SEP ) {
-#ifdef _WIN32
-        _getdcwd( drive, dst, dstlen );
-#else
-        getcwd ( dst, dstlen );
-#endif
-        q += strlen (q);
-#ifdef _WIN32
-        if ( dst[0] != PATH_SEP  ||  dst[1] != '\0' )
-#else
-        if ( dst[2] != PATH_SEP  ||  dst[3] != '\0' )
-#endif
-            *q++ = PATH_SEP;
-    }
-
-    strcpy ( q, filename );
-    return;
-}
-
-/********************************************************************************************/
-
-/*
-
-" "                             ' '
-" - "                           '-'
-"."                             '.'
-"/"                             '/'
-" -- "                          '_'
-"[#0]"                          '0'
-"[#n]"  [number]                'n'
-"#n"    number                  'M'
-"(#N)"  (CD x)                  'N'             it should also be possible: (CD x/x), (DVD x), (DVD x/x)
-"#A"    Artist                  'A'
-"#C"    CD/Album                'C'
-"#T"    Title                   'T'
-"#x"    extention               'x'
-
-
-/#C -- [#n] #A -- #T#x      | Acid Jazz/100% Acid Jazz -- [04] Leena Conquest (and Hip Hop Fingers) -- Boundaries (Radio Edit).pac
-/#A/#C -- [#n] #T#x         | Andreas Vollenweider/Eolian Minstrel -- [02] Across the Iron River.pac
-/#A/#C#N -- [#n] #T#x       | Barbra Streisand/The Concert (CD 1) -- [01] Overture
-/#A -- #C -- [#n] #T#x      | Friedemann/Friedemann -- Aquamarin -- [09] In the Court of the Mermaid.pac
-/#C/[#n] #A -- #T#x         | Jazz Lyrik Prosa/[11] Eberhard Esche -- Anektode.pac
-/#A -- #T#x                 | Lais/Lais -- 06.pac
-/#C/(#N) -- [#n] #A -- #T#x | Tanz- und Folkfest 2001 -- Klingende Post/(CD 2) -- [09] Andy Irvine -- Gladiators.pac
-/#A -- #C -- [#0]#x         | Friedemann/Friedemann -- Aquamarin -- [00].pac
-/#A/#C (#N) -- [#0]#x       | Tangerine Dream/The Warsaw Concert (CD 2) -- [00].pac
-/#A/#T#x                    | Heinz-Rudolf Kunze/Dein ist mein ganzes Herz.pac
-/#A/#C -- [#0]#x            | Sting/Nada como el Sol -- [00].mpc
-
-*/
-
-static const char* const  parser_strings [] = {
-    "/A_Tx",
-    "/A/Tx",
-    "/A_C_0x",
-    "/C_n A_Tx",
-    "/A/C_n Tx",
-    "/A/C N_n Tx",
-    "/A_C_n Tx",
-    "/C/n A_Tx",
-    "/C/N_n A_Tx",
-    "/A/C N_0x",
-    "/A/C_0x",
-};
-
-
-static void
-copy ( char* dst, const char* src, size_t len )
-{
-    memcpy ( dst, src, len );
-    dst [len] = '\0';
-}
-
-/*
- *    dst[0] = Artist
- *    dst[1] = CD
- *    dst[2] = Title
- *    dst[3] = +CD
- *    dst[4] = number
- *    dst[5] = ext
- */
-
-static int
-parse ( char** dst, const char* src, const char* format )
-{
-    int          i;
-    const char*  srcend = src + strlen(src);
-    const char*  p;
-    char*        q;
-
-    for ( i = 0; i < 6; i++)
-        dst[i][0] = '\0';
-
-    for ( i = strlen(format); i-- > 0; ) {
-        p = srcend;
-        stderr_printf ( "%c: ", format[i] );
-
-        switch ( format[i] ) {
-        case '.':
-        case ' ':
-        case '/':                               // !!!!!!!
-            if (p[-1] != format[i])
-                return 1;
-            p--;
-            break;
-        case '_':
-            if (0 != memcmp (p-4, " -- ", 4))
-                return 1;
-            p -= 4;
-            break;
-        case '-':
-            if (0 != memcmp (p-3, " - ", 3))
-                return 1;
-            p -= 3;
-            break;
-        case '0':
-            if (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                return 1;
-            p -= 4;
-            break;
-        case 'n':
-            if (p[-1] != ']' || !isdigit(p[-2]) || !isdigit(p[-3]) || p[-4] != '[')
-                return 1;
-            copy (dst[4], p-3, 2);
-            p -= 4;
-            break;
-        case 'M':
-            if ( !isdigit(p[-1]) || !isdigit(p[-2]) )
-                return 1;
-            copy (dst[4], p-2, 2);
-            p -= 2;
-            break;
-        case 'N':
-            if (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')
-                return 1;
-            dst[3][0] = ' ';
-            copy (dst[3]+1, p-6, 6);
-            p -= 6;
-            break;
-        case 'A':
-            q = dst[0]; goto big;
-        case 'C':
-            q = dst[1]; goto big;
-        case 'T':
-            q = dst[2]; goto big;
-        big:
-            while ( 0 == memcmp (p-4, "/mpc", 4)  ||
-                    0 == memcmp (p-4, "/mp3", 4)  ||
-                    0 == memcmp (p-4, "/pac", 4)  ||
-                    0 == memcmp (p-4, "/ape", 4)  ||
-                    0 == memcmp (p-4, "/pac", 4)  ||
-                    0 == memcmp (p-3, "/.." , 3)  ||
-                    0 == memcmp (p-2, "/."  , 2)
-                  ) {
-                      do {
-                          p--;
-                          srcend--;
-                      } while ( *p != PATH_SEP );
-                }
-            while ( p[-1] != PATH_SEP  &&
-                    p[-1] != DRIVE_SEP &&
-                    0 != memcmp (p-4, " -- ", 4 )  &&
-                    (p[-1] != ')' || !isdigit(p[-2]) || p[-3] != ' ' || p[-4] != 'D' || p[-5] != 'C' || p[-6] != '(')  &&
-                    (p[-1] != ' ' || p[-2] != ']' || !isdigit(p[-3]) || !isdigit(p[-4]) || p[-5] != '[') &&
-                    (p[-1] != ']' || p[-2] != '0' || p[-3] != '0' || p[-4] != '[')
-                  )
-                p--;
-            copy ( q, p, srcend - p );
-            break;
-        case 'x':
-            do {
-                p--;
-                if (p[0] == PATH_SEP || p[0] == DRIVE_SEP)
-                    return -1;
-            } while (*p != '.');
-            copy (dst[5], p, srcend-p );
-            break;
-        }
-        stderr_printf ( "%*.*s\033[7m%*.*s\033[0m\n", p-src, p-src, src, srcend-p, srcend-p, p );
-        srcend = p;
-    }
-    return 0;
-}
-
-static int
-hexdigit ( const char s )
-{
-    if ( (unsigned char)(s-'0') < 10u )
-        return s-'0';
-    if ( (unsigned char)(s-'A') <  6u )
-        return s-'A'+10;
-    return -1;
-}
-
-static void
-spaceconverting ( char* dst, const char* src )          // can work inplace
-{
-    for ( ; src[0] != '\0' ; src++) {
-        if      ( src[0] == '_' )
-            *dst++ = ' ';
-        else if ( src[0] == '%'  &&  hexdigit(src[1]) >= 0  &&  hexdigit(src[2]) >= 0 )
-            *dst++ = hexdigit(src[1]) * 16 + hexdigit(src[2]), src += 2;
-        else
-            *dst++ = *src;
-    }
-    *dst = '\0';
-}
-
-
-static void
-Parser ( const char* src )
-{
-    size_t  i;
-    char    tmp  [6] [1024];
-    char*   buff [6] = { tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5] };
-    char    merge [1024];
-    char*   q;
-
-    stderr_printf ( "\n  »%s«\n", src );
-    for ( i = 0; i < sizeof(parser_strings)/sizeof(*parser_strings); i++ ) {
-        if ( 0 == parse ( buff, src, parser_strings[i] ) ) {
-            sprintf ( merge, "%s%s", tmp[1], tmp[3] );
-            q = merge + strlen (merge);
-
-            if ( q-7 >= merge  &&  q[-7]==' '  &&  q[-6]=='('  && atoi(q-5) >= 1900  &&  atoi(q-5) < 2050  &&  q[-1] == ')' ) {
-                q[-1] = '\0';
-                q[-7] = '\0';
-                q -= 5;
-            }
-            else {
-                q = NULL;
-            }
-
-            spaceconverting ( tmp[0], tmp[0] );
-            spaceconverting ( merge , merge );
-            spaceconverting ( tmp[2], tmp[2] );
-            spaceconverting ( tmp[4], tmp[4] );
-            spaceconverting ( tmp[5], tmp[5] );
-
-            stderr_printf ("\n");
-            stderr_printf ("Artist = »%s«\n", tmp[0] );
-            stderr_printf ("CD     = »%s«\n", merge  );
-            stderr_printf ("Title  = »%s«\n", tmp[2] );
-            stderr_printf ("No#    = »%s«\n", tmp[4] );
-            stderr_printf ("Extent = »%s«\n", tmp[5] );
-            stderr_printf ("Year   = »%s«\n", q  ?  q  :  "????" );
-#if 1
-            if ( tmp[0][0]  &&  ! TagKeyExists ( "Artist", 0 ) ) addtag ( "Artist", 0, tmp[0], strlen (tmp[0]), 5, 0 );
-            if ( merge[0]   &&  ! TagKeyExists ( "Album" , 0 ) ) addtag ( "Album" , 0, merge , strlen (merge) , 5, 0 );
-            if ( tmp[2][0]  &&  ! TagKeyExists ( "Title" , 0 ) ) addtag ( "Title" , 0, tmp[2], strlen (tmp[2]), 5, 0 );
-            if ( tmp[4][0]  &&  ! TagKeyExists ( "Track" , 0 ) ) addtag ( "Track" , 0, tmp[4], strlen (tmp[4]), 5, 0 );
-            if ( q != NULL  &&  ! TagKeyExists ( "Year"  , 0 ) ) addtag ( "Year"  , 0, q     , 4              , 5, 0 );
-#endif
-            return 1;
-        }
-        stderr_printf ("???\n--\n");
-    }
-
-    return 0;
-}
-
-
-/*******************************************************************************/
-
-
-static int
-CopyTags_Name ( const char* filename )
-{
-    char         buff [4096];
-
-    FullPathName  ( buff, sizeof buff, filename );
-    Parser        ( buff );
-    return 0;
-}
-
-
-int
-CopyTags ( const char* filename )
-{
-    FILE*  fp;
-
-    if ( 0 == strncmp (filename, "/dev/", 5 ) )
-        return 0;
-
-    fp = fopen ( filename, "rb" );
-    if ( fp == NULL )
-        return -1;
-
-    CopyTags_APE  (fp);                 // APE tags have higher priority than ID3V1 tags
-    CopyTags_ID3  (fp);
-    CopyTags_Name (filename);
-
-    fclose (fp);
-    return 0;
-}
-
-/* end of tags.c */
Index: penc/trunk/timefreq.c
===================================================================
--- /mppenc/trunk/timefreq.c	(revision 96)
+++ 	(revision )
@@ -1,497 +1,0 @@
-// dts, NPR
-// dts, PR
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifndef M_PI
-# define M_PI    3.1415926535897932384626433832795029
-#endif
-#define MAX     8192
-#define TYPE    double
-
-//////////////////////////////
-//
-// BesselI0 -- Regular Modified Cylindrical Bessel Function (Bessel I).
-//
-
-static double
-Bessel_I_0 ( double x )
-{
-    double  denominator;
-    double  numerator;
-    double  z;
-
-    if (x == 0.)
-        return 1.;
-
-    z = x * x;
-    numerator = z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z* (z*
-                   0.210580722890567e-22  + 0.380715242345326e-19 ) +
-                   0.479440257548300e-16) + 0.435125971262668e-13 ) +
-                   0.300931127112960e-10) + 0.160224679395361e-07 ) +
-                   0.654858370096785e-05) + 0.202591084143397e-02 ) +
-                   0.463076284721000e+00) + 0.754337328948189e+02 ) +
-                   0.830792541809429e+04) + 0.571661130563785e+06 ) +
-                   0.216415572361227e+08) + 0.356644482244025e+09 ) +
-                   0.144048298227235e+10;
-
-    denominator = z* (z* (z - 0.307646912682801e+04) + 0.347626332405882e+07) - 0.144048298227235e+10;
-
-    return - numerator / denominator;
-}
-
-static double
-residual ( double x )
-{
-    return sqrt ( 1. - x*x );
-}
-
-//////////////////////////////
-//
-// KBDWindow -- Kaiser Bessel Derived Window
-//      fills the input window array with size samples of the
-//      KBD window with the given tuning parameter alpha.
-//
-
-
-static void
-KBDWindow ( TYPE* window, unsigned int size, TYPE alpha )
-{
-    double        sumvalue = 0.;
-    unsigned int  i;
-
-    for ( i = 0; i < size/2; i++ )
-        window [i] = sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*i/size - 1.) );
-
-    // need to add one more value to the nomalization factor at size/2:
-    sumvalue += Bessel_I_0 ( M_PI * alpha * residual (4.*(size/2)/size-1.) );
-
-    // normalize the window and fill in the righthand side of the window:
-    for ( i = 0; i < size/2; i++ )
-        window [size-1-i] = window [i] = sqrt ( window [i] / sumvalue );
-}
-
-
-static void
-CosWindow ( TYPE* window, unsigned int size )
-{
-    double        x;
-    unsigned int  i;
-
-    for ( i = 0; i < size/2; i++ ) {
-        x = cos ( (i+0.5) * (M_PI / size) );
-        window [size/2-1-i] = window [size/2+i] = x;
-    }
-}
-
-
-static void
-CosSinWindow ( TYPE* window, unsigned int size )
-{
-    double        x;
-    unsigned int  i;
-
-    for ( i = 0; i < size/2; i++ ) {
-        x = sin ( (i+0.5) * (M_PI / size) );
-        x = cos (x * x * M_PI/2);
-        window [size/2-1-i] = window [size/2+i] = x;
-    }
-}
-
-
-static void
-SincWindow ( TYPE* window, unsigned int size )
-{
-        static long  W [] = {
-            0,   -1,   -1,   -1,   -1,   -1,   -1,   -2,   -2,   -2,   -2,   -3,   -3,   -4,   -4,   -5,
-           -5,   -6,   -7,   -7,   -8,   -9,  -10,  -11,  -13,  -14,  -16,  -17,  -19,  -21,  -24,  -26,
-          -29,  -31,  -35,  -38,  -41,  -45,  -49,  -53,  -58,  -63,  -68,  -73,  -79,  -85,  -91,  -97,
-         -104, -111, -117, -125, -132, -139, -147, -154, -161, -169, -176, -183, -190, -196, -202, -208,
-         -213, -218, -222, -225, -227, -228, -228, -227, -224, -221, -215, -208, -200, -189, -177, -163,
-         -146, -127, -106,  -83,  -57,  -29,    2,   36,   72,  111,  153,  197,  244,  294,  347,  401,
-          459,  519,  581,  645,  711,  779,  848,  919,  991, 1064, 1137, 1210, 1283, 1356, 1428, 1498,
-         1567, 1634, 1698, 1759, 1817, 1870, 1919, 1962, 2001, 2032, 2057, 2075, 2085, 2087, 2080, 2063,
-         2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, 1414, 1280, 1131,  970,  794,  605,  402,  185,
-          -45, -288, -545, -814,-1095,-1388,-1692,-2006,-2330,-2663,-3004,-3351,-3705,-4063,-4425,-4788,
-        -5153,-5517,-5879,-6237,-6589,-6935,-7271,-7597,-7910,-8209,-8491,-8755,-8998,-9219,-9416,-9585,
-        -9727,-9838,-9916,-9959,-9966,-9935,-9863,-9750,-9592,-9389,-9139,-8840,-8492,-8092,-7640,-7134,
-        -6574,-5959,-5288,-4561,-3776,-2935,-2037,-1082,  -70,  998, 2122, 3300, 4533, 5818, 7154, 8540,
-         9975,11455,12980,14548,16155,17799,19478,21189,22929,24694,26482,28289,30112,31947,33791,35640,
-        37489,39336,41176,43006,44821,46617,48390,50137,51853,53534,55178,56778,58333,59838,61289,62684,
-        64019,65290,66494,67629,68692,69679,70590,71420,72169,72835,73415,73908,74313,74630,74856,74992,
-        75038,    0 };
-
-    double        x;
-    unsigned int  i;
-    unsigned int  j;
-
-    for ( i = 0; i <= size/2; i++ ) {
-        x  = i * 512. / size;
-        j  = (int) x;
-        x  = W [j] * (1 - x + j) + W [j+1] * (x - j);
-        x /= 75038.;
-        window [size-1-i] = window [i] = x;
-    }
-
-}
-
-#pragma warning ( disable: 4035 )
-
-
-static void
-Multiply ( TYPE* z, const TYPE* x, const TYPE* y )
-{
-    double X [MAX];
-    int    i;
-    int    j;
-    int    maxx = 0;
-    int    maxy = 0;
-
-    for ( i = 0; i < MAX; i++ ) {
-        if ( x[i] != 0. )
-            maxx = i+1;
-        if ( y[i] != 0. )
-            maxy = i+1;
-    }
-
-    memset ( X, 0, sizeof X );
-
-    for ( i = 0; i < maxx; i++ )
-        for ( j = 0; j < maxy; j++ )
-            X [i+j] += (double)x[i] * y[j];
-
-    for ( i = 0; i < MAX; i++ )
-        z [i] = X [i];
-}
-
-double
-dB ( double x )
-{
-    return 10 * log10 (1.e-99 + x*x);
-}
-
-
-const char*  dir;
-int          flag;
-float        xmin1;
-float        xmax1;
-float        ymin1;
-float        ymax1;
-float        xmin2;
-float        xmax2;
-float        ymin2;
-float        ymax2;
-float        xmin3;
-float        xmax3;
-float        ymin3;
-float        ymax3;
-
-
-void
-Setup ( FILE* fp, float xmin, float xmax, float ymin, float ymax )
-{
-    fprintf ( fp,
-        "@    world xmin %f\n"
-        "@    world xmax %f\n"
-        "@    world ymin %f\n"
-        "@    world ymax %f\n"
-        "@    view xmin 0.08\n"
-        "@    view xmax 0.96\n"
-        "@    view ymin 0.08\n"
-        "@    view ymax 0.96\n", xmin, xmax, ymin, ymax );
-
-}
-
-
-static void
-Message ( const char* name, TYPE* x, const TYPE sf, int fftsize )
-{
-    char    filename [128];
-    TYPE    y [MAX/2 + 1];
-    TYPE    S [MAX + 1];
-    TYPE    C [MAX + 1];
-    double  tmpc;
-    double  tmps;
-    double  tmp;
-    FILE*   fp;
-    TYPE    maxx = 0.;
-    int     maxi = 0;
-    int     maxu = 0;
-    int     i;
-    int     j;
-    int     w;
-
-    if ( fftsize == 0 )
-        fftsize = MAX;
-
-    fprintf ( stderr, "Impulse   response: %s\n", name );
-    for ( i = 0; i < MAX; i++ ) {
-        if ( fabs (x[i]) > maxx ) {
-            maxi = i;
-            maxx = fabs (x[i]);
-        }
-        if ( x[i] != 0. )
-            maxu = i + 1;
-    }
-
-    mkdir (dir, 0777);
-    sprintf ( filename, "%s/%s time.txt", dir, name );
-    if ( flag & 1 ) {
-        fp = fopen ( filename, "w" );
-        Setup ( fp, xmin1, xmax1, ymin1, ymax1 );
-        for ( i = 0; i < maxu; i++ )
-            fprintf ( fp, "%8.4f\t%12.9f\n", (i - maxi) * 1000. / sf , x[i] / maxx );
-        fclose ( fp );
-    }
-
-    fprintf ( stderr, "Frequency response: %s\n", name );
-    for ( j = 0; j <= fftsize/4; j++ ) {
-        tmp =  2. * M_PI / fftsize * j;
-        C[fftsize/2-j] = C[fftsize/2+j] = - ( C[fftsize  -j] = C[j] = cos (tmp) );
-        S[fftsize  -j] = S[fftsize/2+j] = - ( S[fftsize/2-j] = S[j] = sin (tmp) );
-    }
-    for ( i = 0; i <= fftsize/2; i++ ) {
-        tmpc = 0.;
-        tmps = 0.;
-        for ( j = 0; j < maxu; j++ ) {
-            w     = i*j  &  (fftsize - 1);
-            tmpc += x[j] * C[w];
-            tmps += x[j] * S[w];
-        }
-        tmp = tmpc*tmpc + tmps*tmps;
-        y [i] = sqrt ( tmp );
-    }
-
-    sprintf ( filename, "%s/%s freq.txt", dir, name );
-    if ( flag & 2 ) {
-        fp = fopen ( filename, "w" );
-        Setup ( fp, xmin2, xmax2, ymin2, ymax2 );
-        for ( i = 0; i <= fftsize/2; i++ )
-            fprintf ( fp, "%8.2f\t%12.9f\n", i * sf / fftsize, y[i] / y[0] );
-        fclose ( fp );
-    }
-    sprintf ( filename, "%s/%s frq log.txt", dir, name );
-    if ( flag & 4 ) {
-        fp = fopen ( filename, "w" );
-        Setup ( fp, xmin3, xmax3, ymin3, ymax3 );
-        for ( i = 0; i <= fftsize/2; i++ )
-            fprintf ( fp, "%8.2f\t%12.9f\n", i * sf / fftsize, dB (y[i] / y[0]) );
-        fclose ( fp );
-    }
-}
-
-
-int
-#ifdef _WIN32
-_cdecl
-#endif
-main ( int argc, char** argv )
-{
-    TYPE  A [MAX];
-    TYPE  B [MAX];
-    TYPE  sf = argc == 1  ?  44100.  :  atof (argv[1]);
-
-    if ( sf <= 192. ) sf *=  1000.;
-    if ( sf < 3000. ) sf  = 44100.;
-
-    dir  = "Overall impulse response";
-    flag = 7;
-
-
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 512 );
-    Multiply ( A, A, A );
-    Message ( "Klemm1", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 2 );
-    Multiply ( A, A, A );
-    Message ( "Klemm2", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 2.5 );
-    Multiply ( A, A, A );
-    Message ( "Klemm2.5", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 3 );
-    Multiply ( A, A, A );
-    Message ( "Klemm3", A, sf, 0 );
-
-
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Multiply ( A, A, A );
-    Message ( "Layer 1, Layer 2, MPC, dts (NPR)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 2048 );
-    Multiply ( A, A, A );
-    Message ( "Ogg Vorbis (Long)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 256 );
-    Multiply ( A, A, A );
-    Message ( "Ogg Vorbis (Short)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 5.0 );
-    Multiply ( A, A, A );
-    Message ( "AC-3 (Long)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 256, 5.0 );
-    Multiply ( A, A, A );
-    Message ( "AC-3 (Short)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 2048 );
-    Multiply ( A, A, A );
-    Message ( "AAC (Long, Cos)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 256 );
-    Multiply ( A, A, A );
-    Message ( "AAC (Short, Cos)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 2048, 4.0 );
-    Multiply ( A, A, A );
-    Message ( "AAC (Long, KBD)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 256, 6.0 );
-    Multiply ( A, A, A );
-    Message ( "AAC (Short, KBD)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Multiply ( A, A, A );
-    memset ( B, 0, sizeof B );
-    CosWindow ( B, 1152 );
-    Multiply ( B, B, B );
-    Multiply ( A, A, B );
-    Message ( "MP3 (Long)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Multiply ( A, A, A );
-    memset ( B, 0, sizeof B );
-    CosWindow ( B, 384 );
-    Multiply ( B, B, B );
-    Multiply ( A, A, B );
-    Message ( "MP3 (Short)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 1024 );
-    Multiply ( A, A, A );
-    memset ( B, 0, sizeof B );
-    CosWindow ( B, 2304 );
-    Multiply ( B, B, B );
-    Multiply ( A, A, B );
-    Message ( "MP3Pro (Long)", A, sf, 0 );
-
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 1024 );
-    Multiply ( A, A, A );
-    memset ( B, 0, sizeof B );
-    CosWindow ( B, 768 );
-    Multiply ( B, B, B );
-    Multiply ( A, A, B );
-    Message ( "MP3Pro (Short)", A, sf, 0 );
-
-
-    dir  = "Frequency resolution (long)";
-    flag = 6;
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Message ( "Layer 1 + 2", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 2048 );
-    Message ( "Ogg Vorbis", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 2048 );
-    Message ( "AAC cos"   , A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 2048, 4.0 );
-    Message ( "AAC KBD",  A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 2048, 5.0 );
-    Message ( "AC-3",  A, sf, 0 );
-
-
-    dir  = "Frequency resolution (short)";
-    flag = 6;
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Message ( "Layer 1 + 2", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 256 );
-    Message ( "Ogg Vorbis", A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 256 );
-    Message ( "AAC cos"   , A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 256, 6.0 );
-    Message ( "AAC KBD",  A, sf, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 256, 5.0 );
-    Message ( "AC-3",  A, sf, 0 );
-
-    dir  = "Generic Shape";
-    flag = 1;
-    xmin2 = -500;
-    xmax2 = 500;
-    ymin2 = 0;
-    ymax2 = 1;
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 4096 );
-    Message ( "Sinc", A, 4096, 0 );
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 4096  );
-    Message ( "CosSin", A, 4096, 0 );
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 4096 );
-    Message ( "Cos"   , A, 4096, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 4096, 4.0 );
-    Message ( "KBD-4",  A, 4096, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 4096, 5.0 );
-    Message ( "KBD-5",  A, 4096, 0 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 4096, 6.0 );
-    Message ( "KBD-6",  A, 4096, 0 );
-
-
-    dir  = "Generic Frequency Resolution";
-    flag = 6;
-    xmin2 = 0;
-    xmax2 = 500;
-    ymin2 = 0;
-    ymax2 = 1;
-    xmin3 = 0;
-    xmax3 = 1000;
-    ymin3 = -100;
-    ymax3 = 0;
-    memset ( A, 0, sizeof A );
-    SincWindow ( A, 512 );
-    Message ( "Sinc", A, 48000, 512 );
-    memset ( A, 0, sizeof A );
-    CosSinWindow ( A, 512  );
-    Message ( "CosSin", A, 48000, 512 );
-    memset ( A, 0, sizeof A );
-    CosWindow ( A, 512 );
-    Message ( "Cos"   , A, 48000, 512 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 4.0 );
-    Message ( "KBD-4",  A, 48000, 512 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 5.0 );
-    Message ( "KBD-5",  A, 48000, 512 );
-    memset ( A, 0, sizeof A );
-    KBDWindow ( A, 512, 6.0 );
-    Message ( "KBD-6",  A, 48000, 512 );
-
-
-    return 0;
-}
Index: penc/trunk/timefreq.dsp
===================================================================
--- /mppenc/trunk/timefreq.dsp	(revision 96)
+++ 	(revision )
@@ -1,121 +1,0 @@
-# Microsoft Developer Studio Project File - Name="timefreq" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=timefreq - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "timefreq.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "timefreq.mak" CFG="timefreq - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "timefreq - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "timefreq - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "timefreq - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "timefreq___Win32_Release"
-# PROP BASE Intermediate_Dir "timefreq___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "timefreq___Win32_Release"
-# PROP Intermediate_Dir "timefreq___Win32_Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /Gr /Zp4 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "timefreq - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "timefreq___Win32_Debug"
-# PROP BASE Intermediate_Dir "timefreq___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "timefreq___Win32_Debug"
-# PROP Intermediate_Dir "timefreq___Win32_Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "timefreq - Win32 Release"
-# Name "timefreq - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\synthasm.nas
-
-!IF  "$(CFG)" == "timefreq - Win32 Release"
-
-# Begin Custom Build
-InputPath=.\synthasm.nas
-InputName=synthasm
-
-"Release/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
-	"C:/PROGRAM FILES/NASM/NASMW" -d WIN32 -f win32 -o Release/$(InputName).obj $(InputPath) -l $(InputName).lst
-
-# End Custom Build
-
-!ELSEIF  "$(CFG)" == "timefreq - Win32 Debug"
-
-!ENDIF 
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\timefreq.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/tonality.c
===================================================================
--- /mppenc/trunk/tonality.c	(revision 96)
+++ 	(revision )
@@ -1,362 +1,0 @@
-/*
- *  Generate graph with palette
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <memory.h>
-#include <math.h>
-
-#define FS          44100
-
-#ifndef MAX
-# define MAX        2048                // max. elements
-#endif
-#ifndef M_PI
-# define M_PI       3.1415926535897932384626433832795029L
-#endif
-
-
-#define FFT_NORM        0                   // y(t)     -> y(f)
-#define FFT_INVS        1                   // y(f)     -> y(t)
-
-#define FFT_ERR_OK      0                   // no error
-#define FFT_ERR_LD      1                   // len is not a power of 2
-#define FFT_ERR_MAX     2                   // len too large
-
-
-typedef float   compl   [2];
-compl           root    [MAX >> 1];                 // Sine-/cosine-table
-size_t          shuffle [MAX >> 1] [2];             // Shuffle-table
-size_t          shuffle_len;
-
-
-static long double
-sinus ( long double x )
-{
-    x -= floor (x);
-
-    switch ( (int)(8 * x) ) {
-    case 0: return +sin (2*M_PI*      x );
-    case 1: return +cos (2*M_PI*(0.25-x));
-    case 2: return +cos (2*M_PI*(x-0.25));
-    case 3: return +sin (2*M_PI*(0.50-x));
-    case 4: return -sin (2*M_PI*(x-0.50));
-    case 5: return -cos (2*M_PI*(0.75-x));
-    case 6: return -cos (2*M_PI*(x-0.75));
-    case 7: return -sin (2*M_PI*(1.00-x));
-    }
-}
-
-static long double
-cosinus ( long double x )
-{
-    x -= floor (x);
-
-    switch ( (int)(8 * x) ) {
-    case 0: return +cos (2*M_PI*      x );
-    case 1: return +sin (2*M_PI*(0.25-x));
-    case 2: return -sin (2*M_PI*(x-0.25));
-    case 3: return -cos (2*M_PI*(0.50-x));
-    case 4: return -cos (2*M_PI*(x-0.50));
-    case 5: return -sin (2*M_PI*(0.75-x));
-    case 6: return +sin (2*M_PI*(x-0.75));
-    case 7: return +cos (2*M_PI*(1.00-x));
-    }
-}
-
-// Bitinversion
-
-static size_t
-swap ( size_t number, int bits )
-{
-    size_t  ret;
-    for ( ret = 0; bits--; number >>= 1 ) {
-        ret = ret + ret + (number & 1);
-    }
-    return ret;
-}
-
-
-// Determine the logarithmus dualis
-
-static int
-ld ( size_t number )
-{
-    int i;
-
-    for ( i = 0; i < (int) (sizeof(size_t) * CHAR_BIT); i++ )
-        if ( ((size_t)1 << i) == number )
-            return i;
-
-    return -1;
-}
-
-// The actual FFT
-
-int
-fft ( compl* fn, const size_t newlen, const int direction )
-{
-    static size_t    len  = 0;
-    static int       bits = 0;
-    static int       last = 0;
-    register size_t  i;
-    register size_t  j;
-    register size_t  k;
-    float*           p;
-    size_t           pp;
-
-    /* initialize tables */
-
-    if ( newlen != len ) {
-        len  = newlen;
-
-        last = FFT_INVS;
-
-        if ( (bits = ld(len)) == -1 )
-            return FFT_ERR_LD;
-
-        for ( i = 0; i < len; i++ ) {
-            j = swap ( i, bits );
-            if ( i < j ) {
-                shuffle [shuffle_len] [0] = i;
-                shuffle [shuffle_len] [1] = j;
-                shuffle_len++;
-            }
-        }
-
-        for ( i = 0; i < (len>>1); i++ ) {
-            long double  x = (long double) swap ( i+i, bits ) / len;
-            root [i] [0] = cosinus (x);
-            root [i] [1] = sinus   (x);
-        }
-    }
-
-    if ( last != (direction & FFT_INVS) ) {
-        last = direction & FFT_INVS;
-
-        p = (float*) (&root[0][1]);
-
-        for ( i = len>>1; i--; p += 2 )
-            *p = -*p;
-    }
-
-    /* Actual transformation */
-
-    pp = len >> 1;
-    do {
-        float*  bp = (float*) root;
-        float*  si = (float*) fn;
-        float*  di = (float*) fn+pp+pp;
-
-        do {
-            k = pp;
-            do {
-                float  mulr = bp[0]*di[0] - bp[1]*di[1];
-                float  muli = bp[1]*di[0] + bp[0]*di[1];
-                float  addr = si[0];
-                float  addi = si[1];
-
-                si [0] = addr + mulr;
-                si [1] = addi + muli;
-                di [0] = addr - mulr;
-                di [1] = addi - muli;
-
-                si += 2, di += 2;
-            } while ( --k );
-            si += pp+pp, di += pp+pp, bp += 2;
-        } while ( si < &fn[len][0] );
-    } while ( pp >>= 1 );
-
-    /* Bitinversion */
-
-    for ( k = 0; k < shuffle_len; k++ ) {
-        float  tmp;
-        i   = shuffle [k] [0];
-        j   = shuffle [k] [1];
-        tmp = fn [i][0]; fn [i][0] = fn [j][0]; fn [j][0] = tmp;
-        tmp = fn [i][1]; fn [i][1] = fn [j][1]; fn [j][1] = tmp;
-    }
-
-    return FFT_ERR_OK;
-}
-
-
-#define S             8
-#if   FS == 44100
-# define USED_BANDS  203
-#elif FS == 48000
-# define USED_BANDS  205
-#else
-# error
-#endif
-
-float  bands [] = {
-       0,  100,  200,   300,   400,   510,   630,  770,  920, 1080,
-    1270, 1480, 1720,  2000,  2320,  2700,  3150, 3700, 4400, 5300,
-    6400, 7700, 9500, 12000, 15500, 20500, 27000
-};
-
-
-void
-procedure ( float* _A, FILE* fp )
-{
-    static int    init = 0;
-    static float  tab [USED_BANDS] [1024];
-    float         A [2048];
-    float         B [2048] [2];
-    float         C [2048] [2];
-    float         D [2048];
-    int           i;
-    unsigned int  band;
-    double        Sum;
-    double        Diff;
-
-    if ( init == 0 ) {  // +/- 0.5 bark = -6 dB, +/- 1 bark = -96 dB
-
-        // Center the bands differently, so that the 0. Band starts at the bottom?
-        for ( band = 0; band < USED_BANDS; band++ ) {
-            double  f1  = ( (S - band%S)*bands [band/S+0] + (band%S)*bands [band/S+1] ) * (2048. / FS / S);
-            double  f2  = ( (S - band%S)*bands [band/S+1] + (band%S)*bands [band/S+2] ) * (2048. / FS / S);
-            double  tmp = 2. / ( f2 - f1 );
-
-            for ( i = 0; i < 1024; i++ ) {
-                double  w    = (i - f1) * tmp - 1;
-                double  mult = exp ( -0.69314718055994530941723212145818 * w * w * w * w);
-                tab [band] [i] = mult;
-            }
-        }
-        init = 1;
-    }
-
-
-    for ( i = 0; i < 2048; i++ ) {
-        A [i]     = _A [i];
-        B [i] [0] = A[i];
-        B [i] [1] = 0.;
-    }
-
-    fft ( B, 2048, FFT_NORM );
-
-    for ( band = 0; band < USED_BANDS; band++ ) {
-
-        memset ( C [1024], 0, 1024 * sizeof(*C) );
-        for ( i = 0; i < 1024; i++ ) {
-            C [i] [0] = B [i] [0] * tab [band] [i];
-            C [i] [1] = B [i] [1] * tab [band] [i];
-        }
-        fft ( C, 2048, FFT_INVS );
-
-        for ( i = 0; i < 2048; i++ ) {
-            D [i] = sqrt (C[i][0] * C[i][0] + C[i][1] * C[i][1]);
-        }
-
-        Sum = 1.e-70;
-        for ( i = 0; i < 2048; i++ ) {
-            Sum += D[i];
-        }
-        Sum /= 2048.;
-
-        Diff = 1.e-70;
-        for ( i = 0; i < 2048; i++ ) {
-            D[i]  = D[i] / Sum - 1;
-            Diff += D[i] * D[i];
-        }
-        Diff = 1 - 2 * sqrt ( Diff / 2048.);        // 1 for sine signals, ~0 for noise
-
-        printf ("%4.0f", Diff*100 );
-
-        Diff = 170 * Diff + 85;
-        if ( Diff >= 0 )
-            putc ( (int)Diff, fp );
-        else
-            putc ( 0, fp );
-    }
-
-    printf ("\n");
-    return;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    static char          buff [1 << 18];
-    static float         A [4000000];
-    static signed short  b [35 * FS] [2];
-    float*               p = A;
-    int                  i;
-    int                  len;
-    long double          w = 0.L;
-    FILE*                graph;
-    FILE*                fp;
-    char                 name [256];
-
-    freopen ( "report", "w", stdout );
-    setvbuf ( stdout, buff, _IOFBF, sizeof buff );
-
-    // Calculate tone
-    while ( *++argv ) {
-
-        p = A;
-
-        if ( 0 ) {
-            for ( i = 0; i < 10000; i++ )
-                *p++ = (rand () + rand ()) / (double) RAND_MAX - 1;
-
-            for ( i = 0; i < 200000; i++ ) {
-                w   +=  i / 200000. * M_PI;
-                *p++ = sin (w);
-            }
-            for ( i = 0; i < 20000; i++ ) {
-                w   +=  i / 20000. * M_PI;
-                *p++ = sin (w);
-            }
-            for ( i = 0; i < 2000; i++ ) {
-                w   +=  i / 2000. * M_PI;
-                *p++ = sin (w);
-            }
-
-            for ( i = 0; i < 200000; i++ ) {
-                w   +=  i / 200000. * M_PI;
-                *p++ = sin (w) + (rand () + rand ()) / (double) RAND_MAX - 1;
-            }
-            for ( i = 0; i < 20000; i++ ) {
-                w   +=  i / 20000. * M_PI;
-                *p++ = sin (w) + (rand () + rand ()) / (double) RAND_MAX - 1;
-            }
-            for ( i = 0; i < 2000; i++ ) {
-                w   +=  i / 2000. * M_PI;
-                *p++ = sin (w) + (rand () + rand ()) / (double) RAND_MAX - 1;
-            }
-        }
-        else {
-
-            fp = fopen ( *argv, "rb" );
-            fread ( b, 1, 44, fp );
-            len = fread ( b, sizeof(*b), sizeof(b)/sizeof(*b), fp );
-            fclose (fp);
-            fprintf ( stderr, "Add WAV file: %u\n", len );
-            for ( i = 0; i < len; i++ )
-                *p++ = b[i][0] * 1.e-4;
-        }
-
-        fprintf ( stderr, "Total length: %u\n", p - A );
-        sprintf ( name, "%s.ppm", *argv );
-        graph = fopen ( name, "wb" );
-        fprintf ( graph, "P5\n%u %u\n255\n", USED_BANDS, (p - A - MAX) / 256 );
-
-        // Analyze tone
-        for ( i = 0; i < p - A - MAX; i += 256 ) {
-            fprintf ( stderr, "Proceed: %7u %3.0f%%\r", i, 100.*i/(p - A - MAX) );
-            printf ( "%7u: ", i );
-            procedure ( A + i, graph );
-        }
-
-        fclose (graph);
-
-    }
-
-    return 0;
-}
Index: penc/trunk/tonality.dsp
===================================================================
--- /mppenc/trunk/tonality.dsp	(revision 96)
+++ 	(revision )
@@ -1,108 +1,0 @@
-# Microsoft Developer Studio Project File - Name="tonality" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=tonality - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "tonality.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "tonality.mak" CFG="tonality - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "tonality - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "tonality - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "tonality - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "tonality - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "tonality - Win32 Release"
-# Name "tonality - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\tonality.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Debug"
-
-# PROP Default_Filter ".txt"
-# Begin Source File
-
-SOURCE=.\report
-# End Source File
-# End Group
-# End Target
-# End Project
Index: penc/trunk/tonality.vcproj
===================================================================
--- /mppenc/trunk/tonality.vcproj	(revision 96)
+++ 	(revision )
@@ -1,173 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="tonality"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/tonality.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/tonality.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/tonality.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/tonality.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/tonality.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/tonality.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/tonality.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/tonality.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="tonality.c">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Debug"
-			Filter=".txt">
-			<File
-				RelativePath="report">
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Index: penc/trunk/tools.c
===================================================================
--- /mppenc/trunk/tools.c	(revision 96)
+++ 	(revision )
@@ -1,598 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- *  A list of different mixed tools
- *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *  Read_LittleEndians()
- *      Portable file handling
- *  Requantize_MidSideStereo(), Requantize_IntensityStereo()
- *      Requantisation of quantized samples for synthesis filter
- *  Resort_HuffTable(), Make_HuffTable(), Make_LookupTable()
- *      Generating and sorting Huffman tables, making fast lookup tables
- */
-
-#include <string.h>
-#include <errno.h>
-#include "mppdec.h"
-
-
-#if defined HAVE_INCOMPLETE_READ  &&  FILEIO != 1
-
-size_t
-complete_read ( int fd, void* dest, size_t bytes )
-{
-    size_t  bytesread = 0;
-    size_t  ret;
-
-    while ( bytes > 0 ) {
-#if defined _WIN32  &&  defined USE_HTTP  &&  !defined MPP_ENCODER
-        ret = fd & 0x4000  ?  recv ( fd & 0x3FFF, dest, bytes, 0)  :  read ( fd, dest, bytes );
-#else
-        ret = read ( fd, dest, bytes );
-#endif
-        if ( ret == 0  ||  ret == (size_t)-1 )
-            break;
-        dest       = (void*)(((char*)dest) + ret);
-        bytes     -= ret;
-        bytesread += ret;
-    }
-    return bytesread;
-}
-
-#endif
-
-
-int
-isdir ( const char* Name )
-{
-#if FILEIO == 1
-    return 1;
-#else
-    STRUCT_STAT  st;
-
-    if ( STAT_CMD ( Name, &st ) != 0 )
-        return 0;
-    return S_ISDIR ( st.st_mode );
-#endif
-}
-
-
-/*
- *  Change_Endian32() changes the endianess of a 32-bit memory block in-place
- *  by swapping the byte order. This is a little bit tricky, but a well
- *  known method which is much much faster than byte picking, especially on modern CPUs,
- *  because it avoids memory aliasing. Note that this method
- *  is poison for old 16-bit compilers!
- */
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-
-static void
-Change_Endian32 ( Uint32_t* dst, size_t words32bit )
-{
-    ENTER(160);
-
-    for ( ; words32bit--; dst++ ) {
-# if  INT_MAX >= 2147483647L
-        Uint32_t  tmp = *dst;
-        tmp  = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
-        tmp  = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
-        *dst = tmp;
-# else
-        Uint8_t  tmp;
-        tmp                = ((Uint8_t*)dst)[0];
-        ((Uint8_t*)dst)[0] = ((Uint8_t*)dst)[3];
-        ((Uint8_t*)dst)[3] = tmp;
-        tmp                = ((Uint8_t*)dst)[1];
-        ((Uint8_t*)dst)[1] = ((Uint8_t*)dst)[2];
-        ((Uint8_t*)dst)[2] = tmp;
-# endif
-    }
-    LEAVE(160);
-    return;
-}
-
-#endif /* ENDIAN == HAVE_BIG_ENDIAN */
-
-
-/*
- *  Read_LittleEndians() reads little endian 32-bit ints from the stream
- *  'fp'.  Quantities are selected in 32-bit items. On big endian machines
- *  the byte order is changed in-place after reading the data, so all is
- *  okay.
- */
-
-size_t
-Read_LittleEndians ( FILE_T fp, Uint32_t* dst, size_t words32bit )
-{
-    size_t  wordsread;
-
-    ENTER(161);
-    wordsread = READ ( fp, dst, words32bit * sizeof(*dst) ) / sizeof(*dst);
-
-#if ENDIAN == HAVE_BIG_ENDIAN
-    Change_Endian32 ( dst, wordsread );
-#endif
-
-    LEAVE(161);
-    return wordsread;
-}
-
-#ifndef MPP_ENCODER
-
-/*
- *  This is the main requantisation routine which does the following things:
- *
- *      - rescaling the quantized values (int) to their original value (float)
- *      - recalculating both stereo channels for MS stereo
- *
- *  See also: Requantize_IntensityStereo()
- *
- *  For performance reasons all cases are programmed separately and the code
- *  is unrolled.
- *
- *  Input is:
- *      - Stop_Band:
- *          the last band using MS or LR stereo
- *      - used_MS[Band]:
- *          MS or LR stereo flag for every band (0...Stop_Band), Value is 1
- *          for MS and 0 for LR stereo.
- *      - Res[Band].{L,R}:
- *          Quantisation resolution for every band (0...Stop_Band) and
- *          channels (L, R). Value is 0...17.
- *      - SCF_Index[3][Band].{L,R}:
- *          Scale factor for every band (0...Stop_Band), subframe (0...2)
- *          and channel (L, R).
- *      - Q[Band].{L,R}[36]
- *          36 subband samples for every band (0...Stop_Band) and channel (L, R).
- *      - SCF[64], Cc[18], Dc[18]:
- *          Lookup tables for Scale factor and Quantisation resolution.
- *
- *   Output is:
- *     - Y_L:  Left  channel subband signals
- *     - Y_R:  Right channel subband signals
- *
- *   These signals are used for the synthesis filter in the synth*.[ch]
- *   files to generate the PCM output signal.
- */
-
-static const float ISMatrix [32] [2] = {
-    {  1.00000000f,  0.00000000f },
-    {  0.98078528f,  0.19509032f },
-    {  0.92387953f,  0.38268343f },
-    {  0.83146961f,  0.55557023f },
-    {  0.70710678f,  0.70710678f },
-    {  0.55557023f,  0.83146961f },
-    {  0.38268343f,  0.92387953f },
-    {  0.19509032f,  0.98078528f },
-    {  0.00000000f,  1.00000000f },
-    { -0.19509032f,  0.98078528f },
-    { -0.38268343f,  0.92387953f },
-    { -0.55557023f,  0.83146961f },
-    { -0.70710678f,  0.70710678f },
-    { -0.83146961f,  0.55557023f },
-    { -0.92387953f,  0.38268343f },
-    { -0.98078528f,  0.19509032f },
-    { -1.00000000f,  0.00000000f },
-    { -0.98078528f, -0.19509032f },
-    { -0.92387953f, -0.38268343f },
-    { -0.83146961f, -0.55557023f },
-    { -0.70710678f, -0.70710678f },
-    { -0.55557023f, -0.83146961f },
-    { -0.38268343f, -0.92387953f },
-    { -0.19509032f, -0.98078528f },
-    { -0.00000000f, -1.00000000f },
-    {  0.19509032f, -0.98078528f },
-    {  0.38268343f, -0.92387953f },
-    {  0.55557023f, -0.83146961f },
-    {  0.70710678f, -0.70710678f },
-    {  0.83146961f, -0.55557023f },
-    {  0.92387953f, -0.38268343f },
-    {  0.98078528f, -0.19509032f },
-};
-
-
-void
-Requantize_MidSideStereo ( Int Stop_Band, const Bool_t* used_MS )
-{
-    Int    Band;  // 0...Stop_Band
-    Uint   k;     // 0...35
-    Float  ML;
-    Float  MR;
-    Float  mid;
-    Float  side;
-
-    ENTER(162);
-
-    for ( Band = 0; Band <= Stop_Band; Band++ ) {
-
-        if ( used_MS[Band] )  // MidSide coded: left channel contains Mid signal, right channel Side signal
-            if      ( Res[Band].R < -1 ) {
-                k  = 0;
-                ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
-                do {
-                    mid = Q[Band].L[k] * ML;
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 12);
-                ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
-                do {
-                    mid = Q[Band].L[k] * ML;
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 24);
-                ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
-                do {
-                    mid = Q[Band].L[k] * ML;
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 36);
-            }
-            else if ( Res[Band].L < -1 ) {
-                k  = 0;
-                ML = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
-                do {
-                    mid = Q[Band].R[k] * ML;
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 12);
-                ML = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
-                do {
-                    mid = Q[Band].R[k] * ML;
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 24);
-                ML = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
-                do {
-                    mid = Q[Band].R[k] * ML;
-                    Y_R[k][Band] = mid * ISMatrix [used_MS[Band]][0];
-                    Y_L[k][Band] = mid * ISMatrix [used_MS[Band]][1];
-                } while (++k < 36);
-            }
-            else if ( Res[Band].L )
-                if ( Res[Band].R ) {     //  M!=0, S!=0
-                    k  = 0;
-                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
-                        Y_L[k][Band] = mid + side;
-                    } while (++k < 12);
-                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
-                        Y_L[k][Band] = mid + side;
-                    } while (++k < 24);
-                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = (mid = Q[Band].L[k] * ML) - (side = Q[Band].R[k] * MR);
-                        Y_L[k][Band] = mid + side;
-                    } while (++k < 36);
-                } else {                 //  M!=0, S=0
-                    k  = 0;
-                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] =
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 12);
-                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] =
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 24);
-                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] =
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 36);
-                }
-            else
-                if ( Res[Band].R ) {     //  M==0, S!=0
-                    k  = 0;
-                    ML = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = - (
-                        Y_L[k][Band] = Q[Band].R[k] * ML );
-                    } while (++k < 12);
-                    ML = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = - (
-                        Y_L[k][Band] = Q[Band].R[k] * ML );
-                    } while (++k < 24);
-                    ML = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = - (
-                        Y_L[k][Band] = Q[Band].R[k] * ML );
-                    } while (++k < 36);
-                } else {                 //  M==0, S==0
-                    for (k=0; k<36; k++) {
-                        Y_R[k][Band] =
-                        Y_L[k][Band] = 0.f;
-                    }
-                }
-
-        else                  // Left/Right coded: left channel contains left, right the right signal
-
-            if ( Res[Band].L )
-                if ( Res[Band].R ) {     //  L!=0, R!=0
-                    k  = 0;
-                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 12);
-                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 24);
-                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
-                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 36);
-                } else {                 //  L!=0, R==0
-                    k  = 0;
-                    ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] = 0.f;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 12);
-                    ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] = 0.f;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 24);
-                    ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L];
-                    do {
-                        Y_R[k][Band] = 0.f;
-                        Y_L[k][Band] = Q[Band].L[k] * ML;
-                    } while (++k < 36);
-                }
-            else
-                if ( Res[Band].R ) {     //  L==0, R!=0
-                    k  = 0;
-                    MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = 0.f;
-                    } while (++k < 12);
-                    MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = 0.f;
-                    } while (++k < 24);
-                    MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].R];
-                    do {
-                        Y_R[k][Band] = Q[Band].R[k] * MR;
-                        Y_L[k][Band] = 0.f;
-                    } while (++k < 36);
-                } else {                 //  L==0, R==0
-                    for (k=0; k<36; k++) {
-                        Y_R[k][Band] =
-                        Y_L[k][Band] = 0.f;
-                    }
-                }
-
-    }
-
-    LEAVE(162);
-    return;
-}
-
-
-/*
- *  This is the main requantisation routine for Intensity Stereo.
- *  It does the same as Requantize_MidSideStereo() but for IS.
- *
- *  Input is:
- *      - Stop_Band:
- *          the last band using MS or LR stereo
- *      - Res[Band].L:
- *          Quantisation resolution for every band (0...Stop_Band) and
- *          the left channel which is used for both channels. Value is 0...17.
- *      - SCF_Index[3][Band].{L,R}:
- *          Scale factor for every band (0...Stop_Band), subframe (0...2)
- *          and channel (L, R).
- *      - Q[Band].L[36]
- *          36 subband samples for every band (0...Stop_Band), both channels use
- *          the of the left channel
- *      - SCF[64], Cc[18], Dc[18]:
- *          Lookup tables for Scale factor and Quantisation resolution.
- *
- *   Output is:
- *     - Y_L:  Left  channel subband signals
- *     - Y_R:  Right channel subband signals
- *
- *   These signals are used for the synthesis filter in the synth*.[ch]
- *   files to generate the PCM output signal.
- */
-
-void
-Requantize_IntensityStereo ( Int Start_Band, Int Stop_Band )
-{
-    Int    Band;  // Start_Band...Stop_Band
-    Uint   k;     // 0...35
-    Float  ML;
-    Float  MR;
-
-    ENTER(163);
-
-    for ( Band = Start_Band; Band <= Stop_Band; Band++ ) {
-
-        if ( Res[Band].L ) {
-            k  = 0;
-            ML = SCF[SCF_Index[0][Band].L] * Cc[Res[Band].L] * SS05;
-            MR = SCF[SCF_Index[0][Band].R] * Cc[Res[Band].L] * SS05;
-            do {
-                Y_R[k][Band] = Q[Band].L[k] * MR;
-                Y_L[k][Band] = Q[Band].L[k] * ML;
-            } while (++k < 12);
-            ML = SCF[SCF_Index[1][Band].L] * Cc[Res[Band].L] * SS05;
-            MR = SCF[SCF_Index[1][Band].R] * Cc[Res[Band].L] * SS05;
-            do {
-                Y_R[k][Band] = Q[Band].L[k] * MR;
-                Y_L[k][Band] = Q[Band].L[k] * ML;
-            } while (++k < 24);
-            ML = SCF[SCF_Index[2][Band].L] * Cc[Res[Band].L] * SS05;
-            MR = SCF[SCF_Index[2][Band].R] * Cc[Res[Band].L] * SS05;
-            do {
-                Y_R[k][Band] = Q[Band].L[k] * MR;
-                Y_L[k][Band] = Q[Band].L[k] * ML;
-            } while (++k < 36);
-        } else {
-            for (k=0; k<36; k++) {
-                Y_R[k][Band] =
-                Y_L[k][Band] = 0.f;
-            }
-        }
-
-    }
-    LEAVE(163);
-    return;
-}
-
-
-/*
- *  Helper function for the qsort() in Resort_HuffTable() to sort a Huffman table
- *  by its codes.
- */
-
-static int Cdecl
-cmp_fn ( const void* p1, const void* p2 )
-{
-    if ( ((const Huffman_t*)p1) -> Code < ((const Huffman_t*)p2) -> Code ) return +1;
-    if ( ((const Huffman_t*)p1) -> Code > ((const Huffman_t*)p2) -> Code ) return -1;
-    return 0;
-}
-
-
-/*
- *  This functions sorts a Huffman table by its codes. It has also two other functions:
- *
- *    - The table contains LSB aligned codes, these are first MSB aligned.
- *    - The value entry is filled by its position plus 'offset' (Note that
- *      Make_HuffTable() don't fill this item. Offset can be used to offset
- *      range for instance from 0...6 to -3...+3.
- *
- *  Note that this function generates trash if you call it twice!
- */
-
-void
-Resort_HuffTable ( Huffman_t* const Table, const size_t elements, Int offset )
-{
-    size_t  i;
-
-    for ( i = 0; i < elements; i++ ) {
-        Table[i].Value  = i + offset;
-        Table[i].Code <<= (32 - Table[i].Length);
-    }
-
-    qsort ( Table, elements, sizeof(*Table), cmp_fn );
-    return;
-}
-
-#endif /* MPP_ENCODER */
-
-
-/*
- *  Fills out the items Code and Length (but not Value) of a Huffman table
- *  from a bit packed Huffman table 'src'. Table is not sorted, so this is
- *  the table which is suitable for an encoder. Be careful: To get a table
- *  usable for a decoder you must use Resort_HuffTable() after this
- *  function. It's a little bit dangerous to divide the functionality, maybe
- *  there is a more secure and handy solution to this problem.
- */
-
-void
-Make_HuffTable ( Huffman_t* dst, const HuffSrc_t* src, size_t len )
-{
-    size_t  i;
-
-    for ( i = 0; i < len; i++,src++,dst++ ) {
-        dst->Code   = src->Code  ;
-        dst->Length = src->Length;
-    }
-}
-
-
-/*
- *  Generates a Lookup table for quick Huffman decoding. This table must
- *  have a size of a power of 2. Input is the pre-sorted Huffman table,
- *  sorted by Resort_HuffTable() and its length, and the length of the
- *  lookup table. Output is the Lookup table. It can be used for table based
- *  decoding (Huffman_decode_fastest) which fully decodes by means of the
- *  LUT. This is only handy for small huffman codes up to 9...10 bit
- *  maximum length. For longer codes partial lookup is possible with
- *  Huffman_decode_faster() which first estimates possible codes by means
- *  of LUT and then searches the exact code like the tableless version
- *  Huffman_decode().
- */
-
-void
-Make_LookupTable ( Uint8_t* LUT, size_t LUT_len, const Huffman_t* const Table, const size_t elements )
-{
-    size_t    i;
-    size_t    idx  = elements;
-    Uint32_t  dval = (Uint32_t)0x80000000L / LUT_len * 2;
-    Uint32_t  val  = dval - 1;
-
-    for ( i = 0; i < LUT_len; i++, val += dval ) {
-        while ( idx > 0  &&  val >= Table[idx-1].Code )
-            idx--;
-        *LUT++ = (Uint8_t)idx;
-    }
-
-    return;
-}
-
-
-void
-Init_FPU ( void )
-{
-    Uint16_t  cw;
-
-#if   defined __i386__  &&  defined _FPU_GETCW  &&  defined _FPU_SETCW
-    _FPU_GETCW ( cw );
-    cw  &=  ~0x300;
-    _FPU_SETCW ( cw );
-#elif defined __i386__  &&  defined  FPU_GETCW  &&  defined  FPU_SETCW
-    FPU_GETCW ( cw );
-    cw  &=  ~0x300;
-    FPU_SETCW ( cw );
-#elif defined __MINGW32__
-    __asm__ ("fnstcw %0" : "=m" (*&cw));
-    cw  &=  ~0x300;
-    __asm__ ("fldcw %0" : : "m" (*&cw));
-#elif defined(_WIN32) && !defined(_WIN64)
-    _asm { fstcw cw };
-    cw  &=  ~0x300;
-    _asm { fldcw cw };
-#else
-    ;
-#endif
-}
-
-/* end of tools.c */
Index: penc/trunk/tools.inc
===================================================================
--- /mppenc/trunk/tools.inc	(revision 96)
+++ 	(revision )
@@ -1,110 +1,0 @@
-;
-; (C) Ururi 1999
-;
-
-BITS 32
-
-%ifdef WIN32
-        %define _NAMING
-        %define segment_code segment .text align=32 class=CODE use32
-        %define segment_data segment .data align=32 class=DATA use32
-  %ifdef __BORLANDC__
-        %define segment_bss  segment .data align=32 class=DATA use32
-  %else
-        %define segment_bss  segment .bss  align=32 class=DATA use32
-  %endif
-
-%elifdef AOUT
-        %define _NAMING
-        %define segment_code segment .text
-        %define segment_data segment .data
-        %define segment_bss  segment .bss
-
-%else
-        %define segment_code segment .text align=32 class=CODE use32
-        %define segment_data segment .data align=32 class=DATA use32
-        %define segment_bss  segment .bss  align=32 class=DATA use32
-%endif
-
-%define pmov    movq
-%define pmovd   movd
-
-%define pupldq  punpckldq
-%define puphdq  punpckhdq
-%define puplwd  punpcklwd
-%define puphwd  punpckhwd
-
-%imacro globaldef 1
-        %ifdef _NAMING
-                %define %1 _%1
-        %endif
-        global %1
-%endmacro
-
-%imacro externdef 1
-        %ifdef _NAMING
-                %define %1 _%1
-        %endif
-        extern %1
-%endmacro
-
-%imacro proc 1
-        %push   proc
-        global  _%1
-        global  %1
-_%1:
-%1:
-        %assign %$STACK  0
-        %assign %$STACKN 0
-        %assign %$ARG    4
-%endmacro
-
-%imacro endproc 0
-        %ifnctx proc
-                %error expected 'proc' before 'endproc'.
-        %else
-                %if %$STACK > 0
-                        add esp, %$STACK
-                %endif
-
-                %if %$STACK <> (-%$STACKN)
-                        %error STACKLEVEL mismatch check 'local', 'alloc', 'pushd', 'popd'
-                %endif
-
-                ret
-                %pop
-        %endif
-%endmacro
-
-%idefine sp(a) esp+%$STACK+a
-
-%imacro arg 1
-        %00     equ %$ARG
-        %assign %$ARG %$ARG+%1
-%endmacro
-
-%imacro local 1
-        %assign %$STACKN %$STACKN-%1
-        %00 equ %$STACKN
-%endmacro
-
-%imacro alloc 0
-        sub esp, (-%$STACKN)-%$STACK
-        %assign %$STACK (-%$STACKN)
-%endmacro
-
-%imacro pushd 1-*
-        %rep %0
-                push %1
-                %assign %$STACK %$STACK+4
-        %rotate 1
-        %endrep
-%endmacro
-
-%imacro popd 1-*
-        %rep %0
-        %rotate -1
-                pop %1
-                %assign %$STACK %$STACK-4
-        %endrep
-%endmacro
Index: penc/trunk/udp_server_client.c
===================================================================
--- /mppenc/trunk/udp_server_client.c	(revision 96)
+++ 	(revision )
@@ -1,481 +1,0 @@
-/*====================================================================
- *
- *                          Copyright (C) 1999 by
- *             Digital Equipment Corporation, Maynard, Massachusetts
- *
- * This software is furnished under a license and may be used and  copied
- * only  in  accordance  with  the  terms  of  such  license and with the
- * inclusion of the above copyright notice.  This software or  any  other
- * copies  thereof may not be provided or otherwise made available to any
- * other person.  No title to and ownership of  the  software  is  hereby
- * transferred.
- *
- * The information in this software is subject to change  without  notice
- * and  should  not  be  construed  as  a commitment by Digital Equipment
- * Corporation.
- *
- * DIGITAL assumes no responsibility for the use or  reliability  of  its
- * software on equipment that is not supplied by DIGITAL.
- *
- *
- *
- *  FACILITY:
- *        INSTALL
- *
- *
- *  ABSTRACT:
- *        This is an example of a UDP/IP server using the IPC
- *        socket interface.
- *
- *
- *  ENVIRONMENT:
- *        UCX V1.2 or higher, VMS V5.2 or higher
- *
- *        This example is portable to ULTRIX. The include
- *        files are conditionally defined for both systems, and
- *        "perror" is used for error reporting.
- *  BUILD INSTRUCTIONS:
- *
- *       To link in VAXC/VMS you must have the following
- *       entries in your .opt file:
- *          sys$library:ucx$ipc.olb/lib
- *          sys$share:vaxcrtl.exe/share
- *
- *       For Compaq C or Compaq C++, compile /PREFIX=ALL and link via
- *          $ link UCX$UDP_SERVER_IPC
- *
- *    To build this example program, use commands of the following form:
- *
- *        using the Compaq C compiler:
- *
- *            $ cc/prefix=all UCX$UDP_SERVER_IPC.C
- *            $ link UCX$UDP_SERVER_IPC
- *
- *        using the Compaq C++ compiler:
- *
- *            $ cxx/prefix=all/define=VMS UCX$UDP_SERVER_IPC.C
- *            $ link UCX$UDP_SERVER_IPC
- *        using the VAX C compiler:
- *
- *            $  cc /vaxc UCX$UDP_SERVER_IPC.C
- *            $  link UCX$UDP_SERVER_IPC, -
- *                    SYS$LIBRARY:UCX$IPC/LIB, -
- *                    SYS$INPUT/OPTIONS
- *            SYS$SHARE:UCX$IPC_SHR/SHARE
- *            SYS$SHARE:VAXCRTL.EXE/SHARE
- *
- *
- *  AUTHORS:
- *        UCX Developer
- *
- *  CREATION DATE: May 23, 1989
- *
- *  MODIFICATION HISTORY:
- *
- *       16 May 1996 Joseph J. Vlcek
- *       Make compatible with the Compaq C and Compaq C++ compilers.
- *       Add directions on how to build this example modules.
- *
- */
-
-/*
- *
- *  INCLUDE FILES
- *
- */
-
-#ifdef VMS
-# include <descrip.h>        /* VMS descriptor stuff */
-# include <errno.h>          /* Unix style error codes for IO routines. */
-# include <in.h>             /* internet system Constants and structures. */
-# include <inet.h>           /* Network address info. */
-# include <iodef.h>          /* I/O FUNCTION CODE DEFS */
-# include <lib$routines.h>   /* LIB$ RTL-routine signatures. */
-# include <netdb.h>          /* Network database library info. */
-# include <signal.h>         /* UNIX style Signal Value Definitions */
-# include <socket.h>         /* TCP/IP socket definitions. */
-# include <ssdef.h>          /* SS$_<xyz> sys ser return statistics */
-# include <starlet.h>        /* Sys ser calls */
-# include <stdio.h>          /* UNIX 'Standard I/O' Definitions   */
-# include <stdlib.h>         /* General Utilities */
-# include <string.h>         /* String handling function definitions */
-# include <ucx$inetdef.h>    /* UCX network definitions */
-# include <unixio.h>         /* Prototypes for UNIX emulation functions */
-#else
-# include <errno.h>
-# include <sys/types.h>
-# include <stdio.h>
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# include <arpa/inet.h>
-# include <sys/uio.h>
-# include <time.h>               /* timeval declared here */
-#endif
-
-static void
-cleanup ( int socket )
-{
-    int  retval;
-
-    /* Shutdown socket completely */
-    retval = shutdown ( socket, 2 );
-    if ( retval == -1 )
-        perror ("shutdown");
-
-    /* Close socket */
-    retval = close (socket);
-    if (retval)
-        perror ("close");
-
-    return 1;
-} /* end cleanup */
-
-/*
- * Functional Description
- *
- *        This example creates a socket of type SOCK_DGRAM (UDP), binds
- *        it, and selects to receive a message on the socket.
- *        Error messages are printed to the screen.
- *
- *        IPC calls used:
- *        bind
- *        close
- *        gethostbyname
- *        recvfrom
- *        select
- *        shutdown
- *        socket
- *
- *
- * Formal Parameters
- *        The server program expects one parameter:
- *        portnumber ... port where it is listening
- *
- *
- * Routine Value
- *
- *        Status
- */
-
-/*--------------------------------------------------------------------*/
-int
-main ( int argc, char** argv )
-{
-    struct sockaddr_in  sock1_name;       /* Address struct for socket1 */
-    struct sockaddr_in  sock2_name;       /* Address struct for socket2 */
-    struct hostent      hostentstruct;    /* Storage for hostent data.  */
-    struct hostent*     hostentptr;       /* Pointer to hostent data.   */
-    struct timeval      timeout;
-    int     rmask;
-    int     wmask;
-    int     emask;
-    int     sock_2;                       /* Socket2  descriptor.       */
-    int     buflen;
-    int     fromlen;
-    char    recvbuf [BUFSIZ];
-    int     namelength;
-    char    hostname [256];               /* Name of local host.        */
-    int     retval;
-    int     flag;
-
-    /* Check input parameters */
-    if ( argc != 2 ) {
-        fprintf ( stderr, "Usage: server portnumber.\n");
-        return 1;
-    }
-
-    /* Open socket 2: AF_INET, SOCK_DGRAM. */
-    if ((sock_2 = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
-        perror( "socket");
-        return 1;
-    }
-
-    /* Get the local host name. */
-    retval = gethostname ( hostname, sizeof hostname );
-    if ( retval != 0 ) {
-        perror ("gethostname");
-        return cleanup ( sock_2 );
-    }
-
-    /* Get pointer to network data structure for local host. */
-    if ( (hostentptr = gethostbyname (hostname)) == NULL ) {
-        perror ("gethostbyname");
-        return cleanup (sock_2);
-    }
-
-    /* Copy hostent data to safe storage. */
-    hostentstruct = *hostentptr;
-
-    /* Fill in the address structure for socket 2 */
-    sock2_name.sin_family = hostentstruct.h_addrtype;
-    sock2_name.sin_port   = htons(atoi(argv[1]));
-    sock2_name.sin_addr   = *((struct in_addr*) hostentstruct.h_addr);
-
-    /* Bind name to socket 2. */
-    retval = bind ( sock_2, (struct sockaddr*) & sock2_name, sizeof sock2_name );
-    if ( retval != 0 ) {
-        perror ("bind");
-        return cleanup (sock_2);
-    }
-
-    /*
-     * Select socket to receive message.
-     */
-    emask           = 0;
-    wmask           = 0;
-    rmask           = 1 << sock_2;  /* set read mask */
-    timeout.tv_sec  = 30;
-    timeout.tv_usec =  0;
-
-    retval = select ( 32, &rmask, &wmask, &emask, &timeout );
-    switch ( retval ) {
-    case -1:
-        perror ("select");
-        return cleanup (sock_2);
-    case 0:
-        fprintf ( stderr,  "Select timed out with status 0.\n" );
-        return cleanup ( sock_2 );
-    default:
-        if ( (rmask & (1 << sock_2)) == 0 ) {
-            fprintf ( stderr, "Select not reading on sock_2.\n");
-            return cleanup (sock_2);
-        }
-    } /* switch */
-
-    /* Recvfrom buffer - from sock1 on sock2. */
-    buflen  = sizeof recvbuf;
-    fromlen = sizeof sock1_name;
-    flag    = 0;        /* flag may be MSG_OOB and/or MSG_PEEK */
-
-    retval = recvfrom ( sock_2, recvbuf, buflen, flag, (struct sockaddr*) & sock1_name, &fromlen );
-    if ( retval == -1 )
-        perror ( "recvfrom" );
-    else
-        fprintf ( stderr, " %s\n", recvbuf);
-
-    /* Call cleanup to shut down and close socket. */
-    return cleanup (sock_2);
-
-} /* end main */
-
-
-
-
-
-/*====================================================================
- *
- *                          Copyright (C) 1999 by
- *             Digital Equipment Corporation, Maynard, Massachusetts
- *
- * This software is furnished under a license and may be used and  copied
- * only  in  accordance  with  the  terms  of  such  license and with the
- * inclusion of the above copyright notice.  This software or  any  other
- * copies  thereof may not be provided or otherwise made available to any
- * other person.  No title to and ownership of  the  software  is  hereby
- * transferred.
- *
- * The information in this software is subject to change  without  notice
- * and  should  not  be  construed  as  a commitment by Digital Equipment
- * Corporation.
- *
- * DIGITAL assumes no responsibility for the use or  reliability  of  its
- * software on equipment that is not supplied by DIGITAL.
- *
- *
- *
- *  FACILITY:
- *        INSTALL
- *
- *
- *  ABSTRACT:
- *        This is an example of a UDP/IP client using the IPC
- *        socket interface.
- *
- *
- *  ENVIRONMENT:
- *        UCX V1.2 or higher, VMS V5.2 or higher
- *
- *        This example is portable to ULTRIX. The include
- *        files are conditionally defined for both systems, and
- *        "perror" is used for error reporting.
- *
- *  BUILD INSTRUCTIONS:
- *
- *       To link in VAXC/VMS you must have the following
- *       entries in your .opt file:
- *          sys$library:ucx$ipc.olb/lib
- *          sys$share:vaxcrtl.exe/share
- *
- *       For Compaq C or Compaq C++, compile /PREFIX=ALL and link via
- *          $ link UCX$UDP_CLIENT_IPC
- *
- *    To build this example program, use commands of the following form:
- *
- *        using the Compaq C compiler:
- *
- *            $ cc/prefix=all UCX$UDP_CLIENT_IPC.C
- *            $ link UCX$UDP_CLIENT_IPC
- *
- *        using the Compaq C++ compiler:
- *
- *            $ cxx/prefix=all/define=VMS UCX$UDP_CLIENT_IPC.C
- *            $ link UCX$UDP_CLIENT_IPC
- *        using the VAX C compiler:
- *
- *            $  cc /vaxc UCX$UDP_CLIENT_IPC.C
- *            $  link UCX$UDP_CLIENT_IPC, -
- *                    SYS$LIBRARY:UCX$IPC/LIB, -
- *                    SYS$INPUT/OPTIONS
- *            SYS$SHARE:UCX$IPC_SHR/SHARE
- *            SYS$SHARE:VAXCRTL.EXE/SHARE
- *
- *  AUTHORS:
- *        UCX Developer
- *
- *  CREATION DATE: May 23, 1989
- *
- *  MODIFICATION HISTORY:
- *
- *       16 May 1996 Joseph J. Vlcek
- *       Make compatible with the Compaq C and Compaq C++ compilers.
- *       Add directions on how to build this example modules.
- */
-
-/*
- *
- *  INCLUDE FILES
- *
- */
-
-#ifdef VMS
-# include <descrip.h>        /* VMS descriptor stuff */
-# include <errno.h>          /* Unix style error codes for IO routines. */
-# include <in.h>             /* internet system Constants and structures. */
-# include <inet.h>           /* Network address info. */
-# include <iodef.h>          /* I/O FUNCTION CODE DEFS */
-# include <lib$routines.h>   /* LIB$ RTL-routine signatures. */
-# include <netdb.h>          /* Network database library info. */
-# include <signal.h>         /* UNIX style Signal Value Definitions */
-# include <socket.h>         /* TCP/IP socket definitions. */
-# include <ssdef.h>          /* SS$_<xyz> sys ser return statistics */
-# include <starlet.h>        /* Sys ser calls */
-# include <stdio.h>          /* UNIX 'Standard I/O' Definitions   */
-# include <stdlib.h>         /* General Utilities */
-# include <string.h>         /* String handling function definitions */
-# include <ucx$inetdef.h>    /* UCX network definitions */
-# include <unixio.h>         /* Prototypes for UNIX emulation functions */
-#else
-# include <errno.h>
-# include <sys/types.h>
-# include <stdio.h>
-# include <sys/socket.h>
-# include <netinet/in.h>
-# include <netdb.h>
-# include <arpa/inet.h>
-# include <sys/uio.h>
-#endif
-
-/*-----------------------------------------------------------*/
-static void
-cleanup ( int socket )
-{
-    int  retval;
-
-    /* Shutdown socket completely */
-    retval = shutdown ( socket, 2 );
-    if ( retval == -1 )
-        perror ("shutdown");
-
-    /* Close socket */
-    retval = close (socket);
-    if (retval)
-        perror ("close");
-
-    return 1;
-} /* end cleanup */
-
-/*
- * Functional Description
- *
- *        This example creates a socket of type SOCK_DGRAM (UDP),
- *        binds it, and sends a message to the given host and port number.
- *        Error messages are printed to the screen.
- *
- *        IPC calls used:
- *        bind
- *        close
- *        gethostbyname
- *        sendto
- *        shutdown
- *        socket
- *
- * Formal Parameters
- *        The client program expects two parameters:
- *        hostname ... name of remote host
- *        portnumber ... port where remote host(server) is listening
- *
- *
- * Routine Value
- *
- *        Status
- */
-
-/*--------------------------------------------------------------------*/
-int
-main ( int argc, char **argv )
-{
-    static  char         sendbuf[] = "Hi there.";
-    struct  hostent      hostentstruct;      /* Storage for hostent data.  */
-    struct  hostent*     hostentptr;         /* Pointer to hostent data.   */
-    struct  sockaddr_in  sock2_name;         /* Address struct for socket2.*/
-    int     sock_1;                          /* Socket 1 descriptor.       */
-    int     sendlen;
-    int     tolen;
-    int     namelength;
-    char    hostname[256];                   /* Name of local host.        */
-    int     flag;
-    int     retval;
-
-    /* Check input parameters. */
-    if (argc != 3 ) {
-        fprintf ( stderr, "Usage: client hostname portnumber.\n");
-        return 1;
-    }
-
-    /* Open socket 1: AF_INET, SOCK_DGRAM. */
-    if ((sock_1 = socket (AF_INET, SOCK_DGRAM, 0)) == -1) {
-        perror( "socket");
-        return 1;
-    }
-
-    /* Get pointer to network data structure for given host. */
-    if ( (hostentptr = gethostbyname (argv[1])) == NULL ) {
-        perror( "gethostbyname");
-        return cleanup (sock_1);
-    }
-
-    /* Copy hostent data to safe storage. */
-    hostentstruct         = *hostentptr;
-
-    /* Fill in the address structure for socket 2 (to receive message). */
-    sock2_name.sin_family = hostentstruct.h_addrtype;
-    sock2_name.sin_port   = htons ( atoi (argv[2]) );
-    sock2_name.sin_addr   = *((struct in_addr*) hostentstruct.h_addr);
-
-    /* Initialize send block. */
-    sendlen = sizeof sendbuf;
-    tolen   = sizeof sock2_name;
-    flag    = 0;                /* flag may be MSG_OOB */
-
-    /* Send message from socket 1 to socket 2. */
-    retval = sendto ( sock_1, sendbuf, sendlen, flag, (struct sockaddr*) & sock2_name, tolen );
-    if ( retval == -1 ) {
-        perror ( "sendto");
-        return cleanup (sock_1);
-    }
-
-    /* Call cleanup to shut down and close socket. */
-    return cleanup (sock_1);
-
-} /* end main */
Index: penc/trunk/version
===================================================================
--- /mppenc/trunk/version	(revision 96)
+++ 	(revision )
@@ -1,6 +1,0 @@
-MPPDEC_VERSION=1.15v
-MPPENC_VERSION=1.15v
-WINAMP_VERSION=0.96
-XMMS_VERSION=0.96
-REPLAY_VERSION=0.84
-MONKEY_VERSION=3.96b8
Index: penc/trunk/wavcmp.c
===================================================================
--- /mppenc/trunk/wavcmp.c	(revision 96)
+++ 	(revision )
@@ -1,151 +1,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifndef __TURBOC__
-# define MB      1
-# define SIZE    ((MB)*256*1024)
-#else
-# include <io.h>
-# define KB      48
-# define SIZE    ((KB)*256)
-#endif
-
-
-static signed short   buff1 [SIZE];
-static signed short   buff2 [SIZE];
-
-
-const char* diff ( unsigned long x1, unsigned long x2, unsigned long mult )     // x1*mult/x2
-{
-    static char    tmp [128];
-    int            expo = -16;
-    unsigned long  val;
-    unsigned long  integ;
-    unsigned long  fract;
-
-    if (x2 == 0)
-        return "?";
-
-    while ( x1    &&  x1   < 0x8000000 ) x1   <<= 1, expo++;
-    while ( mult  &&  mult < 0x8000000 ) mult <<= 1, expo++;
-    while ( x2    &&  x2   < 0x8000000 ) x2   <<= 1, expo--;
-
-    val = (x1 >> 16) * (mult >> 16)
-        + ((x1 & 0xFFFF) * (mult >> 16) >> 16)
-        + ((x1 >> 16) * (mult & 0xFFFF) >> 16);
-    while ( val   &&  val  < 0x8000000 ) val  <<= 1, expo++;
-    val = val / ((x2+0x8000) >> 16);
-    while ( val   &&  val  < 0x8000000 ) val  <<= 1, expo++;
-
-    integ = val >> expo/2 >> (expo-expo/2);
-    fract = val - (integ << expo/2 << (expo - expo/2));
-    fract = ((fract >> 10) * 1000 + (1LU << (expo-11))) >> (expo-10);
-    sprintf ( tmp, "%lu.%03lu", integ, fract );
-    return tmp;
-}
-
-void  compare ( FILE* fp1, FILE* fp2 )
-{
-    unsigned char  char1 [44];
-    unsigned char  char2 [44];
-    size_t         i;
-    unsigned long  error1 = 0;
-    unsigned long  errorn = 0;
-    size_t         len1;
-    size_t         len2;
-    size_t         len;
-    long           size1 = 0;
-    long           size2 = 0;
-    long           offs  = 0;
-
-    fread ( char1, 1, 44, fp1 );
-    fread ( char2, 1, 44, fp2 );
-    for ( i = 0; i < 44; i++ )
-        if ( char1[i] != char2[i] )
-            printf ( "%2u: %3u %3u\n", i, char1[i], char2[i] );
-
-
-    while ( 1 ) {
-#ifdef __TURBOC__
-        len1 = _read ( fileno(fp1), buff1, 2*SIZE ) / 2;
-        len2 = _read ( fileno(fp2), buff2, 2*SIZE ) / 2;
-#else
-        len1 = fread ( buff1, 2, SIZE, fp1 );
-        len2 = fread ( buff2, 2, SIZE, fp2 );
-#endif
-        size1 += len1;
-        size2 += len2;
-        if ( len1==0  &&  len2==0 )
-            break;
-        len = len1 < len2  ?  len1  :  len2;
-
-        for ( i = 0; i < len; i++ ) {
-            if ( buff1 [i] == buff2 [i] )
-                continue;
-            if ( abs (buff1 [i] - buff2 [i]) == 1 ) {
-                error1++;
-                continue;
-            }
-            printf ( "%8lu %6d %6d\n", offs + i, buff1 [i], buff2 [i] );
-            fflush (stdout);
-            errorn++;
-        }
-        offs += len;
-    }
-
-    if ( error1 + errorn )
-        printf ("\n");
-
-    if ( size1 != size2 )
-        printf ("file sizes are different: %lu bytes <-> %lu bytes (%s%%)\n", (long)size1, (long)size2, diff (labs(size1-size2),size1+size2,200) );
-    if ( error1 )
-        printf ("%lu samples are differing by 1 (%s%%).\n", error1, diff (error1,offs,100) );
-    if ( errorn ) {
-        printf ("%lu samples are differing by more than 1 (%s ppm).\n", errorn, diff (errorn,offs,1000000) );
-        fprintf (stderr, "\a");
-    }
-    if ( error1 + errorn )
-        printf ("\n");
-
-    fflush (stdout);
-    return;
-}
-
-int  main ( int argc, char** argv )
-{
-    FILE*  fp1;
-    FILE*  fp2;
-
-    switch (argc) {
-    case 2:
-        fp2 = stdin;
-        break;
-    case 3:
-        if ( (fp2 = fopen ( argv[2], "rb" )) == NULL ) {
-            fprintf ( stderr, "Can't open '%s'\n", argv[2] );
-            return 2;
-        }
-        break;
-    default:
-        fprintf (stderr, "usage: wavcmp file       \tcompares file and <stdin>\n"
-                         "         or\n"
-                         "       wavcmp file1 file2\tcompares 2 files\n\n" );
-        return 1;
-    }
-    if ( (fp1 = fopen ( argv[1], "rb" )) == NULL ) {
-        fprintf ( stderr, "Can't open '%s'\n", argv[1] );
-        return 3;
-    }
-
-    setvbuf ( fp1, NULL, _IONBF, 0 );
-    setvbuf ( fp2, NULL, _IONBF, 0 );
-
-    compare ( fp1, fp2 );
-
-    fclose ( fp1 );
-    fclose ( fp2 );
-
-    return 0;
-}
-
-/* end of wavcmp.c */
Index: penc/trunk/wave_in.c
===================================================================
--- /mppenc/trunk/wave_in.c	(revision 96)
+++ 	(revision )
@@ -1,657 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-
-static int
-init_in ( const int  SampleCount,
-          const int  SampleFreq,
-          const int  Channels,
-          const int  BitsPerSample );
-static size_t
-get_in ( void* DataPtr );
-
-
-#if defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO
-static void
-Set_Realtime ( void )
-{
-# if defined USE_NICE
-    seteuid     ( 0 );
-    setpriority ( PRIO_PROCESS, getpid(), -20 );
-    seteuid     ( getuid() );
-# endif
-}
-#endif /* USE_OSS_AUDIO || USE_ESD_AUDIO || USE_SUN_AUDIO */
-
-
-#define EXT(x)  (0 == strcasecmp (ext, #x))
-
-int
-Open_WAV_Header ( wave_t* type, const char* filename )
-{
-    const char*  ext = strrchr ( filename, '.');
-    FILE*        fp;
-
-    type -> raw = 0;
-
-    if ( 0 == strcmp ( filename, "-")  ||  0 == strcmp ( filename, "/dev/stdin") ) {
-        fp = SETBINARY_IN ( stdin );
-    }
-#ifndef _WIN32
-#ifndef NO_DEV_AUDIO
-    else if ( 0 == strncmp ( filename, "/dev/", 5) ) {
-        int          fd;
-        int          arg;
-        int          org;
-
-        fd = open (filename, O_RDONLY);
-        if ( fd < 0 )
-            return -1;
-
-        type->Channels = org = arg = 2;
-        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_CHANNELS, &arg ) )
-            return -1;
-        if (arg != org)
-            return -1;
-
-        type->BitsPerSample = org = arg = 16;
-        type->BytesPerSample = 2;
-        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_BITS, &arg ) )
-            return -1;
-        if (arg != org)
-            return -1;
-
-        org = arg = AFMT_S16_LE;
-        if ( -1 == ioctl ( fd, SNDCTL_DSP_SETFMT, &arg ) )
-            return -1;
-        if ((arg & org) == 0)
-            return -1;
-
-        type->SampleFreq = org = arg = 44100.;
-        if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_RATE, &arg ) )
-            return -1;
-        if ( 23.609375 * abs(arg-org) > abs(arg+org) )    // Sample frequency: Accept 40.5...48.0 kHz for 44.1 kHz
-            return -1;
-
-        type->raw        = 1;
-        type->PCMOffset  = 0;
-        type->PCMBytes   = 0xFFFFFFFF;
-        type->PCMSamples = 86400 * type->SampleFreq;
-
-        fp = fdopen (fd, "rb");
-        Set_Realtime ();
-    }
-#endif
-#else
-    else if ( 0 == strncmp ( filename, "/dev/audio", 10 ) ) {
-        int     tmp;
-        int     fs  = 44100;
-        double  dur = 86400.;
-
-        sscanf ( filename, "%*[^:]:%u:%lf", &fs, &dur );
-
-        fp                     = (FILE*)-1;
-        type -> Channels       =  2;
-        type -> BitsPerSample  = 16;
-        type -> BytesPerSample =  2;
-        type -> SampleFreq     = fs;
-        type -> PCMOffset      =  0;
-        type -> PCMBytes       = 0xFFFFFFFF;
-        type -> PCMSamples     = dur * type -> SampleFreq;
-        type -> raw            = 1;
-        tmp  = init_in ( 1152, (int) floor (type -> SampleFreq + 0.5), type -> Channels, type -> BitsPerSample );
-        if ( tmp )
-            return -1;
-# if   defined USE_REALTIME
-        SetPriorityClass ( GetCurrentProcess (), REALTIME_PRIORITY_CLASS );
-# elif defined USE_NICE
-        SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
-# endif
-    }
-#endif
-    else if ( ext == NULL ) {
-        fp = NULL;
-    }
-    else if ( EXT(.wav) ) {
-        fp = fopen ( filename, "rb" );
-    }
-    else if ( EXT(.wv) ) {                              // wavpack (www.wavpack.com)
-        fp = pipeopen ( "wvunpack # -", filename );
-    }
-    else if ( EXT(.la) ) {                              // lossless-audio (www.lossless-audio.com)
-        fp = pipeopen ( "la -console #", filename );
-    }
-    else if ( EXT(.raw)  ||  EXT(.cdr)  ||  EXT(.pcm) ) {
-        fp = fopen ( filename, "rb" );
-        type->Channels       = 2;
-        type->BitsPerSample  = 16;
-        type->BytesPerSample = 2;
-        type->SampleFreq     = 44100.;
-        type->raw            = 1;
-        type->PCMOffset      = 0;
-        type->PCMBytes       = 0xFFFFFFFF;
-        type->PCMSamples     = 86400 * type->SampleFreq;
-    }
-    else if ( EXT(.pac)  ||  EXT(.lpac)  ||  EXT(.lpa) ) {
-        fp = pipeopen ( "lpac -o -x #", filename );
-    }
-    else if ( EXT(.fla)  ||  EXT(.flac) ) {
-#ifdef _WIN32
-        stderr_printf ( "*** Install at least version 1.03 of FLAC.EXE. Thanks! ***\n\n" );
-#endif
-        fp = pipeopen ( "flac -d -s -c - < #", filename );
-    }
-    else if ( EXT(.rka)  ||  EXT(.rkau) ) {
-        fp = pipeopen ( "rkau # -", filename );
-    }
-    else if ( EXT(.sz) ) {
-        fp = pipeopen ( "szip -d < #", filename );
-    }
-    else if ( EXT(.sz2) ) {
-        fp = pipeopen ( "szip2 -d < #", filename );
-    }
-    else if ( EXT(.ofr) ) {
-        fp = pipeopen ( "optimfrog d # -", filename );
-    }
-    else if ( EXT(.ape) ) {
-        fp = pipeopen ( "mac # - -d", filename );
-    }
-    else if ( EXT(.shn)  ||  EXT(.shorten) ) {
-#ifdef _WIN32
-        stderr_printf ( "*** Install at least version 3.4 of Shorten.exe. Thanks! ***\n\n" );
-#endif
-        fp = pipeopen ( "shorten -x # -", filename );           // Test if it's okay !!!!
-        if ( fp == NULL )
-            fp = pipeopen ( "shortn32 -x # -", filename );
-    }
-    else if ( EXT(.mod) ) {
-        fp = pipeopen ( "xmp -b16 -c -f44100 --stereo -o- #", filename );
-        type->Channels       = 2;
-        type->BitsPerSample  = 16;
-        type->BytesPerSample = 2;
-        type->SampleFreq     = 44100.;
-        type->raw            = 1;
-        type->PCMOffset      = 0;
-        type->PCMBytes       = 0xFFFFFFFF;
-        type->PCMSamples     = 86400 * type->SampleFreq;
-    }
-    else {
-        fp = NULL;
-    }
-
-    type -> fp  = fp;
-    return fp == NULL  ?  -1  :  0;
-}
-
-#undef EXT
-
-
-static float f0  ( const void* p )
-{
-    return (void)p, 0.;
-}
-
-static float f8  ( const void* p )
-{
-    return (((unsigned char*)p)[0] - 128) * 256.;
-}
-
-static float f16 ( const void* p )
-{
-    return ((unsigned char*)p)[0] + 256. * ((signed char*)p)[1];
-}
-
-static float f24 ( const void* p )
-{
-    return ((unsigned char*)p)[0]*(1./256) + ((unsigned char*)p)[1] + 256 * ((signed char*)p)[2];
-}
-
-static float f32 ( const void* p )
-{
-    return ((unsigned char*)p)[0]*(1./65536) + ((unsigned char*)p)[1]*(1./256) + ((unsigned char*)p)[2] + 256 * ((signed char*)p)[3];
-}
-
-
-typedef float (*rf_t) (const void*);
-
-static int
-DigitalSilence ( void* buffer, size_t len )
-{
-    unsigned long*  pl;
-    unsigned char*  pc;
-    size_t          loops;
-
-    for ( pl = buffer, loops = len >> 3; loops--; pl += 2 )
-        if ( pl[0] | pl[1] )
-            return 0;
-
-    for ( pc = (unsigned char*)pl, loops = len & 7; loops--; pc++ )
-        if ( pc[0] )
-            return 0;
-
-    return 1;
-}
-
-
-size_t
-Read_WAV_Samples ( wave_t*          t,
-                   const size_t     RequestedSamples,
-                   PCMDataTyp*      data,
-                   const ptrdiff_t  offset,
-                   const float      scalel,
-                   const float      scaler,
-                   int*             Silence )
-{
-    static const rf_t rf [5] = { f0, f8, f16, f24, f32 };
-    short   Buffer [8 * 32/16 * BLOCK]; // read buffer, up to 8 channels, up to 32 bit
-    size_t  ReadSamples;                // returns number of read samples
-    size_t  i;
-    short*  b = (short*) Buffer;
-    char*   c = (char*) Buffer;
-    float*  l = data -> L + offset;
-    float*  r = data -> R + offset;
-    float*  m = data -> M + offset;
-    float*  s = data -> S + offset;
-
-    ENTER(120);
-
-    // Read PCM data
-#ifdef _WIN32
-    if ( t->fp != (FILE*)-1 ) {
-        ReadSamples = fread ( b, t->BytesPerSample * t->Channels, RequestedSamples, t->fp );
-    }
-    else {
-        while (1) {
-            ReadSamples = get_in (b) / ( t->Channels * t->BytesPerSample );
-            if ( ReadSamples != 0 )
-                break;
-            Sleep (10);
-        }
-    }
-#else
-    ReadSamples = fread ( b, t->BytesPerSample * t->Channels, RequestedSamples, t->fp );
-#endif
-
-
-    *Silence    = DigitalSilence ( b, ReadSamples * t->BytesPerSample * t->Channels );
-
-    // Add Null Samples if EOF is reached
-    if ( ReadSamples != RequestedSamples )
-        //memset ( b + ReadSamples * t->Channels, 0, (RequestedSamples - ReadSamples) * (sizeof(short) * t->Channels) );
-		memset ( c + ReadSamples * t->Channels * t->BytesPerSample, t->BytesPerSample == 1 ? 0x80 : 0, (RequestedSamples - ReadSamples) * (t->BytesPerSample * t->Channels) );
-
-    // Convert to float and calculate M=(L+R)/2 and S=(L-R)/2 signals
-#if ENDIAN == HAVE_LITTLE_ENDIAN
-    if ( t->BytesPerSample == 2 ) {
-        switch ( t->Channels ) {
-        case 1:
-            for ( i = 0; i < RequestedSamples; i++, b++ ) {
-				float temp = b[0] * scalel;
-				l[i] = temp + MPPENC_DENORMAL_FIX_LEFT;
-				r[i] = temp + MPPENC_DENORMAL_FIX_RIGHT;
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        case 2:
-            for ( i = 0; i < RequestedSamples; i++, b += 2 ) {
-                l[i] = b[0] * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
-                r[i] = b[1] * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        case 5:
-        case 6:
-        case 7:
-        case 8:
-            for ( i = 0; i < RequestedSamples; i++, b += t->Channels ) {
-                l[i] = (0.4142 * b[0] + 0.2928 * b[1] + 0.2928 * b[3] - 0.1464 * b[4]) * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
-                r[i] = (0.4142 * b[2] + 0.2928 * b[1] + 0.2928 * b[4] - 0.1464 * b[3]) * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        default:
-            for ( i = 0; i < RequestedSamples; i++, b += t->Channels ) {
-                l[i] = b[0] * scalel + MPPENC_DENORMAL_FIX_LEFT;           // left
-                r[i] = b[1] * scaler + MPPENC_DENORMAL_FIX_RIGHT;           // right
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        }
-    }
-    else
-#endif
-         {
-        unsigned int  bytes = t->BytesPerSample;
-        rf_t          f     = rf [bytes];
-
-        c = (char*)b;
-        switch ( t->Channels ) {
-        case 1:
-            for ( i = 0; i < RequestedSamples; i++, c += bytes ) {
-				float temp = f(c) * scalel;
-				l[i] = temp + MPPENC_DENORMAL_FIX_LEFT;
-				r[i] = temp + MPPENC_DENORMAL_FIX_RIGHT;
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        case 2:
-            for ( i = 0; i < RequestedSamples; i++, c += 2*bytes ) {
-                l[i] = f(c)       * scalel + MPPENC_DENORMAL_FIX_LEFT;     // left
-                r[i] = f(c+bytes) * scaler + MPPENC_DENORMAL_FIX_RIGHT;     // right
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        default:
-            for ( i = 0; i < RequestedSamples; i++, c += bytes * t->Channels ) {
-                l[i] = f(c)       * scalel + MPPENC_DENORMAL_FIX_LEFT;     // left
-                r[i] = f(c+bytes) * scaler + MPPENC_DENORMAL_FIX_RIGHT;     // right
-                m[i] = (l[i] + r[i]) * 0.5f;
-                s[i] = (l[i] - r[i]) * 0.5f;
-            }
-            break;
-        }
-    }
-
-    LEAVE(120);
-    return ReadSamples;
-}
-
-
-// read WAVE header
-
-static unsigned short
-Read16 ( FILE* fp )
-{
-    unsigned char  buff [2];
-
-    if (fread ( buff, 1, 2, fp ) != 2 )
-        return -1;
-    return buff[0] | (buff[1] << 8);
-}
-
-static unsigned long
-Read32 ( FILE* fp )
-{
-    unsigned char  buff [4];
-
-    if ( fread ( buff, 1, 4, fp ) != 4 )
-        return -1;
-    return (buff[0] | (buff[1] << 8)) | ((unsigned long)(buff[2] | (buff[3] << 8)) << 16);
-}
-
-
-int
-Read_WAV_Header ( wave_t* type )
-{
-	int bytealign;
-
-    FILE*  fp = type->fp;
-
-    if ( type->raw )
-        return 0;
-
-    fseek ( fp, 0, SEEK_SET );
-    if ( Read32 (fp) != 0x46464952 ) {                  // 4 Byte: check for "RIFF"
-        stderr_printf ( Read32(fp) == -1  ?  " ERROR: Empty file or no data from coprocess!\n\n"
-                                          :  " ERROR: 'RIFF' not found in WAVE header!\n\n");
-        return -1;
-    }
-    Read32 (fp);                                        // 4 Byte: chunk size (ignored)
-    if ( Read32 (fp) != 0x45564157 ) {                  // 4 Byte: check for "WAVE"
-        stderr_printf ( " ERROR: 'WAVE' not found in WAVE header!\n\n");
-        return -1;
-    }
-    if ( Read32 (fp) != 0x20746D66 ) {                  // 4 Byte: check for "fmt "
-        stderr_printf ( " ERROR: 'fmt ' not found in WAVE header!\n\n");
-        return -1;
-    }
-    Read32 (fp);                                        // 4 Byte: read chunk-size (ignored)
-    if ( Read16 (fp) != 0x0001 ) {                      // 2 Byte: check for linear PCM
-        stderr_printf ( " ERROR: WAVE file has no linear PCM format!\n\n");
-        return -1;
-    }
-    type -> Channels    = Read16 (fp);                  // 2 Byte: read no. of channels
-    type -> SampleFreq  = Read32 (fp);                  // 4 Byte: read sampling frequency
-    Read32 (fp);                                        // 4 Byte: read avg. blocksize (fs*channels*bytepersample)
-    bytealign = Read16 (fp);							// 2 Byte: read byte-alignment (channels*bytepersample)
-    type->BitsPerSample = Read16 (fp);                  // 2 Byte: read bits per sample
-    type->BytesPerSample= (type->BitsPerSample + 7) / 8;
-    while ( 1 ) {                                       // search for "data"
-        if ( feof (fp) )
-            return -1;
-        if ( Read16 (fp) != 0x6164 )
-            continue;
-        if ( Read16 (fp) == 0x6174 )
-            break;
-    }
-    type->PCMBytes      = Read32 (fp);                  // 4 Byte: no. of byte in file
-    if ( feof (fp) ) return -1;
-
-														// finally calculate number of samples
-    if (type->PCMBytes >= 0xFFFFFF00  ||  
-			type->PCMBytes == 0  ||  
-			(Uint32_t)type->PCMBytes % (type -> Channels * type->BytesPerSample) != 0) {
-		type->PCMSamples = 36000000 * type->SampleFreq;
-	}
-	else {
-		type->PCMSamples = type->PCMBytes / bytealign;
-	}
-    type->PCMOffset     = ftell (fp);
-    return 0;
-}
-
-
-#ifdef _WIN32
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <windows.h>
-#include <winbase.h>
-#include <mmsystem.h>
-#ifndef __MINGW32__
-#include <mmreg.h>
-#endif
-#include <io.h>
-#include <fcntl.h>
-
-
-#define NBLK  383               // 10 sec of audio
-
-
-typedef struct {
-    int      active;
-    char*    data;
-    size_t   datalen;
-    WAVEHDR  hdr;
-} oblk_t;
-
-static HWAVEIN       Input_WAVHandle;
-static HWAVEOUT      Output_WAVHandle;
-static size_t        BufferBytes;
-static WAVEHDR       whi    [NBLK];
-static char*         data   [NBLK];
-static oblk_t        array  [NBLK];
-static unsigned int  NextInputIndex;
-static unsigned int  NextOutputIndex;
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-int
-init_in ( const int  SampleCount,
-          const int  SampleFreq,
-          const int  Channels,
-          const int  BitsPerSample )
-{
-
-    WAVEFORMATEX  pwf;
-    MMRESULT      r;
-    int           i;
-
-    pwf.wFormatTag      = WAVE_FORMAT_PCM;
-    pwf.nChannels       = Channels;
-    pwf.nSamplesPerSec  = SampleFreq;
-    pwf.nAvgBytesPerSec = SampleFreq * Channels * ((BitsPerSample + 7) / 8);
-    pwf.nBlockAlign     = Channels * ((BitsPerSample + 7) / 8);
-    pwf.wBitsPerSample  = BitsPerSample;
-    pwf.cbSize          = 0;
-
-    r = waveInOpen ( &Input_WAVHandle, WAVE_MAPPER, &pwf, 0, 0, CALLBACK_EVENT );
-    if ( r != MMSYSERR_NOERROR ) {
-        fprintf ( stderr, "waveInOpen failed: ");
-        switch (r) {
-        case MMSYSERR_ALLOCATED:   fprintf ( stderr, "resource already allocated\n" );                                  break;
-        case MMSYSERR_INVALPARAM:  fprintf ( stderr, "invalid Params\n" );                                              break;
-        case MMSYSERR_BADDEVICEID: fprintf ( stderr, "device identifier out of range\n" );                              break;
-        case MMSYSERR_NODRIVER:    fprintf ( stderr, "no device driver present\n" );                                    break;
-        case MMSYSERR_NOMEM:       fprintf ( stderr, "unable to allocate or lock memory\n" );                           break;
-        case WAVERR_BADFORMAT:     fprintf ( stderr, "attempted to open with an unsupported waveform-audio format\n" ); break;
-        case WAVERR_SYNC:          fprintf ( stderr, "device is synchronous but waveOutOpen was\n" );                   break;
-        default:                   fprintf ( stderr, "unknown error code: %#X\n", r );                                  break;
-        }
-        return -1;
-    }
-
-    BufferBytes = SampleCount * Channels * ((BitsPerSample + 7) / 8);
-
-    for ( i = 0; i < NBLK; i++ ) {
-        whi [i].lpData         = data [i] = malloc (BufferBytes);
-        whi [i].dwBufferLength = BufferBytes;
-        whi [i].dwFlags        = 0;
-        whi [i].dwLoops        = 0;
-
-        r = waveInPrepareHeader ( Input_WAVHandle, whi + i, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInPrepareHeader  (%u) failed\n", i );  return -1; }
-        r = waveInAddBuffer     ( Input_WAVHandle, whi + i, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInAddBuffer      (%u) failed\n", i );  return -1; }
-    }
-    NextInputIndex = 0;
-    waveInStart (Input_WAVHandle);
-    return 0;
-}
-
-
-size_t
-get_in ( void* DataPtr )
-{
-    MMRESULT  r;
-    size_t    Bytes;
-
-    if ( whi [NextInputIndex].dwFlags & WHDR_DONE ) {
-        Bytes = whi [NextInputIndex].dwBytesRecorded;
-        memcpy ( DataPtr, data [NextInputIndex], Bytes );
-
-        r = waveInUnprepareHeader ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInUnprepareHeader (%d) failed\n", NextInputIndex ); return -1; }
-        whi [NextInputIndex].lpData         = data [NextInputIndex];
-        whi [NextInputIndex].dwBufferLength = BufferBytes;
-        whi [NextInputIndex].dwFlags        = 0;
-        whi [NextInputIndex].dwLoops        = 0;
-        r = waveInPrepareHeader   ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInPrepareHeader   (%d) failed\n", NextInputIndex ); return -1; }
-        r = waveInAddBuffer       ( Input_WAVHandle, whi + NextInputIndex, sizeof (*whi) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveInAddBuffer       (%d) failed\n", NextInputIndex ); return -1; }
-        NextInputIndex = (NextInputIndex + 1) % NBLK;
-        return  Bytes;
-    }
-    return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-int
-init_out ( const int  SampleCount,
-           const int  SampleFreq,
-           const int  Channels,
-           const int  BitsPerSample )
-{
-    WAVEFORMATEX  pwf;
-    MMRESULT      r;
-    int           i;
-
-    pwf.wFormatTag      = WAVE_FORMAT_PCM;
-    pwf.nChannels       = Channels;
-    pwf.nSamplesPerSec  = SampleFreq;
-    pwf.nAvgBytesPerSec = SampleFreq * Channels * ((BitsPerSample + 7) / 8);
-    pwf.nBlockAlign     = Channels * ((BitsPerSample + 7) / 8);
-    pwf.wBitsPerSample  = BitsPerSample;
-    pwf.cbSize          = 0;
-
-    r = waveOutOpen ( &Output_WAVHandle, WAVE_MAPPER, &pwf, 0, 0, CALLBACK_EVENT );
-    if ( r != MMSYSERR_NOERROR ) {
-        fprintf ( stderr, "waveOutOpen failed\n" );
-        switch (r) {
-        case MMSYSERR_ALLOCATED:   fprintf ( stderr, "resource already allocated\n" );                                  break;
-        case MMSYSERR_INVALPARAM:  fprintf ( stderr, "invalid Params\n" );                                              break;
-        case MMSYSERR_BADDEVICEID: fprintf ( stderr, "device identifier out of range\n" );                              break;
-        case MMSYSERR_NODRIVER:    fprintf ( stderr, "no device driver present\n" );                                    break;
-        case MMSYSERR_NOMEM:       fprintf ( stderr, "unable to allocate or lock memory\n" );                           break;
-        case WAVERR_BADFORMAT:     fprintf ( stderr, "attempted to open with an unsupported waveform-audio format\n" ); break;
-        case WAVERR_SYNC:          fprintf ( stderr, "device is synchronous but waveOutOpen was\n" );                   break;
-        default:                   fprintf ( stderr, "unknown error code: %#X\n", r );                                  break;
-        }
-        return -1;
-    }
-
-    BufferBytes = SampleCount * Channels * ((BitsPerSample + 7) / 8);
-
-    for ( i = 0; i < NBLK; i++ ) {
-        array [i].active = 0;
-        array [i].data   = malloc (BufferBytes);
-    }
-    NextOutputIndex = 0;
-    return 0;
-}
-
-
-int
-put_out ( const void*   DataPtr,
-          const size_t  Bytes )
-{
-    MMRESULT  r;
-    int       i = NextOutputIndex;
-
-    if ( array [i].active )
-        while ( ! (array [i].hdr.dwFlags & WHDR_DONE) )
-            Sleep (26);
-
-    r = waveOutUnprepareHeader ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutUnprepareHeader (%d) failed\n", i ); return -1; }
-
-    array [i].active             = 1;
-    array [i].hdr.lpData         = array [i].data;
-    array [i].hdr.dwBufferLength = Bytes;
-    array [i].hdr.dwFlags        = 0;
-    array [i].hdr.dwLoops        = 0;
-    memcpy ( array [i].data, DataPtr, Bytes );
-
-    r = waveOutPrepareHeader   ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutPrepareHeader   (%d) failed\n", i ); return -1; }
-    r = waveOutWrite           ( Output_WAVHandle, &(array [i].hdr), sizeof (array [i].hdr) ); if ( r != MMSYSERR_NOERROR ) { fprintf ( stderr, "waveOutAddBuffer       (%d) failed\n", i ); return -1; }
-
-    NextInputIndex = (NextInputIndex + 1) % NBLK;
-    return Bytes;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-#endif
-
-/* end of wave_in.c */
Index: penc/trunk/wave_out.c
===================================================================
--- /mppenc/trunk/wave_out.c	(revision 96)
+++ 	(revision )
@@ -1,1135 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <string.h>
-#include <errno.h>
-#include "mppdec.h"
-
-#define MAXWAVESIZE     4294967040LU
-
-
-/*
- *  Write 'len' Bytes to a Stream.
- *  Output Error Message if write fails
- */
-
-static size_t
-write_with_test ( FILE_T outputFile, const void* data, size_t len )
-{
-    ssize_t  written;
-    size_t   done = 0;
-
-    ENTER(200);
-
-#ifdef USE_WIN_AUDIO
-    if ( outputFile == WINAUDIO_FD ) {
-        WIN_Play_Samples ( data, len );
-    } else
-#endif
-#ifdef USE_IRIX_AUDIO
-    if ( outputFile == IRIXAUDIO_FD ) {
-        IRIX_Play_Samples ( data, len );
-    } else
-#endif
-    if ( outputFile != NULL_FD )
-        while ( len != done ) {
-            written = (size_t) WRITE (outputFile, (char*)data+done, len-done);
-            if ( written <= 0 ) {
-                stderr_printf ( "\n"PROG_NAME": write error: %s, repeat once more...\a\r", strerror(errno) );
-                sleep (10);
-                continue;
-            }
-            done += written;
-        }
-
-    LEAVE(200);
-    return len;
-}
-
-
-/*
- *  Write a WAV header for a simple RIFF-WAV file with 1 PCM-Chunk. Settings are passed via function parameters.
- */
-
-Int
-Write_WAVE_Header ( FILE_T   outputFile,
-                    Ldouble  SampleFreq,
-                    Uint     BitsPerSample,
-                    Uint     Channels,
-                    Ulong    SamplesPerChannel )
-{
-    Uint8_t   Header [44];
-    Uint8_t*  p             = Header;
-    Uint      Bytes         = (BitsPerSample + 7) / 8;
-    Double    PCMdataLength = (Double) Channels * Bytes * SamplesPerChannel;
-    Uint32_t  word32;
-    size_t    ret;
-
-    ENTER(201);
-
-    *p++ = 'R';
-    *p++ = 'I';
-    *p++ = 'F';
-    *p++ = 'F';                                   // "RIFF" label
-
-    word32 = PCMdataLength + (44 - 8) < (Double)MAXWAVESIZE  ?
-             (Uint32_t)PCMdataLength + (44 - 8)  :  (Uint32_t)MAXWAVESIZE;
-    *p++ = (Uint8_t)(word32 >>  0);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >> 24);               // Size of the next chunk
-
-    *p++ = 'W';
-    *p++ = 'A';
-    *p++ = 'V';
-    *p++ = 'E';                                   // "WAVE" label
-
-    *p++ = 'f';
-    *p++ = 'm';
-    *p++ = 't';
-    *p++ = ' ';                                   // "fmt " label
-
-    *p++ = 0x10;
-    *p++ = 0x00;
-    *p++ = 0x00;
-    *p++ = 0x00;                                  // length of the PCM data declaration = 2+2+4+4+2+2
-
-    *p++ = 0x01;
-    *p++ = 0x00;                                  // ACM type 0x0001 = uncompressed linear PCM
-
-    *p++ = (Uint8_t)(Channels >> 0);
-    *p++ = (Uint8_t)(Channels >> 8);              // Channels
-
-    word32 = (Uint32_t) (SampleFreq + 0.5);
-    *p++ = (Uint8_t)(word32 >>  0);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >> 24);               // Sample frequency
-
-    word32 *= Bytes * Channels;
-    *p++ = (Uint8_t)(word32 >>  0);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >> 24);               // Bytes per second in the data stream
-
-    word32 = Bytes * Channels;
-    *p++ = (Uint8_t)(word32 >>  0);
-    *p++ = (Uint8_t)(word32 >>  8);               // Bytes per sample time
-
-    *p++ = (Uint8_t)(BitsPerSample >> 0);
-    *p++ = (Uint8_t)(BitsPerSample >> 8);         // Bits per single sample
-
-    *p++ = 'd';
-    *p++ = 'a';
-    *p++ = 't';
-    *p++ = 'a';                                   // "data" label
-
-    word32 = PCMdataLength < MAXWAVESIZE  ?  (Uint32_t)PCMdataLength  :  (Uint32_t)MAXWAVESIZE;
-    *p++ = (Uint8_t)(word32 >>  0);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >> 24);               // Size of raw PCM-data
-
-    assert ( p == Header + (sizeof(Header) ) );   // nothing forgotten or too much?
-
-    ret = write_with_test ( outputFile, Header, sizeof(Header) );
-    LEAVE(201);
-    return ret;
-}
-
-
-/*
- *  Write a header for a headerless RAW PCM file. Settings are passed via function parameters.
- *  Of course this is only a dummy function.
- */
-
-Int
-Write_Raw_Header ( FILE_T   outputFile,
-                   Ldouble  SampleFreq,
-                   Uint     BitsPerSample,
-                   Uint     Channels,
-                   Ulong    SamplesPerChannel )
-{
-    (void) outputFile;
-    (void) SampleFreq;
-    (void) BitsPerSample;
-    (void) Channels;
-    (void) SamplesPerChannel;
-    return 0;
-}
-
-
-/*
- *  Write a 80 bit IEEE854 big endian number as 10 octets. Destination is passed as pointer,
- *  End of destination (p+10) is returned.
- */
-
-static Uint8_t*
-Convert_to_80bit_BE_IEEE854_Float ( Uint8_t* p, Ldouble val )
-{
-#ifndef HAVE_IEEE854_LONGDOUBLE
-    Uint32_t  word32 = 0x401E;
-
-    if ( val > 0.L )
-        while ( val < (Ldouble)0x80000000 )                    // scales value in the range 2^31...2^32
-            word32--, val *= 2.L;                              // so you have the exponent
-
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);                          // write exponent, sign is assumed as '+'
-    word32 = (Uint32_t) val;
-    *p++   = (Uint8_t)(word32 >> 24);
-    *p++   = (Uint8_t)(word32 >> 16);
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);                          // write the upper 32 bit of the mantissa
-    word32 = (Uint32_t) ( (val - word32) * 4294967296.L );
-    *p++   = (Uint8_t)(word32 >> 24);
-    *p++   = (Uint8_t)(word32 >> 16);
-    *p++   = (Uint8_t)(word32 >>  8);
-    *p++   = (Uint8_t)(word32 >>  0);                          // write the lower 32 bit of the mantissa
-#elif ENDIAN == HAVE_LITTLE_ENDIAN
-    const Uint8_t*  q = (Uint8_t*) &val;
-
-    *p++ = q[9];                                               // only change the endianess
-    *p++ = q[8];
-    *p++ = q[7];
-    *p++ = q[6];
-    *p++ = q[5];
-    *p++ = q[4];
-    *p++ = q[3];
-    *p++ = q[2];
-    *p++ = q[1];
-    *p++ = q[0];
-#elif defined MUST_ALIGNED
-    const Uint8_t*  q = (Uint8_t*) &val;
-
-    *p++ = q[0];                                               // only copy
-    *p++ = q[1];
-    *p++ = q[2];
-    *p++ = q[3];
-    *p++ = q[4];
-    *p++ = q[5];
-    *p++ = q[6];
-    *p++ = q[7];
-    *p++ = q[8];
-    *p++ = q[9];
-#else
-    *(Ldouble*)p = val;                                        // copy directly
-    p += 10;
-#endif /* HAVE_IEEE854_LONGDOUBLE */
-
-    return p;
-}
-
-
-/*
- *  Write an AIFF header for a simple AIFF file with 1 PCM-Chunk. Settings are passed via function parameters.
- */
-
-Int
-Write_AIFF_Header ( FILE_T   outputFile,
-                    Ldouble  SampleFreq,
-                    Uint     BitsPerSample,
-                    Uint     Channels,
-                    Ulong    SamplesPerChannel )
-{
-    Uint8_t      Header [54];
-    Uint8_t*     p             = Header;
-    Uint         Bytes         = (BitsPerSample + 7) / 8;
-    Double       PCMdataLength = (Double) Channels * Bytes * SamplesPerChannel;
-    Uint32_t     word32;
-    size_t       ret;
-
-    ENTER(203);
-
-    // FORM chunk
-    *p++ = 'F';
-    *p++ = 'O';
-    *p++ = 'R';
-    *p++ = 'M';
-
-    word32 = (Uint32_t) PCMdataLength + 0x2E;  // size of the AIFF chunk
-    *p++ = (Uint8_t)(word32 >> 24);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    *p++ = 'A';
-    *p++ = 'I';
-    *p++ = 'F';
-    *p++ = 'F';
-    // end of FORM chunk
-
-    // COMM chunk
-    *p++ = 'C';
-    *p++ = 'O';
-    *p++ = 'M';
-    *p++ = 'M';
-
-    word32 = 0x12;                             // size of this chunk
-    *p++ = (Uint8_t)(word32 >> 24);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    word32 = Channels;                         // channels
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    word32 = SamplesPerChannel < 0xFFFFFFFFLU  ?  (Uint32_t)SamplesPerChannel  :  (Uint32_t)0xFFFFFFFFLU;  // so called "frames"
-    *p++ = (Uint8_t)(word32 >> 24);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    word32 = BitsPerSample;                    // bits
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    p = Convert_to_80bit_BE_IEEE854_Float ( p, SampleFreq );  // sample frequency as big endian 80 bit IEEE854 float
-    // End of COMM chunk
-
-    // SSND chunk
-    *p++ = 'S';
-    *p++ = 'S';
-    *p++ = 'N';
-    *p++ = 'D';
-
-    word32 = (Uint32_t) PCMdataLength + 0x08;  // chunk length
-    *p++ = (Uint8_t)(word32 >> 24);
-    *p++ = (Uint8_t)(word32 >> 16);
-    *p++ = (Uint8_t)(word32 >>  8);
-    *p++ = (Uint8_t)(word32 >>  0);
-
-    *p++ = 0;                                  // offset
-    *p++ = 0;
-    *p++ = 0;
-    *p++ = 0;
-
-    *p++ = 0;                                  // block size
-    *p++ = 0;
-    *p++ = 0;
-    *p++ = 0;
-
-    assert ( p == Header + (sizeof(Header) ) );// nothing forgotten or too much?
-
-    ret = write_with_test ( outputFile, Header, sizeof(Header) );
-    LEAVE(203);
-    return ret;
-}
-
-
-/***********************************************************************************
- *
- *  Write 16 bit PCM samples from 16 bit PCM data, needed if no MAKE_xxBIT is defined
- *
- ***********************************************************************************/
-
-#if !defined MAKE_16BIT  &&  !defined MAKE_24BIT  &&  !defined MAKE_32BIT
-
-static void
-Change_Endian2x16 ( Int2x16_t* dst, size_t words2x16bit )
-{
-    ENTER(202);
-
-    for ( ; words2x16bit--; dst++ ) {
-# if  INT_MAX >= 2147483647L  &&  !defined MUST_ALIGNED
-        Uint32_t  tmp = *(Uint32_t*)dst;
-        *(Uint32_t*)dst = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
-# else
-        Uint8_t  tmp;
-        tmp                = ((Uint8_t*)dst)[0];
-        ((Uint8_t*)dst)[0] = ((Uint8_t*)dst)[1];
-        ((Uint8_t*)dst)[1] = tmp;
-        tmp                = ((Uint8_t*)dst)[2];
-        ((Uint8_t*)dst)[2] = ((Uint8_t*)dst)[3];
-        ((Uint8_t*)dst)[3] = tmp;
-# endif
-    }
-
-    LEAVE(202);
-    return;
-}
-
-
-size_t
-Write_PCM_2x16bit ( FILE_T fp, Int2x16_t* data, size_t len )
-{
-    size_t  ret;
-
-    ENTER(203);
-
-    if ( output_endianess != machine_endianess )
-        Change_Endian2x16 ( data, len );
-
-    ret = write_with_test ( fp, data, 16/8 * 2 * len ) / (16/8 * 2);
-    LEAVE(203);
-    return ret;
-}
-
-#endif
-
-
-/***********************************************************************************
- *
- *  Write 16 bit PCM samples from 32 bit PCM data, needed if MAKE_16BIT is defined
- *
- ***********************************************************************************/
-
-#ifdef MAKE_16BIT
-
-size_t
-Write_PCM_HQ_2x16bit ( FILE_T fp, Int2x32_t* data, size_t len )
-{
-    size_t          ret;
-    Uint8_t         buff [1152 * 2 * 2];
-    Uint8_t*        p = buff;
-    const Uint8_t*  q = (const Uint8_t*) data;
-    size_t          i;
-
-    ENTER(213);
-
-# if ENDIAN == HAVE_LITTLE_ENDIAN
-    if ( output_endianess == LITTLE ) {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            ((Int16_t*)p)[0] = ((Int16_t*)q)[1];
-            ((Int16_t*)p)[1] = ((Int16_t*)q)[3];
-            p += 4;
-        }
-    } else {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[3];
-            *p++ = q[2];
-            *p++ = q[7];
-            *p++ = q[6];
-        }
-    }
-# else
-    if ( output_endianess == LITTLE ) {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[1];
-            *p++ = q[0];
-            *p++ = q[5];
-            *p++ = q[4];
-        }
-    } else {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            ((Int16_t*)p)[0] = ((Int16_t*)q)[0];
-            ((Int16_t*)p)[1] = ((Int16_t*)q)[2];
-            p += 4;
-        }
-    }
-# endif
-
-    ret = write_with_test ( fp, buff, 16/8 * 2 * len ) / (16/8 * 2);
-    LEAVE(213);
-    return ret;
-}
-
-#endif /* MAKE_16BIT */
-
-
-/***********************************************************************************
- *
- *  Write 24 bit PCM samples from 32 bit PCM data, needed if MAKE_24BIT is defined
- *
- ***********************************************************************************/
-
-#ifdef MAKE_24BIT
-
-size_t
-Write_PCM_HQ_2x24bit ( FILE_T fp, Int2x32_t* data, size_t len )
-{
-    size_t          ret;
-    Uint8_t         buff [1152 * 2 * 3];
-    Uint8_t*        p = buff;
-    const Uint8_t*  q = (const Uint8_t*) data;
-    size_t          i;
-
-    ENTER(213);
-
-# if ENDIAN == HAVE_LITTLE_ENDIAN
-    if ( output_endianess == LITTLE ) {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[1];
-            *p++ = q[2];
-            *p++ = q[3];
-            *p++ = q[5];
-            *p++ = q[6];
-            *p++ = q[7];
-        }
-    } else {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[3];
-            *p++ = q[2];
-            *p++ = q[1];
-            *p++ = q[7];
-            *p++ = q[6];
-            *p++ = q[5];
-        }
-    }
-# else
-    if ( output_endianess == LITTLE ) {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[2];
-            *p++ = q[1];
-            *p++ = q[0];
-            *p++ = q[6];
-            *p++ = q[5];
-            *p++ = q[4];
-        }
-    } else {
-        for ( i = 0; i < len; i++, q += 8 ) {
-            *p++ = q[0];
-            *p++ = q[1];
-            *p++ = q[2];
-            *p++ = q[4];
-            *p++ = q[5];
-            *p++ = q[6];
-        }
-    }
-# endif
-
-    ret = write_with_test ( fp, buff, 24/8 * 2 * len ) / (24/8 * 2);
-    LEAVE(213);
-    return ret;
-}
-
-#endif /* MAKE_24BIT */
-
-
-/***********************************************************************************
- *
- *  Write 32 bit PCM samples from 32 bit PCM data, needed if MAKE_32BIT is defined
- *
- ***********************************************************************************/
-
-#ifdef MAKE_32BIT
-
-static void
-Change_Endian2x32 ( Int2x32_t* dst, size_t words2x32bit )
-{
-    ENTER(212);
-
-    for ( ; words2x32bit--; dst++ ) {
-# if  INT_MAX >= 2147483647L
-        Uint32_t  tmp;
-        tmp                 = ((Uint32_t*)dst)[0];
-        tmp                 = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
-        ((Uint32_t*)dst)[0] = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
-        tmp                 = ((Uint32_t*)dst)[1];
-        tmp                 = ((tmp << 0x10) & 0xFFFF0000) | ((tmp >> 0x10) & 0x0000FFFF);
-        ((Uint32_t*)dst)[1] = ((tmp << 0x08) & 0xFF00FF00) | ((tmp >> 0x08) & 0x00FF00FF);
-# else
-        Uint8_t  tmp;
-        tmp                 = ((Uint8_t*)dst)[0];
-        ((Uint8_t*)dst)[0]  = ((Uint8_t*)dst)[3];
-        ((Uint8_t*)dst)[3]  = tmp;
-        tmp                 = ((Uint8_t*)dst)[1];
-        ((Uint8_t*)dst)[1]  = ((Uint8_t*)dst)[2];
-        ((Uint8_t*)dst)[2]  = tmp;
-        tmp                 = ((Uint8_t*)dst)[4];
-        ((Uint8_t*)dst)[4]  = ((Uint8_t*)dst)[7];
-        ((Uint8_t*)dst)[7]  = tmp;
-        tmp                 = ((Uint8_t*)dst)[5];
-        ((Uint8_t*)dst)[5]  = ((Uint8_t*)dst)[6];
-        ((Uint8_t*)dst)[6]  = tmp;
-# endif
-    }
-
-    LEAVE(212);
-    return;
-}
-
-
-size_t
-Write_PCM_HQ_2x32bit ( FILE_T fp, Int2x32_t* data, size_t len )
-{
-    size_t  ret;
-
-    ENTER(213);
-
-    if ( output_endianess != machine_endianess )
-        Change_Endian2x32 ( data, len );
-
-    ret = write_with_test ( fp, data, 32/8 * 2 * len ) / (32/8 * 2);
-    LEAVE(213);
-    return ret;
-}
-
-#endif /* MAKE_32BIT */
-
-
-#if defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO
-
-# if defined USE_REALTIME  ||  defined USE_NICE
-
-static uid_t
-GetUID ( void )
-{
-#  if defined _HPUX_SOURCE
-    uid_t  user;
-    gid_t  group;
-    uid_t  saved;
-
-    getresuid ( &user, &group, &saved );
-    return user;
-#  else
-    return getuid ();
-#  endif
-}
-
-static void
-SetEUID ( uid_t uid )
-{
-#  if defined _HPUX_SOURCE
-    setresuid (-1, uid, -1);
-#  else
-    seteuid (uid);
-#  endif
-}
-
-void
-DisableSUID ( void )
-{
-    SetEUID (GetUID());
-}
-
-void
-EnableSUID ( void )
-{
-    SetEUID (0);
-}
-
-# endif
-
-
-static void
-Set_Realtime ( void )
-{
-# if defined USE_REALTIME               // works for all POSIX 1b-conform systems, also the memory should be locked
-    struct sched_param  sp;
-    int                 ret;
-    int                 err;
-
-    memset      ( &sp, 0, sizeof(sp) );
-    EnableSUID  ();
-    sp.sched_priority = sched_get_priority_min ( SCHED_FIFO );
-    ret               = sched_setscheduler ( 0, SCHED_RR, &sp );
-    err               = errno;
-    DisableSUID ();
-# endif
-
-# if defined USE_NICE
-    EnableSUID  ();
-    setpriority ( PRIO_PROCESS, getpid(), -20 );
-    DisableSUID ();
-# endif
-}
-
-#endif /* USE_OSS_AUDIO || USE_ESD_AUDIO || USE_SUN_AUDIO */
-
-
-#if defined USE_OSS_AUDIO
-
-Int
-Set_DSP_OSS_Params ( FILE_T   outputFile,
-                     Ldouble  SampleFreq,
-                     Uint     BitsPerSample,
-                     Uint     Channels )
-{
-    int  arg;
-    int  org;
-    int  fd = FILENO (outputFile);
-
-    org = arg = Channels;
-    if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_CHANNELS, &arg ) )
-        return -1;
-    if (arg != org)
-        return -1;
-
-    org = arg = BitsPerSample;
-    if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_BITS, &arg ) )
-        return -1;
-    if (arg != org)
-        return -1;
-
-    org = arg = AFMT_S16_LE;
-    if ( -1 == ioctl ( fd, SNDCTL_DSP_SETFMT, &arg ) )
-        return -1;
-    if ((arg & org) == 0)
-        return -1;
-
-    org = arg = SampleFreq + 0.5;
-    if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_RATE, &arg ) )
-        return -1;
-    if ( 23.609375 * fabs(arg-SampleFreq) > fabs(arg+SampleFreq) )    // Sample frequency: Accept 40.5...48.0 kHz for 44.1 kHz
-        return -1;
-
-    Set_Realtime ();
-    return 0;
-}
-
-#endif /* USE_OSS_AUDIO */
-
-
-#if defined USE_SUN_AUDIO
-
-Int
-Set_DSP_Sun_Params ( FILE_T   outputFile,
-                     Ldouble  SampleFreq,
-                     Uint     BitsPerSample,
-                     Uint     Channels )
-{
-    audio_info_t  audio_info;
-    int           fd = FILENO (outputFile);
-
-
-    AUDIO_INITINFO ( &audio_info );
-    audio_info.play.sample_rate = (unsigned int) (SampleFreq + 0.5);
-    audio_info.play.channels    = Channels;
-    audio_info.play.precision   = BitsPerSample;
-    audio_info.play.encoding    = AUDIO_ENCODING_LINEAR;
-
-    if ( 0 != ioctl (fd, AUDIO_SETINFO, &audio_info) )
-        return -1;
-    if ( audio_info.play.channels  != Channels )
-        return -1;
-    if ( audio_info.play.precision != BitsPerSample )
-        return -1;
-    if ( audio_info.play.encoding  != AUDIO_ENCODING_LINEAR )
-        return -1;
-    if ( 23.609375 * fabs(audio_info.play.sample_rate-SampleFreq) > fabs(audio_info.play.sample_rate+SampleFreq) )    // Sample frequency: Accept 40.5...48.0 kHz for 44.1 kHz
-        return -1;
-
-    Set_Realtime ();
-    return 0;
-}
-
-#endif /* USE_SUN_AUDIO */
-
-
-#ifdef __TURBOC__
-/*
- *  Turbo-C assigns stdin/stdout with 512 byte buffers if they are
- *  associated with regular files and pipes. This links a lot of code (ca.
- *  6 KByte) which is not used in this program, because FILE I/O buffering
- *  is done by the program itself (8/4 Kbyte for input, 4.5 KByte for
- *  output). Defining the next two functions as dummy functions breaks this
- *  linking chain. This is especially important because we only have limited
- *  space for Code and Data/Stack (each 64 KByte).
- */
-# pragma argsused
-int  pascal near  __IOerror ( int no ) { return -1; }
-void near         _setupio  ( void )   {}
-#endif /* __TURBOC__ */
-
-
-#ifdef USE_ESD_AUDIO
-
-# define AUDIO_FORMAT_UNSIGNED_8       1
-# define AUDIO_FORMAT_SIGNED_16        2
-
-int
-Set_ESD_Params ( FILE_T   dummyFile,
-                 Ldouble  SampleFreq,
-                 Uint     BitsPerSample,
-                 Uint     Channels )
-{
-    static unsigned int  esd_rate     = 0;
-    static unsigned int  esd_format   = 0;
-    static unsigned int  esd_channels = 0;
-    esd_server_info_t*   info;
-    esd_format_t         format = ESD_STREAM | ESD_PLAY;
-    esd_format_t         fmt;
-    int                  esd;
-    int                  aif;
-
-    (void) dummyFile;
-
-    if ( esd_rate == 0 ) {
-        if ( (esd = esd_open_sound (NULL)) >= 0 ) {
-            info     = esd_get_server_info (esd);
-            esd_rate = info -> rate;
-            fmt      = info -> format;
-            esd_free_server_info (info);
-            esd_close (esd);
-        } else {
-            esd_rate = esd_audio_rate;
-            fmt      = esd_audio_format;
-        }
-        esd_format = AUDIO_FORMAT_UNSIGNED_8;
-        if ( (fmt & ESD_MASK_BITS) == ESD_BITS16 )
-            esd_format |= AUDIO_FORMAT_SIGNED_16;
-        esd_channels = fmt & ESD_MASK_CHAN;
-    }
-
-    switch ( (BitsPerSample + 7) / 8 ) {
-    case  1:
-        aif = AUDIO_FORMAT_UNSIGNED_8;
-        break;
-    case  2:
-        aif = AUDIO_FORMAT_SIGNED_16;
-        break;
-    default:
-        stderr_printf ( "audio: Wrong number of bits: %d\n", BitsPerSample );
-        return -1;
-    }
-
-    if ( (aif & esd_format) == 0 ) {
-        stderr_printf ( "audio: Wrong number of bits: %d\n", BitsPerSample );
-        return -1;
-    }
-    if      ( aif & AUDIO_FORMAT_SIGNED_16  )
-        format |= ESD_BITS16;
-    else if ( aif & AUDIO_FORMAT_UNSIGNED_8 )
-        format |= ESD_BITS8;
-    else
-        assert (0);
-
-    if ( Channels <= 0 )
-        Channels = 2;
-    else if ( Channels > esd_channels ) {
-        stderr_printf ( "audio: Unsupported number of channels: %d\n", Channels );
-        return -1;
-    }
-
-    if ( Channels == 1 )
-        format |= ESD_MONO;
-    else if ( Channels == 2 )
-        format |= ESD_STEREO;
-    else
-        assert (0);
-
-    if ( SampleFreq == -1 )
-        SampleFreq = esd_rate;
-    else if ( SampleFreq > esd_rate )
-        return -1;
-
-    Set_Realtime ();
-    return esd_play_stream_fallback ( format, (int)(SampleFreq + 0.5), NULL, PROG_NAME );
-}
-
-#endif /* USE_ESD_AUDIO */
-
-
-#ifdef USE_WIN_AUDIO
-
-static CRITICAL_SECTION  cs;
-static HWAVEOUT          dev                    = NULL;
-static int               ScheduledBlocks        = 0;
-static int               PlayedWaveHeadersCount = 0;          // free index
-static WAVEHDR*          PlayedWaveHeaders [MAX_WAVEBLOCKS];
-
-/* This whole thing should be rearranged to a fixed memory pool that doesn't have to be allocated and deallocated all the time */
-
-static int
-Box ( const char* msg )
-{
-    MessageBox ( NULL, msg, " "PROG_NAME": Error Message . . .", MB_OK | MB_ICONEXCLAMATION );
-    return -1;
-}
-
-
-/*
- *  This function registers already played WAVE chunks. Freeing is done by free_memory(),
- */
-
-static void CALLBACK
-wave_callback ( HWAVE hWave, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
-{
-    if ( uMsg == WOM_DONE ) {
-        EnterCriticalSection ( &cs );
-        PlayedWaveHeaders [PlayedWaveHeadersCount++] = (WAVEHDR*) dwParam1;
-        LeaveCriticalSection ( &cs );
-    }
-}
-
-
-static void
-free_memory ( void )
-{
-    WAVEHDR*  wh;
-    HGLOBAL   hg;
-
-    EnterCriticalSection ( &cs );
-    wh = PlayedWaveHeaders [--PlayedWaveHeadersCount];
-    ScheduledBlocks--;                               // decrease the number of USED blocks
-    LeaveCriticalSection ( &cs );
-
-    waveOutUnprepareHeader ( dev, wh, sizeof (WAVEHDR) );
-
-    hg = GlobalHandle ( wh -> lpData );       // Deallocate the buffer memory
-    GlobalUnlock (hg);
-    GlobalFree   (hg);
-
-    hg = GlobalHandle ( wh );                 // Deallocate the header memory
-    GlobalUnlock (hg);
-    GlobalFree   (hg);
-}
-
-
-Int
-Set_WIN_Params ( FILE_T   dummyFile ,
-                 Ldouble  SampleFreq,
-                 Uint     BitsPerSample,
-                 Uint     Channels )
-{
-    WAVEFORMATEX  outFormat;
-    UINT          deviceID = WAVE_MAPPER;
-
-    (void) dummyFile;
-
-    if ( waveOutGetNumDevs () == 0 )
-        return Box ( "No audio device present." );
-
-    outFormat.wFormatTag      = WAVE_FORMAT_PCM;
-    outFormat.wBitsPerSample  = BitsPerSample;
-    outFormat.nChannels       = Channels;
-    outFormat.nSamplesPerSec  = (unsigned long)(SampleFreq + 0.5);
-    outFormat.nBlockAlign     = (outFormat.wBitsPerSample + 7) / 8 * outFormat.nChannels;
-    outFormat.nAvgBytesPerSec = outFormat.nSamplesPerSec * outFormat.nBlockAlign;
-
-    switch ( waveOutOpen ( &dev, deviceID, &outFormat, (DWORD)wave_callback, 0, CALLBACK_FUNCTION ) ) {
-    case MMSYSERR_ALLOCATED:   return Box ( "Device is already open." );
-    case MMSYSERR_BADDEVICEID: return Box ( "The specified device is out of range." );
-    case MMSYSERR_NODRIVER:    return Box ( "There is no audio driver in this system." );
-    case MMSYSERR_NOMEM:       return Box ( "Unable to allocate sound memory." );
-    case WAVERR_BADFORMAT:     return Box ( "This audio format is not supported." );
-    case WAVERR_SYNC:          return Box ( "The device is synchronous." );
-    default:                   return Box ( "Unknown media error." );
-    case MMSYSERR_NOERROR:     break;
-    }
-
-    waveOutReset ( dev );
-    InitializeCriticalSection ( &cs );
-#if   defined USE_REALTIME
-    SetPriorityClass ( GetCurrentProcess (), REALTIME_PRIORITY_CLASS );
-#elif defined USE_NICE
-    SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
-#endif
-    return 0;
-}
-
-
-int
-WIN_Play_Samples ( const void* data, size_t len )
-{
-    HGLOBAL    hg;
-    HGLOBAL    hg2;
-    LPWAVEHDR  wh;
-    void*      allocptr;
-
-    do {
-        while ( PlayedWaveHeadersCount > 0 )                        // free used blocks ...
-            free_memory ();
-
-        if ( ScheduledBlocks < sizeof(PlayedWaveHeaders)/sizeof(*PlayedWaveHeaders) ) // wait for a free block ...
-            break;
-        Sleep (26);
-    } while (1);
-
-    if ( (hg2 = GlobalAlloc ( GMEM_MOVEABLE, len )) == NULL )   // allocate some memory for a copy of the buffer
-        return Box ( "GlobalAlloc failed." );
-
-    allocptr = GlobalLock (hg2);
-    CopyMemory ( allocptr, data, len );                         // Here we can call any modification output functions we want....
-
-    if ( (hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR))) == NULL ) // now make a header and WRITE IT!
-        return -1;
-
-    wh                   = GlobalLock (hg);
-    wh -> dwBufferLength = len;
-    wh -> lpData         = allocptr;
-
-    if ( waveOutPrepareHeader ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {
-        GlobalUnlock (hg);
-        GlobalFree   (hg);
-        return -1;
-    }
-
-    if ( waveOutWrite ( dev, wh, sizeof (WAVEHDR)) != MMSYSERR_NOERROR ) {
-        GlobalUnlock (hg);
-        GlobalFree   (hg);
-        return -1;
-    }
-
-    EnterCriticalSection ( &cs );
-    ScheduledBlocks++;
-    LeaveCriticalSection ( &cs );
-
-    return len;
-}
-
-
-int
-WIN_Audio_close ( void )
-{
-    if ( dev != NULL ) {
-
-        while ( ScheduledBlocks > 0 ) {
-            Sleep (ScheduledBlocks);
-            while ( PlayedWaveHeadersCount > 0 )                        // free used blocks ...
-                free_memory ();
-        }
-
-        waveOutReset (dev);      // reset the device
-        waveOutClose (dev);      // close the device
-        dev = NULL;
-    }
-
-    DeleteCriticalSection ( &cs );
-    ScheduledBlocks = 0;
-    return 0;
-}
-
-#endif /* USE_WIN_AUDIO */
-
-
-#ifdef USE_IRIX_AUDIO
-
-/*
- *  output_irix.c
- *
- *      Copyright (C) Aaron Holtzman - May 1999
- *      Port to IRIX by Jim Miller, SGI - Nov 1999
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GNU Make; see the file COPYING.  If not, write to
- *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <math.h>
-#include <audio.h>
-
-
-static int       init         = 0;
-static ALport    alport       = 0;
-static ALconfig  alconfig     = 0;
-static int       bytesPerWord = 1;
-static int       nChannels    = 2;
-
-
-// open the audio device for writing to
-
-int
-Set_IRIX_Params ( FILE_T dummyFile , Ldouble SampleFreq, Uint BitsPerSample, Uint Channels );
-{
-    ALpv  params [2];
-    int   dev   = AL_DEFAULT_OUTPUT;
-    int   wsize = AL_SAMPLE_16;
-
-    nChannels = Channels;
-
-    if ( init == 0 ) {
-        init     = 1;
-        alconfig = alNewConfig ();
-
-        if ( alSetQueueSize ( alconfig, BUFFER_SIZE) < 0 ) {
-            stderr_printf ( "alSetQueueSize failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        if ( alSetChannels ( alconfig, Channels) < 0 ) {
-            stderr_printf ( "alSetChannels(%d) failed: %s\n", Channels, alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        if ( alSetDevice ( alconfig, dev) < 0 ) {
-            stderr_printf ( "alSetDevice failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        if ( alSetSampFmt ( alconfig, AL_SAMPFMT_TWOSCOMP) < 0 ) {
-            stderr_printf ( "alSetSampFmt failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        alport = alOpenPort ("mppdec", "w", 0 );
-        if ( alport == 0 ) {
-            stderr_printf ( "alOpenPort failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        switch ( BitsPerSample ) {
-        case 8:
-            bytesPerWord = 1;
-            wsize        = AL_SAMPLE_8;
-            break;
-        case 16:
-            bytesPerWord = 2;
-            wsize        = AL_SAMPLE_16;
-            break;
-        case 24:
-            bytesPerWord = 4;
-            wsize        = AL_SAMPLE_24;
-            break;
-        default:
-            stderr_printf ( "Irix audio: unsupported bit with %d\n", BitsPerSample );
-            return -1;
-        }
-
-        if ( alSetWidth ( alconfig, wsize) < 0 ) {
-            stderr_printf ( "alSetWidth failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-
-        params [0].param    = AL_RATE;
-        params [0].value.ll = alDoubleToFixed ((double) SampleFreq);
-        params [1].param    = AL_MASTER_CLOCK;
-        params [1].value.i  = AL_CRYSTAL_MCLK_TYPE;
-        if ( alSetParams ( dev, params, 1) < 0 ) {
-            stderr_printf ( "alSetParams() failed: %s\n", alGetErrorString(oserror()) );
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-
-// play the sample to the already opened file descriptor
-
-int
-IRIX_Play_Samples ( const void* buff, size_t len )
-{
-    alWriteFrames ( alport, buff, len );
-    return len;
-}
-
-
-int
-IRIX_Audio_close ( void )
-{
-    alClosePort  ( alport );
-    alFreeConfig ( alconfig );
-    alport   = 0;
-    alconfig = 0;
-    init     = 0;
-    return 0;
-}
-
-#endif /* USE_IRIX_AUDIO */
-
-
-/* end of wave_out.c */
Index: /mppenc/trunk/win32/mppenc.sln
===================================================================
--- /mppenc/trunk/win32/mppenc.sln	(revision 97)
+++ /mppenc/trunk/win32/mppenc.sln	(revision 97)
@@ -0,0 +1,20 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mppenc", "mppenc.vcproj", "{15082E34-9324-469F-8423-F995B4814A37}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{15082E34-9324-469F-8423-F995B4814A37}.Debug|Win32.ActiveCfg = Debug|Win32
+		{15082E34-9324-469F-8423-F995B4814A37}.Debug|Win32.Build.0 = Debug|Win32
+		{15082E34-9324-469F-8423-F995B4814A37}.Release|Win32.ActiveCfg = Release|Win32
+		{15082E34-9324-469F-8423-F995B4814A37}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: /mppenc/trunk/win32/mppenc.vcproj
===================================================================
--- /mppenc/trunk/win32/mppenc.vcproj	(revision 97)
+++ /mppenc/trunk/win32/mppenc.vcproj	(revision 97)
@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="mppenc"
+	ProjectGUID="{15082E34-9324-469F-8423-F995B4814A37}"
+	RootNamespace="mppenc"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;MPP_ENCODER"
+				ExceptionHandling="0"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				BrowseInformation="1"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="1"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				OutputFile="$(OutDir)\$(ProjectName)_d.exe"
+				GenerateManifest="false"
+				GenerateDebugInformation="true"
+				GenerateMapFile="true"
+				MapExports="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(TargetPath) ..\bin"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;MPP_ENCODER"
+				ExceptionHandling="0"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				FloatingPointModel="2"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				CompileAs="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="winmm.lib"
+				GenerateManifest="false"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+				AllowIsolation="false"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+				EmbedManifest="false"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(TargetPath) ..\bin"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\src\analy_filter.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\ans.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\bitstream.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\cvd.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\encode_sv7.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\fastmath.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\fft4g.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\fft_routines.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\huffsv7.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\keyboard.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\mppenc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\pipeopen.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\profile.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\psy.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\psy_tab.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\quant.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\stderr.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\tags.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\tools.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\wave_in.c"
+				>
+			</File>
+			<File
+				RelativePath="..\src\winmsg.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\src\config.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\cvd.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\fastmath.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\minimax.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\mpp.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\mppdec.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\mppenc.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\predict.h"
+				>
+			</File>
+			<File
+				RelativePath="..\src\profile.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Index: penc/trunk/winmsg.c
===================================================================
--- /mppenc/trunk/winmsg.c	(revision 96)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Musepack audio compression
- * Copyright (C) 1999-2004 Buschmann/Klemm/Piecha/Wolf
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "mppenc.h"
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-static HWND  FrontEndHandle;
-
-
-int
-SearchForFrontend ( void )
-{
-    FrontEndHandle = FindWindow ( NULL, "mpcdispatcher" );      // check for dispatcher window and (send startup-message???)
-
-    return FrontEndHandle != 0;
-}
-
-
-static void
-SendMsg ( const char* s )
-{
-    COPYDATASTRUCT  MsgData;
-
-    MsgData.dwData = 3;         // build message
-    MsgData.lpData = (char*)s;
-    MsgData.cbData = strlen(s) + 1;
-
-    SendMessage ( FrontEndHandle, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &MsgData );  // send message
-}
-
-
-void
-SendStartupMessage ( const char*  Version,
-                     const int    SV,
-                     const char*  Build )
-{
-    char  startup [120];
-
-    sprintf ( startup, "#START#MP+ v%s SV%i %s#", Version, SV, Build );   // fill startup-message
-    SendMsg ( startup );
-}
-
-
-void
-SendQuitMessage ( void )
-{
-    SendMsg ("#EOF#");
-}
-
-
-void
-SendModeMessage ( const int Profile )
-{
-    char  message [32];
-
-    sprintf ( message, "#PARAM#%d#", Profile-8 );  // fill message
-    SendMsg ( message );
-}
-
-
-void                                            /* sends progress information to the frontend */
-SendProgressMessage ( const int    bitrate,
-                      const float  speed,
-                      const float  percent )
-{
-    char  message [64];
-
-    sprintf ( message, "#STAT#%4ik %5.2fx %5.1f%%#", bitrate, speed, percent );
-    SendMsg ( message );
-}
-
-#endif /* _WIN32 */
Index: penc/trunk/wp.c
===================================================================
--- /mppenc/trunk/wp.c	(revision 96)
+++ 	(revision )
@@ -1,684 +1,0 @@
-
-/*
-   Performance (ReiserFS Disk IO)
-   Test of all extensions
-   Determine file length at the beginning
-   Keyboard shortcuts
-   Too early abort with unfiltered WAVs
-   No Wait for Coprocesses
-   AAC doesn't work
-   Process ID3 Tags V1/1.1
-   Playlength is only correct with 4 Bytes per Sample (2*16 bit)
-   No support of 24 or 32 bit
- */
-
-#define USE_OSS_AUDIO
-#define USE_NICE
-#define USE_REALTIME
-#define BLOCK             1024
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-#include <memory.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-typedef struct {
-    const char* const  ext;
-    const char* const  argv [8];
-} decoder_t;
-
-// ogg, mpc, mp3, mp2,
-
-
-#define PATH      "/usr/local/bin/"
-#define STDERR    " 2> /dev/null"
-
-const decoder_t  decoder [] = {
-    { ".mp1"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer I         : www.iis.fhg.de, www.mpeg.org
-    { ".mp2"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer II        : www.iis.fhg.de, www.uq.net.au/~zzmcheng, www.mpeg.org
-    { ".mp3"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mp3pro" , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mpt"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mpp"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".mpc"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".mp+"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".aac"    , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { ".mp4"    , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { "aac.lqt" , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { ".ac3"    , { PATH"ac3dec" , "/dev/fd/0"                                             , NULL }},  // Dolby AC3            : www.att.com
-    { "ac3.lqt" , { PATH"ac3dec" , "/dev/fd/0"                                             , NULL }},  // Dolby AC3            : www.att.com
-//  { ".ogg"    , { PATH"ogg123" , "-d", "wav", "-o", "file:/dev/fd/1", "/dev/fd/0"        , NULL }},  // Ogg Vorbis           : www.xiph.org/ogg/vorbis/index.html
-    { ".ogg"    , { PATH"ogg123" , "-d", "wav", "-f", "/dev/fd/1", "/dev/fd/0"             , NULL }},  // Ogg Vorbis           : www.xiph.org/ogg/vorbis/index.html
-    { ".pac"    , { PATH"lpac"   , "-x", "-o", "/dev/fd/0"                                 , NULL }},  // Lossless predictive Audio Compression: www-ft.ee.tu-berlin.de/~liebchen/lpac.html (liebchen@ft.ee.tu-berlin.de)
-    { ".shn"    , { PATH"shorten", "-x"                                                    , NULL }},  // Shorten              : shnutils.freeshell.org, www.softsound.com/Shorten.html (shnutils@freeshell.org, shorten@softsound.com)
-    { ".gz"     , { "gzip"       , "-d"                                                    , NULL }},  // gziped WAV
-    { ".sz"     , { PATH"szip"   , "-d"                                                    , NULL }},  // sziped WAV
-    { ".sz2"    , { PATH"szip2"  , "-d"                                                    , NULL }},  // sziped WAV
-    { ".bz"     , { PATH"bzip"   , "-d", "-"                                               , NULL }},  // bziped WAV
-    { ".bz2"    , { "bzip2"      , "-d", "-"                                               , NULL }},  // bziped WAV
-    { ".raw"    , { "sox"        , "-r44100 -sw -c2 -traw /dev/fd/0 -twav -sw -"           , NULL }},  // raw files are treated as CD like audio
-    { ".cdr"    , { "sox"        , "-r44100 -sw -c2 -traw /dev/fd/0 -twav -sw -"           , NULL }},  // CD-DA files are treated as CD like audio, no preemphasis info available
-    { ".flac"   , { PATH"flac"   , "-c", "-d", "/dev/fd/0"                                 , NULL }},  // Free Lossless Audio Coder: flac.sourceforge.net/
-    { ".fla"    , { PATH"flac"   , "-c", "-d", "/dev/fd/0"                                 , NULL }},  // Free Lossless Audio Coder: flac.sourceforge.net/
-    { ".ape"    , { PATH"mac"    , "/dev/stdin", "/dev/stdout", "-d"                       , NULL }},  // APE
-    { ".ofr"    , { PATH"optimfrog", "d", "/dev/fd/0", "-"                                 , NULL }},  // OFR
-    { ".la"     , { PATH"la"     , "-console", "/dev/fd/0"                                 , NULL }},  // LA
-    { ".mod"    , { "xmp"        , "-b16", "-c", "-f44100", "--stereo", "-o-", "/dev/fd/0" , NULL }},  // Amiga's Music on Disk:
-//  { ""        , { "sox"        , "/dev/fd/0", "-twav", "-sw", "-"                        , NULL }},  // Rest, maybe SOX can handle it
-};
-
-#undef PATH
-
-#if defined USE_OSS_AUDIO
-# include <sys/ioctl.h>
-# include <sys/time.h>
-# if   defined __linux__
-#  include <linux/soundcard.h>
-# elif defined __bsdi__
-#  include <sys/soundcard.h>
-# elif defined __FreeBSD__
-#  include <machine/soundcard.h>
-# elif defined __NetBSD__  ||  defined __OpenBSD__
-#  include <soundcard.h>
-# else
-#  include <soundcard.h>
-# endif
-#endif /* USE_OSS_AUDIO */
-
-#if defined USE_ESD_AUDIO
-# include <esd.h>
-#endif
-
-#if defined USE_SUN_AUDIO
-# include <sys/audioio.h>
-#endif
-
-#if defined USE_NICE
-# include <sys/resource.h>
-#endif
-
-// scheduler stuff
-#if defined USE_REALTIME
-# include <sched.h>
-#endif
-
-#ifndef O_BINARY
-# ifdef _O_BINARY
-#  define O_BINARY              _O_BINARY
-# else
-#  define O_BINARY              0
-# endif
-#endif
-
-#if defined _WIN32  ||  defined __TURBOC__
-# define strncasecmp(s1,s2,n)   strnicmp (s1, s2, n)
-# define strcasecmp(s1,s2,n)    stricmp (s1, s2)
-#endif
-
-static void
-Set_Realtime ( void )
-{
-# if defined USE_REALTIME               // works for all POSIX 1b-conform systems, also the memory should be locked
-    struct sched_param  sp;
-
-    memset      ( &sp, 0, sizeof(sp) );
-    seteuid     ( 0 );
-    sp.sched_priority = sched_get_priority_min ( SCHED_FIFO );
-    sched_setscheduler ( 0, SCHED_RR, &sp );
-    seteuid     ( getuid() );
-# endif
-
-# if defined USE_NICE
-    seteuid     ( 0 );
-    setpriority ( PRIO_PROCESS, getpid(), -20 );
-    seteuid     ( getuid() );
-# endif
-}
-
-
-
-
-/*
- *
- *  Manpages of pipe(2), fork(2), dup2(2), execve(2) respectively exec(3), including waitpid(2) respectively sigaction(2)+signal(7).
- *
- *   1) create a pipe with pipe(2)
- *   2) fork(2)
- *
- *  if fork successful:
- *
- *  Parent process:
- *   E3) close the write end of the pipe
- *   E4) read the data from the pipe, wait for the end of the child and process errors
- *   E5) clean up
- *
- *  Child process:
- *   K3) close the write end of the pipe
- *   K4) dup2(2)licate fd on stdin
- *   K5) dup2(2)licate the write end of the pipe on stdout
- *   K6) think of something good for stderr ;-)
- *   K7) exec(2/3)ute A
- *
- */
-
-
-int
-filter ( int fdi, char** argv )
-{
-    int    fd [2];
-    pid_t  pid;
-    int    i;
-
-    if ( 0 != pipe (fd) )
-        exit (1);
-
-    pid = fork ();
-
-    switch ( pid ) {
-    case -1: /* error */
-        exit (2);
-
-    case  0: /* child process */
-        dup2   ( fdi   , STDIN_FILENO  );
-        dup2   ( fd [1], STDOUT_FILENO );
-        close  ( STDERR_FILENO );
-        for ( i = 3; i < 256; i++ )
-           close (i);
-        Set_Realtime ();
-        execvp ( argv [0], argv );
-        break;
-
-    default: /* parent process */
-        close (fd [1]);
-        break;
-    }
-//    fcntl ( fd [0], F_SETFD, FD_CLOEXEC);
-
-    return fd [0];
-}
-
-
-int
-test_for_filters ( int fd, const char* name )
-{
-    const char*  nameend = name + strlen(name);
-    size_t       i;
-    size_t       sl;
-
-rep:
-    for ( i = 0; i < sizeof(decoder)/sizeof(*decoder); i++ ) {
-        sl = strlen(decoder[i].ext);
-        if (nameend - sl >= name  &&
-            0 == strncasecmp (nameend - sl, decoder[i].ext, sl) ) {
-            nameend -= sl;
-            fd = filter (fd, decoder[i].argv );
-            goto rep;
-        }
-    }
-    return fd;
-}
-
-
-
-typedef unsigned long  u32;
-typedef unsigned short u16;
-typedef unsigned char  label[4];
-
-typedef struct {
-    label riff;
-    u32   File_Length;
-} Prefix;
-
-typedef struct {
-    u16 is_PCM;
-    u16 Channels;
-    u32 Sample_Frequency;
-    u32 Bytes_per_sec;
-    u16 Bytes_per_Sample;
-    u16 Bits;
-} Format;
-
-typedef struct {
-    Prefix P;
-    label  wave;
-    label  fmt;
-    u32    fmt_Length;
-    Format F;
-    label  data;
-    u32    Sample_Length;
-} Header;
-
-
-
-static long
-defaults ( long val, long std )
-{
-    return val ? val : std;
-}
-
-static void
-message ( unsigned long samples, unsigned long samptot, unsigned long sampfreq )
-{
-    if ( samptot > 0  &&  samptot < 100*60*sampfreq )
-        fprintf ( stderr, "%2u:%02u.%03u/%2u:%02u.%03u\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b",
-                  samples/sampfreq/60, samples/sampfreq%60, samples%sampfreq*1000/sampfreq,
-                  samptot/sampfreq/60, samptot/sampfreq%60, samptot%sampfreq*1000/sampfreq );
-    else
-        fprintf ( stderr, "%2u:%02u.%03u\b\b\b\b\b\b\b\b\b",
-                  samples/sampfreq/60, samples/sampfreq%60, samples%sampfreq*1000/sampfreq );
-}
-
-
-static int    last_channels = -1;
-static int    last_freq     = -1;
-static int    last_fmt      = -1;
-static int    last_size     = -1;
-
-static int    channels;
-static int    freq;
-static int    fmt;
-static int    size;
-
-static unsigned char       A [BLOCK * 8 * 4];
-static signed short        B [BLOCK] [2];
-
-
-static void
-play ( int fdd, int fd, const char* name )
-{
-    Header              H;
-    int                 org;      /* argument for ioctl calls */
-    int                 arg;      /* argument for ioctl calls */
-    int                 status;   /* return status of system calls */
-    unsigned long       filelen;
-    unsigned long long  toplay;
-    unsigned long       totalsamples;
-    size_t              len;
-    size_t              tmp;
-    ssize_t             bytesread;
-    ssize_t             byteswrote;
-    size_t              samples;
-    size_t              totalread;
-    int                 i;
-    int                 finish;
-    unsigned char*      p;
-
-
-    if ( sizeof (H) != 44 ) {
-        fprintf ( stderr,"%s: program malfunction: Header struct not 44 bytes long.\nCompile without struct alignment and try again.\a\n", "wp" );
-        exit (1);
-    }
-
-    fd = test_for_filters ( fd, name );
-
-    if ( sizeof(H)-8 != read ( fd, &H, sizeof (H)-8 ))
-        return;
-
-    fprintf (stderr, "\r\033[7m\r%s\033[0m\033[K\n", name );
-    if ( 0 != memcmp (H.P.riff, "RIFF", 4) ) {
-        fprintf (stderr, "not a WAV file\n");
-        return;
-    }
-
-    do {
-        memmove (H.data+0, H.data+1, 3);
-        if (read (fd, H.data+3, 1) != 1)
-            return;
-    } while ( 0 != memcmp (H.data, "data", 4) );
-    read ( fd, &H.Sample_Length, 4 );
-
-    freq     = defaults (H.F.Sample_Frequency, 44100);  /* set sampling parameters: sampling rate */
-    channels = defaults (H.F.Channels, 2);              /* set sampling parameters: mono or stereo */
-    size     = defaults (H.F.Channels ? 8*H.F.Bytes_per_Sample/H.F.Channels : 0, 16);      /* set sampling parameters: sample size */
-
-#if 0
-    // Moved to front
-    if ( -1 == (status = ioctl (fdd, SOUND_PCM_SYNC, 0)) )
-        perror ("SOUND_PCM_SYNC ioctl failed");
-#endif
-
-    org = arg = 2;
-    if ( arg != last_channels  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_CHANNELS, &arg)) )
-        perror ("SOUND_PCM_WRITE_CHANNELS ioctl failed");
-    if (arg != org)
-        perror ("unable to set number of channels");
-    last_channels = arg;
-
-    org = arg = 16;
-    if ( arg != last_size  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_BITS, &arg)) )
-        perror ("SOUND_PCM_WRITE_BITS ioctl failed");
-    if (arg != org)
-        perror ("unable to set sample size");
-    last_size = arg;
-
-    org = arg = org <= 8  ?  AFMT_U8  :  AFMT_S16_LE;
-    if ( arg != last_fmt  &&  -1 == ioctl (fdd, SNDCTL_DSP_SETFMT, &arg) )
-        perror ("SNDCTL_DSP_SETFMT ioctl failed");
-    if ((arg & org) == 0)
-        perror ("unable to set data format");
-    last_fmt = arg;
-
-    org = arg = freq;                   /* set sampling parameters: sampling rate */
-    if ( arg != last_freq  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_RATE, &arg)) )
-        perror ("SOUND_PCM_WRITE_WRITE ioctl failed");
-    last_freq = arg;
-
-    fprintf (stderr, "\r%1u*%2u bit %5u Hz:   ", channels, size, freq );
-    fflush (stderr);
-
-    toplay = H.Sample_Length < 0x7FFFFFFF  &&  H.Sample_Length > 0
-           ? H.Sample_Length / (channels*(size/8))
-           : 0xFFFFFFFFFFFFFFFF;
-
-    totalread    = 0;
-    totalsamples = 0;
-
-    message ( totalsamples, toplay, freq );
-
-    for ( finish = 0; !finish; ) {
-
-        if ( toplay-totalsamples <= BLOCK )
-            len = (toplay-totalsamples) * channels * (size/8), finish = 1;
-        else
-            len = BLOCK * channels * (size/8);
-
-        bytesread = 0;
-        do {
-            tmp = read ( fd, A+bytesread, len-bytesread );
-            if ( tmp <= 0 ) {
-                finish = 1;
-                break;
-            }
-            bytesread += tmp;
-        } while ( bytesread < len );
-
-        totalread    += bytesread;
-        samples       = bytesread / (channels * (size/8));
-        totalsamples += samples;
-
-        message ( totalsamples, toplay, freq );
-
-        p = A;
-        switch (channels) {
-        case 1:
-            switch (size) {
-            case  8:
-                for ( i = 0; i < samples; i++, p++ )
-                    B [i][0] = B [i][1] = (*p-128) << 8;
-                break;
-            case 16:
-                for ( i = 0; i < samples; i++, p+=2 )
-                    B [i][0] = B [i][1] = *(short*)(p);
-                break;
-            case 24:
-                for ( i = 0; i < samples; i++, p+=3 )
-                    B [i][0] = B [i][1] = *(short*)(p+1);
-                break;
-            case 32:
-                for ( i = 0; i < samples; i++, p+=4 )
-                    B [i][0] = B [i][1] = *(short*)(p+2);
-                break;
-            }
-            break;
-
-        case 2:
-            switch (size) {
-            case  8:
-                for ( i = 0; i < samples; i++, p+=2 )
-                    B [i][0] = (p[0]-128) << 8,
-                    B [i][1] = (p[1]-128) << 8;
-                break;
-            case 16:
-                for ( i = 0; i < samples; i++, p+=4 )
-                    B [i][0] = *(short*)(p+0),
-                    B [i][1] = *(short*)(p+2);
-                break;
-            case 24:
-                for ( i = 0; i < samples; i++, p+=6 )
-                    B [i][0] = *(short*)(p+1),
-                    B [i][1] = *(short*)(p+4);
-                break;
-            case 32:
-                for ( i = 0; i < samples; i++, p+=8 )
-                    B [i][0] = *(short*)(p+2),
-                    B [i][1] = *(short*)(p+6);
-                break;
-            }
-            break;
-
-        default:
-            switch (size) {
-            case  8:
-                for ( i = 0; i < samples; i++, p+=1*channels )
-                    B [i][0] = (p[0]-128) << 8,
-                    B [i][0] = (p[1]-128) << 8;
-                break;
-            case 16:
-                for ( i = 0; i < samples; i++, p+=2*channels )
-                    B [i][0] = *(short*)(p+0),
-                    B [i][0] = *(short*)(p+2);
-                break;
-            case 24:
-                for ( i = 0; i < samples; i++, p+=3*channels )
-                    B [i][0] = *(short*)(p+1),
-                    B [i][0] = *(short*)(p+4);
-                break;
-            case 32:
-                for ( i = 0; i < samples; i++, p+=4*channels )
-                    B [i][0] = *(short*)(p+2),
-                    B [i][0] = *(short*)(p+6);
-                break;
-            }
-            break;
-        }
-
-        len = samples * (16/8 * 2);
-        byteswrote = 0;
-
-        while ( byteswrote < len ) {
-            tmp = write ( fdd, B+byteswrote, len-byteswrote );
-            if ( tmp <= 0 ) {
-                perror ("Wrote wrong number of bytes");
-                finish = 1;
-                break;
-            }
-            byteswrote += tmp;
-        }
-    }
-
-    return;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    int           fds;
-    int           fdd;
-    int           fdm;
-    int           org;      /* argument for ioctl calls */
-    int           arg;      /* argument for ioctl calls */
-    int           status;   /* return status of system calls */
-    const char*   name;
-
-    seteuid     ( getuid() );
-
-#if 0
-    if ( (fdd = open ("/dev/audio0", O_WRONLY)) < 0 ) {  /* open sound device */
-        perror ("open of /dev/audio0 failed");
-        return 1;
-    }
-    if ( (fdm = open ("/dev/mixer0", O_RDWR)) < 0 ) {    /* open mixer device */
-        perror ("open of /dev/mixer0 failed");
-        return 1;
-    }
-
-    org = arg = 0x6060;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_VOLUME, &arg)) )
-        perror ("SOUND_MIXER_WRITE_VOLUME ioctl failed");
-    org = arg = 0x5A5A;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_PCM, &arg)) )
-        perror ("SOUND_MIXER_WRITE_PCM ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_MIC, &arg)) )
-        perror ("SOUND_MIXER_WRITE_MIC ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_SYNTH, &arg)) )
-        perror ("SOUND_MIXER_WRITE_SYNTH ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_IMIX, &arg)) )
-        perror ("SOUND_MIXER_WRITE_IMIX ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE1, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE1 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE2, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE2 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE3, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE3 ioctl failed");
-    close (fdm);
-#else
-    if ( (fdd = open ("/dev/audio2", O_WRONLY)) < 0 ) {  /* open sound device */
-        perror ("open of /dev/audio2 failed");
-        return 1;
-    }
-    if ( (fdm = open ("/dev/mixer1", O_RDWR)) < 0 ) {    /* open mixer device */
-        perror ("open of /dev/mixer1 failed");
-        return 1;
-    }
-
-    org = arg = 0x6060;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_VOLUME, &arg)) )
-        perror ("SOUND_MIXER_WRITE_VOLUME ioctl failed");
-    org = arg = 0x5A5A;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_PCM, &arg)) )
-        perror ("SOUND_MIXER_WRITE_PCM ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_MIC, &arg)) )
-        perror ("SOUND_MIXER_WRITE_MIC ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_SYNTH, &arg)) )
-        perror ("SOUND_MIXER_WRITE_SYNTH ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_IMIX, &arg)) )
-        perror ("SOUND_MIXER_WRITE_IMIX ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE1, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE1 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE2, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE2 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE3, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE3 ioctl failed");
-    close (fdm);
-#endif    
-
-#if 0
-
-#define SOUND_MIXER_SPEAKER      5
-#define SOUND_MIXER_LINE         6
-#define SOUND_MIXER_CD           8
-#define SOUND_MIXER_ALTPCM      10
-#define SOUND_MIXER_RECLEV      11      /* Recording level */
-#define SOUND_MIXER_IGAIN       12      /* Input gain */
-#define SOUND_MIXER_OGAIN       13      /* Output gain */
-#define SOUND_MIXER_DIGITAL1    17      /* Digital (input) 1 */
-#define SOUND_MIXER_DIGITAL2    18      /* Digital (input) 2 */
-#define SOUND_MIXER_DIGITAL3    19      /* Digital (input) 3 */
-#define SOUND_MIXER_PHONEIN     20      /* Phone input */
-#define SOUND_MIXER_PHONEOUT    21      /* Phone output */
-#define SOUND_MIXER_VIDEO       22      /* Video/TV (audio) in */
-#define SOUND_MIXER_RADIO       23      /* Radio in */
-#define SOUND_MIXER_MONITOR     24      /* Monitor (usually mic) volume */
-
-#endif
-
-    mlock (A, sizeof (A) );
-    mlock (B, sizeof (B) );
-    Set_Realtime ();
-
-    if ( argc <= 1 )
-        play ( fdd, 0, "<stdin>" );
-    else
-        while ( (name = *++argv) != NULL ) {
-            if ( (fds = open (*argv, O_RDONLY)) < 0 ) {
-                perror ("open of file failed");
-                continue;
-            }
-            play  ( fdd, fds, name );
-            close ( fds );
-        }
-
-    write (fdd, "\0\0\0\0\0\0\0\0\0\0\0\0", 12);
-    close (fdd);
-    fprintf (stderr, "\n");
-    return 0;
-}
-
-
-#if 0
-
-static struct termios stored_settings;
-
-
-void reset ( void )
-{
-    tcsetattr ( 0, TCSANOW, &stored_settings );
-}
-
-
-void set ( void )
-{
-    struct termios new_settings;
-
-    tcgetattr ( 0, &stored_settings );
-    new_settings = stored_settings;
-
-    new_settings.c_lflag    &= ~ECHO;
-    /* Disable canonical mode, and set buffer size to 1 byte */
-    new_settings.c_lflag    &= ~ICANON;
-    new_settings.c_cc[VTIME] = 0;
-    new_settings.c_cc[VMIN]  = 1;
-
-    tcsetattr(0,TCSANOW,&new_settings);
-    return;
-}
-
-
-int sel ( void )
-{
-    struct timeval  t;
-    fd_set          fd [1];
-    int             ret;
-    unsigned char   c;
-
-    FD_SET (0, fd);
-    t.tv_sec  = 0;
-    t.tv_usec = 0;
-
-    ret = select ( 1, fd, NULL, NULL, &t );
-
-    switch ( ret ) {
-    case  0:
-        return -1;
-    case  1:
-        ret = read (0, &c, 1);
-        return ret == 1  ?  c  :  -1;
-    default:
-        return -2;
-    }
-}
-
-#endif
Index: penc/trunk/wp.c-
===================================================================
--- /mppenc/trunk/wp.c-	(revision 96)
+++ 	(revision )
@@ -1,680 +1,0 @@
-
-/*
-   Performance (ReiserFS Disk IO)
-   Test of all extensions
-   Determine file length at the beginning
-   Keyboard shortcuts
-   Too early abort with unfiltered WAVs
-   No Wait for Coprocesses
-   AAC doesn't work
-   Process ID3 Tags V1/1.1
-   Playlength is only correct with 4 Bytes per Sample (2*16 bit)
-   No support of 24 or 32 bit
- */
-
-#define USE_OSS_AUDIO
-#define USE_NICE
-#define USE_REALTIME
-#define BLOCK             1024
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-#include <memory.h>
-#include <math.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-typedef struct {
-    const char* const  ext;
-    const char* const  argv [8];
-} decoder_t;
-
-// ogg, mpc, mp3, mp2,
-
-
-#define PATH      "/usr/local/bin/"
-#define STDERR    " 2> /dev/null"
-
-const decoder_t  decoder [] = {
-    { ".mp1"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer I         : www.iis.fhg.de, www.mpeg.org
-    { ".mp2"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer II        : www.iis.fhg.de, www.uq.net.au/~zzmcheng, www.mpeg.org
-    { ".mp3"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mp3pro" , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mpt"    , { PATH"mpg123" , "-w", "-", "/dev/fd/0"                                  , NULL }},  // MPEG Layer III       : www.iis.fhg.de, www.mp3dev.org/mp3, www.mpeg.org
-    { ".mpp"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".mpc"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".mp+"    , { PATH"mppdec" , "-", "-"                                                , NULL }},  // MPEGplus             : www.stud.uni-hannover.de/user/73884
-    { ".aac"    , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { ".mp4"    , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { "aac.lqt" , { PATH"faad"   , "-t.wav", "-w", "/dev/fd/0"                             , NULL }},  // Advanced Audio Coding: psytel.hypermart.net, www.aac-tech.com, sourceforge.net/projects/faac, www.aac-audio.com, www.mpeg.org
-    { ".ac3"    , { PATH"ac3dec" , "/dev/fd/0"                                             , NULL }},  // Dolby AC3            : www.att.com
-    { "ac3.lqt" , { PATH"ac3dec" , "/dev/fd/0"                                             , NULL }},  // Dolby AC3            : www.att.com
-//  { ".ogg"    , { PATH"ogg123" , "-d", "wav", "-o", "file:/dev/fd/1", "/dev/fd/0"        , NULL }},  // Ogg Vorbis           : www.xiph.org/ogg/vorbis/index.html
-    { ".ogg"    , { PATH"ogg123" , "-d", "wav", "-f", "/dev/fd/1", "/dev/fd/0"             , NULL }},  // Ogg Vorbis           : www.xiph.org/ogg/vorbis/index.html
-    { ".pac"    , { PATH"lpac"   , "-x", "-o", "/dev/fd/0"                                 , NULL }},  // Lossless predictive Audio Compression: www-ft.ee.tu-berlin.de/~liebchen/lpac.html (liebchen@ft.ee.tu-berlin.de)
-    { ".shn"    , { PATH"shorten", "-x"                                                    , NULL }},  // Shorten              : shnutils.freeshell.org, www.softsound.com/Shorten.html (shnutils@freeshell.org, shorten@softsound.com)
-    { ".gz"     , { "gzip"       , "-d"                                                    , NULL }},  // gziped WAV
-    { ".sz"     , { PATH"szip"   , "-d"                                                    , NULL }},  // sziped WAV
-    { ".sz2"    , { PATH"szip2"  , "-d"                                                    , NULL }},  // sziped WAV
-    { ".bz"     , { PATH"bzip"   , "-d", "-"                                               , NULL }},  // bziped WAV
-    { ".bz2"    , { "bzip2"      , "-d", "-"                                               , NULL }},  // bziped WAV
-    { ".raw"    , { "sox"        , "-r44100 -sw -c2 -traw /dev/fd/0 -twav -sw -"           , NULL }},  // raw files are treated as CD like audio
-    { ".cdr"    , { "sox"        , "-r44100 -sw -c2 -traw /dev/fd/0 -twav -sw -"           , NULL }},  // CD-DA files are treated as CD like audio, no preemphasis info available
-    { ".flac"   , { PATH"flac"   , "-c", "-d", "/dev/fd/0"                                 , NULL }},  // Free Lossless Audio Coder: flac.sourceforge.net/
-    { ".fla"    , { PATH"flac"   , "-c", "-d", "/dev/fd/0"                                 , NULL }},  // Free Lossless Audio Coder: flac.sourceforge.net/
-    { ".ape"    , { PATH"mac"    , "/dev/stdin", "/dev/stdout", "-d"                       , NULL }},  // APE
-    { ".ofr"    , { PATH"optimfrog", "d", "/dev/fd/0", "-"                                 , NULL }},  // OFR
-    { ".la"     , { PATH"la"     , "-console", "/dev/fd/0"                                 , NULL }},  // LA
-    { ".mod"    , { "xmp"        , "-b16", "-c", "-f44100", "--stereo", "-o-", "/dev/fd/0" , NULL }},  // Amiga's Music on Disk:
-//  { ""        , { "sox"        , "/dev/fd/0", "-twav", "-sw", "-"                        , NULL }},  // Rest, may be sox can handle it
-};
-
-#undef PATH
-
-#if defined USE_OSS_AUDIO
-# include <sys/ioctl.h>
-# include <sys/time.h>
-# if   defined __linux__
-#  include <linux/soundcard.h>
-# elif defined __bsdi__
-#  include <sys/soundcard.h>
-# elif defined __FreeBSD__
-#  include <machine/soundcard.h>
-# elif defined __NetBSD__  ||  defined __OpenBSD__
-#  include <soundcard.h>
-# else
-#  include <soundcard.h>
-# endif
-#endif /* USE_OSS_AUDIO */
-
-#if defined USE_ESD_AUDIO
-# include <esd.h>
-#endif
-
-#if defined USE_SUN_AUDIO
-# include <sys/audioio.h>
-#endif
-
-#if defined USE_NICE
-# include <sys/resource.h>
-#endif
-
-// scheduler stuff
-#if defined USE_REALTIME
-# include <sched.h>
-#endif
-
-#ifndef O_BINARY
-# ifdef _O_BINARY
-#  define O_BINARY              _O_BINARY
-# else
-#  define O_BINARY              0
-# endif
-#endif
-
-#if defined _WIN32  ||  defined __TURBOC__
-# define strncasecmp(s1,s2,n)   strnicmp (s1, s2, n)
-# define strcasecmp(s1,s2,n)    stricmp (s1, s2)
-#endif
-
-static void
-Set_Realtime ( void )
-{
-# if defined USE_REALTIME               // works for all POSIX 1b-conform systems, also the memory should be locked
-    struct sched_param  sp;
-
-    memset      ( &sp, 0, sizeof(sp) );
-    seteuid     ( 0 );
-    sp.sched_priority = sched_get_priority_min ( SCHED_FIFO );
-    sched_setscheduler ( 0, SCHED_RR, &sp );
-    seteuid     ( getuid() );
-# endif
-
-# if defined USE_NICE
-    seteuid     ( 0 );
-    setpriority ( PRIO_PROCESS, getpid(), -20 );
-    seteuid     ( getuid() );
-# endif
-}
-
-
-
-
-/*
- *
- *  Manpages of pipe(2), fork(2), dup2(2), execve(2) respectively exec(3), including waitpid(2) respectively sigaction(2)+signal(7).
- *
- *   1) create a pipe with pipe(2)
- *   2) fork(2)
- *
- *  if fork successful:
- *
- *  Parent process:
- *   E3) close the write end of the pipe
- *   E4) read the data from the pipe, wait for the end of the child and process errors
- *   E5) clean up
- *
- *  Child process:
- *   K3) close the write end of the pipe
- *   K4) dup2(2)licate fd on stdin
- *   K5) dup2(2)licate the write end of the pipe on stdout
- *   K6) think of something good for stderr ;-)
- *   K7) exec(2/3)ute A
- *
- */
-
-
-int
-filter ( int fdi, char** argv )
-{
-    int    fd [2];
-    pid_t  pid;
-    int    i;
-
-    if ( 0 != pipe (fd) )
-        exit (1);
-
-    pid = fork ();
-
-    switch ( pid ) {
-    case -1: /* error */
-        exit (2);
-
-    case  0: /* child process */
-        dup2   ( fdi   , STDIN_FILENO  );
-        dup2   ( fd [1], STDOUT_FILENO );
-        close  ( STDERR_FILENO );
-        for ( i = 3; i < 256; i++ )
-           close (i);
-        Set_Realtime ();
-        execvp ( argv [0], argv );
-        break;
-
-    default: /* parent process */
-        close (fd [1]);
-        break;
-    }
-//    fcntl ( fd [0], F_SETFD, FD_CLOEXEC);
-
-    return fd [0];
-}
-
-
-int
-test_for_filters ( int fd, const char* name )
-{
-    const char*  nameend = name + strlen(name);
-    size_t       i;
-    size_t       sl;
-
-rep:
-    for ( i = 0; i < sizeof(decoder)/sizeof(*decoder); i++ ) {
-        sl = strlen(decoder[i].ext);
-        if (nameend - sl >= name  &&
-            0 == strncasecmp (nameend - sl, decoder[i].ext, sl) ) {
-            nameend -= sl;
-            fd = filter (fd, decoder[i].argv );
-            goto rep;
-        }
-    }
-    return fd;
-}
-
-
-
-typedef unsigned long  u32;
-typedef unsigned short u16;
-typedef unsigned char  label[4];
-
-typedef struct {
-    label riff;
-    u32   File_Length;
-} Prefix;
-
-typedef struct {
-    u16 is_PCM;
-    u16 Channels;
-    u32 Sample_Frequency;
-    u32 Bytes_per_sec;
-    u16 Bytes_per_Sample;
-    u16 Bits;
-} Format;
-
-typedef struct {
-    Prefix P;
-    label  wave;
-    label  fmt;
-    u32    fmt_Length;
-    Format F;
-    label  data;
-    u32    Sample_Length;
-} Header;
-
-
-
-static long
-defaults ( long val, long std )
-{
-    return val ? val : std;
-}
-
-static void
-message ( unsigned long samples, unsigned long samptot, unsigned long sampfreq )
-{
-    if ( samptot > 0  &&  samptot < 100*60*sampfreq )
-        fprintf ( stderr, "%2u:%02u.%03u/%2u:%02u.%03u\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b",
-                  samples/sampfreq/60, samples/sampfreq%60, samples%sampfreq*1000/sampfreq,
-                  samptot/sampfreq/60, samptot/sampfreq%60, samptot%sampfreq*1000/sampfreq );
-    else
-        fprintf ( stderr, "%2u:%02u.%03u\b\b\b\b\b\b\b\b\b",
-                  samples/sampfreq/60, samples/sampfreq%60, samples%sampfreq*1000/sampfreq );
-}
-
-
-static int    last_channels = -1;
-static int    last_freq     = -1;
-static int    last_fmt      = -1;
-static int    last_size     = -1;
-
-static int    channels;
-static int    freq;
-static int    fmt;
-static int    size;
-
-static unsigned char       A [BLOCK * 8 * 4];
-static signed short        B [BLOCK] [2];
-
-
-static inline int
-r ( double x )
-{
-    long  l = (long) floor ( x + 0.5 );
-
-    if ( (short)l == l )
-        return (short)l;
-    return (short) ( (l << 31) ^ 0x7FFF );
-}
-
-
-static void
-play ( int fdd, int fd, const char* name )
-{
-    Header              H;
-    int                 org;      /* argument for ioctl calls */
-    int                 arg;      /* argument for ioctl calls */
-    int                 status;   /* return status of system calls */
-    unsigned long       filelen;
-    unsigned long long  toplay;
-    unsigned long       totalsamples;
-    size_t              len;
-    size_t              tmp;
-    ssize_t             bytesread;
-    ssize_t             byteswrote;
-    size_t              samples;
-    size_t              totalread;
-    int                 i;
-    int                 j;
-    int                 finish;
-    unsigned char*      p;
-    short               ch [8];
-
-
-    if ( sizeof (H) != 44 ) {
-        fprintf ( stderr,"%s: program malfunction: Header struct not 44 bytes long.\nCompile without struct alignment and try again.\a\n", "wp" );
-        exit (1);
-    }
-
-    fd = test_for_filters ( fd, name );
-
-    if ( sizeof(H)-8 != read ( fd, &H, sizeof (H)-8 ))
-        return;
-
-    fprintf (stderr, "\r\033[7m\r%s\033[0m\033[K\n", name );
-    if ( 0 != memcmp (H.P.riff, "RIFF", 4) ) {
-        fprintf (stderr, "not a WAV file\n");
-        return;
-    }
-
-    do {
-        memmove (H.data+0, H.data+1, 3);
-        if (read (fd, H.data+3, 1) != 1)
-            return;
-    } while ( 0 != memcmp (H.data, "data", 4) );
-    read ( fd, &H.Sample_Length, 4 );
-
-    freq     = defaults (H.F.Sample_Frequency, 44100);  /* set sampling parameters: sampling rate */
-    channels = defaults (H.F.Channels, 2);              /* set sampling parameters: mono or stereo */
-    size     = defaults (H.F.Channels ? 8*H.F.Bytes_per_Sample/H.F.Channels : 0, 16);      /* set sampling parameters: sample size */
-
-#if 0
-    // Moved to front
-    if ( -1 == (status = ioctl (fdd, SOUND_PCM_SYNC, 0)) )
-        perror ("SOUND_PCM_SYNC ioctl failed");
-#endif
-
-    org = arg = 2;
-    if ( arg != last_channels  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_CHANNELS, &arg)) )
-        perror ("SOUND_PCM_WRITE_CHANNELS ioctl failed");
-    if (arg != org)
-        perror ("unable to set number of channels");
-    last_channels = arg;
-
-    org = arg = 16;
-    if ( arg != last_size  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_BITS, &arg)) )
-        perror ("SOUND_PCM_WRITE_BITS ioctl failed");
-    if (arg != org)
-        perror ("unable to set sample size");
-    last_size = arg;
-
-    org = arg = org <= 8  ?  AFMT_U8  :  AFMT_S16_LE;
-    if ( arg != last_fmt  &&  -1 == ioctl (fdd, SNDCTL_DSP_SETFMT, &arg) )
-        perror ("SNDCTL_DSP_SETFMT ioctl failed");
-    if ((arg & org) == 0)
-        perror ("unable to set data format");
-    last_fmt = arg;
-
-    org = arg = freq;                   /* set sampling parameters: sampling rate */
-    if ( arg != last_freq  &&  -1 == (status = ioctl (fdd, SOUND_PCM_WRITE_RATE, &arg)) )
-        perror ("SOUND_PCM_WRITE_WRITE ioctl failed");
-    last_freq = arg;
-
-    fprintf (stderr, "\r%1u*%2u bit %5u Hz:   ", channels, size, freq );
-    fflush (stderr);
-
-    toplay = H.Sample_Length < 0x7FFFFFFF  &&  H.Sample_Length > 0
-           ? H.Sample_Length / (channels*(size/8))
-           : 0xFFFFFFFFFFFFFFFF;
-
-    totalread    = 0;
-    totalsamples = 0;
-
-    message ( totalsamples, toplay, freq );
-
-    for ( finish = 0; !finish; ) {
-
-        if ( toplay-totalsamples <= BLOCK )
-            len = (toplay-totalsamples) * channels * (size/8), finish = 1;
-        else
-            len = BLOCK * channels * (size/8);
-
-        bytesread = 0;
-        do {
-            tmp = read ( fd, A+bytesread, len-bytesread );
-            if ( tmp <= 0 ) {
-                finish = 1;
-                break;
-            }
-            bytesread += tmp;
-        } while ( bytesread < len );
-
-        totalread    += bytesread;
-        samples       = bytesread / (channels * (size/8));
-        totalsamples += samples;
-
-        message ( totalsamples, toplay, freq );
-
-        p = A;
-        switch (channels) {
-        case 1:
-            switch (size) {
-            case  8:
-                for ( i = 0; i < samples; i++, p++ )
-                    B [i][0] = B [i][1] = (*p-128) << 8;
-                break;
-            case 16:
-                for ( i = 0; i < samples; i++, p+=2 )
-                    B [i][0] = B [i][1] = *(short*)(p);
-                break;
-            case 24:
-                for ( i = 0; i < samples; i++, p+=3 )
-                    B [i][0] = B [i][1] = *(short*)(p+1);
-                break;
-            case 32:
-                for ( i = 0; i < samples; i++, p+=4 )
-                    B [i][0] = B [i][1] = *(short*)(p+2);
-                break;
-            }
-            break;
-
-        case 2:
-            switch (size) {
-            case  8:
-                for ( i = 0; i < samples; i++, p+=2 )
-                    B [i][0] = (p[0]-128) << 8,
-                    B [i][1] = (p[1]-128) << 8;
-                break;
-            case 16:
-                for ( i = 0; i < samples; i++, p+=4 )
-                    B [i][0] = *(short*)(p+0),
-                    B [i][1] = *(short*)(p+2);
-                break;
-            case 24:
-                for ( i = 0; i < samples; i++, p+=6 )
-                    B [i][0] = *(short*)(p+1),
-                    B [i][1] = *(short*)(p+4);
-                break;
-            case 32:
-                for ( i = 0; i < samples; i++, p+=8 )
-                    B [i][0] = *(short*)(p+2),
-                    B [i][1] = *(short*)(p+6);
-                break;
-            }
-            break;
-
-        default:
-            for ( i = 0; i < samples; i++ ) {
-
-                switch (size) {
-                case  8:
-                    for ( j = 0; j < channels; j++, p+=1 )
-                        ch [j] = (p[0]-128) << 8;
-                    break;
-                case 16:
-                    for ( j = 0; j < channels; j++, p+=2 )
-                        ch [j] = *(short*)(p+0);
-                    break;
-                case 24:
-                    for ( j = 0; j < channels; j++, p+=3 )
-                        ch [j] = *(short*)(p+1);
-                    break;
-                case 32:
-                    for ( j = 0; j < channels; j++, p+=4 )
-                        ch [j] = *(short*)(p+2);
-                    break;
-                }
-
-                switch (channels) {
-                case 3:
-                    B [i][0] = r ( ch[0] + 0.707*ch[2] );
-                    B [i][1] = r ( ch[1] + 0.707*ch[2] );
-                    break;
-                case 4:
-                    B [i][0] = r ( ch[0] + 0.707*ch[2] );
-                    B [i][1] = r ( ch[1] + 0.707*ch[3] );
-                    break;
-                case 5:
-                    B [i][0] = r ( ch[0] + 0.707*ch[2] + 0.707*ch[3] );
-                    B [i][1] = r ( ch[1] + 0.707*ch[2] + 0.707*ch[4] );
-                    break;
-                case 6:
-                case 7:
-                case 8:
-                    B [i][0] = r ( ch[0] + 0.707*ch[2] + 3.16*ch[3] + 0.707*ch[4] );
-                    B [i][1] = r ( ch[1] + 0.707*ch[2] + 3.16*ch[3] + 0.707*ch[5] );
-                    break;
-                }
-            }
-            break;
-        }
-
-        len = samples * (16/8 * 2);
-        byteswrote = 0;
-
-        while ( byteswrote < len ) {
-            tmp = write ( fdd, B+byteswrote, len-byteswrote );
-            if ( tmp <= 0 ) {
-                perror ("Wrote wrong number of bytes");
-                finish = 1;
-                break;
-            }
-            byteswrote += tmp;
-        }
-    }
-
-    return;
-}
-
-
-int
-main ( int argc, char** argv )
-{
-    int           fds;
-    int           fdd;
-    int           fdm;
-    int           org;      /* argument for ioctl calls */
-    int           arg;      /* argument for ioctl calls */
-    int           status;   /* return status of system calls */
-    const char*   name;
-
-    seteuid     ( getuid() );
-
-    if ( (fdd = open ("/dev/audio", O_WRONLY)) < 0 ) {  /* open sound device */
-        perror ("open of /dev/dsp failed");
-        return 1;
-    }
-    if ( (fdm = open ("/dev/mixer", O_RDWR)) < 0 ) {    /* open mixer device */
-        perror ("open of /dev/mixer failed");
-        return 1;
-    }
-
-    org = arg = 0x6060;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_VOLUME, &arg)) )
-        perror ("SOUND_MIXER_WRITE_VOLUME ioctl failed");
-    org = arg = 0x5A5A;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_PCM, &arg)) )
-        perror ("SOUND_MIXER_WRITE_PCM ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_MIC, &arg)) )
-        perror ("SOUND_MIXER_WRITE_MIC ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_SYNTH, &arg)) )
-        perror ("SOUND_MIXER_WRITE_SYNTH ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_IMIX, &arg)) )
-        perror ("SOUND_MIXER_WRITE_IMIX ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE1, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE1 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE2, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE2 ioctl failed");
-    org = arg = 0x0000;
-    if ( -1 == (status = ioctl (fdm, SOUND_MIXER_WRITE_LINE3, &arg)) )
-        perror ("SOUND_MIXER_WRITE_LINE3 ioctl failed");
-    close (fdm);
-
-#if 0
-
-#define SOUND_MIXER_SPEAKER      5
-#define SOUND_MIXER_LINE         6
-#define SOUND_MIXER_CD           8
-#define SOUND_MIXER_ALTPCM      10
-#define SOUND_MIXER_RECLEV      11      /* Recording level */
-#define SOUND_MIXER_IGAIN       12      /* Input gain */
-#define SOUND_MIXER_OGAIN       13      /* Output gain */
-#define SOUND_MIXER_DIGITAL1    17      /* Digital (input) 1 */
-#define SOUND_MIXER_DIGITAL2    18      /* Digital (input) 2 */
-#define SOUND_MIXER_DIGITAL3    19      /* Digital (input) 3 */
-#define SOUND_MIXER_PHONEIN     20      /* Phone input */
-#define SOUND_MIXER_PHONEOUT    21      /* Phone output */
-#define SOUND_MIXER_VIDEO       22      /* Video/TV (audio) in */
-#define SOUND_MIXER_RADIO       23      /* Radio in */
-#define SOUND_MIXER_MONITOR     24      /* Monitor (usually mic) volume */
-
-#endif
-
-    mlock (A, sizeof (A) );
-    mlock (B, sizeof (B) );
-    Set_Realtime ();
-
-    if ( argc <= 1 )
-        play ( fdd, 0, "<stdin>" );
-    else
-        while ( (name = *++argv) != NULL ) {
-            if ( (fds = open (*argv, O_RDONLY)) < 0 ) {
-                perror ("open of file failed");
-                continue;
-            }
-            play  ( fdd, fds, name );
-            close ( fds );
-        }
-
-    write (fdd, "\0\0\0\0\0\0\0\0\0\0\0\0", 12);
-    close (fdd);
-    fprintf (stderr, "\n");
-    return 0;
-}
-
-
-#if 0
-
-static struct termios stored_settings;
-
-
-void reset ( void )
-{
-    tcsetattr ( 0, TCSANOW, &stored_settings );
-}
-
-
-void set ( void )
-{
-    struct termios new_settings;
-
-    tcgetattr ( 0, &stored_settings );
-    new_settings = stored_settings;
-
-    new_settings.c_lflag    &= ~ECHO;
-    /* Disable canonical mode, and set buffer size to 1 byte */
-    new_settings.c_lflag    &= ~ICANON;
-    new_settings.c_cc[VTIME] = 0;
-    new_settings.c_cc[VMIN]  = 1;
-
-    tcsetattr(0,TCSANOW,&new_settings);
-    return;
-}
-
-
-int sel ( void )
-{
-    struct timeval  t;
-    fd_set          fd [1];
-    int             ret;
-    unsigned char   c;
-
-    FD_SET (0, fd);
-    t.tv_sec  = 0;
-    t.tv_usec = 0;
-
-    ret = select ( 1, fd, NULL, NULL, &t );
-
-    switch ( ret ) {
-    case  0:
-        return -1;
-    case  1:
-        ret = read (0, &c, 1);
-        return ret == 1  ?  c  :  -1;
-    default:
-        return -2;
-    }
-}
-
-#endif
Index: penc/trunk/wp.dsp
===================================================================
--- /mppenc/trunk/wp.dsp	(revision 96)
+++ 	(revision )
@@ -1,100 +1,0 @@
-# Microsoft Developer Studio Project File - Name="wp" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=wp - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "wp.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "wp.mak" CFG="wp - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "wp - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "wp - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "wp - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "wp___Win32_Release"
-# PROP BASE Intermediate_Dir "wp___Win32_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF  "$(CFG)" == "wp - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "wp___Win32_Debug"
-# PROP BASE Intermediate_Dir "wp___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ  /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "wp - Win32 Release"
-# Name "wp - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\wp.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: penc/trunk/wp.vcproj
===================================================================
--- /mppenc/trunk/wp.vcproj	(revision 96)
+++ 	(revision )
@@ -1,166 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="wp"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="5"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/wp.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Debug/wp.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/wp.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Debug/wp.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				StringPooling="TRUE"
-				RuntimeLibrary="4"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/wp.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				OutputFile=".\Release/wp.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/wp.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				TypeLibraryName=".\Release/wp.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="wp.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
